* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100%;
}

body {
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 520px;
  min-width: 0;
  padding: 24px 16px 48px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 200ms ease, transform 200ms ease;
}

#app.screen-enter {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  #app, .history-row { transition: none !important; animation: none !important; }
}

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-cell);
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-accent {
  background: var(--accent);
  color: #1a1a1d;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--text-dim);
}

.text-input, .picker {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-cell);
  border: 1px solid rgba(242, 239, 233, 0.15);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
}

.field-label {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 16px 0 8px;
}

/* ---------- gate ---------- */

.gate-screen {
  display: flex;
  justify-content: center;
  margin-top: 20vh;
}

.gate-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gate-error, .setup-error {
  color: var(--late);
  font-size: 0.85rem;
  margin: 0;
}

/* ---------- setup ---------- */

.setup-card {
  display: flex;
  flex-direction: column;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.toggle {
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: rgba(242, 239, 233, 0.15);
  border: none;
  position: relative;
  cursor: pointer;
  padding: 0;
}

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 150ms ease, background 150ms ease;
}

.toggle-on {
  background: rgba(232, 165, 75, 0.3);
}

.toggle-on .toggle-knob {
  transform: translateX(18px);
  background: var(--accent);
}

.rounds-row {
  display: flex;
  gap: 8px;
}

.chip-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-cell);
  border: 1px solid rgba(242, 239, 233, 0.15);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-ui);
}

.chip-btn-active {
  background: var(--accent);
  color: #1a1a1d;
  border-color: var(--accent);
  font-weight: 600;
}

.setup-card .btn {
  margin-top: 20px;
}

.progress-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.progress-label {
  margin: 0;
  color: var(--text);
}

.progress-bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(242, 239, 233, 0.1);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 300ms ease;
}

.progress-count {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ---------- board ---------- */

.round-chip {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-align: right;
  margin-bottom: 8px;
}

.photo-card {
  padding: 12px;
  margin-bottom: 16px;
}

.photo-frame {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(232, 165, 75, 0.15);
  aspect-ratio: 1 / 1;
  background: var(--bg);
}

.photo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.revealed-day {
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
  margin: 10px 0 0;
}

.guess-input {
  margin-bottom: 16px;
}

.picker-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-row {
  display: flex;
  gap: 8px;
  animation: pop-in 150ms ease;
}

@keyframes pop-in {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.history-cell {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: var(--radius-cell);
  font-size: 0.9rem;
  font-weight: 600;
}

.cell-correct {
  background: rgba(232, 165, 75, 0.25);
  color: var(--accent);
}

.cell-early {
  background: rgba(91, 141, 190, 0.2);
  color: var(--early);
}

.cell-late {
  background: rgba(217, 119, 87, 0.2);
  color: var(--late);
}

/* ---------- reveal ---------- */

.reveal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 29, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in 200ms ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.reveal-card {
  width: 100%;
  max-width: 400px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reveal-date {
  font-family: var(--font-accent);
  font-size: 1.4rem;
  margin: 0;
}

.reveal-points {
  font-family: var(--font-accent);
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  color: var(--accent);
}

.reveal-solved .reveal-points {
  background: var(--win-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- results ---------- */

.results-screen {
  text-align: center;
  margin-top: 10vh;
}

.results-total {
  font-family: var(--font-accent);
  font-size: 3rem;
  font-weight: 700;
  background: var(--win-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0 0 20px;
}

.dot-strip {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.dot-solved {
  background: var(--accent);
}

.dot-partial {
  background: rgba(232, 165, 75, 0.4);
}

.dot-zero {
  background: rgba(155, 150, 145, 0.3);
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 320px;
  margin: 0 auto;
}
