
:root {
  --ink: #18252a;
  --muted: #647276;
  --paper: #fffdf7;
  --cream: #f3efe3;
  --line: #d9d6cb;
  --teal: #0f766e;
  --teal-dark: #075f59;
  --coral: #ef6f51;
  --yellow: #f4c95d;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--cream);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 4%, rgba(244, 201, 93, 0.22), transparent 24rem),
    radial-gradient(circle at 92% 34%, rgba(15, 118, 110, 0.1), transparent 22rem),
    var(--cream);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-shell {
  width: min(100% - 28px, 760px);
  margin: 0 auto;
  padding: 22px 0 30px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 11px;
  background: var(--yellow);
  font-size: 1.25rem;
  line-height: 1;
}

.daily-pill {
  color: var(--teal-dark);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.game-panel {
  min-height: 560px;
  padding: clamp(24px, 5vw, 46px);
  overflow: hidden;
  border: 1px solid rgba(24, 37, 42, 0.13);
  border-radius: 28px;
  background: rgba(255, 253, 247, 0.96);
  box-shadow: 0 20px 60px rgba(48, 52, 43, 0.11);
}

.loading-card,
.notice {
  display: grid;
  min-height: 420px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.question-meta {
  display: flex;
  min-height: 33px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.timer {
  display: inline-flex;
  min-width: 57px;
  justify-content: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: color 180ms ease, border-color 180ms ease;
}

.timer-urgent {
  border-color: var(--coral);
  color: #c73f2b;
  animation: pulse-timer 0.8s ease-in-out infinite;
}

@keyframes pulse-timer {
  50% {
    opacity: 0.48;
  }
}

h1 {
  max-width: 640px;
  margin: 24px 0 10px;
  font-size: clamp(1.75rem, 5.8vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.question-theme {
  display: inline-flex;
  margin: 0;
  padding: 5px 9px;
  border-radius: 8px;
  background: #e0f0ec;
  color: var(--teal-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.answer-zone {
  margin-top: 42px;
}

.answer-zone label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.answer-field {
  display: flex;
  min-height: 72px;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 4px 5px 0 var(--yellow);
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.answer-field:focus-within {
  box-shadow: 6px 7px 0 var(--yellow);
  transform: translate(-1px, -1px);
}

.answer-field input {
  width: 100%;
  min-width: 0;
  padding: 15px 8px 15px 18px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: clamp(1.5rem, 8vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  caret-color: var(--coral);
}

.answer-field input::placeholder {
  color: #b8b9b2;
}

.answer-unit {
  flex: 0 0 auto;
  padding: 0 18px 0 8px;
  color: var(--teal);
  font-size: 1.15rem;
  font-weight: 800;
}

.answer-zone > p {
  margin: 11px 2px 20px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.primary-button {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 15px;
  background: var(--teal);
  color: white;
  cursor: pointer;
  font-weight: 850;
  transition: background 160ms ease, transform 160ms ease;
}

.primary-button:hover:not(:disabled) {
  background: var(--teal-dark);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.inline-error {
  color: #b72d21 !important;
  text-align: center;
}

.timeout-card {
  display: grid;
  min-height: 340px;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.timeout-card > span {
  font-size: 2rem;
}

.timeout-card h2 {
  margin: 14px 0 6px;
}

.timeout-card p {
  max-width: 400px;
  color: var(--muted);
  line-height: 1.6;
}

.result-zone {
  margin-top: 30px;
}

.score-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 20px;
  background: #e9f4f0;
}

.score-card > div {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.score-eyebrow {
  margin-right: 11px;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.score-card strong {
  color: var(--teal-dark);
  font-size: 2.65rem;
  line-height: 1;
  letter-spacing: -0.06em;
}

.explanation-button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 900;
}

.scale-card {
  padding: 18px 16px 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--white);
}

.scale-heading {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.scale-heading span:last-child {
  font-weight: 500;
  text-transform: none;
}

.scale {
  position: relative;
  width: min(100%, 440px);
  height: 390px;
  margin: 30px auto 12px;
}

.scale-axis {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  border-radius: 999px;
  background: var(--ink);
  transform: translateX(-50%);
}

.scale-tick {
  position: absolute;
  right: 50%;
  left: 0;
  display: flex;
  align-items: center;
  transform: translateY(50%);
}

.tick-line {
  width: 100%;
  border-top: 1px dashed #d9d6cb;
}

.tick-label {
  position: absolute;
  left: calc(100% + 13px);
  width: 48px;
  color: var(--muted);
  font-size: 0.72rem;
}

.scale-marker {
  position: absolute;
  left: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translate(-50%, 50%);
  transition: bottom 1.25s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 180ms ease;
}

.scale-marker.is-visible {
  opacity: 1;
}

.marker-dot {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 3px solid var(--white);
  border-radius: 50%;
  box-shadow: 0 0 0 2px currentColor;
  background: var(--marker-color);
}

.marker-label {
  position: absolute;
  left: 25px;
  width: max-content;
  max-width: 180px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--marker-color);
  color: white;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.2;
}

.marker-label small {
  display: block;
  margin-bottom: 2px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.62rem;
  font-weight: 650;
}

.player-marker {
  --marker-color: var(--teal);
  color: var(--marker-color);
}

.reference-marker {
  --marker-color: var(--coral);
  color: var(--marker-color);
}

.reference-marker .marker-label {
  right: 25px;
  left: auto;
  text-align: right;
}

.feedback-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 14px 4px 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.feedback-card button {
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-size: 1.25rem;
}

.feedback-card button.selected {
  border-color: var(--line);
  background: var(--white);
}

.feedback-card button:disabled:not(.selected) {
  opacity: 0.25;
}

footer {
  padding: 22px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(24, 37, 42, 0.46);
  backdrop-filter: blur(4px);
}

.explanation-modal {
  position: relative;
  width: min(100%, 620px);
  max-height: min(82vh, 720px);
  padding: 30px;
  overflow: auto;
  border-radius: 26px;
  background: var(--paper);
  box-shadow: 0 25px 80px rgba(10, 24, 29, 0.3);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--cream);
  cursor: pointer;
  font-size: 1.5rem;
}

.modal-kicker {
  color: var(--coral);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.explanation-modal h2 {
  margin: 8px 48px 16px 0;
  letter-spacing: -0.03em;
}

.explanation-modal p,
.explanation-modal li {
  color: #4f5d60;
  font-size: 0.92rem;
  line-height: 1.65;
}

.assumptions,
.sources {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.assumptions ul {
  margin-bottom: 0;
  padding-left: 18px;
}

.sources {
  display: grid;
  gap: 9px;
}

.sources a {
  color: var(--teal-dark);
  font-size: 0.86rem;
  font-weight: 750;
}

@media (min-width: 620px) {
  .modal-backdrop {
    place-items: center;
  }
}

@media (max-width: 520px) {
  .site-shell {
    width: min(100% - 18px, 760px);
    padding-top: 12px;
  }

  .daily-pill {
    display: none;
  }

  .game-panel {
    min-height: calc(100vh - 92px);
    padding: 22px 18px 28px;
    border-radius: 22px;
  }

  .answer-zone {
    margin-top: 34px;
  }

  .score-eyebrow {
    display: none;
  }

  .scale {
    height: 360px;
  }

  .marker-label {
    max-width: 135px;
    font-size: 0.7rem;
  }
}

.admin-shell {
  width: min(100% - 28px, 1120px);
  margin: 0 auto;
  padding: 34px 0 60px;
}

.admin-header,
.admin-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.admin-header {
  margin-bottom: 30px;
}

.admin-header h1,
.admin-section-title h2 {
  margin: 4px 0 0;
  letter-spacing: -0.035em;
}

.admin-header h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.admin-header a,
.admin-sources a {
  color: var(--teal-dark);
  font-weight: 800;
}

.admin-kicker,
.admin-section-title > div > span {
  color: var(--coral);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-alert,
.admin-loading {
  margin-bottom: 20px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--white);
}

.admin-alert {
  color: #af3025;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 36px;
}

.stats-grid article {
  display: grid;
  gap: 5px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
}

.stats-grid strong {
  color: var(--teal-dark);
  font-size: 2rem;
  letter-spacing: -0.05em;
}

.stats-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.admin-section {
  margin-top: 36px;
}

.admin-section-title {
  margin-bottom: 14px;
}

.admin-section-title > span {
  color: var(--muted);
  font-size: 0.78rem;
}

.locked-pill {
  padding: 7px 10px;
  border-radius: 999px;
  background: #e3e1d7;
  font-weight: 800;
}

.admin-question-card {
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(24, 37, 42, 0.06);
}

.current-question {
  border-left: 5px solid var(--teal);
}

.tomorrow-question {
  border-left: 5px solid var(--yellow);
}

.admin-question-card h3 {
  margin: 10px 0;
  font-size: 1.25rem;
  line-height: 1.25;
}

.admin-question-card > p:not(.admin-answer) {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.admin-theme {
  color: var(--teal-dark);
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: uppercase;
}

.admin-answer {
  color: var(--coral);
  font-size: 1.08rem;
  font-weight: 900;
}

.admin-sources {
  display: grid;
  gap: 5px;
  margin-top: 14px;
}

.admin-sources a {
  font-size: 0.76rem;
}

.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.mini-stats span {
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--cream);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.alternatives-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.admin-question-card button {
  width: 100%;
  margin-top: 18px;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: var(--teal);
  color: white;
  cursor: pointer;
  font-weight: 800;
}

.admin-question-card button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-actions button {
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--coral);
  color: white;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 850;
}

.admin-actions button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.history-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.history-table th,
.history-table td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.history-table th {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

@media (max-width: 820px) {
  .stats-grid,
  .alternatives-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .admin-shell {
    width: min(100% - 18px, 1120px);
    padding-top: 20px;
  }

  .stats-grid,
  .alternatives-grid {
    grid-template-columns: 1fr;
  }

  .admin-header {
    align-items: flex-end;
  }
}
