/*
  We Ate This: one stylesheet for the game and admin.
  Look: late 2000s personal site crossed with JR station signage. Square corners everywhere.
*/

:root {
  --jr-green: #008a3e;
  --jr-green-dark: #005e2a;
  --jr-orange: #f07800;
  --jr-blue: #0072bc;
  --wrong-red: #d7000f;
  --ink: #222;
  --muted: #666;
  --rule: #999;
  --page-bg: #d9d9d9;
  --panel-bg: #fff;
  --input-border: #7f9db9;
  --board-bg: #111;
  --board-amber: #ffa200;
  --font: Meiryo, Verdana, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0;
}

[hidden] {
  /* biome-ignore lint/complexity/noImportantStyles: hidden must beat component display rules */
  display: none !important;
}

body {
  margin: 0;
  padding: 0 0 2rem;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page-bg)
    repeating-linear-gradient(45deg, transparent 0 6px, rgb(255 255 255 / 35%) 6px 7px);
}

.page {
  max-width: 760px;
  margin: 0 auto;
  border: 1px solid #777;
  border-top: 0;
  background: var(--panel-bg);
}

.admin {
  max-width: 900px;
}

h1,
h2 {
  line-height: 1.2;
}

.muted {
  color: var(--muted);
}

hr {
  border: 0;
  border-top: 1px dashed var(--rule);
}

/* Station sign header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 10px 12px 0;
  border-top: 6px solid var(--ink);
  border-bottom: 10px solid var(--jr-green);
  background: #fff;
}

.sign {
  display: flex;
  flex-direction: column;
  padding-bottom: 8px;
}

.sign-name {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sign-sub {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--jr-green-dark);
}

.admin .sign-sub {
  text-transform: none;
  letter-spacing: 0.05em;
}

.station-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.4rem;
  margin: 0 0 8px;
  border: 4px solid var(--jr-green);
  background: #fff;
  font-weight: 700;
  line-height: 1.1;
}

.station-code {
  padding: 2px 0;
  font-size: 12px;
}

.station-number {
  font-size: 22px;
  padding-bottom: 2px;
}

.ticker {
  margin: 0;
  padding: 3px 12px;
  border-bottom: 1px solid #777;
  background: linear-gradient(#fff3d6, #ffe0a3);
  font-size: 12px;
}

.site-footer {
  margin-top: 1rem;
  padding: 6px 12px;
  border-top: 3px double var(--rule);
  background: #f2f2f2;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

/* Boxes with title bars */

section {
  margin: 12px;
  padding: 0 10px 10px;
  border: 1px solid #888;
  background: #fff;
}

section > h2 {
  margin: 0 -10px 10px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--jr-green-dark);
  background: linear-gradient(#22a456, var(--jr-green));
  color: #fff;
  font-size: 14px;
}

.status {
  min-height: 1.5em;
  margin: 8px 12px 0;
  font-weight: 700;
}

.status:empty {
  display: none;
}

.status-error {
  color: var(--wrong-red);
}

/* Form controls */

label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 700;
  font-size: 13px;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 3px 4px;
  border: 1px solid var(--input-border);
  background: #fff;
  font-weight: 400;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #fc0;
  outline-offset: 0;
}

button {
  padding: 4px 14px;
  border: 1px solid #707070;
  background: linear-gradient(#fdfdfd, #dcdcdc);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  color: #888;
  cursor: wait;
}

button:hover:not(:disabled) {
  background: linear-gradient(#fff, #e9f3ff);
  border-color: var(--jr-blue);
}

button:active:not(:disabled) {
  background: linear-gradient(#d4d4d4, #f2f2f2);
}

button.primary {
  border-color: var(--jr-green-dark);
  background: linear-gradient(#2fb663, var(--jr-green));
  color: #fff;
}

button.primary:hover:not(:disabled) {
  border-color: var(--jr-green-dark);
  background: linear-gradient(#3cc770, #00a049);
}

button.danger {
  border-color: var(--wrong-red);
  color: var(--wrong-red);
}

#reload-button {
  margin: 4px 12px 0;
}

/* Game */

.progress {
  margin: 0;
  font-weight: 700;
}

.stops {
  display: flex;
  justify-content: space-between;
  margin: 6px 0 10px;
  padding: 0;
  list-style: none;
  background: linear-gradient(transparent 45%, var(--jr-green) 45% 55%, transparent 55%);
}

.stop {
  width: 14px;
  height: 14px;
  border: 2px solid var(--jr-green);
  background: #fff;
}

.stop.is-current {
  border-color: var(--ink);
  background: var(--jr-orange);
}

.stop.is-correct {
  background: var(--jr-green);
}

.stop.is-wrong {
  border-color: var(--wrong-red);
  background: var(--wrong-red);
}

.prompt {
  margin: 0 0 10px;
  padding: 4px 6px;
  border-left: 4px solid var(--jr-orange);
  background: #fafafa;
}

.matchup {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.food-choice {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border: 1px solid #999;
  background: #fff;
  font-weight: 400;
  text-align: left;
}

.food-choice:disabled {
  color: var(--ink);
  cursor: default;
}

.food-choice:hover:not(:disabled) {
  border-color: var(--jr-blue);
  background: #ffffcc;
}

.food-choice.is-chosen {
  outline: 3px solid var(--jr-orange);
  outline-offset: -3px;
}

.food-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid #ccc;
}

.food-title {
  font-weight: 700;
  font-size: 15px;
}

.food-meta {
  font-size: 12px;
  color: #555;
}

.food-reveal {
  font-weight: 700;
}

.food-reveal:not(:empty) {
  margin-top: 4px;
  padding: 2px 4px;
  background: #eee;
}

.food-choice.is-leading .food-reveal {
  background: var(--jr-green);
  color: #fff;
}

.verdict {
  min-height: 1.5em;
  margin: 10px 0;
  font-weight: 700;
}

.verdict.is-correct,
.verdict.is-wrong {
  padding: 4px 8px;
  border: 1px solid;
}

.verdict.is-correct {
  border-color: var(--jr-green);
  background: #e3f6e9;
  color: var(--jr-green-dark);
}

.verdict.is-wrong {
  border-color: var(--wrong-red);
  background: #ffe6e6;
  color: var(--wrong-red);
}

.turnstile {
  margin-top: 10px;
}

.score {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}

.share-fallback {
  margin-top: 6px;
}

.recap {
  margin: 10px 0;
  padding: 0;
  border: 1px solid #ccc;
  list-style: none;
}

.recap-item {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 6px;
  border-bottom: 1px dotted #ccc;
  font-size: 13px;
}

.recap-item:nth-child(even) {
  background: #f4f4f4;
}

.recap-item:last-child {
  border-bottom: 0;
}

.recap-chosen {
  font-weight: 700;
  text-decoration: underline;
}

/* Departure board */

.departure {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 10px;
  border: 4px solid #444;
  background: var(--board-bg);
  color: var(--board-amber);
  font-family: "Courier New", monospace;
}

.departure-label {
  font-family: var(--font);
  font-size: 12px;
  color: #fff;
}

.countdown {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}

.departure-note {
  font-size: 11px;
  color: #9ad;
}

/* Admin */

.food-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.form-actions {
  display: flex;
  gap: 6px;
}

.photo-preview {
  max-width: 12rem;
  border: 1px solid #999;
}

.search {
  margin-bottom: 8px;
}

.food-list,
.lineup-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border: 1px solid #ccc;
  list-style: none;
}

.food-card {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 8px;
  padding: 6px;
  border-bottom: 1px dotted #bbb;
}

.food-card:nth-child(even) {
  background: #f4f4f4;
}

.food-card.is-inactive {
  color: #888;
  background: repeating-linear-gradient(-45deg, #fff 0 6px, #eee 6px 12px);
}

.food-thumb {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: cover;
  border: 1px solid #999;
}

.food-info p {
  margin: 0 0 2px;
  font-size: 13px;
}

.food-name {
  font-weight: 700;
}

.badge {
  margin-left: 6px;
  padding: 0 4px;
  border: 1px solid #888;
  background: #ffc;
  font-size: 11px;
  font-weight: 400;
}

.food-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.lineup-list {
  margin-top: 8px;
}

.lineup-pair {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  gap: 2px 6px;
  align-items: center;
  padding: 4px 6px;
  border-bottom: 1px dotted #bbb;
}

.lineup-pair:nth-child(even) {
  background: #f4f4f4;
}

.lineup-position {
  grid-row: span 3;
  border: 2px solid var(--jr-green);
  font-weight: 700;
  text-align: center;
}

.lineup-vs {
  font-size: 11px;
  color: var(--muted);
}

.lineup-side {
  display: flex;
  gap: 6px;
  align-items: center;
}

.lineup-side p {
  margin: 0;
  font-size: 13px;
}

.lineup-thumb {
  width: 2.6rem;
  height: 2.6rem;
  object-fit: cover;
  border: 1px solid #999;
}

@media (min-width: 48rem) {
  body {
    padding-top: 12px;
  }

  .page {
    border-top: 1px solid #777;
  }

  .lineup-pair {
    grid-template-columns: 1.6rem 1fr auto 1fr;
  }

  .lineup-position {
    grid-row: auto;
  }

  .food-card {
    grid-template-columns: 4.5rem 1fr auto;
  }

  .food-actions {
    grid-column: auto;
    flex-direction: column;
  }
}
