:root {
  --ink: #17241c;
  --muted: #5d6b62;
  --paper: #f3f0e7;
  --card: #fffdf8;
  --line: #e2daca;
  --green: #0e6b52;
  --green-dark: #0b3d30;
  --lime: #e4f27a;
  --amber: #c56a12;
  --danger: #9c341f;
  --shadow: 0 10px 30px rgba(23, 36, 28, 0.08);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: var(--green-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  background: var(--green-dark);
  color: #f6f3ea;
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand strong { font-size: 1.05rem; letter-spacing: 0.01em; }
.brand span, .who { color: #d5e4db; font-size: 0.86rem; }
.who { display: flex; gap: 10px; align-items: center; }
.who form { margin: 0; }
.ghost {
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 6px 12px;
}

.wrap { width: min(1100px, calc(100% - 24px)); margin: 18px auto 40px; }
.board-wrap { width: min(1280px, calc(100% - 16px)); }
.event-card { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.event-card > a:first-child { color: inherit; text-decoration: none; }
.poster { width: 100%; height: 160px; object-fit: cover; border-radius: 12px; display: block; }
.floor { width: 100%; height: auto; border-radius: 12px; display: block; }
.moved { font-weight: 750; }
.moved-note { display: block; font-weight: 500; font-style: italic; color: var(--amber); }

.stepper { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; }
.stepper input {
  width: 3.4rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: white;
  pointer-events: none;
}
.stepper button {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  font-size: 1.5rem;
}
.stepper-note { color: var(--muted); }

body.screen { background: #f4f1e8; color: #102018; overflow: hidden; }
.screen-main { width: 100%; height: 100vh; margin: 0; overflow: hidden; }
#robot-screen { height: 100%; display: flex; flex-direction: column; }
.screen-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px 18px;
  background: #0b3d30;
  color: #f6f3ea;
}
.screen-bar h1 { color: #f6f3ea; margin: 0; font-size: clamp(1.5rem, 3vw, 2.6rem); }
.screen-bar p { margin: 4px 0 0; color: #d7e7de; max-width: 70ch; }
.screen-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.screen-actions a, .screen-actions .btn-line { text-decoration: none; color: #102018; background: #fff; }
.screen-view { flex: 1; overflow: auto; background: #fff; }
.screen-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  color: #102018;
  table-layout: fixed;
  font-size: clamp(1.45rem, 3.1vw, 2.7rem);
  font-weight: 650;
}
.screen-table th, .screen-table td {
  padding: 0.38em 0.4em;
  border-bottom: 2px solid #e4dfd2;
  text-align: left;
  color: #102018;
  background: #fff;
  font-size: inherit;
}
.screen-table th {
  position: sticky;
  top: 0;
  background: #0b3d30;
  color: #f6f3ea;
  font-size: 0.62em;
  font-weight: 750;
  letter-spacing: 0.02em;
}
.screen-table tbody tr:nth-child(even) td { background: #f3f6ee; }
.screen-table th:first-child, .screen-table td:first-child { width: 8%; }
.screen-table th:nth-child(2), .screen-table td:nth-child(2) { width: 28%; }
.screen-table th:nth-child(3), .screen-table td:nth-child(3) { width: 14%; }
.screen-table .score, .screen-table .place { text-align: right; font-weight: 800; }
.screen-table .place { color: #0b3d30; }

h1 { font-size: 1.7rem; line-height: 1.15; margin: 0 0 8px; }
h2 { font-size: 1.2rem; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 16px; }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.nav a, .btn, .btn-dark, .btn-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 12px;
  text-decoration: none;
  border: 0;
}
.nav a { background: #fff; border: 1px solid var(--line); }
.nav a.active, .btn-dark { background: var(--green-dark); color: white; }
.btn { background: var(--lime); color: var(--ink); font-weight: 700; }
.btn-line { background: white; border: 1px solid var(--line); }

.grid { display: grid; gap: 12px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); align-items: stretch; }
.cards > form { display: flex; min-width: 0; }
.cards > form > button.card { height: 100%; }
.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
a.card { display: block; color: inherit; text-decoration: none; }
.card { padding: 14px; }
.card strong, .card span { display: block; }
.card span { color: var(--muted); margin-top: 4px; }
button.card { width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.face { width: 100%; height: 72px; display: block; margin-bottom: 10px; }
.event-card { display: flex; flex-direction: column; align-items: stretch; gap: 6px; height: 100%; min-width: 0; }
.event-card .btn { margin-top: auto; text-align: center; }
.poster-empty {
  width: 100%;
  height: 160px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #efeae0;
  color: var(--muted);
  border: 1px dashed var(--line);
}
.panel { padding: 16px; margin-bottom: 14px; }
.stat { font-size: 1.8rem; font-weight: 750; }
.muted { color: var(--muted); }
.warn { color: var(--danger); }

.person {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.person small { color: var(--muted); }
.person.selected { outline: 3px solid var(--lime); }

.pin-box { display: flex; gap: 8px; margin-top: 14px; }
.pin-box input, .field input, .field select, .field textarea, .inline input, .inline select {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  padding: 8px 12px;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.field textarea { min-height: 90px; resize: vertical; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.grow { flex: 1; min-width: 140px; }

.slot {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.slot:first-of-type { border-top: 0; }
.time { font-variant-numeric: tabular-nums; font-weight: 700; }
.team-no { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; }
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  background: #efe8d4;
  font-size: 0.78rem;
}
.pill.now { background: var(--lime); }
.pill.done { background: #d9efe4; }
.pill.cv { background: #d7efe8; color: var(--green-dark); }

.hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(243, 240, 231, 0.94);
  backdrop-filter: blur(8px);
  padding: 8px 0 10px;
}
.sheet-head {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}
.sheet-head div, .sheet-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
}
.sheet-head span, .sheet-box span { display: block; color: var(--muted); font-size: 0.75rem; }
.sheet-head small { display: block; color: var(--muted); }
fieldset { border: 0; margin: 0; padding: 0; min-inline-size: 0; }
.levels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.level {
  display: block;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  background: white;
  min-height: 108px;
}
.level input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.level span { display: block; font-weight: 750; }
.level small { color: var(--muted); }
.level:has(input:checked) {
  background: var(--green-dark);
  color: white;
  border-color: var(--green-dark);
}
.level:has(input:checked) small { color: #d7efe8; }
.criterion { margin-bottom: 12px; }
.rubric-guide { margin: 0 0 14px; padding-left: 18px; }
.rubric { width: 100%; border-collapse: collapse; min-width: 760px; }
.rubric th, .rubric td { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; text-align: left; }
.rubric thead th { font-size: 0.82rem; }
.rubric .section-row th {
  background: var(--green-dark);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.rubric td.mark, .rubric th.mark { width: 8.2rem; text-align: center; }
.rubric td.mark label { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; font-size: 0.78rem; }
.rubric td.mark input { width: 18px; height: 18px; }
.rubric td.mark:has(input:checked) { background: var(--green-dark); color: white; }
.exceeds { margin-top: 8px; }
.exceeds[hidden] { display: none; }

.bar {
  position: sticky;
  bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  background: var(--ink);
  color: white;
}
.bar .btn { min-width: 140px; }
.totals { display: flex; gap: 14px; font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 0.78rem; color: var(--muted); font-weight: 650; }
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
.score { font-variant-numeric: tabular-nums; font-weight: 750; }
.s1 { background: #f3f1ea; }
.s2 { background: #d9ebf5; }
.s3 { background: #d7f0df; }
.s4 { background: #f3e2a2; }
.place { font-size: 1.25rem; font-weight: 800; }
.advance { background: #f7fbe4; }

.checkline {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.checkline input { width: 22px; height: 22px; margin-top: 2px; }
.mission { margin-bottom: 8px; }
.score-live { font-size: 2rem; font-weight: 800; }

.login-layout { width: min(720px, calc(100% - 24px)); margin: 28px auto; }
.need {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.need.short strong { color: var(--danger); }
.sheet input, .sheet select, .sheet textarea { width: 100%; min-width: 7rem; }
.sheet td { vertical-align: middle; }
.person-more { margin: 8px 0; }
.spot { border-radius: 8px; padding: 2px 6px; }
.spot-away { background: #f6e7c1; }
.spot-late { background: #f8d0cb; }
.spot-wait { background: #d7ebf8; }
.spot-field { background: #d9f2e4; }
tr.spot-away td, tr.spot-late td, tr.spot-wait td, tr.spot-field td { background: transparent; }
tr.spot-away { background: #f6e7c1; }
tr.spot-late { background: #f8d0cb; }
tr.spot-wait { background: #d7ebf8; }
tr.spot-field { background: #d9f2e4; }
textarea { width: 100%; min-height: 8rem; font: inherit; }
.alarm {
  border: 2px solid #b42318;
  background: #fde8e6;
  border-radius: 14px;
  padding: 10px 12px;
  margin: 8px 0;
}
.alarm.hot { animation: alarm-glow 1.2s ease-in-out infinite; }
.alarm.settling {
  animation: none;
  border-color: #1f7a4d;
  background: #e7f6ec;
}
.alarm.help {
  border-color: #b86e00;
  background: #fff4e5;
}
.alarm.help.hot { animation: help-glow 1.2s ease-in-out infinite; }
@keyframes help-glow {
  50% { box-shadow: 0 0 0 4px #f3d3a2; background: #fff; }
}
@keyframes alarm-glow {
  50% { box-shadow: 0 0 0 4px #f3b4ae; background: #fff; }
}
@media (prefers-reduced-motion: reduce) {
  .alarm.hot, .alarm.help.hot { animation: none; }
}
.need.ok strong { color: var(--green); }
.board th { background: var(--green-dark); color: #f6f3ea; }
.dayline { width: 100%; margin: 8px 0 18px; }
tr[data-keep="1"] td, tr.current-row td { background: #f6f1c8; font-weight: 700; }
tr[data-banner="1"] td { background: #0b3d30; color: #fff; font-weight: 700; }
.series-line { margin: 18px 0 8px; padding: 8px 12px; background: #0b3d30; color: #fff; font-weight: 700; }
tr.excel td { background: #e7f6ec; }
tr.awarded td { background: #d9f2e4; }
tr.cutoff td { box-shadow: inset 0 -3px 0 #c4453c; }
.warn-pill { background: #fde8e2; color: var(--danger); }
@media print {
  .topbar, .nav, .no-print, form { display: none !important; }
  .board { font-size: 12pt; }
  body { background: white; }
}

.nav .locked {
  opacity: 0.45;
  pointer-events: none;
}
.trial {
  background: #f3e2a2;
  color: var(--ink);
  padding: 10px 16px;
  text-align: center;
  font-weight: 650;
}

.alert {
  background: #fde8e2;
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.ok {
  background: #e5f6ea;
  color: var(--green-dark);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.score-side {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}
@media (max-width: 720px) {
  .slot { grid-template-columns: 96px 1fr; }
  .slot form, .slot a.btn { grid-column: 1 / -1; }
  .hero, .bar, .score-side { align-items: stretch; flex-direction: column; }
  .sheet-head { grid-template-columns: 1fr; }
  .levels { grid-template-columns: 1fr 1fr; }
  .level { min-height: 108px; padding: 8px; }
  .level span { font-size: 0.86rem; }
  .level small { font-size: 0.75rem; line-height: 1.3; }
  .who { font-size: 0.75rem; }
  h1 { font-size: 1.35rem; }
}
