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

body {
  background: #fff;
  color: #111;
  font-family: Georgia, serif;
  min-height: 100vh;
  padding: 0 16px 80px;
}

/* ── Fixed top nav ── */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-bottom: 2px solid #111;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

h1 {
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.slogan {
  font-size: 0.78rem;
  color: #777;
  font-style: italic;
}

.score-row {
  font-size: 0.85rem;
  color: #555;
  text-align: right;
}

.score-row span {
  font-weight: bold;
  color: #111;
}

/* ── Main content ── */
#app {
  max-width: 600px;
  margin: 0 auto;
  padding-top: 88px;
}

.game-area {
  text-align: center;
  padding: 16px 0;
}

#equation {
  font-size: 2.2rem;
  font-weight: bold;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  transition: transform 0.15s;
}

#equation.solved {
  transform: scale(1.08);
}

.solve-hint {
  font-size: 0.78rem;
  color: #999;
  font-style: italic;
  margin-bottom: 20px;
}

#next-equation {
  font-size: 1rem;
  color: #666;
  min-height: 1.4em;
  margin-bottom: 20px;
}

/* ── Calculator display ── */
.calc-display {
  font-size: 1.8rem;
  font-weight: bold;
  text-align: right;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: #f5f5f5;
  border: 2px solid #111;
  min-height: 56px;
  letter-spacing: 0.02em;
  color: #111;
  font-family: monospace;
}

.calc-display.placeholder {
  color: #aaa;
}

/* ── Calculator keys ── */
.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.calc-spacer { }

.calc-btn {
  padding: 12px 0;
  font-size: 1.1rem;
  font-family: Georgia, serif;
  border: 1px solid #111;
  background: #fff;
  color: #111;
  cursor: pointer;
  line-height: 1.2;
}

.calc-btn:hover:not(:disabled) {
  background: #f2f2f2;
}

.fn-key {
  font-size: 0.95rem;
}

.fn-key sup {
  font-size: 0.7em;
}

.op-key {
  font-size: 1.25rem;
}

.calc-btn.active {
  background: #111;
  color: #fff;
}

.calc-btn.active:hover {
  background: #333;
}

.zero-key {
  grid-column: span 2;
}

.enter-key {
  grid-column: span 2;
  background: #111;
  color: #fff;
  font-size: 1.3rem;
  border-color: #111;
}

.enter-key:hover:not(:disabled) {
  background: #333;
}

.calc-keys.disabled .calc-btn {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Feedback ── */
.feedback {
  font-size: 1.05rem;
  font-weight: bold;
  min-height: 1.5em;
  margin-bottom: 14px;
  color: #111;
}

/* ── Restart ── */
#restart-btn {
  display: none;
  padding: 10px 28px;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid #111;
  background: #111;
  color: #fff;
  cursor: pointer;
  margin-top: 4px;
}

#restart-btn:hover {
  background: #333;
  border-color: #333;
}

/* ── Fixed bottom action bar ── */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 2px solid #111;
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  z-index: 10;
}

.bar-divider {
  width: 1px;
  height: 20px;
  background: #ccc;
}

.bar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar-group label {
  font-size: 0.78rem;
  color: #777;
  font-style: italic;
  white-space: nowrap;
}

.bar-group select {
  font-family: Georgia, serif;
  font-size: 0.88rem;
  border: 1.5px solid #111;
  background: #fff;
  color: #111;
  padding: 4px 8px;
  cursor: pointer;
}
