/* Kaizen Ninja: the trainer's class board. Same tokens as ../game/game.css; sized to read on a projector. */
:root {
  color-scheme: dark;
  --ink: #15151d;
  --paper: #f6f4ef;
  --white: #ffffff;
  --orange: #f26522;
  --orange-text: #c2410c;
  --yellow: #f6b800;
  --navy: #1b2550;
  --navy-2: #111833;
  --red: #b3141b;
  --green: #17803d;
  --muted: #5b6070;
  --line: #e2ded5;
  --head: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--navy-2); color: var(--white); font-family: var(--body); font-size: 20px; line-height: 1.35; }
[hidden] { display: none !important; }

header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 18px; padding: 18px 28px; background: var(--navy); border-bottom: 5px solid var(--orange); }
header h1 { margin: 0; font-family: var(--head); font-weight: 700; font-size: clamp(24px, 3vw, 40px); letter-spacing: .04em; }
.class-title { font-family: var(--head); font-weight: 600; font-size: clamp(20px, 2.4vw, 32px); color: var(--yellow); }
.status { margin-left: auto; font-weight: 800; color: #e3e6ef; }

main { padding: 24px 28px 40px; }
main.start { max-width: 860px; margin: 0 auto; }
main.board { display: grid; grid-template-columns: minmax(300px, 34%) 1fr; gap: 24px; align-items: start; }

.panel { background: var(--paper); color: var(--ink); border: 4px solid var(--ink); border-radius: 20px; padding: 22px 26px; box-shadow: 0 8px 0 rgba(0, 0, 0, .35); }
.panel h2 { margin: 0 0 12px; font-family: var(--head); font-weight: 700; font-size: 28px; letter-spacing: .03em; }
.lead { margin: 0 0 18px; font-size: 22px; font-weight: 700; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 260px; font-size: 17px; font-weight: 800; color: var(--muted); }
.row.small .field { flex: 0 1 200px; }
.field input { min-height: 56px; padding: 6px 14px; border: 3px solid var(--ink); border-radius: 14px; background: var(--white); color: var(--ink);
  font: 700 22px var(--body); }
.row.small .field input { text-transform: uppercase; letter-spacing: .14em; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: 6px 24px; border: 3px solid var(--ink); border-radius: 14px;
  background: var(--white); color: var(--ink); font: 600 22px var(--head); box-shadow: 0 4px 0 var(--ink); cursor: pointer; }
.btn.primary { background: var(--orange); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.link { padding: 6px 0; border: 0; background: none; color: var(--navy); font: 800 18px var(--body); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.btn:focus-visible, .field input:focus-visible, .link:focus-visible { outline: 4px solid var(--yellow); outline-offset: 2px; }
.msg { min-height: 1.4em; margin: 4px 0 18px; font-weight: 800; color: var(--orange-text); }

.join { text-align: center; }
/* the game's title screen above "Scan to play", so people walking by see what the game is. The QR code comes first, so
   the picture gets the height that is left: the screen less the QR code (35vh), the class code (8vh) and everything
   else down to the bottom of the panel (about 380px, with room for the panel's shadow and a TV that crops its edges).
   On a 1920x1080 TV the whole panel fits (the picture is about 420px wide). On shorter screens it stays 200px wide
   and the "Start another class" link can drop below the bottom; at 1366x768 the QR code, the code and the address
   still fit, even when the address takes 3 lines. Below 620px tall the picture is left out, so the code stays on. */
.shot { display: block; width: 100%; max-width: max(200px, calc((57vh - 380px) * 16 / 9)); height: auto; margin: 0 auto 14px;
  border: 3px solid var(--ink); border-radius: 14px; background: var(--navy); }
@media (max-height: 800px) { .join .shot { margin-bottom: 8px; } .join h2 { margin-bottom: 8px; } .join .code { margin-top: 10px; } }
@media (max-height: 619px) { .join .shot { display: none; } }
.qr { max-width: min(380px, 35vh); margin: 0 auto; padding: 10px; border-radius: 14px; background: var(--white); }
.qr svg { display: block; width: 100%; height: auto; }
.code { margin: 14px 0 4px; font-family: var(--head); font-weight: 700; font-size: clamp(56px, min(7vw, 8vh), 112px); line-height: 1; letter-spacing: .16em; }
.url { margin: 6px 0 12px; font-size: 18px; font-weight: 800; color: var(--muted); overflow-wrap: anywhere; }

.count:empty { display: none; }
.count { margin: 0 0 10px; font-family: var(--head); font-weight: 700; font-size: 26px; }
.empty { margin: 0; font-size: 22px; font-weight: 700; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: clamp(18px, 1.7vw, 26px); }
th { padding: 4px 10px; border-bottom: 3px solid var(--line); text-align: left; font-size: .68em; font-weight: 800; color: var(--muted); }
td { padding: 8px 10px; border-bottom: 2px solid var(--line); font-weight: 700; }
.c-rank { width: 2.4em; font-family: var(--head); color: var(--muted); }
tbody tr:nth-child(-n+3) .c-rank { color: var(--orange-text); }
.c-name { font-weight: 800; }
.c-spotted, .c-tricks, .c-score { text-align: right; white-space: nowrap; }
td.c-score { font-family: var(--head); font-size: 1.15em; }
.c-progress { white-space: nowrap; color: var(--navy); }
.c-progress.defeated { color: var(--green); }
.c-progress.wounded { color: var(--orange-text); }
.c-progress.foughtBack { color: var(--red); }
.gain { display: inline-block; margin-right: 10px; font-family: var(--body); font-size: .72em; font-weight: 800; color: var(--green); animation: gain 4s ease-out both; animation-delay: calc(-1 * var(--age, 0ms)); }
@keyframes gain { 0% { opacity: 0; transform: translateY(8px); } 10% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; } }
tr.new td { animation: arrive 2.4s ease-out both; animation-delay: calc(-1 * var(--age, 0ms)); }
@keyframes arrive { from { background: #ffe58a; } to { background: transparent; } }

@media (max-width: 860px) {
  main.board { grid-template-columns: 1fr; }
  .status { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { tr.new td, .gain { animation: none; } }
