:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #18232b;
  background: #f3f0e8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;

  --paper: #fffaf0;
  --paper-2: #f8f1df;
  --ink: #18232b;
  --muted: #62717c;
  --line: #d8cfbd;
  --accent: #d63d63;
  --accent-strong: #a52143;
  --teal: #147987;
  --green: #18744d;
  --yellow: #f2c14e;
  --shadow: 0 18px 50px rgb(35 29 18 / 13%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 74%) 0 24%, transparent 24%),
    repeating-linear-gradient(90deg, rgb(24 35 43 / 4%) 0 1px, transparent 1px 34px),
    var(--paper-2);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgb(20 121 135 / 40%);
  outline-offset: 2px;
}

.game-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  border-bottom: 2px solid #2f3a41;
  background: #fffdf8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.seal {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 15px rgb(0 0 0 / 18%));
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.05;
}

.brand p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.timer {
  width: min(240px, 38vw);
  padding: 10px 12px;
  border: 2px solid #2f3a41;
  border-radius: 8px;
  background: var(--paper);
}

.timer span:first-child {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.timer strong {
  display: block;
  margin: 2px 0 8px;
  font-size: 1.7rem;
  line-height: 1;
}

.timer strong.danger {
  color: var(--accent-strong);
}

.timer-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #ded5c2;
}

.timer-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--yellow), var(--accent));
  transition: width 180ms ease;
}

.game-board {
  display: grid;
  grid-template-columns: minmax(250px, 330px) minmax(0, 1fr);
  gap: 18px;
  width: min(1160px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 30px;
}

.side-panel,
.play-panel {
  min-width: 0;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card,
.ready-card,
.form-card,
.result-card,
.banner {
  border: 2px solid #2f3a41;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.card {
  padding: 16px;
}

.card h2,
.ready-card h2,
.result-card h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.card p,
.ready-card p,
.result-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.big-count {
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-size: 3rem;
  font-weight: 950;
  line-height: 1;
}

.rule-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 9px;
  border: 1px solid #e1d6c2;
  border-radius: 7px;
  background: #fffdf7;
}

.rule-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #f7dce4;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 900;
}

.rule.ok .rule-dot {
  background: #dff4e8;
  color: var(--green);
}

.rule strong,
.rule small {
  display: block;
}

.rule strong {
  font-size: 0.92rem;
}

.rule small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.play-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 12px 14px;
  background: #13242a;
  color: #fffaf0;
}

.banner strong {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 5px;
  background: rgb(255 255 255 / 14%);
  font-size: 0.78rem;
}

.banner span {
  line-height: 1.4;
}

.ready-card,
.result-card {
  min-height: 370px;
  padding: 28px;
}

.ready-card h2,
.result-card h2 {
  font-size: clamp(2rem, 6vw, 4.8rem);
  line-height: 0.95;
}

.form-card {
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field,
.checks {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdf8;
}

.field span:first-child {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

input[type="text"],
select {
  width: 100%;
  min-height: 43px;
  border: 2px solid #2f3a41;
  border-radius: 6px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--ink);
}

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

.stepper-btn {
  width: 44px;
  height: 44px;
  border: 2px solid #2f3a41;
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 950;
  line-height: 1;
}

.stepper-btn:hover {
  filter: brightness(1.08);
}

.stepper-count {
  min-width: 56px;
  font-size: 1.05rem;
  font-weight: 900;
  text-align: center;
}

.checks {
  grid-column: 1 / -1;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
}

.check-row input {
  width: 19px;
  height: 19px;
  accent-color: var(--teal);
}

.action-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 110px;
  padding-top: 18px;
}

.submit-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: right;
}

.action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.primary-action,
.secondary-action {
  min-height: 46px;
  border: 2px solid #2f3a41;
  border-radius: 7px;
  padding: 11px 18px;
  font-weight: 950;
  line-height: 1;
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.primary-action {
  background: var(--accent);
  color: white;
  box-shadow: 0 8px 0 #2f3a41;
}

.primary-action:hover:not(:disabled),
.secondary-action:hover:not(:disabled) {
  filter: brightness(1.12);
}

.secondary-action {
  background: #fffdf8;
  color: var(--ink);
}

.moving-action {
  min-width: 128px;
}

/* Only the ACCEPT face is the green "go" state. The DENY/REJECT face uses a
   neutral slate so it reads as "not now" without the confusing red flash. */
.moving-action.ready.face-accept {
  background: var(--green);
}

.moving-action.ready.face-deny {
  background: #34424b;
  color: #f3efe4;
}

.result-card.won {
  background: #effaf2;
}

.boot-message {
  display: grid;
  min-height: 100vh;
  place-content: center;
  padding: 24px;
  text-align: center;
}

.boot-message code {
  display: inline-block;
  margin-top: 8px;
  border-radius: 6px;
  padding: 8px 10px;
  background: #13242a;
  color: #fffaf0;
}

@media (max-width: 820px) {
  .topbar,
  .brand {
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
  }

  .timer {
    width: 100%;
  }

  .game-board,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .game-board {
    width: min(100vw - 20px, 680px);
    padding-top: 10px;
  }

  .ready-card,
  .result-card {
    min-height: 300px;
    padding: 20px;
  }
}
