:root {
  --cream: #f7f1e4;
  --ivory: #fffaf2;
  --ink: #1b2822;
  --emerald: #146154;
  --emerald-deep: #0c3d36;
  --gold: #c9963a;
  --muted: #5e6d64;
  --line: rgba(20, 56, 48, 0.12);
  --sq-light:
    radial-gradient(125% 85% at 30% 18%, rgba(255, 252, 245, 0.75), transparent 46%),
    linear-gradient(155deg, #fbf6ec, #ecd9b8 42%, #f6ecda 68%, #d4bc96);
  --sq-dark:
    radial-gradient(110% 85% at 24% 18%, rgba(128, 214, 188, 0.38), transparent 48%),
    linear-gradient(158deg, #1f6b5c, #0e3c35 40%, #186056 72%, #082420);
  --frame-bg:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 236, 190, 0.18), transparent 42%),
    linear-gradient(180deg, #2a2118, #140e0c 46%, #0c0908);
  --frame-shadow:
    0 28px 40px rgba(30, 50, 40, 0.28),
    inset 0 0 0 1px rgba(212, 168, 90, 0.45);
  --bezel: #100c0a;
  color-scheme: light;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: "Amiri", "Times New Roman", serif;
  background:
    radial-gradient(900px 480px at 50% -10%, #fffdf8, transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(47, 143, 122, 0.18), transparent 50%),
    radial-gradient(640px 420px at 0% 100%, rgba(201, 150, 58, 0.2), transparent 46%),
    linear-gradient(180deg, #f4efe4 0%, #e7f3ee 100%);
}

.silk,
.grain,
.veil,
#dust,
.halo,
.tableau::after,
.ornament {
  display: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

button:focus-visible {
  outline: 2px solid var(--emerald);
  outline-offset: 3px;
}

.salon {
  position: relative;
  z-index: 4;
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 1rem 1.25rem 3rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  flex-wrap: wrap;
  min-height: 3.2rem;
}

.top-login,
.name-form button,
.play-button,
#watch-next,
.online-box button,
.curtain-actions button {
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1.25rem;
  color: var(--ivory);
  background: linear-gradient(180deg, #2f8f7a, var(--emerald) 55%, var(--emerald-deep));
  box-shadow: 0 10px 22px rgba(20, 80, 68, 0.22);
}

.top-user {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.25rem 0.35rem 0.25rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 24px rgba(40, 70, 55, 0.08);
}

.logo-hero {
  display: flex;
  justify-content: center;
  margin: 0.2rem 0 1.1rem;
}

.logo-img {
  width: min(420px, 86vw);
  height: auto;
  border-radius: 28px;
  filter: drop-shadow(0 22px 28px rgba(80, 60, 20, 0.16));
  animation: logo-float 5.5s ease-in-out infinite;
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(240px, 0.7fr);
  gap: 1.1rem;
  align-items: center;
  padding: 1.15rem;
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.72);
  box-shadow: 0 24px 50px rgba(40, 70, 55, 0.1);
}

.stage-board {
  width: min(100%, 340px);
  aspect-ratio: 1;
  justify-self: center;
  border-radius: 14px;
  background: repeating-conic-gradient(#fbf6ec 0% 25%, #14685a 0% 50%) 0 0 / 25% 25%;
  box-shadow:
    0 0 0 10px #1a3c34,
    0 22px 36px rgba(20, 60, 48, 0.28);
  animation: board-float 7s ease-in-out infinite;
}

.home-top {
  display: grid;
  gap: 0.75rem;
}

.home-card {
  padding: 1.1rem 1.15rem 1.15rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 30px rgba(40, 70, 55, 0.08);
}

.home-card h2,
.home-block h2,
.viewing h2,
.ledger h2,
.curtain-card h2,
.modal-card h2 {
  margin: 0;
  color: var(--emerald-deep);
  font-size: 1.7rem;
  line-height: 1.15;
}

.profile-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.15rem 0.85rem;
  align-items: center;
}

.crest {
  grid-row: span 2;
  width: 3.6rem;
  height: 3.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--emerald-deep);
  font-size: 1.45rem;
  background: radial-gradient(circle at 35% 30%, #fffaf0, #e7c98a 60%, #b9893e);
}

.player-name {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.1;
}

.rating,
.home-rating {
  margin: 0.15rem 0 0;
  color: var(--gold);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.35rem;
}

.profile-card .name-form,
.profile-card .text-button {
  grid-column: 1 / -1;
}

.eyebrow,
.match-label,
.reel-kicker,
.curtain-kicker {
  margin: 0;
  color: var(--gold);
  font-size: 0.95rem;
}

.subtitle,
.home-lead,
.play-lead,
.home-streak,
.house-line,
.watch-meta {
  margin: 0.4rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.play-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.play-button {
  width: 100%;
  margin-top: 1rem;
  font-size: 1.3rem;
}

.play-button-quiet {
  color: var(--emerald-deep);
  background: transparent;
  box-shadow: inset 0 0 0 1.5px rgba(20, 97, 84, 0.45);
}

.play-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.play-choices button,
.hall button,
.match-row button,
.actions button,
.academy button,
.sound,
.promote-choice {
  color: var(--ink);
  background: rgba(20, 97, 84, 0.08);
  border: 0;
  border-radius: 12px;
  box-shadow: none;
}

.play-choices button {
  padding: 0.65rem 0.3rem;
}

.play-choices button:hover,
.reel-card:hover,
.hall button:hover,
.academy button:hover:not(:disabled),
.actions button:hover:not(:disabled) {
  background: rgba(20, 97, 84, 0.16);
}

.text-button {
  padding: 0.2rem 0.1rem;
  border: 0;
  background: transparent;
  color: var(--emerald);
}

.name-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.name-form input {
  grid-column: 1 / -1;
  border: 0;
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  color: var(--ink);
  background: #f4f7f5;
}

.name-form input::placeholder {
  color: #8b978f;
}

.auth-error,
.lesson.is-wrong {
  margin: 0.45rem 0 0;
  color: #9d3030;
}

.foyer {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.reel-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-height: 9rem;
  padding: 1rem 1.05rem;
  text-align: right;
  color: inherit;
  border: 0;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(40, 70, 55, 0.08);
  transition: transform 0.35s ease;
}

.reel-card:hover {
  transform: translateY(-4px);
}

.reel-card strong {
  font-size: 1.4rem;
  color: var(--emerald-deep);
}

.reel-blurb {
  color: var(--muted);
  line-height: 1.45;
}

.home-split {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr 0.9fr;
  gap: 0.75rem;
}

.primer,
.ranks {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.primer li,
.ranks li {
  margin: 0 0 0.45rem;
  line-height: 1.5;
  color: var(--muted);
}

.ranks li {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.ranks .empty {
  display: block;
  border: 0;
}

.house-line {
  font-style: italic;
  text-align: center;
}

.table {
  direction: ltr;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1.25rem;
}

.tableau {
  position: relative;
  flex: 1 1 auto;
  width: min(680px, 100%);
  max-width: 680px;
  min-width: 0;
  perspective: 1400px;
}

.frame {
  padding: 0.9rem;
  border-radius: 18px;
  background: var(--frame-bg);
  box-shadow: var(--frame-shadow);
  transform: rotateX(12deg);
  transform-style: preserve-3d;
  animation: board-tilt 8s ease-in-out infinite;
}

.frame:hover {
  animation: none;
  transform: rotateX(4deg) rotateY(-7deg);
}

.bezel {
  padding: 0.45rem;
  border-radius: 8px;
  background: var(--bezel);
}

.board {
  display: grid;
  width: 100%;
  grid-template-columns: 1.2rem minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 0.28rem 0.4rem;
}

.squares {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  aspect-ratio: 1;
  overflow: visible;
  touch-action: none;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 236, 200, 0.12);
}

.move-arrows {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.square {
  --shift: 0;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.square.light,
.mini-board i.light,
.mini-pieces i.light {
  background: var(--sq-light);
}

.square.dark,
.mini-board i.dark,
.mini-pieces i.dark {
  background: var(--sq-dark);
}

.square:hover {
  filter: brightness(1.08);
}

.square.chosen.light,
.square.chosen.dark {
  box-shadow: inset 0 0 0 3px rgba(255, 230, 170, 0.95);
}

.square.last.light {
  box-shadow: inset 0 0 0 100px rgba(236, 205, 140, 0.38);
}

.square.last.dark {
  box-shadow: inset 0 0 0 100px rgba(228, 194, 122, 0.28);
}

.square.mark::before {
  content: "";
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 28%;
  height: 28%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 244, 214, 0.95), rgba(228, 194, 122, 0.35) 70%, transparent 72%);
  pointer-events: none;
}

.square.mark.capture::before {
  width: 82%;
  height: 82%;
  background: transparent;
  box-shadow: inset 0 0 0 3px rgba(255, 220, 160, 0.92);
}

.square.in-check {
  box-shadow: inset 0 0 0 3px rgba(255, 90, 80, 0.9);
}

.piece {
  position: absolute;
  inset: 1% 8% 0;
  z-index: 1;
  pointer-events: none;
  transform-origin: 50% 92%;
  transition: transform 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.35));
}

.piece.flip svg {
  transform: scaleX(-1);
}

.piece svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.square:hover .piece {
  transform: translateY(-6%);
}

.square.chosen .piece {
  transform: translateY(-10%);
}

.square.lifting,
.square.lifting:hover {
  z-index: 5;
}

.piece.gliding {
  z-index: 6;
}

.piece.taken {
  z-index: 4;
  animation: piece-taken 0.48s ease forwards;
}

.piece.arriving {
  animation: piece-arrive 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ranks,
.files {
  display: grid;
}

.ranks {
  grid-column: 1;
  grid-row: 1;
  grid-template-rows: repeat(8, 1fr);
}

.files {
  grid-column: 2;
  grid-row: 2;
  grid-template-columns: repeat(8, 1fr);
}

.ranks span,
.files span {
  display: grid;
  place-items: center;
  color: rgba(228, 194, 122, 0.8);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 0.78rem;
  user-select: none;
}

.inscription {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

.inscription::before,
.inscription::after {
  content: none;
}

.ledger {
  display: none !important;
}

.ledger-retired {
  direction: rtl;
  flex: 0 1 300px;
  width: min(300px, 100%);
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 34px rgba(40, 70, 55, 0.1);
}

.identity {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0.7rem 0 0.4rem;
}

.hall,
.match-row,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.hall {
  margin: 0.8rem 0;
}

.hall button,
.match-row button,
.actions button,
.academy button {
  padding: 0.45rem 0.7rem;
}

.hall button.is-on,
.match-row button.is-on,
.academy button.is-on {
  color: var(--ivory);
  background: var(--emerald);
}

.academy {
  display: grid;
  gap: 0.35rem;
  max-height: 240px;
  margin-bottom: 0.7rem;
  overflow: auto;
}

.academy button {
  width: 100%;
  text-align: right;
}

.online-box,
.coach-note,
.lesson {
  margin: 0.35rem 0 0.75rem;
  line-height: 1.5;
}

.online-box {
  display: grid;
  gap: 0.5rem;
}

.online-box p,
.coach-note,
.lesson,
.turn p,
.promote-title,
.curtain-line {
  margin: 0;
}

.turn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.8rem 0;
}

.sound {
  margin-inline-start: auto;
  padding: 0.3rem 0.55rem;
  color: var(--emerald);
  background: transparent;
}

.stone {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  flex: none;
}

.stone.pearl {
  background: radial-gradient(circle at 35% 30%, #fffaf0, #e4c27a);
}

.stone.obsidian {
  background: #241b33;
}

.score {
  list-style: none;
  direction: ltr;
  max-height: 160px;
  margin: 0 0 0.8rem;
  padding: 0;
  overflow: auto;
}

.score li {
  display: grid;
  grid-template-columns: 1.6rem 1fr 1fr;
  gap: 0.3rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.15rem;
}

.score .num,
.score li.empty {
  color: var(--muted);
}

.score li.empty {
  display: block;
  direction: rtl;
  font-family: "Amiri", serif;
  font-style: italic;
}

.promote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.promote.is-beside {
  position: absolute;
  z-index: 12;
  margin: 0;
}

.promote.is-beside .promote-title {
  display: none;
}

.promote.is-below .promote-choices {
  flex-direction: row;
}

.promote-choices,
.promote.is-beside .promote-choices {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.promote-choice {
  position: relative;
  width: 54px;
  height: 62px;
  padding: 0;
  background: #fff;
}

.promote-choice .piece {
  inset: 4% 12% 0;
}

.curtain {
  position: absolute;
  inset: 0;
  z-index: 8;
  direction: rtl;
  display: grid;
  place-items: center;
  background: rgba(247, 241, 228, 0.72);
}

.curtain-card,
.modal-card {
  width: min(100%, 24rem);
  padding: 1.3rem 1.2rem 1.4rem;
  text-align: center;
  border-radius: 24px;
  background: var(--ivory);
  box-shadow: 0 24px 50px rgba(40, 70, 55, 0.18);
}

.curtain-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.viewing {
  margin-bottom: 0.9rem;
  text-align: center;
}

.viewing-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: 40rem;
  margin: 1rem auto 0;
  text-align: center;
}

.watch-note {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  width: min(100%, 36rem);
  margin: 0;
  padding: 0.95rem 1.1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  text-align: right;
  box-shadow: 0 10px 24px rgba(40, 70, 55, 0.08);
}

.watch-head {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: baseline;
  gap: 0.55rem;
}

.watch-side {
  color: var(--gold);
  font-size: 1rem;
}

.watch-move {
  direction: ltr;
  unicode-bidi: isolate;
  color: var(--emerald-deep);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1;
}

.watch-idea,
.watch-meta,
.reel-blurb,
.reel-kicker,
.lesson,
.coach-note {
  direction: rtl;
  unicode-bidi: plaintext;
}

.watch-idea {
  display: block;
  font-size: 1.2rem;
  line-height: 1.7;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(27, 40, 34, 0.35);
  animation: fade-in 0.25s ease;
}

.modal-card {
  animation: rise-in 0.35s ease;
}

.salon.is-watch .ledger,
.salon.is-watch .inscription,
.salon.is-daily .ledger,
.salon.is-daily .inscription {
  display: none;
}

.salon.is-daily .table {
  justify-content: center;
}

#daily-home {
  margin-bottom: 0.4rem;
}

.salon.is-watch .table {
  justify-content: center;
}

.salon.is-table .logo-hero {
  display: none;
}

@keyframes logo-float {
  0%,
  100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes board-float {
  0%,
  100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-6px) rotate(1deg); }
}

@keyframes board-tilt {
  0%,
  100% { transform: rotateX(12deg) rotateY(0deg); }
  50% { transform: rotateX(9deg) rotateY(4deg); }
}

@keyframes piece-taken {
  to {
    opacity: 0;
    transform: scale(0.7);
  }
}

@keyframes piece-arrive {
  from {
    opacity: 0;
    transform: translateY(8%) scale(0.86);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.seat {
  width: min(100%, 40rem);
  margin: 0 auto 0.7rem;
}

.seat-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.seat-id {
  margin: 0;
  font-size: 1.15rem;
}

.captures {
  min-height: 1.2rem;
  margin: 0.2rem 0 0;
  letter-spacing: 0.15rem;
  color: var(--emerald-deep);
}

.clock {
  min-width: 4.5rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: #12382f;
  color: #f6f1e6;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.clock.is-low {
  background: #8c2f2f;
}

.above-board {
  width: min(100%, 40rem);
  margin: 0 auto 0.8rem;
}

.live-note,
.review-text,
.review-accuracy,
.coach-note,
.lesson {
  margin: 0.3rem 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  font-size: 1.15rem;
  line-height: 1.6;
}

.review-title {
  display: inline-block;
  margin: 0 0 0.25rem;
  padding: 0.12rem 0.75rem;
  border-radius: 999px;
  background: #12382f;
  color: #f6f1e6;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.35rem;
}

.review-actions,
.time-chips,
.curtain-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}

.review input[type="range"] {
  width: 100%;
  margin-top: 0.6rem;
}

.square.reviewed::after {
  content: attr(data-badge);
  position: absolute;
  top: -0.35rem;
  left: 50%;
  z-index: 6;
  min-width: 1.7rem;
  height: 1.45rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--mark, #12382f);
  color: #fffaf0;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.45rem;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 4px 10px rgba(20, 30, 24, 0.28);
  pointer-events: none;
}

.square.mark-brilliant { --mark: #d4a017; color: #1b2822; }
.square.mark-brilliant::after { color: #1b2822; }
.square.mark-best { --mark: #1f6f8f; }
.square.mark-great { --mark: #1f8f4e; }
.square.mark-inaccuracy { --mark: #d89b2b; color: #1b2822; }
.square.mark-inaccuracy::after { color: #1b2822; }
.square.mark-mistake { --mark: #e07a2f; }
.square.mark-blunder { --mark: #c43c3c; }

.square.ghost-from,
.square.ghost-to {
  box-shadow: inset 0 0 0 3px rgba(198, 161, 91, 0.95);
}

.play-menu {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(100%, 28rem);
}

.play-menu button,
.time-chips button,
#cup-panel button,
.friend-row button {
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  background: #14624f;
  color: #f6f1e6;
  cursor: pointer;
}

.time-chips button.is-on {
  background: #c6a15b;
  color: #1b2822;
}

.menu-arrow {
  margin: 0;
  text-align: center;
  color: #14624f;
}

.friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.45rem 0;
}

.presence {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-left: 0.35rem;
  border-radius: 50%;
  background: #b9b1a4;
}

.presence.is-on {
  background: #1f9d55;
}

.duel-banner {
  position: fixed;
  top: 0.8rem;
  left: 50%;
  z-index: 30;
  width: min(92vw, 32rem);
  padding: 0.8rem 1rem;
  border-radius: 18px;
  background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 12px 30px rgba(20, 40, 30, 0.18);
}

.duel-track {
  height: 0.35rem;
  margin: 0.45rem 0;
  overflow: hidden;
  border-radius: 999px;
  background: #efe6d6;
}

.duel-track span {
  display: block;
  height: 100%;
  background: #14624f;
  transform-origin: right center;
}

.duel-circle {
  --p: 1;
  width: 4.2rem;
  height: 4.2rem;
  margin: 0 auto 0.6rem;
  border-radius: 50%;
  background: conic-gradient(#14624f calc(var(--p) * 1turn), #efe6d6 0);
  display: grid;
  place-items: center;
}

.duel-circle span {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
}

.dock {
  display: none;
}

.analysis-toggle {
  display: none;
}

.end-people {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.end-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 14px;
  background: #fff;
}

.end-row.is-win {
  box-shadow: inset 0 0 0 2px #14624f;
}

.end-row.is-loss {
  background: #f3ece3;
}

.end-role {
  color: var(--gold);
  font-size: 0.92rem;
}

.end-score {
  min-width: 3.2rem;
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
}

.end-score.is-up {
  color: #14624f;
}

.end-score.is-down {
  color: #9d1c1c;
}

.end-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.75rem;
  text-align: center;
}

.end-col {
  padding: 0.55rem 0.35rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
}

.end-col p,
.end-wait {
  margin: 0.2rem 0 0;
}

.load-track {
  height: 0.45rem;
  margin: 0.75rem 0 0.3rem;
  border-radius: 999px;
  background: #efe6d6;
  overflow: hidden;
}

#end-load-bar {
  display: block;
  height: 100%;
  width: 0;
  background: #14624f;
}

.cap-plus {
  margin-inline-start: 0.35rem;
  letter-spacing: 0;
  font-weight: 700;
  color: var(--emerald-deep);
}

.live-strip {
  margin: 0.2rem 0;
  text-align: center;
}

.playbar {
  display: none;
}

.salon.is-table .playbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 25;
  display: flex;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem calc(0.4rem + env(safe-area-inset-bottom));
  background: #12382f;
}

.salon.is-table:has(#curtain:not([hidden])) .playbar,
.salon.is-table:has(#review:not([hidden])) .playbar {
  display: none;
}

.playbar button {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 0.72rem 0.3rem;
  background: #f6f1e6;
  color: #12382f;
  font-size: 1rem;
}

#playbar-resign {
  background: #8c2f2f;
  color: #fff;
}

.accuracy-ring {
  --p: 0;
  width: 5.4rem;
  height: 5.4rem;
  margin: 0.8rem auto 0;
  border-radius: 50%;
  background: conic-gradient(#d4a017 calc(var(--p) * 1turn), #efe6d6 0);
  display: grid;
  place-items: center;
}

.accuracy-ring span {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  color: #12382f;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.6rem;
}

.curtain-delta {
  margin: 0.35rem 0 0;
  color: #14624f;
}

.square.premove {
  box-shadow: inset 0 0 0 3px rgba(31, 111, 143, 0.9);
}

@media (max-width: 900px) {
  .stage,
  .home-split,
  .gallery,
  .table {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .frame,
  .frame:hover,
  .stage-board,
  .logo-img {
    animation: none;
    transform: none;
  }

  .ledger {
    width: 100%;
  }

  .play-choices {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .stage-board {
    display: none;
  }

  .foyer .house-line {
    display: none;
  }

  .foyer .home-card {
    padding: 1rem 1rem 1.1rem;
  }

  .foyer .play-button {
    min-height: 3.2rem;
    font-size: 1.35rem;
  }

  .logo-hero {
    margin: 0;
  }

  .logo-img {
    width: 4.6rem;
  }

  .gallery {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 0.7rem;
    padding-bottom: 0.4rem;
  }

  .reel-card {
    flex: 0 0 78%;
    scroll-snap-align: start;
  }

  .silk,
  #dust,
  .grain,
  .veil,
  .halo {
    display: none;
  }

  .salon.is-home {
    padding: 0.35rem 0.7rem calc(4.6rem + env(safe-area-inset-bottom));
  }

  .salon.is-home .stage {
    display: block;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .salon.is-home .home-card {
    border-radius: 18px;
  }

  .salon.is-home .play-card h2 {
    font-size: 2rem;
  }

  .salon.is-table {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    padding: 0 0 calc(3.15rem + env(safe-area-inset-bottom));
    box-sizing: border-box;
    overflow: hidden;
  }

  .salon.is-table .topbar,
  .salon.is-table .inscription,
  .salon.is-table .above-board,
  .salon.is-table .ornament,
  .salon.is-table .dock {
    display: none;
  }

  .salon.is-table:has(#review:not([hidden])) .above-board {
    display: block;
  }

  .salon.is-table .table {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    width: 100%;
    padding: 0;
  }

  .salon.is-table .tableau {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    min-height: 0;
  }

  .salon.is-table .frame,
  .salon.is-table .frame:hover {
    container-type: size;
    flex: 1;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 0;
    padding: 0;
    border-radius: 0;
    transform: none;
    box-shadow: none;
    background: transparent;
  }

  .salon.is-table .bezel {
    width: min(100cqw, 100cqh);
    height: min(100cqw, 100cqh);
    padding: 0;
    border-radius: 0;
    background: transparent;
  }

  .salon.is-table .board {
    width: 100%;
    height: 100%;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    gap: 0;
  }

  .salon.is-table .ranks,
  .salon.is-table .files {
    display: none;
  }

  .salon.is-table .squares {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
  }

  .salon.is-table .seat {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    margin: 0;
    padding: 0.15rem 0.45rem;
  }

  .salon.is-table .seat-line {
    flex: 1;
    min-width: 0;
    gap: 0.35rem;
  }

  .salon.is-table .captures {
    flex: 0 1 auto;
    min-height: 0;
    margin: 0;
    white-space: nowrap;
  }

  .squares {
    touch-action: none;
  }

  .duel-banner {
    top: calc(0.6rem + env(safe-area-inset-top));
  }

  .salon {
    padding-bottom: calc(4.6rem + env(safe-area-inset-bottom));
  }

  .salon.is-table .seat {
    margin: 0 auto;
    padding: 0.15rem 0;
  }

  .salon.is-table .seat-id {
    font-size: 0.95rem;
  }

  .salon.is-table .seat-clock,
  .salon.is-table .clock {
    margin: 0;
  }

  .salon.is-table .captures {
    min-height: 1.1rem;
  }

  .salon.is-table .above-board:not(.is-open) .review,
  .salon.is-table .above-board:not(.is-open) .live-note,
  .salon.is-table .above-board:not(.is-open) .coach-note,
  .salon.is-table .above-board:not(.is-open) .lesson,
  .salon.is-table .above-board:not(.is-open) .academy {
    display: none;
  }

  .salon.is-table #table-home {
    display: none;
  }

  .salon.is-table .playbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 25;
    display: flex;
    gap: 0.4rem;
    padding: 0.4rem 0.55rem calc(0.4rem + env(safe-area-inset-bottom));
    background: #12382f;
  }

  .salon.is-table:has(#curtain:not([hidden])) .playbar,
  .salon.is-table:has(#review:not([hidden])) .playbar {
    display: none;
  }

  .playbar button {
    flex: 1;
    border: 0;
    border-radius: 999px;
    padding: 0.72rem 0.3rem;
    background: #f6f1e6;
    color: #12382f;
    font-size: 1rem;
  }

  #playbar-resign {
    background: #8c2f2f;
    color: #fff;
  }

  .curtain-card {
    width: min(100% - 0.6rem, 26rem);
    max-height: calc(100dvh - 1rem);
    overflow: auto;
  }

  .dock {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: flex;
    gap: 0.4rem;
    justify-content: space-around;
    padding: 0.55rem 0.8rem calc(0.55rem + env(safe-area-inset-bottom));
    background: rgba(246, 241, 230, 0.96);
    border-top: 1px solid rgba(20, 98, 79, 0.18);
  }

  .dock button {
    min-width: 5.5rem;
  }

  .promote.is-below {
    flex-direction: row;
  }

  .promote.is-below .promote-title {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .frame,
  .frame:hover {
    transform: none;
  }
}

.clock.is-low {
  color: #9d1c1c;
  font-weight: 700;
}

.opening-name {
  min-height: 1.4rem;
  text-align: center;
}

.eval-bar {
  height: 0.7rem;
  margin: 0.4rem 0;
  border-radius: 999px;
  background: #1b2822;
  overflow: hidden;
}

#eval-fill {
  display: block;
  height: 100%;
  width: 50%;
  background: #f4efe4;
}

.chat-log {
  max-height: 7rem;
  overflow: auto;
  text-align: right;
}

.chat-form {
  display: flex;
  gap: 0.4rem;
}

#player-body {
  white-space: pre-wrap;
}

html[data-motion="off"] .frame,
html[data-motion="off"] .frame:hover {
  animation: none;
  transform: none;
}

html[data-board="wood"],
.mini-board[data-board="wood"] {
  --sq-light: linear-gradient(155deg, #f3d7a8, #e2b56a 50%, #c4893d);
  --sq-dark: linear-gradient(158deg, #8a5a32, #5c3a1e 55%, #3d2412);
  --frame-bg: linear-gradient(180deg, #6b4428, #3a2416 50%, #24160e);
  --bezel: #2a1a10;
  --frame-shadow: 0 28px 40px rgba(40, 24, 12, 0.28), inset 0 0 0 1px rgba(232, 190, 120, 0.4);
}

html[data-board="marble"],
.mini-board[data-board="marble"] {
  --sq-light: linear-gradient(155deg, #f7f5f2, #e4e0da 48%, #cfc8c0);
  --sq-dark: linear-gradient(158deg, #8d8794, #5c5668 50%, #3a3644);
  --frame-bg: linear-gradient(180deg, #d9d4cc, #8e8880 46%, #3c3834);
  --bezel: #2c2a28;
  --frame-shadow: 0 28px 40px rgba(40, 36, 32, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

html[data-board="night"],
.mini-board[data-board="night"] {
  --sq-light: linear-gradient(155deg, #d5e4f8, #9eb6d8 48%, #7f98bc);
  --sq-dark: linear-gradient(158deg, #24365c, #15243f 52%, #0c1628);
  --frame-bg: linear-gradient(180deg, #1c2c4a, #10192c 50%, #070d18);
  --bezel: #0a101c;
  --frame-shadow: 0 28px 40px rgba(8, 16, 36, 0.35), inset 0 0 0 1px rgba(150, 190, 255, 0.35);
}

html[data-board="emerald"],
.mini-board[data-board="emerald"] {
  --sq-light: linear-gradient(155deg, #e7f6ea, #b7dfc0 48%, #8fc99c);
  --sq-dark: linear-gradient(158deg, #1f6b45, #0e3d28 52%, #082418);
  --frame-bg: linear-gradient(180deg, #1d4a34, #10281c 50%, #08140e);
  --bezel: #0c1812;
  --frame-shadow: 0 28px 40px rgba(10, 40, 28, 0.3), inset 0 0 0 1px rgba(160, 220, 170, 0.35);
}

html[data-board="parchment"],
.mini-board[data-board="parchment"] {
  --sq-light: linear-gradient(155deg, #f8f1df, #ead7b0 50%, #d8c094);
  --sq-dark: linear-gradient(158deg, #c4a36a, #8d6a3a 54%, #6a4c28);
  --frame-bg: linear-gradient(180deg, #8a6840, #5c4024 48%, #3a2816);
  --bezel: #3a2a18;
  --frame-shadow: 0 28px 40px rgba(60, 40, 16, 0.24), inset 0 0 0 1px rgba(244, 220, 170, 0.4);
}

html[data-board="ice"],
.mini-board[data-board="ice"] {
  --sq-light: linear-gradient(155deg, #f7fbff, #d5e8f6 48%, #c3d7ea);
  --sq-dark: linear-gradient(158deg, #7fa4c4, #4d6f90 52%, #314a64);
  --frame-bg: linear-gradient(180deg, #d7e6f2, #8eabC4 46%, #3d556c);
  --bezel: #243646;
  --frame-shadow: 0 28px 40px rgba(40, 70, 96, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

html[data-board="blood"],
.mini-board[data-board="blood"] {
  --sq-light: linear-gradient(155deg, #f8e6c8, #e2c07a 50%, #c9a25a);
  --sq-dark: linear-gradient(158deg, #8a2430, #5c121c 52%, #320910);
  --frame-bg: linear-gradient(180deg, #4a1820, #2a0c12 50%, #140608);
  --bezel: #1a080c;
  --frame-shadow: 0 28px 40px rgba(60, 12, 18, 0.32), inset 0 0 0 1px rgba(224, 176, 80, 0.45);
}

html[data-board="sea"],
.mini-board[data-board="sea"] {
  --sq-light: linear-gradient(155deg, #e7f7f6, #b7e0dc 48%, #8fc9c4);
  --sq-dark: linear-gradient(158deg, #1a6e78, #0d3e4a 52%, #082830);
  --frame-bg: linear-gradient(180deg, #145868, #0c303c 50%, #071820);
  --bezel: #082028;
  --frame-shadow: 0 28px 40px rgba(8, 40, 48, 0.3), inset 0 0 0 1px rgba(140, 220, 210, 0.35);
}

html[data-board="neon"],
.mini-board[data-board="neon"] {
  --sq-light: linear-gradient(155deg, #e8fff6, #9ef0d4 48%, #6ad4ef);
  --sq-dark: linear-gradient(158deg, #243056, #14182e 52%, #0c1020);
  --frame-bg: linear-gradient(180deg, #1a2040, #101428 50%, #070914);
  --bezel: #080a14;
  --frame-shadow: 0 28px 40px rgba(8, 12, 32, 0.4), inset 0 0 0 1px rgba(120, 255, 210, 0.35);
}

.user-arrows {
  z-index: 6;
}

.user-ink {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.user-ink.red { background: rgba(196, 60, 60, 0.5); }
.user-ink.gold { background: rgba(212, 160, 23, 0.5); }
.user-ink.green { background: rgba(31, 143, 78, 0.48); }

html[data-pieces="neon"] .tableau .piece {
  filter: drop-shadow(0 0 4px rgba(94, 255, 200, 0.75));
}

html[data-pieces="glass"] .tableau .piece {
  filter: drop-shadow(0 6px 8px rgba(40, 80, 120, 0.28));
}

html[data-pieces="flat"] .tableau .piece,
html[data-pieces="line"] .tableau .piece {
  filter: none;
}

html[data-pieces="gold"] .tableau .piece {
  filter: drop-shadow(0 2px 1px rgba(80, 50, 10, 0.45));
}

html[data-pieces="afarit"] .tableau .piece {
  filter: drop-shadow(0 3px 2px rgba(90, 16, 16, 0.45));
}

html[data-pieces="diamond"] .tableau .piece {
  filter: drop-shadow(0 4px 3px rgba(40, 90, 140, 0.35));
}

html[data-board="wood"] .squares {
  border-radius: 2px;
}

html[data-board="marble"] .squares,
html[data-board="ice"] .squares,
html[data-board="night"] .squares,
html[data-board="neon"] .squares {
  gap: 4px;
  padding: 4px;
}

html[data-board="marble"] .square,
html[data-board="ice"] .square {
  border-radius: 7px;
}

html[data-board="night"] .squares {
  background: #070d18;
  border-radius: 10px;
}

html[data-board="neon"] .squares {
  background: #070914;
  border-radius: 16px;
}

html[data-board="neon"] .square {
  border-radius: 5px;
}

html[data-board="sea"] .squares {
  border-radius: 22px;
  overflow: hidden;
}

html[data-board="emerald"] .squares {
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
}

html[data-board="blood"] .squares {
  box-shadow: inset 0 0 0 3px rgba(224, 176, 80, 0.85);
}

html[data-board="parchment"] .squares {
  box-shadow: inset 0 0 0 2px rgba(106, 76, 40, 0.55);
}

.look-card {
  width: min(100%, 42rem);
  text-align: right;
}

.look-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.35rem 0 1rem;
}

.look-chip {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  padding: 0.4rem 0.2rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.look-chip.is-on {
  border-color: var(--emerald);
  box-shadow: 0 0 0 2px rgba(20, 97, 84, 0.2);
}

.look-chip span:last-child {
  font-size: 0.85rem;
}

.mini-board,
.mini-pieces {
  display: grid;
  width: 64px;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
}

.mini-board {
  grid-template-columns: repeat(4, 1fr);
}

.mini-pieces {
  grid-template-columns: 1fr 1fr;
}

.mini-board i,
.mini-pieces i {
  display: block;
  position: relative;
  font-style: normal;
}

.mini-pieces .piece {
  inset: 8% 10% 0;
}

.look-motion {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.2rem;
}

@media (max-width: 720px) {
  .look-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
