/* Crew Helper bubble (crew-helper.js): who is talking, what they said, and its controls. */
#learningAccount {display:block;color:#bbb;font-size:11px;margin:6px 0}
.crew-helper {
  --helper-color: var(--yellow, #ffd21c);
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 60;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: min(560px, calc(100vw - 32px));
  padding: 12px 14px;
  color: white;
  background: rgba(10, 10, 13, .94);
  border: 2px solid var(--helper-color);
  border-radius: 10px;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, .55);
  transform: translateX(-50%);
  font-family: system-ui, sans-serif;
}
.crew-helper[hidden] { display: none; }
.crew-helper[data-voice="phantom"] { --helper-color: #ffb400; }
.crew-helper[data-voice="motor"] { --helper-color: #69f02c; }
.crew-helper[data-voice="rail"] { --helper-color: #b640ff; }
.crew-helper[data-voice="madam"] { --helper-color: #1687ff; }
.crew-helper[data-voice="k3yz"] { --helper-color: #26a7ff; }
.crew-helper-cast { display:flex; gap:6px; flex:none; align-items:flex-start; justify-content:center; }
.crew-helper-face { flex:none; width:76px; margin:0; padding:3px; overflow:hidden; border:2px solid #55535e; border-radius:6px; background:#18181c; opacity:.85; }
.crew-helper-face img { display:block; width:100%; height:112px; object-fit:contain; object-position:top; }
.crew-helper-face figcaption { padding-top:3px; color:white; font:700 9px/1.2 system-ui,sans-serif; text-align:center; overflow-wrap:anywhere; }
.crew-helper-face[data-speaking="true"] { opacity:1; border-color:var(--helper-color); box-shadow:0 0 0 2px #0a0a0d,0 0 12px var(--helper-color); }
.crew-helper-body { min-width: 0; flex: 1; }
.crew-helper-who { margin: 0 0 4px; font-size: .72rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.crew-helper-who strong { color: var(--helper-color); }
.crew-helper-who span { color: #b9b9c2; }
.crew-helper-text { margin: 0; font-size: .95rem; line-height: 1.35; }
.crew-helper-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.crew-helper-actions button { min-height: 30px; padding: 0 10px; color: white; background: #1d1d22; border: 1px solid #3a3a44; border-radius: 4px; cursor: pointer; font: 800 .72rem system-ui, sans-serif; }
.crew-helper-actions button:hover, .crew-helper-actions button:focus-visible { color: #09090b; background: var(--helper-color); border-color: var(--helper-color); }
.crew-helper-actions [data-helper="skip"] { margin-left: auto; color: #b9b9c2; }

/* Inside the match-result dialog it sits at the top so it never covers the result buttons. */
dialog .crew-helper { top: 18px; bottom: auto; }

/* Wide screens: the empty foot of the left column (under Match History), clear of the hand. */
@media (min-width: 900px) and (min-height: 621px) {
  .crew-helper { left: 12px; bottom: 18px; width: clamp(190px, 19vw, 248px); padding: 10px; gap: 8px; transform: none; }
  .crew-helper { flex-direction:column; align-items:stretch; }
  .crew-helper-face { width:76px; }
  .crew-helper-face img { height:112px; }
  .crew-helper-text { font-size: .84rem; }
  .crew-helper-actions [data-helper="skip"] { margin-left: 0; }
}

/* Phones held sideways: small, over the top of the rival's mat, clear of the top bar and the hand. */
@media (max-height: 620px) and (orientation: landscape) {
  .crew-helper { left: 8px; top: 36px; bottom: auto; width: min(420px, calc(100vw - 230px)); padding: 6px 8px; gap: 8px; transform: none; }
  .crew-helper-cast { flex-direction:column; gap:5px; }
  .crew-helper-face { width:58px; padding:2px; }
  .crew-helper-face img { height:82px; }
  .crew-helper-face figcaption { font-size:8px; }
  .crew-helper-who { font-size: .6rem; margin-bottom: 2px; }
  .crew-helper-text { font-size: .74rem; line-height: 1.25; }
  .crew-helper-actions { margin-top: 4px; gap: 4px; }
  .crew-helper-actions button { min-height: 22px; padding: 0 7px; font-size: .6rem; }
  /* below the Crew bar (crew-bar.css) where the page has one */
  body:has(.crew-bar) .crew-helper:not(dialog .crew-helper) { top: 58px; }
}

/* While a teaching line plays (crew-helper.js hold): the board holds still, taps are blocked, and a
   spotlight dims everything but what the line is about. The bubble sits above it. */
.crew-helper-stage {
  --helper-color: var(--yellow, #ffd21c);
  position: fixed;
  inset: 0;
  z-index: 58;
  cursor: default;
  touch-action: none;
}
.crew-helper-stage[hidden] { display: none; }
/* Keep card taps blocked while allowing Safari/Chrome to tuck their bars away during speech. */
@media (pointer: coarse) and (orientation: landscape) {
  html.browser-bars .crew-helper-stage { touch-action:pan-y; }
}
.crew-helper-stage.no-spot { background: rgba(0, 0, 0, .45); }
.crew-helper-stage[data-voice="phantom"] { --helper-color: #ffb400; }
.crew-helper-stage[data-voice="motor"] { --helper-color: #69f02c; }
.crew-helper-stage[data-voice="rail"] { --helper-color: #b640ff; }
.crew-helper-stage[data-voice="madam"] { --helper-color: #1687ff; }
.crew-helper-stage[data-voice="k3yz"] { --helper-color: #26a7ff; }
.crew-helper-spot {
  position: absolute;
  border: 3px solid var(--helper-color);
  border-radius: 10px;
  /* Same picture as before, drawn in two pieces: the pulsing glow stays on the frame, and the dimming of the
     rest of the screen sits still on top of it (::after). Pulsing both in one shadow made tablets repaint the
     whole screen every frame for as long as a lesson line played. */
  box-shadow: 0 0 22px 4px var(--helper-color);
  pointer-events: none;
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease;
  animation: crew-helper-glow 1.4s ease-in-out infinite alternate;
}
.crew-helper-spot::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .62); pointer-events: none; }
.crew-helper-spot[hidden] { display: none; }
@keyframes crew-helper-glow { to { box-shadow: 0 0 6px 1px var(--helper-color); } }
@media (prefers-reduced-motion: reduce) { .crew-helper-spot { animation: none; transition: none; } }
.crew-helper-actions [data-helper="next"] { color: #09090b; background: var(--helper-color); border-color: var(--helper-color); }

/* Match the difficulty dropdown without adding a separate lesson start button. */
.practice-options { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr)); gap:24px; align-items:start; margin:20px 0; }
.practice-difficulty,.setup-lessons { min-width:0; }
.practice-options select { max-width:100%; width:100%; }

/* Graffiti signs: preserve the full rectangular touch targets. */
.setup-start-actions { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr)); gap:24px; padding:8px 9px 14px; }
.setup-start-actions .primary-button {
  --sign-color:var(--yellow,#ffd21c); --sign-shadow:var(--pink,#ff2ca8);
  position:relative; isolation:isolate; min-height:84px; padding:16px 20px;
  border:2px solid var(--sign-color); border-radius:3px 12px 2px 9px;
  background:radial-gradient(ellipse at 8% 15%,#ffffff16,transparent 48%),repeating-linear-gradient(165deg,transparent 0 10px,#ffffff04 11px 12px),#131019;
  color:var(--sign-color); font:400 clamp(22px,2.3vw,32px)/1.2 CCMarker,Impact,sans-serif; letter-spacing:.025em;
  text-shadow:2px 2px #08080b,3px 3px var(--sign-shadow);
  box-shadow:6px 6px 0 var(--sign-shadow),-3px -2px 0 var(--cyan,#16dcff);
  transform:rotate(-1deg) skew(-2deg); transition:transform .15s,box-shadow .15s;
}
.setup-start-actions .lessons-entry-button { --sign-color:var(--cyan,#16dcff); --sign-shadow:var(--yellow,#ffd21c); transform:rotate(1deg) skew(-2deg); }
.setup-start-actions .primary-button::before { content:""; position:absolute; right:18px; top:-6px; width:42px; height:8px; background:repeating-linear-gradient(120deg,var(--sign-color) 0 5px,#131019 6px 9px); transform:rotate(5deg); pointer-events:none; }
.setup-start-actions .primary-button::after { content:""; position:absolute; right:24px; bottom:-10px; width:48px; height:14px; background:linear-gradient(var(--sign-color),var(--sign-color)) 0 0/4px 14px no-repeat,linear-gradient(var(--sign-color),var(--sign-color)) 18px 0/3px 8px no-repeat,linear-gradient(var(--sign-color),var(--sign-color)) 39px 0/5px 11px no-repeat; pointer-events:none; }
.setup-start-actions .primary-button:hover:not(:disabled) { background-color:#241a2c; transform:translate(-2px,-2px) skew(-2deg); box-shadow:8px 8px 0 var(--sign-shadow),-3px -2px 0 var(--sign-color); }
.setup-start-actions .primary-button:focus-visible { outline:3px solid white; outline-offset:8px; }
.setup-start-actions .primary-button:disabled { opacity:.5; cursor:not-allowed; }
@media(prefers-reduced-motion:reduce) { .setup-start-actions .primary-button { transition:none; } }

/* Lift only the speaking full-body figure above the lesson dimmer, leaving cards blocked. */
#gameScreen .crew-helper-speaker-figure { position:relative; z-index:59; filter:brightness(1.12) drop-shadow(0 0 12px var(--helper-color,#ffd21c)); pointer-events:none; }
#gameScreen .crew-helper-speaker-board { opacity:1 !important; }

/* Repeat the spoken line in the character's own bubble without overwriting game guidance. */
.crew-helper-spoken-content { display:none; }
#gameScreen .crew-helper-speech-bubble { position:relative; z-index:59 !important; display:block !important; opacity:1; color:white; background:#111117; border-color:#eee; pointer-events:none; box-shadow:0 0 16px color-mix(in srgb,var(--helper-color,#ffd21c) 45%,transparent),4px 4px 0 #000; }
#gameScreen .crew-helper-speech-bubble > :not(.crew-helper-spoken-content):not(.phase-track) { display:none !important; }
#gameScreen .crew-helper-speech-bubble > .crew-helper-spoken-content { display:block; }
#gameScreen .crew-helper-spoken-content strong { display:block; margin:6px 0; color:var(--helper-color,#ffd21c); font:800 13px/1.3 system-ui,sans-serif; text-transform:uppercase; }
#gameScreen .crew-helper-spoken-content p { display:block; margin:0; color:white; font:500 12px/1.45 system-ui,sans-serif; overflow-wrap:anywhere; }

/* Mobile lessons teach by voice; keep only a single row of controls over the mat. */
@media (max-width: 900px), (pointer: coarse) {
  .crew-helper { width:max-content; max-width:calc(100vw - 16px); padding:6px 8px; }
  .crew-helper-cast,
  .crew-helper-who,
  .crew-helper-text { display:none; }
  .crew-helper-actions { flex-wrap:nowrap; gap:4px; margin-top:0; }
  .crew-helper-actions button { flex:none; min-height:30px; padding:0 7px; font-size:.65rem; white-space:nowrap; }
  body.crew-helper-lesson #gameScreen .match-artists > figure,
  body.crew-helper-lesson #gameScreen .crew-helper-speech-bubble { display:none !important; }
}

/* The transcript stays in the free rail below counts, with its own scrolling. */
.crew-helper-script { display:none; }
@media (pointer: coarse) and (orientation: landscape) {
  .crew-helper-script:not([hidden]) {
    display:block; position:fixed; z-index:60; box-sizing:border-box;
    overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y;
    padding:6px 8px; border:1px solid var(--helper-color,#ffd21c); border-radius:6px;
    background:#111117f5; color:white; font:500 12px/1.4 system-ui,sans-serif;
    overflow-wrap:anywhere; scrollbar-width:thin;
  }
  .crew-helper-script strong { display:block; margin-bottom:4px; color:var(--helper-color,#ffd21c); font-size:10px; text-transform:uppercase; }
  .crew-helper-script p { margin:0; }
  .crew-helper-script:focus-visible { outline:2px solid white; outline-offset:2px; }
  body:has(.crew-helper-script:not([hidden])) .fs-scroll-hint { flex-direction:row; gap:4px; padding:4px; font-size:9px; }
  body:has(.crew-helper-script:not([hidden])) .fs-scroll-hint .fs-scroll-arrow { flex:none; font-size:20px; }
  body:has(dialog[open]) .crew-helper-script,
  body.match-choice-open .crew-helper-script { display:none !important; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 350px) {
  .crew-helper-script:not([hidden]) { padding:4px 6px; font-size:11px; }
  .crew-helper-script strong { display:none; }
}

/* All 5 lessons finished (owner, 2026-10-26): the LESSONS button goes grey but still opens a lesson for a refresher. */
.setup-start-actions .lessons-entry-button.lessons-done { --sign-color:#8a8794; --sign-shadow:#4a4752; filter:grayscale(1); opacity:.75; }

/* Result screen after a lesson: LESSON N (next lesson) above BACK TO MAIN */
.result-dialog .next-lesson-button { margin-bottom: 14px; background: var(--cyan, #16dcff); color: #09090b; box-shadow: 7px 7px 0 var(--pink, #ff2ca8); }
.result-dialog .next-lesson-button small { font: 800 .72rem/1.2 system-ui, sans-serif; letter-spacing: .08em; text-align: right; }
@media (max-height: 500px) {
  /* short sideways phones: keep LESSON N and BACK TO MAIN both on screen */
  .result-dialog:has(#nextLessonButton:not([hidden])) .primary-button { min-height: 42px; }
  .result-dialog .next-lesson-button { margin-bottom: 10px; }
}
@media (max-height: 400px) {
  /* the shortest phones: the two buttons side by side */
  .result-dialog:has(#nextLessonButton:not([hidden])) :is(#nextLessonButton, #rematchButton) { display: inline-flex; width: calc(50% - 12px); margin: 0 6px 6px; vertical-align: top; padding: 0 14px; }
  .result-dialog .next-lesson-button small { display: none; }
}
/* Tablets held sideways (iPad and bigger): the phone layout's 72px hand strip cut the cards to a sliver.
   Here the hand gets about a quarter of the screen and every card shows whole; the mat row shrinks to match. */
@media (pointer: coarse) and (orientation: landscape) and (min-height: 560px) {
  #gameScreen { --tablet-hand: clamp(150px, 26dvh, 250px); }
  #gameScreen:not([hidden]) { grid-template-rows: minmax(44px,.16fr) minmax(0,1.84fr) calc(var(--tablet-hand) - 24px); }
  #gameScreen.opponent-focus:not([hidden]) { grid-template-rows: minmax(0,1.84fr) minmax(44px,.16fr) calc(var(--tablet-hand) - 24px); }
  #gameScreen .player-hand-zone .hand-row { height: var(--tablet-hand); gap: 12px; padding-top: 4px; }
  /* a card is its 2:3 picture plus the two cost lines on top (about 34px) */
  #gameScreen #hand .game-card { flex: 0 0 calc((var(--tablet-hand) - 44px) / 1.5); }
  #gameScreen .hand-card-cost { height: 18px; font-size: 12px; line-height: 18px; }
}

/* Lesson helper buttons (Got it, Again, Voice on, Skip lessons) on phones and tablets: up at the top of the
   screen, over the empty wall above your mat, so they never sit on the hand or the mat during play. */
@media (pointer: coarse) and (orientation: landscape) and (min-height: 560px) {
  .crew-helper:not(dialog .crew-helper) { top: calc(9dvh + 6px); bottom: auto; left: calc((100vw - 156px) / 2); right: auto; transform: translateX(-50%); }
}

/* iPads and tablets play sideways only. Held upright (600px or wider, so phones are left alone), the whole
   game is covered by a "turn it sideways" screen that also takes every tap; turning it back shows the game
   exactly where it was. */
@media (pointer: coarse) and (orientation: portrait) and (min-width: 600px) {
  html, body { overflow: hidden !important; }
  body > *, dialog[open] { visibility: hidden !important; }
  html::after {
    content: "\21BB\A TURN YOUR iPAD OR TABLET SIDEWAYS\A\A Can Control plays in landscape on iPads and tablets.";
    white-space: pre-line;
    position: fixed; inset: 0; z-index: 2147483647;
    display: flex; align-items: center; justify-content: center;
    padding: 40px; box-sizing: border-box;
    background: #09090b; color: #ffd21c;
    font: 900 clamp(26px, 5vw, 44px)/1.35 CCMarker, Impact, system-ui, sans-serif;
    letter-spacing: .04em; text-align: center;
    text-shadow: 3px 3px 0 #ff2ca8;
    pointer-events: auto; touch-action: none;
  }
}


/* 1 VS CPU and LESSONS graffiti signs (owner art, 2026-11-24). The text label stays for screen readers;
   1 VS CPU shows its art only while the button says 1 VS CPU (other modes keep their text). */
.setup-start-actions .sign-art { display:none; }
.setup-start-actions #startButton.cpu-art .sign-art,.setup-start-actions .lessons-entry-button .sign-art { display:block; height:clamp(54px,5.4vw,78px); width:auto; max-width:calc(100% - 44px); object-fit:contain; filter:drop-shadow(3px 3px 0 #08080b); }
.setup-start-actions #startButton.cpu-art > span:first-child,.setup-start-actions .lessons-entry-button > span:first-child { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap; }
