:root {
  --ink: #16213c;
  --muted: #667085;
  --paper: #ffffff;
  --line: #dbe5f2;
  --sky-1: #2f7fc2;
  --sky-2: #80c8ec;
  --sky-3: #eaf7ff;
  --shadow: 0 10px 24px rgba(31, 58, 96, 0.14);
  --shadow-soft: 0 6px 16px rgba(31, 58, 96, 0.1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #eef7ff;
  color: var(--ink);
  font-family: ui-rounded, "Arial Rounded MT Bold", "Segoe UI", system-ui, -apple-system, sans-serif;
  user-select: none;
}

button,
a {
  font: inherit;
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 4px solid #111827;
  outline-offset: 3px;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* Start screen */
#screen-start {
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 86% 11%, #fffbd0 0 4.5%, #ffd95d 4.6% 7.5%, transparent 7.6%),
    linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 48%, var(--sky-3) 100%);
}

#screen-start::before,
#screen-start::after {
  position: absolute;
  z-index: -1;
  width: 180px;
  height: 46px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow:
    48px -22px 0 -8px rgba(255, 255, 255, 0.72),
    92px 2px 0 -14px rgba(255, 255, 255, 0.68);
  content: "";
}

#screen-start::before {
  top: 14%;
  left: -36px;
}

#screen-start::after {
  right: 2%;
  bottom: 14%;
  transform: scale(0.8);
  opacity: 0.56;
}

.start-shell {
  width: min(920px, calc(100% - 36px));
  max-height: calc(100% - 24px);
  margin: auto;
  padding: clamp(16px, 2.8vh, 28px) clamp(18px, 3vw, 34px);
  overflow: hidden;
  text-align: center;
  background: rgba(255, 255, 255, 0.94);
  border: 3px solid rgba(255, 255, 255, 0.94);
  border-radius: 34px;
  box-shadow: 0 18px 0 rgba(25, 89, 139, 0.16), 0 28px 60px rgba(17, 71, 114, 0.2);
  backdrop-filter: blur(3px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 66px;
  margin-bottom: 4px;
}

.brand-lockup img {
  display: block;
  width: clamp(160px, 21vw, 230px);
  height: auto;
  object-fit: contain;
}

.start-kicker {
  margin: 2px 0 4px;
  color: #39709d;
  font-size: clamp(11px, 1.4vw, 14px);
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.start-emoji {
  font-size: clamp(42px, 6.5vw, 68px);
  line-height: 1;
  filter: drop-shadow(0 5px 8px rgba(24, 48, 79, 0.14));
}

.start-title {
  margin: 0;
  color: var(--ink);
  font-size: clamp(32px, 5.5vw, 58px);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.04em;
}

.start-pattern {
  display: inline-block;
  margin: 12px 0 6px;
  padding: 8px 20px;
  color: var(--theme);
  background: #f4f7ff;
  border: 3px solid var(--theme);
  border-radius: 999px;
  font-size: clamp(17px, 2.4vw, 24px);
  font-weight: 900;
}

.start-hint {
  margin: 3px 0 13px;
  color: #526174;
  font-size: clamp(14px, 1.8vw, 17px);
  font-weight: 750;
}

.team-pick-label {
  margin-bottom: 8px;
  font-size: clamp(14px, 1.8vw, 17px);
  font-weight: 900;
}

.team-pick {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
}

.team-pick-btn {
  min-width: 96px;
  min-height: 66px;
  padding: 6px 16px;
  color: #344054;
  background: #f8fafc;
  border: 3px solid #cbd5e1;
  border-radius: 18px;
  box-shadow: 0 5px 0 #aab8c8;
  font-weight: 900;
}

.team-pick-btn .n {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.team-pick-btn .lbl {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.team-pick-btn.selected {
  color: #704d00;
  background: #fff2a8;
  border-color: #e2a400;
  box-shadow: 0 5px 0 #a66a00;
}

.team-pick-btn:active,
.btn-start:active,
.primary-btn:active,
.top-action:active,
.corner-btn:active {
  transform: translateY(3px);
  box-shadow: none;
}

.start-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-start {
  min-width: 250px;
  min-height: 62px;
  padding: 12px 28px;
  color: #5b3500;
  background: linear-gradient(180deg, #ffd86b, #ffb82e);
  border: 3px solid #be7110;
  border-radius: 20px;
  box-shadow: 0 7px 0 #98500a;
  font-size: clamp(20px, 2.6vw, 27px);
  font-weight: 950;
}

.btn-menu-start {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  color: #2e4f82;
  background: #eef5ff;
  border: 3px solid #7b9fd5;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
}

.start-teacher {
  max-width: 680px;
  margin: 14px auto 0;
  color: #526174;
  font-size: 13px;
  line-height: 1.4;
}

/* Shared top score bar */
.top-bar {
  position: relative;
  z-index: 60;
  min-height: 76px;
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 8px 10px;
  background: #ffffff;
  border-bottom: 3px solid #d8e5f4;
  box-shadow: 0 5px 14px rgba(39, 69, 105, 0.11);
}

.top-teams {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--team-count), minmax(0, 1fr));
  gap: 8px;
}

.top-team {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 7px 11px;
  color: #fff;
  background: var(--team);
  border-radius: 15px;
  box-shadow: 0 4px 0 var(--team-dark);
}

.top-team .tn {
  overflow: hidden;
  font-size: clamp(11px, 1.35vw, 15px);
  font-weight: 950;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.score-ctrl {
  display: flex;
  align-items: center;
  gap: 7px;
}

.score-ctrl button {
  width: 34px;
  height: 34px;
  padding: 0;
  color: #fff;
  background: rgba(16, 24, 40, 0.16);
  border: 2px solid rgba(255, 255, 255, 0.36);
  border-radius: 50%;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.score-ctrl .pts {
  min-width: 32px;
  text-align: center;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 950;
  line-height: 1;
}

.top-actions {
  width: 126px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
}

.top-action {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  color: #fff;
  border: 0;
  border-radius: 11px;
  box-shadow: 0 3px 0 rgba(31, 41, 55, 0.28);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.btn-menu {
  background: #4866c9;
}

.btn-winner {
  background: #e88c19;
}

/* Main game */
#screen-game {
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.72), transparent 24%),
    linear-gradient(135deg, #dff3ff 0%, #fce8f3 56%, #fff4c7 100%);
}

.game-main {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.question-box {
  position: absolute;
  z-index: 20;
  top: 16px;
  left: 18px;
  max-width: min(60vw, 570px);
  padding: 10px 18px;
  color: #244265;
  background: #fff;
  border: 4px solid #acd5ef;
  border-radius: 22px;
  box-shadow: 0 6px 0 #82b9dc, var(--shadow-soft);
  font-size: clamp(20px, 2.8vw, 34px);
  font-weight: 950;
  transform: rotate(-1.5deg);
}

.tap-hint {
  position: absolute;
  z-index: 15;
  top: 25%;
  right: 6%;
  color: #bb6500;
  font-size: clamp(15px, 2vw, 21px);
  font-weight: 950;
  transform: rotate(3deg);
}

.tap-hint::after {
  display: block;
  margin: -2px 0 0 42%;
  color: #e58a13;
  content: "↙";
  font-size: 48px;
  line-height: 1;
}

.card-wrap {
  position: absolute;
  z-index: 10;
  right: 0;
  bottom: 5%;
  left: 0;
  display: flex;
  justify-content: center;
}

.spin-btn {
  padding: 0;
  background: none;
  border: 0;
}

.game-card {
  width: min(450px, 84vw);
  height: min(280px, 38vh);
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  color: var(--theme);
  background: #fff;
  border: 7px solid currentColor;
  border-radius: 32px;
  box-shadow: 0 14px 0 rgba(79, 105, 145, 0.14), 0 24px 40px rgba(31, 58, 96, 0.18);
  contain: layout paint;
}

#card-inner {
  width: 100%;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-label {
  margin-bottom: 7px;
  color: #7d899c;
  font-size: clamp(15px, 2vw, 21px);
  font-weight: 900;
  text-align: center;
}

.card-body {
  min-height: 0;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 8px 14px;
  background: #f9fbfe;
  border: 3px solid currentColor;
  border-radius: 22px;
}

.emoji-big {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: clamp(62px, 10vw, 102px);
  line-height: 1;
  filter: drop-shadow(0 4px 5px rgba(31, 58, 96, 0.14));
}

.person-scene {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4vw, 46px);
}

.person-figure,
.person-clue {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: clamp(66px, 10vw, 104px);
  line-height: 1;
}

.person-clue {
  font-size: clamp(48px, 7.5vw, 80px);
}

.height-person {
  position: relative;
  width: 62px;
  height: 112px;
  display: block;
}

.height-head {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 50%;
  width: 34px;
  height: 34px;
  background: #f2c29e;
  border: 4px solid #73513b;
  border-radius: 50%;
  transform: translateX(-50%);
}

.height-body {
  position: absolute;
  z-index: 2;
  top: 30px;
  left: 50%;
  width: 48px;
  height: 51px;
  background: #4f7ed8;
  border: 4px solid #2b4f95;
  border-radius: 15px 15px 8px 8px;
  transform: translateX(-50%);
}

.height-legs {
  position: absolute;
  z-index: 1;
  top: 76px;
  left: 50%;
  width: 44px;
  height: 35px;
  background: linear-gradient(90deg, #273b68 0 34%, transparent 34% 66%, #273b68 66% 100%);
  border-radius: 0 0 7px 7px;
  transform: translateX(-50%);
}

.person-scene[data-word="tall"] .person-figure {
  transform: scale(1.2);
}

.person-scene[data-word="small"] .person-figure {
  transform: scale(0.7);
}

.person-scene[data-word="fast"] .person-figure {
  transform: skewX(-8deg);
}

.person-scene[data-word="tall"] .person-clue::after,
.person-scene[data-word="small"] .person-clue::after {
  color: #3478bd;
  content: "↕";
  font-family: system-ui, sans-serif;
  font-size: clamp(66px, 10vw, 108px);
  font-weight: 900;
}

.person-scene[data-word="tall"] .person-clue,
.person-scene[data-word="small"] .person-clue {
  font-size: 0;
}

/* Two tiny CSS pictograms replace semantically wrong emoji. */
.art {
  position: relative;
  width: clamp(108px, 17vw, 166px);
  height: clamp(86px, 13vw, 128px);
  flex: 0 0 auto;
}

.art-table::before {
  position: absolute;
  top: 24%;
  left: 4%;
  width: 92%;
  height: 22%;
  background: #be7a38;
  border: 5px solid #75431f;
  border-radius: 10px;
  box-shadow: inset 0 7px 0 rgba(255, 255, 255, 0.2);
  content: "";
}

.art-table::after {
  position: absolute;
  top: 47%;
  left: 15%;
  width: 70%;
  height: 47%;
  background: linear-gradient(90deg, #8c552c 0 17%, transparent 17% 83%, #8c552c 83% 100%);
  border-bottom: 4px solid #633819;
  border-radius: 0 0 7px 7px;
  content: "";
}

.art-eraser {
  width: clamp(112px, 18vw, 178px);
  height: clamp(70px, 10vw, 104px);
  margin: 12px;
  overflow: hidden;
  background: linear-gradient(110deg, #f7a7ba 0 48%, #5aa6df 49% 100%);
  border: 6px solid #4a5570;
  border-radius: 18px;
  box-shadow: 0 10px 0 rgba(74, 85, 112, 0.18);
  transform: rotate(-8deg);
}

.art-eraser::after {
  position: absolute;
  inset: 18% 8%;
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 9px;
  content: "";
}

/* Spatial preposition scene */
.prep-scene {
  position: relative;
  width: min(320px, 88%);
  height: 100%;
  min-height: 135px;
}

.scene-object,
.scene-place {
  position: absolute;
  display: grid;
  place-items: center;
  width: 120px;
  height: 100px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: clamp(54px, 8vw, 82px);
  line-height: 1;
  transition: none;
}

.scene-object::after,
.scene-place::after {
  position: absolute;
  right: 0;
  bottom: -2px;
  left: 0;
  overflow: hidden;
  color: #536277;
  content: attr(data-label);
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.prep-name {
  position: absolute;
  z-index: 8;
  top: 3px;
  left: 8px;
  padding: 4px 11px;
  color: #fff;
  background: var(--theme);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transform: none;
}

.prep-on .scene-place {
  z-index: 2;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
}

.prep-on .scene-object {
  z-index: 3;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scale(0.56);
}

.prep-on.place-tree .scene-object {
  top: -8px;
}

.prep-on.place-box .scene-object {
  top: -28px;
}

.prep-on.place-bed .scene-object {
  top: 14px;
}

.prep-on.place-chair .scene-object,
.prep-on.place-car .scene-object,
.prep-on.place-table .scene-object {
  top: 5px;
}

.prep-under .scene-place {
  z-index: 3;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
}

.prep-under .scene-object {
  z-index: 2;
  top: 62px;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%) scale(0.58);
}

.prep-next-to .scene-object {
  bottom: 8px;
  left: 10%;
  transform: scale(0.78);
}

.prep-next-to .scene-place {
  right: 8%;
  bottom: 8px;
}

.prep-behind .scene-object {
  z-index: 1;
  top: 23px;
  left: 20%;
  transform: translateX(-50%) scale(0.88);
}

.prep-behind .scene-place {
  z-index: 3;
  right: auto;
  bottom: 5px;
  left: 58%;
  transform: translateX(-50%);
}

.prep-in-front-of .scene-place {
  z-index: 1;
  top: 17px;
  left: 43%;
  transform: translateX(-50%);
}

.prep-in-front-of .scene-object {
  z-index: 3;
  right: 15%;
  bottom: 0;
  transform: scale(0.84);
}

.scene-place.art-table {
  width: 120px;
  height: 100px;
  font-size: 0;
}

.scene-place.art-table::before {
  top: 33%;
}

.scene-place.art-table::after {
  top: 53%;
  box-shadow: 66px 0 0 -4px #8c552c;
}

.scene-art-wrap .art {
  width: 118px;
  height: 92px;
  transform: scale(0.76);
}

.scene-place.art-table[data-label]::after {
  /* The table legs are drawn by this pseudo-element; label is added separately in markup. */
  font-size: 0;
}

.scene-caption {
  position: absolute;
  z-index: 7;
  right: 0;
  bottom: -2px;
  left: 0;
  color: #536277;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.spin-idle {
  animation: card-float 2.8s ease-in-out infinite;
}

.spin-running {
  animation: card-shuffle 0.15s ease-in-out infinite;
}

.answer-bar {
  position: relative;
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 12px 160px 12px 86px;
  background: #fff;
  border-top: 4px solid #c8b9ed;
  box-shadow: 0 -5px 18px rgba(31, 58, 96, 0.08);
}

.primary-btn {
  width: min(560px, 100%);
  min-height: 58px;
  padding: 10px 18px;
  color: #fff;
  background: linear-gradient(180deg, #39b86a, #218d4c);
  border: 0;
  border-radius: 17px;
  box-shadow: 0 6px 0 #126435;
  font-size: clamp(18px, 2.4vw, 25px);
  font-weight: 950;
}

.primary-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.answer-text {
  margin: 0;
  color: #2d345d;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 950;
  line-height: 1.22;
  text-align: center;
}

.answer-text .hl {
  color: var(--theme);
  border-bottom: 4px solid currentColor;
}

.play-brand {
  position: absolute;
  right: 16px;
  bottom: 10px;
  width: 132px;
  height: auto;
}

.btn-dice {
  position: absolute;
  right: 158px;
  bottom: 17px;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  background: #7654cf;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 5px 0 #4d328e;
  font-size: 28px;
}

/* Scoring and dice */
#screen-scoring {
  background: linear-gradient(145deg, #e9f5ff, #fcecf5 55%, #fff9d9);
}

.score-mid {
  min-height: 58px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 7px 16px 5px;
}

.next-btn {
  min-height: 42px;
  justify-self: start;
  padding: 8px 16px;
  color: #fff;
  background: #3d78d8;
  border: 0;
  border-radius: 13px;
  box-shadow: 0 4px 0 #27519d;
  font-size: 14px;
  font-weight: 900;
}

.round-title {
  margin: 0;
  color: #364153;
  font-size: clamp(20px, 2.7vw, 31px);
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.round-num {
  display: inline-grid;
  min-width: 42px;
  min-height: 42px;
  place-items: center;
  color: #9a6000;
  background: #fff1a8;
  border-radius: 12px;
}

.score-brand {
  width: 112px;
  height: auto;
  justify-self: end;
}

.score-body {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
  padding: 0 12px 12px;
}

.dice-instructions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dice-hint,
.one-finger {
  margin: 0;
  color: #526174;
  font-size: clamp(12px, 1.5vw, 15px);
  font-weight: 900;
}

.one-finger {
  padding: 5px 11px;
  color: #984116;
  background: #fff2e2;
  border: 2px solid #ed8a3b;
  border-radius: 999px;
}

.dice-row {
  width: 100%;
  height: min(55vh, 470px);
  min-height: 270px;
  display: grid;
  grid-template-columns: repeat(var(--team-count), minmax(0, 1fr));
  gap: clamp(8px, 1.2vw, 14px);
}

.dice-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 9px;
  overflow: hidden;
  background: #fff;
  border: 3px solid var(--team);
  border-radius: 22px;
  box-shadow: var(--shadow);
  contain: layout paint;
}

.dice-panel h3 {
  margin: 0 0 7px;
  color: var(--team-dark);
  font-size: clamp(12px, 1.45vw, 16px);
  font-weight: 950;
  text-align: center;
}

.dice-grid {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dice-row[data-teams="2"] .dice-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.die-choice {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1vw, 11px);
  padding: 6px;
  color: var(--ink);
  background: #f8fafc;
  border: 3px solid var(--team);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--team-dark);
}

.die-choice:hover {
  background: #eef5ff;
}

.die-choice:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--team-dark);
}

.die-cube {
  width: clamp(46px, 5.2vw, 66px);
  aspect-ratio: 1;
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 8px;
  background: #fff;
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.9),
    inset 0 -3px 0 #e6ebf2,
    0 5px 0 var(--team-dark),
    0 8px 12px rgba(31, 58, 96, 0.16);
}

.pip {
  width: 58%;
  aspect-ratio: 1;
  place-self: center;
  display: none;
  background: #15243b;
  border-radius: 50%;
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.16);
}

.die-cube[data-v="1"] .p22,
.die-cube[data-v="3"] .p22,
.die-cube[data-v="5"] .p22 {
  display: block;
}

.die-cube[data-v="2"] .p13,
.die-cube[data-v="2"] .p31,
.die-cube[data-v="3"] .p13,
.die-cube[data-v="3"] .p31 {
  display: block;
}

.die-cube[data-v="4"] .p11,
.die-cube[data-v="4"] .p13,
.die-cube[data-v="4"] .p31,
.die-cube[data-v="4"] .p33,
.die-cube[data-v="5"] .p11,
.die-cube[data-v="5"] .p13,
.die-cube[data-v="5"] .p31,
.die-cube[data-v="5"] .p33 {
  display: block;
}

.die-cube[data-v="6"] .p11,
.die-cube[data-v="6"] .p13,
.die-cube[data-v="6"] .p21,
.die-cube[data-v="6"] .p23,
.die-cube[data-v="6"] .p31,
.die-cube[data-v="6"] .p33 {
  display: block;
}

.p11 { grid-area: 1 / 1; }
.p12 { grid-area: 1 / 2; }
.p13 { grid-area: 1 / 3; }
.p21 { grid-area: 2 / 1; }
.p22 { grid-area: 2 / 2; }
.p23 { grid-area: 2 / 3; }
.p31 { grid-area: 3 / 1; }
.p32 { grid-area: 3 / 2; }
.p33 { grid-area: 3 / 3; }

.die-label {
  min-width: 44px;
  color: var(--team-dark);
  font-size: clamp(12px, 1.4vw, 16px);
  font-weight: 950;
  line-height: 1.05;
  text-align: left;
}

.die-label strong {
  display: block;
  font-size: clamp(24px, 3.2vw, 38px);
  line-height: 0.95;
}

.locked-msg {
  flex: 1;
  display: grid;
  place-items: center;
  color: #1c7c42;
  background: #ecfdf3;
  border: 3px dashed #6bd28d;
  border-radius: 16px;
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 950;
  text-align: center;
}

/* Winner */
#winner-overlay {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(18, 28, 50, 0.9);
}

#winner-overlay.show {
  display: flex;
}

.winner-card {
  width: min(560px, 96vw);
  padding: 28px;
  text-align: center;
  background: #fff;
  border: 8px solid #ffd34f;
  border-radius: 34px;
  box-shadow: 0 18px 0 #9b5e00, 0 30px 70px rgba(0, 0, 0, 0.42);
}

.winner-card h2 {
  margin: 0 0 14px;
  color: #9a5a00;
  font-size: clamp(36px, 7vw, 66px);
  font-weight: 950;
  line-height: 1;
}

.winner-trophy {
  font-size: clamp(64px, 12vw, 108px);
  line-height: 1;
}

.winner-names {
  margin-top: 8px;
  color: #243450;
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 950;
}

.winner-points {
  margin: 4px 0 18px;
  color: #667085;
  font-size: 18px;
  font-weight: 800;
}

.winner-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Utility controls */
.corner-controls {
  position: fixed;
  z-index: 150;
  bottom: 10px;
  left: 12px;
  display: flex;
  gap: 8px;
}

.corner-btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #243450;
  background: rgba(255, 255, 255, 0.95);
  border: 3px solid #243450;
  border-radius: 50%;
  box-shadow: 0 4px 0 rgba(36, 52, 80, 0.27);
  font-size: 20px;
}

.corner-btn.confirm {
  color: #7f1d1d;
  background: #fecaca;
}

#screen-scoring.active ~ .corner-controls {
  top: 88px;
  bottom: auto;
  left: 174px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes card-float {
  0%,
  100% { transform: translateY(0) rotate(-0.5deg); }
  50% { transform: translateY(-8px) rotate(0.5deg); }
}

@keyframes card-shuffle {
  0%,
  100% { transform: rotate(-2deg) scale(0.99); }
  50% { transform: rotate(2deg) scale(1.01); }
}

@media (max-width: 850px) {
  .top-bar {
    min-height: 70px;
    padding: 6px;
  }

  .top-team {
    padding: 5px 7px;
  }

  .top-team .tn {
    font-size: 10px;
  }

  .score-ctrl {
    gap: 4px;
  }

  .score-ctrl button {
    width: 28px;
    height: 28px;
    font-size: 18px;
  }

  .score-ctrl .pts {
    min-width: 24px;
    font-size: 24px;
  }

  .top-actions {
    width: 104px;
  }

  .top-action {
    font-size: 10px;
  }

  .question-box {
    max-width: 72vw;
  }

  .play-brand {
    width: 106px;
  }

  .btn-dice {
    right: 125px;
  }

  .answer-bar {
    padding-right: 126px;
  }

  .die-choice {
    flex-direction: column;
    gap: 4px;
  }

  .die-label {
    min-width: 0;
    text-align: center;
  }

  .die-label strong {
    display: inline;
    margin-right: 3px;
    font-size: 19px;
  }
}

@media (max-height: 700px) {
  .start-shell {
    width: min(940px, calc(100% - 28px));
    padding-top: 12px;
    padding-bottom: 12px;
    border-radius: 26px;
  }

  .brand-lockup {
    min-height: 48px;
  }

  .brand-lockup img {
    width: 160px;
  }

  .start-kicker {
    display: none;
  }

  .start-emoji {
    font-size: 42px;
  }

  .start-title {
    font-size: 38px;
  }

  .start-pattern {
    margin: 7px 0 3px;
    padding: 5px 16px;
    font-size: 18px;
  }

  .start-hint {
    margin-bottom: 7px;
    font-size: 13px;
  }

  .team-pick-label {
    margin-bottom: 5px;
  }

  .team-pick {
    margin-bottom: 10px;
  }

  .team-pick-btn {
    min-height: 54px;
  }

  .btn-start {
    min-height: 50px;
    font-size: 21px;
  }

  .btn-menu-start {
    min-height: 44px;
  }

  .start-teacher {
    display: none;
  }

  .game-card {
    height: min(235px, 36vh);
    min-height: 170px;
  }

  .answer-bar {
    min-height: 96px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .score-mid {
    min-height: 50px;
    padding-top: 4px;
    padding-bottom: 2px;
  }

  .score-body {
    gap: 4px;
    padding-bottom: 7px;
  }

  .dice-row {
    height: min(53vh, 395px);
    min-height: 240px;
  }

  .dice-panel {
    padding: 6px;
    border-radius: 17px;
  }

  .dice-panel h3 {
    margin-bottom: 4px;
  }

  .dice-grid {
    gap: 5px;
  }

  .die-choice {
    padding: 3px;
    border-width: 2px;
    border-radius: 12px;
  }

  .die-cube {
    width: clamp(40px, 4.4vw, 54px);
    padding: 6px;
    border-radius: 13px;
  }

  .corner-btn {
    width: 40px;
    height: 40px;
    font-size: 17px;
  }
}

@media (max-width: 650px) {
  #screen-scoring.active ~ .corner-controls {
    left: 114px;
  }

  .start-actions {
    gap: 8px;
  }

  .btn-start {
    min-width: 220px;
  }

  .title-row {
    gap: 8px;
  }

  .start-emoji {
    font-size: 38px;
  }

  .start-title {
    font-size: 34px;
  }

  .top-bar {
    min-height: 66px;
  }

  .top-team {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
  }

  .score-ctrl button {
    width: 25px;
    height: 25px;
  }

  .top-actions {
    width: 88px;
  }

  .tap-hint {
    right: 2%;
  }

  .answer-bar {
    padding-left: 70px;
    padding-right: 102px;
  }

  .play-brand {
    right: 8px;
    width: 88px;
  }

  .btn-dice {
    right: 102px;
    width: 52px;
    height: 52px;
  }

  .score-brand {
    width: 82px;
  }

  .score-mid {
    padding-right: 8px;
    padding-left: 8px;
  }

  .next-btn {
    padding: 7px 9px;
    font-size: 11px;
  }

  .dice-row {
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Comparative pairs */
.compare-scene{display:flex;align-items:center;justify-content:center;gap:12px;width:100%;padding:8px}
.compare-side{display:flex;flex-direction:column;align-items:center;gap:4px}
.compare-label{font-size:14px;font-weight:900;color:#334155}
.compare-vs{font-weight:950;color:#64748b;font-size:18px}
/* Dice instruction clarity */
.dice-hint{font-weight:900}
.one-finger{font-weight:900}

/* ── Wellesley watermarks: ONLY inside #screen-game .game-main (v2.2) ──
   Geometry contract: question-box, tap-hint, card-wrap stay position:absolute
   (Version 1.9). Watermarks sit at z-index 0 behind gameplay. Do not force
   relative positioning on gameplay children. */
.game-main {
  isolation: isolate;
}

.game-main .game-background-watermarks {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

.game-main .bg-logo {
  position: absolute;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  max-width: none;
  height: auto;
  display: block;
  /* original SVG colours preserved; opacity only */
}

/* Unified composition: large left + large right frame, slightly smaller centre */
/* Left framing logo (100% scale) */
.game-main .bg-logo-1 {
  width: clamp(300px, 46vw, 680px);
  left: -10%;
  bottom: 0%;
  opacity: 0.13;
}

/* Right framing logo (~92% scale, shared baseline) */
.game-main .bg-logo-2 {
  width: clamp(280px, 42vw, 620px);
  right: -9%;
  bottom: 1%;
  opacity: 0.12;
}

/* Central / upper-centre connector (~78% scale) */
.game-main .bg-logo-3 {
  width: clamp(240px, 36vw, 520px);
  left: 50%;
  top: 16%;
  transform: translateX(-50%);
  opacity: 0.095;
}

/* Short landscape classroom displays — stay large and recognizable */
@media (max-height: 700px) {
  .game-main .bg-logo-1 {
    width: clamp(260px, 42vw, 600px);
    left: -8%;
    bottom: -2%;
    opacity: 0.125;
  }
  .game-main .bg-logo-2 {
    width: clamp(240px, 38vw, 560px);
    right: -7%;
    bottom: -1%;
    opacity: 0.115;
  }
  .game-main .bg-logo-3 {
    width: clamp(200px, 32vw, 460px);
    top: 10%;
    opacity: 0.09;
  }
}

/* Tablet portrait-ish */
@media (max-width: 900px) and (min-width: 701px) {
  .game-main .bg-logo-1 {
    width: clamp(240px, 44vw, 520px);
    left: -12%;
    bottom: 2%;
    opacity: 0.12;
  }
  .game-main .bg-logo-2 {
    width: clamp(220px, 40vw, 480px);
    right: -10%;
    bottom: 3%;
    opacity: 0.11;
  }
  .game-main .bg-logo-3 {
    width: clamp(180px, 34vw, 400px);
    top: 14%;
    opacity: 0.09;
  }
}

/* Mobile portrait — three logos, compact controlled composition */
@media (max-width: 700px) {
  .game-main .bg-logo-1 {
    width: 54vw;
    left: -14%;
    bottom: 2%;
    opacity: 0.115;
  }
  .game-main .bg-logo-2 {
    width: 50vw;
    right: -12%;
    bottom: 6%;
    opacity: 0.105;
  }
  .game-main .bg-logo-3 {
    width: 44vw;
    left: 50%;
    top: 6%;
    transform: translateX(-50%);
    opacity: 0.09;
  }
}
