* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
  font-size: 14px;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}

.page-wrapper {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  width: 100%;
  max-width: 1280px;
}

.ad-slot {
  width: 300px;
  min-width: 300px;
  height: 600px;
  background: #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 13px;
  position: sticky;
  top: 32px;
  margin-top: 45px;
}

@media (max-width: 1000px) { .ad-slot.ad-left  { display: none; } }
@media (max-width: 1280px) { .ad-slot.ad-right { display: none; } }

.container {
  width: 100%;
  max-width: 640px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1 { font-size: 22px; font-weight: 700; color: #1a1a1a; }
h1 span { color: #0078d4; }

.card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
}

.display {
  background: #f0f2f5;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 14px 16px;
  text-align: right;
  margin-bottom: 12px;
}
.display .expression {
  color: #999;
  font-size: 12px;
  min-height: 18px;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'Consolas', monospace;
}
.display .result {
  color: #1a1a1a;
  font-size: 32px;
  font-weight: 300;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'Consolas', monospace;
}

.mode-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.mode-btn {
  flex: 1;
  padding: 7px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f5f5f5;
  color: #888;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 600;
}
.mode-btn.active {
  background: #0078d4;
  border-color: #0078d4;
  color: #fff;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

button {
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 13px 0;
  border: 1px solid #e0e0e0;
  transition: background 0.12s;
  font-family: inherit;
}
button:active { transform: scale(0.93); }

.btn-number   { background: #fff;    color: #1a1a1a; }
.btn-number:hover   { background: #f5f5f5; }
.btn-operator { background: #e8f0fe; color: #0078d4; border-color: #d0e1fb; }
.btn-operator:hover { background: #d0e1fb; }
.btn-equal    { background: #0078d4; color: #fff;    border-color: #0078d4; font-size: 16px; }
.btn-equal:hover    { background: #005fa3; }
.btn-clear    { background: #fce8e6; color: #c5221f; border-color: #f5c2be; }
.btn-clear:hover    { background: #f5c2be; }
.btn-special  { background: #fef3e2; color: #e37400; border-color: #fde2a3; }
.btn-special:hover  { background: #fde2a3; }
.btn-fn       { background: #f0f7ff; color: #1565c0; border-color: #c5ddf9; font-size: 12px; }
.btn-fn:hover       { background: #daeafd; }
.btn-mem      { background: #f3e8ff; color: #6a1b9a; border-color: #ddb3f7; font-size: 12px; }
.btn-mem:hover      { background: #e5c8fc; }

.span-two { grid-column: span 2; }
