.tablepage {
  min-height: 100vh;
  background: #f1f4ef;
}
.deskbar {
  background: #102725;
  color: #f1f7eb;
  padding: 15px max(18px, calc((100vw - 1080px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.deskbar b {
  font-size: 22px;
  white-space: nowrap;
}
.deskbar small {
  font-size: 10px;
  color: #c0f664;
  letter-spacing: 2px;
}
.deskbar span {
  font-size: 15px;
}
.tablepage main {
  width: min(1080px, 100%);
  padding: 28px 18px 60px;
  margin: auto;
}
.deskhead,
.cardtitle,
.seatline,
.toolbar,
.cardpair,
.welcomeline {
  display: flex;
  align-items: center;
  gap: 12px;
}
.deskhead,
.cardtitle,
.seatline {
  justify-content: space-between;
  flex-wrap: wrap;
}
.deskhead {
  margin-bottom: 17px;
}
.deskhead h1 {
  font-size: 34px;
}
.toolbar {
  flex-wrap: wrap;
}
.darkboard {
  background: #17332d;
  color: #eff7e8;
  border-radius: 15px;
  padding: 24px;
  margin-bottom: 16px;
}
.darkboard .help {
  color: #cedbc8;
}
.boardgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 15px 0;
}
.seatbox {
  border: 1px solid #bfcfc1;
  background: #fafcf6;
  border-radius: 10px;
  color: #1c3329;
  text-align: left;
  padding: 12px;
  min-height: 65px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.seatbox.open {
  border: 1px dashed #8fa292;
  background: transparent;
  color: inherit;
  justify-content: flex-start;
}
.seatbox.picked {
  outline: 3px solid #89ad42;
}
.seatbox small {
  display: block;
}
.seatbox.seatvip {
  border: 2px solid #d2a022;
  background: #fff5ce;
}
.ava {
  display: inline-grid;
  place-items: center;
  vertical-align: middle;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
  background: #dce8d3;
  color: #344c30;
  font-weight: 750;
}
.vipmark {
  display: inline-block;
  background: #ffdb67;
  color: #583e00;
  border-radius: 4px;
  font: bold 11px Arial;
  padding: 3px 5px;
  letter-spacing: 1px;
  margin-left: 4px;
}
.tablepage .panel {
  margin-bottom: 14px;
}
.sheetfields {
  display: grid;
  gap: 12px;
}
#formbox {
  padding: 22px;
}
.aligncenter {
  text-align: center;
}
.qrview img {
  width: min(260px, 78vw);
  height: auto;
  image-rendering: pixelated;
}
.tablepage .row button {
  padding: 7px 11px;
}
.outflag {
  color: #975147;
}
.ranked {
  display: grid;
  gap: 6px;
  margin: 14px 0;
}
.rankline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: #e8eee2;
  color: #1b3228;
  border-radius: 8px;
}
.rankline:first-child {
  background: #ffedb0;
}
.rankline b:last-child {
  margin-left: auto;
}
.rankline .ava {
  width: 32px;
  height: 32px;
}
.welcome {
  background: #e2f2c9;
  border: 1px solid #a7bf87;
  color: #203925;
  border-radius: 12px;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.welcome.vipglow {
  background: linear-gradient(110deg, #f1cb62, #fff5c3, #f0ce70);
  color: #493608;
  border: 2px solid #ffdf73;
  animation: vipglow 1s ease-in-out 3 alternate;
}
@keyframes vipglow {
  to {
    box-shadow: 0 0 24px #f2ca6199;
  }
}
@media (prefers-reduced-motion: reduce) {
  .welcome.vipglow {
    animation: none;
  }
}
.tvroster {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.tvroster > span {
  border: 1px solid #78957d;
  border-radius: 20px;
  padding: 4px 9px;
}
.tvroster .ava {
  width: 26px;
  height: 26px;
}
.sheetfields input[type="file"] {
  max-width: 100%;
}
.chipsline {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.playingcard {
  background: #fff;
  border: 1px solid #cad8cc;
  border-radius: 5px;
  min-width: 2em;
  padding: 3px;
  text-align: center;
  font-weight: 750;
  color: #222;
}
.playingcard.red {
  color: #b22c37;
}
.videobox {
  width: 100%;
  max-height: 55vh;
  background: #13231e;
}
.reviewer {
  padding: 18px;
  border-radius: 12px;
  background: #183830;
  color: white;
}
.reviewer input[type="range"] {
  width: 100%;
}
.reviewer .seatline {
  padding: 7px 0;
  border-top: 1px solid #4c6559;
}
.reviewer .toolbar button {
  margin: 6px 0;
}
.smallmeta {
  color: #64766c;
  font-size: 14px;
}
.tv .ranked {
  width: min(850px, 100%);
  margin: 12px auto;
}
.wraptext {
  overflow-wrap: anywhere;
}
.seatform {
  max-width: 560px;
  margin: auto;
}
.seatline {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.tablepage .field textarea {
  width: 100%;
}
.tablepage .scroll {
  max-height: 65vh;
}
.tablepage .toolbar select {
  padding: 7px;
  border-radius: 6px;
}
.tablepage h2 {
  margin-bottom: 9px;
}
.tablepage #toast {
  bottom: 18px;
}
.handcards {
  margin: 10px 0;
}
.badgecount {
  font: 700 18px Arial;
  color: #c6ef88;
}
.deskhead .help {
  margin-top: 5px;
}
.tv .welcome .ava {
  max-width: 6vh;
}
.tv .ranked {
  max-height: 45vh;
  overflow: auto;
}

.tv.tv-live {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 clamp(12px, 2vw, 96px) max(1vh, env(safe-area-inset-bottom));
  justify-content: flex-start;
}
.tv-notice {
  padding: 0.2em 0;
  line-height: 1.25;
  background: transparent;
  color: inherit;
  text-shadow: 0 1px 3px #0009;
  display: flex;
  align-items: baseline;
  gap: 0.75em;
  text-align: left;
  font-size: clamp(14px, 1vw, 24px);
}
.tv-notice .ico {
  align-self: center;
  width: 1.1em;
  height: 1.1em;
}
.tv-notice b {
  white-space: nowrap;
}
.tv-marquee {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  align-self: center;
}
.tv-marquee-track {
  display: flex;
  width: max-content;
  animation: tv-news-scroll var(--notice-period, 24s) linear
    var(--notice-phase, 0s) infinite;
}
.tv-marquee-copy {
  display: block;
  flex: none;
  min-width: var(--notice-lane, 75vw);
  box-sizing: border-box;
  padding-inline-end: 3em;
  white-space: nowrap;
}
@keyframes tv-news-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .tv-marquee-track {
    animation: none;
    width: 100%;
  }
  .tv-marquee {
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .tv-marquee-copy {
    white-space: nowrap;
    min-width: 0;
    padding: 0;
  }
  .tv-marquee-copy[aria-hidden] {
    display: none;
  }
}

.tv-meta {
  padding: clamp(10px, 1.8vh, 28px) 0;
  gap: 10px;
  text-align: left;
}
.tv .tvactions {
  margin: 0;
  flex-wrap: nowrap;
}
.tv:not(.tv-live) > .tvactions {
  position: absolute;
  top: max(12px, 1.8vh, env(safe-area-inset-top));
  right: max(16px, 2.6vw, env(safe-area-inset-right));
}
.tv-tools {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .4em 1em;
}
.tv-footer {
  flex: none;
  width: 100%;
}
.tv-footer .chip-strip {
  gap: clamp(7px, 2.1vw, 90px);
  margin: .35vh auto .7vh;
}
.tv-footer .chip-strip img,
.tv-footer .chip-token {
  width: clamp(25px, min(7.5vw, 9.1vh), 224px);
  height: clamp(25px, min(7.5vw, 9.1vh), 224px);
}
.tv-footer .chip-strip b {
  font-size: clamp(13px, min(1.65vw, 2.7vh), 66px);
  line-height: 1.05;
  letter-spacing: .015em;
}
.tv-footer .chip-token {
  border: 1px solid #ffffff55;
  box-shadow: inset 0 0 0 .18vh #0004, 0 .35vh .55vh #0005;
}
.light-surface .tv-notice {
  text-shadow: 0 1px 2px #fff8;
}
.tv-layout {
  flex: 1;
  display: grid;
  justify-items: center;
  align-items: center;
  min-width: 0;
  gap: clamp(8px, 1vw, 42px);
}
.tv-stage {
  min-width: 0;
  width: min(100%, 76vw);
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
}
@media (orientation: landscape) {
  .tv-layout.has-ranking {
    --rail: clamp(142px, 16.5vw, 680px);
    grid-template-columns: var(--rail) minmax(0, 1fr) var(--rail);
  }
  .has-ranking > .tv-stage { grid-column: 2; width: 100%; }
  .has-ranking > .tv-ranking { grid-column: 3; width: 100%; }
}
.tv-stage > h1 {
  margin: 0;
  font-size: clamp(34px, min(5.6vw, 8.3vh), 204px);
  line-height: 1.06;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.tv-stage > .leveltag {
  margin: .55vh 0;
  font-size: clamp(16px, min(2.5vw, 3.65vh), 90px);
  line-height: 1.14;
}
.tv-stage > .leveltag::before,
.tv-stage > .leveltag::after {
  content: "";
  display: inline-block;
  width: 1em;
  height: 2px;
  margin: 0 .5em;
  vertical-align: middle;
  background: currentColor;
  opacity: .45;
}
.tv-live .timer {
  font-size: clamp(68px, min(22vw, 35vh), 860px);
  font-size: clamp(58px, min(35vh, 34cqw), 860px);
  line-height: 1;
  margin: .25vh 0;
  white-space: nowrap;
}
.tv-live .timer.long-clock {
  font-size: clamp(46px, min(35vh, 23cqw), 860px);
}
.tv-stage .tickbar {
  flex-shrink: 0;
  width: 90%;
  height: clamp(3px, .45vh, 11px);
  margin: .8vh auto 1.15vh;
}
.tv-stage .blindrow {
  width: 100%;
  margin: 0 auto;
  padding: .55vh 0;
  gap: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tv-stage .blindrow > div {
  min-width: 0;
  padding: 0 1.1vw;
  container-type: inline-size;
}
.tv-stage .blindrow small,
.tv-stage .blindrow em {
  display: block;
  font-size: clamp(15px, min(2.05vw, 3vh), 72px);
  line-height: 1.16;
}
.tv-stage .blindrow strong {
  font-size: clamp(25px, min(5.2vw, 8.2vh), 196px);
  font-size: min(8.2vh, calc(168cqw / var(--blind-length, 9)));
  margin: .2vh 0;
  line-height: 1.09;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tv-stage > button { align-self: center; }
.tv-live .score {
  align-items: baseline;
  gap: .4em 1.1em;
  margin: 1.35vh 0 .3vh;
  font-size: clamp(14px, min(1.95vw, 3.35vh), 82px);
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.tv-live .score b { font-size: 1.13em; }
.tv-live .score span { overflow-wrap: anywhere; }
.champion-cup {
  align-self: center;
  color: #ffdf8b;
  background: radial-gradient(ellipse, #ac771d54, transparent 72%);
  padding: .2em .55em;
  font-size: clamp(38px, 7vh, 92px);
  line-height: 1;
}
.champion-cup .ico {
  width: 1em;
  height: 1em;
  filter: drop-shadow(0 2px 2px #593a15);
}
.tv-victory {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}
.tv-victory i {
  position: absolute;
  top: -3vh;
  width: clamp(5px, .52vw, 14px);
  height: clamp(9px, 1.2vw, 28px);
  border-radius: 2px;
  background: #f4c25f;
  animation: victory-fall 3.4s ease-in both;
}
.tv-victory i:nth-child(3n) { background: #fff3cf; }
.tv-victory i:nth-child(3n + 1) { background: #73cfac; }
@keyframes victory-fall {
  from { transform: translateY(0) rotate(15deg); }
  to { transform: translate(var(--drift), 103vh) rotate(560deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tv-victory { display: none; }
  .tv-victory i { animation: none; }
}
.tv-winners {
  font-size: clamp(28px, 4vw, 80px);
  color: #e0f6bc;
  overflow-wrap: anywhere;
}
.tv-ranking {
  align-self: center;
  min-width: 0;
  text-align: left;
  background: #173a32;
  border: 1px solid #395a4c;
  border-radius: 15px;
  overflow: hidden;
}
.tv-ranking h2 {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.5em 0.72em;
  color: #d8f3ae;
  border-bottom: 1px solid #466355;
  font-size: clamp(17px, 1.22vw, 30px);
}
.tv-ranking h2 .ico {
  width: 1em;
  height: 1em;
}
.tv-ranking p {
  padding: 1em;
  color: #cbdccf;
}
.tv-rank-list {
  list-style: none;
  padding: 0 0.55em;
  margin: 0;
  max-height: 65vh;
  overflow: auto;
  scrollbar-width: thin;
}
.tv-rank-row {
  display: grid;
  grid-template-columns: 1.3em 1.65em minmax(0, 1fr) auto;
  gap: 0.32em;
  align-items: center;
  padding: 0.55em 0;
  border-bottom: 1px solid #36574a;
  font-size: clamp(14px, 0.98vw, 25px);
}
.tv-rank-row:last-child {
  border: 0;
}
.tv-rank-row .place {
  text-align: center;
  color: #c5dbba;
  font-variant-numeric: tabular-nums;
}
.tv-rank-row .ava {
  width: 1.65em;
  height: 1.65em;
}
.tv-rank-row:first-child .place {
  color: #dfbe70;
}
.tv-rank-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.tv-rank-name small {
  display: block;
  color: #c1d0c4;
  font-size: 0.83em;
}
.tv-rank-row .stack-size {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: #e1f5c0;
}
.tv-rank-row.eliminated .stack-size {
  color: #d7b3a5;
  font-size: 0.9em;
}
.tv-ranking .vipmark {
  vertical-align: middle;
}
@media (orientation: portrait) {
  .tv-layout.has-ranking {
    grid-template-columns: 1fr;
  }
  .tv-ranking {
    width: 100%;
  }
  .tv-rank-list {
    max-height: 45vh;
  }
  .tv-stage {
    width: 100%;
    padding: 12px 0;
  }
}
@media (max-height: 550px) and (orientation: landscape) {
  .tv-stage .blindrow { padding: 2px 0; }
  .tv-meta { padding: 5px 0; }
  .tv-live .score { margin: 4px 0; }
}

.film-screen { position:fixed; inset:0; z-index:12; background:#080e0d; color:white; display:grid; place-items:center; }
.film-screen video { display:block; width:100%; height:100%; object-fit:contain; min-height:0; }
.film-caption { position:absolute; top:3vh; left:2.5vw; display:flex; gap:1ch; align-items:center; background:#102725dd; border-left:.25em solid #c0f664; border-radius:4px; padding:.55em 1em; font-size:clamp(16px,1.5vw,48px); }

/* Some mobile browsers only allow native fullscreen on video. */
html.tv-page-fullscreen, .tv-page-fullscreen body { overflow: hidden; }
.tv-page-fullscreen #app {
  position: fixed;
  inset: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: #102c27;
}
.tv-page-fullscreen .tv-live {
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(12px, 2vw, env(safe-area-inset-left));
  padding-right: max(12px, 2vw, env(safe-area-inset-right));
}
@media (max-width: 600px) {
  .tv-page-fullscreen .tv-meta > b { display: none; }
  .tv-page-fullscreen .tv-meta { padding-block: 4px; }
}

.seat-code-dialog { padding: 20px; }
.seat-code-dialog .qrview { margin: 12px auto; }
.seat-code-dialog .qrview img { max-width: 100%; }
.dashboard-seats { margin-top: 18px; scroll-margin-top: 70px; }
.dashboard-seats .cardtitle { flex-wrap: wrap; gap: 8px; }
.dashboard-roster { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(145px, 100%), 1fr)); margin-top: 14px; }
.dashboard-seat { min-width: 0; display: grid; text-align: left; align-content: center; gap: 2px; border-radius: 9px; padding: 8px 12px; background: #eff4ef; color: var(--ink); overflow-wrap: anywhere; }
.dashboard-seat small { color: var(--muted); font-weight: 500; }
.dashboard-seat.empty-seat { background: transparent; border: 1px dashed var(--line); }
.tv .tv-seat-code { text-align: center; display: grid; justify-items: center; gap: 12px; padding: 12px; }
.tv .tv-seat-code img { display: block; width: min(62vmin, 100%); height: auto; image-rendering: pixelated; }
.tv .tv-seat-code h2 { font-size: clamp(22px, 3.2vmin, 72px); }
