/* FrankenSketch UI — docs/FRANKENSKETCH_DESIGN_SYSTEM.md 기준
   짙은 보라 배경 · 크림 패널 · 굵은 검정 외곽선 · 고정 4분면 색 · 만화식 눌림.
   브랜드 화면은 화려하게, 플레이 화면은 명료하게, 리빌은 폭발적으로. */

@font-face {
  font-family: 'Lilita One';
  src: url('fonts/LilitaOne-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Black Han Sans';
  src: url('fonts/BlackHanSans-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

* { box-sizing: border-box; }

:root {
  /* Background */
  --fs-bg-deep: #130824;
  --fs-bg-raised: #261436;
  --fs-bg-purple-soft: #3a2042;

  /* Surface */
  --fs-paper: #fdf5e4;
  --fs-paper-warm: #f9ebd5;

  /* Text & outline */
  --fs-outline: #050504;
  --fs-outline-soft: #292a2c;
  --fs-text-light: #fff8ea;
  --fs-text-dark: #17131c;
  --fs-text-muted: #c9bdd3;
  /* Context-owned foregrounds. Do not infer readable text from a semantic fill. */
  --fs-text-on-blue: #17131c;
  --fs-text-on-danger: #17131c;
  --fs-text-muted-on-paper: #6b6172;
  --fs-danger-text-on-paper: #a92e24;
  --fs-danger-text-on-dark: #ff6b55;

  /* Quadrants — 위치 고정: TL 초록 / TR 보라 / BL 파랑 / BR 주황 */
  --fs-green: #93c30d;
  --fs-green-bright: #9ecb12;
  --fs-purple: #9039bb;
  --fs-purple-bright: #b864cb;
  --fs-blue: #1d9bdc;
  --fs-blue-bright: #3fa3d0;
  --fs-orange: #f77f02;
  --fs-orange-bright: #f7a311;

  /* Status */
  --fs-success: #78c72a;
  --fs-warning: #ffc52e;
  --fs-danger: #e85642;
  --fs-info: #39a9e8;
  --fs-disabled: #706779;

  /* Radius */
  --fs-radius-sm: 12px;
  --fs-radius-md: 16px;
  --fs-radius-lg: 22px;
  --fs-radius-xl: 28px;

  /* Border */
  --fs-border-thin: 2px;
  --fs-border-default: 3px;
  --fs-border-brand: 4px;

  /* Shadow (아래로 눌린 만화식) */
  --fs-shadow-button: 0 5px 0 #09040f;
  --fs-shadow-card: 0 7px 0 rgba(9, 4, 15, 0.9);

  /* Motion */
  --fs-motion-fast: 120ms;
  --fs-motion-default: 220ms;
  --fs-motion-reveal: 800ms;

  /* Layout system — docs/UI_LAYOUT_SPEC.md */
  --game-stage-width: 1180px;
  --game-stage-height: 780px;
  --game-stage-gutter: 24px;
  --game-stage-min-readable-scale: 0.72;
  --game-mobile-max-width: 640px;
  --game-stage-scale: 1;
  --game-stage-top: 12px;
  --game-header-height: 56px;
  --game-active-header-height: var(--game-header-height);
  --game-header-pad-top: 4px;
  /* Home Landing owns its internal vertical rhythm without changing the outer stage. */
  --home-brand-band: 160px;
  --home-main-height: 472px;
  --home-footer-height: 52px;
  --home-section-gap: 32px;
  --home-logo-height: 108px;
  --game-stage-pad: 16px;
  --game-side-rail: 136px;
  --game-work-column: 616px;
  --game-canvas: 600px;
  --reveal-side-width: 420px;
  --game-rail-gap: 24px;
  --control-height: 48px;
  --primary-height: 56px;
  --icon-control: 48px;

  --layout-stage-max: var(--game-stage-width);
  --layout-content-max: 960px;
  --layout-card-max: 520px;
  --layout-canvas-max: 600px;
  --layout-side-width: 136px;
  --layout-outer-pad: 24px;
  --layout-gap-xs: 8px;
  --layout-gap-sm: 12px;
  --layout-gap-md: 16px;
  --layout-gap-lg: 24px;
  --layout-gap-xl: 32px;
  --layout-card-pad: 24px;
  --layout-header-height: var(--game-header-height);
  --layout-status-min-height: 44px;
  --layout-status-max-width: 560px;
  --touch-min: 44px;

  /* Existing canvas sizing API aliases. client.js reads --canvas-max. */
  --stage-max: var(--layout-stage-max);
  --stage-pad: var(--layout-outer-pad);
  --stage-gap: var(--layout-gap-lg);
  --content-max: var(--layout-content-max);
  --card-max: var(--layout-card-max);
  --canvas-max: var(--layout-canvas-max);
  --hero-max: var(--layout-card-max);
}

html, body {
  margin: 0;
  min-height: 100%;
  overscroll-behavior-y: none;
  background: var(--fs-bg-deep);
  color: var(--fs-text-light);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'Hiragino Sans', 'Yu Gothic UI', Meiryo, 'Apple SD Gothic Neo', 'Noto Sans KR',
    'Noto Sans Thai', 'Leelawadee UI', Thonburi, Tahoma, sans-serif;
  -webkit-text-size-adjust: 100%;
}

html[lang="ko"] body {
  word-break: keep-all;
  overflow-wrap: break-word;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  /* 은은한 페인트 얼룩 — 장식은 클릭 영역을 침범하지 않는다 */
  background-image:
    radial-gradient(60% 45% at 15% 0%, rgba(144, 57, 187, 0.28), transparent 70%),
    radial-gradient(55% 40% at 100% 15%, rgba(29, 155, 220, 0.18), transparent 70%),
    radial-gradient(50% 45% at 85% 100%, rgba(247, 127, 2, 0.14), transparent 70%);
  background-attachment: fixed;
}

/* 짧은 터치 기기의 가로 화면은 별도 게임 레이아웃 대신 세로 전환만 안내한다.
   실제 판정은 visualViewport 높이까지 보는 orientation-guard.js가 담당한다. */
.orientation-blocker {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  overflow: auto;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background: var(--fs-bg-deep);
  overscroll-behavior: contain;
}
.orientation-blocker[hidden] { display: none; }
.orientation-blocker-card {
  width: min(440px, 100%);
  max-height: 100%;
  padding: clamp(18px, 4vh, 28px);
  overflow: auto;
  border: var(--fs-border-brand) solid var(--fs-outline);
  border-radius: var(--fs-radius-xl);
  box-shadow: var(--fs-shadow-card);
  color: var(--fs-text-dark);
  text-align: center;
}
.orientation-blocker-icon {
  width: clamp(62px, 14vh, 88px);
  height: auto;
  margin: 0 auto 8px;
  overflow: visible;
  color: var(--fs-purple);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6;
}
.orientation-blocker-card h2 {
  margin: 0;
  font-family: 'Lilita One', 'Black Han Sans', Inter, system-ui, sans-serif;
  font-size: clamp(1.45rem, 5.2vh, 2rem);
  line-height: 1.12;
}
.orientation-blocker-card p {
  margin: 10px 0 0;
  font-size: clamp(0.94rem, 3.4vh, 1.05rem);
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.orientation-blocker-card .orientation-blocker-timer {
  width: fit-content;
  margin: 14px auto 0;
  padding: 7px 12px;
  border: 2px solid var(--fs-outline);
  border-radius: 999px;
  background: var(--fs-warning);
  font-weight: 900;
}
.orientation-blocker-timer[hidden] { display: none; }

/* 중앙형 브랜드 화면의 빈 공간에만 은은한 낙서 타일을 얹는다. 작화·리빌은 제외. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='180' viewBox='0 0 240 180'%3E%3Cg fill='none' stroke='%23fff8ea' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' opacity='.08'%3E%3Cpath d='M25 30l4 9 10 1-8 6 3 10-9-5-9 5 3-10-8-6 10-1zM180 24l-9 17h10l-8 19 23-25h-11l8-11M45 135q12-12 24 0t24 0M180 126c-12-13-31 4 0 24 31-20 12-37 0-24z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 240px 180px;
  transition: opacity var(--fs-motion-default);
}
body[data-view="home"]::before,
body[data-view="intro"]::before,
body[data-view="blind"]::before,
body[data-view="finished"]::before { opacity: 1; }
.app { position: relative; z-index: 1; }

.sr-only {
  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;
}

/* 별도 헤더 띠 없이 로고를 Stage 상단 중앙에 둔다. 라운드·언어는 양끝에 뜬다. */
.stage-brand {
  position: relative;
  flex-shrink: 0;
  padding-top: env(safe-area-inset-top);
}
.stage-brand-inner {
  position: relative;
  min-height: var(--layout-header-height);
  padding: 12px var(--stage-pad) 4px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}
.brand-lockup {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  width: 100%;
}
.stage-brand .language-picker { grid-column: 3; justify-self: end; }
/* The first body script assigns the layout mode before visible Home markup is parsed.
   Keep the Desktop-only tutorial closed as a defensive fallback if that script cannot run. */
.home-tutorial-overlay { display: none; }
body[data-layout-mode="desktop"] .home-tutorial-overlay { display: contents; }
.app-logo { width: auto; max-width: min(96px, 42vw); height: 46px; object-fit: contain; display: block; }
body:not([data-view="home"]) .stage-brand .tagline { display: none; }
.round-badge {
  grid-column: 1;
  justify-self: start;
  padding: 5px 11px;
  border: 2px solid var(--fs-outline);
  border-radius: 999px;
  background: var(--fs-warning);
  color: var(--fs-text-dark);
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: 0.92rem;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--fs-outline);
}
.round-badge[hidden] { display: none; }
.app {
  flex: none;
  width: min(calc(100% - 32px), var(--stage-max));
  max-width: var(--stage-max);
  margin: 0 auto;
  padding: 0;
  overflow: clip;
  background: rgba(38, 20, 54, 0.92);
  border: var(--fs-border-default) solid var(--fs-outline);
  border-radius: var(--fs-radius-xl);
  box-shadow: 0 10px 0 rgba(9, 4, 15, 0.9);
}

.stage-content {
  min-width: 0;
  padding: var(--stage-pad);
  padding-bottom: calc(var(--stage-pad) + env(safe-area-inset-bottom));
}

.view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.view:not([hidden]) { animation: viewEnter 220ms ease-out both; }
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 레이아웃 모드의 고특이도 grid/flex 선언보다 hidden 상태가 항상 우선한다. */
.view[hidden] { display: none !important; }

/* 정보·행동 묶음은 모바일에서도 한 덩어리를 유지하고 데스크톱 그리드의 컬럼이 된다. */
.vside {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* 브랜드 디스플레이 폰트 (실패 시 굵은 시스템 폰트로 폴백) */
.center-title, .code-label, .draw-clock, .tagline {
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* ── 재사용 표면 ───────────────────── */

.fs-paper {
  background: var(--fs-paper);
  color: var(--fs-text-dark);
  border: var(--fs-border-default) solid var(--fs-outline);
  border-radius: var(--fs-radius-lg);
  box-shadow: var(--fs-shadow-card);
}

/* 스티치: 크림 패널 안쪽에 점선 봉합 — 한 화면 2~3곳 이내 */
.fs-stitch {
  position: relative;
}
.fs-stitch::before {
  content: '';
  position: absolute;
  inset: 7px;
  border: 2px dashed rgba(23, 19, 28, 0.4);
  border-radius: calc(var(--fs-radius-lg) - 8px);
  pointer-events: none;
}

/* ── 버튼 시스템 ───────────────────── */

.btn {
  min-height: var(--control-height);
  padding: 12px 20px;
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fs-text-dark);
  background: var(--fs-paper);
  border: var(--fs-border-default) solid var(--fs-outline);
  border-radius: var(--fs-radius-md);
  box-shadow: var(--fs-shadow-button);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform var(--fs-motion-fast), box-shadow var(--fs-motion-fast),
    filter var(--fs-motion-fast);
}
.btn-stitch-card {
  --stitch-card-width: 100%;
  --stitch-card-min-height: var(--control-height);
  --stitch-card-padding: 12px 20px;
  --stitch-card-radius: var(--fs-radius-md);
  --stitch-card-inset: 7px;
  --stitch-card-line-width: 2px;
  --stitch-card-line-color: rgba(23, 19, 28, 0.4);
  position: relative;
  width: var(--stitch-card-width);
  min-height: var(--stitch-card-min-height);
  padding: var(--stitch-card-padding);
  border-radius: var(--stitch-card-radius);
}
.btn-stitch-card::before {
  content: '';
  position: absolute;
  inset: var(--stitch-card-inset);
  border: var(--stitch-card-line-width) dashed var(--stitch-card-line-color);
  border-radius: calc(var(--stitch-card-radius) - var(--stitch-card-inset));
  pointer-events: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 #09040f; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #09040f; }
.btn:focus-visible { outline: 3px solid var(--fs-info); outline-offset: 2px; }

.btn-lg { min-height: var(--primary-height); font-size: 1.15rem; }
.btn-icon {
  position: relative;
  width: var(--icon-control);
  min-width: var(--icon-control);
  min-height: var(--icon-control);
  padding: 0;
  font-family: Inter, system-ui, sans-serif;
  font-size: 1.65rem;
  line-height: 1;
}
.btn-icon::after {
  content: attr(aria-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 10;
  width: max-content;
  max-width: 180px;
  padding: 6px 9px;
  border: 2px solid var(--fs-outline);
  border-radius: 8px;
  background: var(--fs-paper);
  color: var(--fs-text-dark);
  box-shadow: 0 3px 0 var(--fs-outline);
  font: 700 0.78rem/1.2 Inter, system-ui, sans-serif;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 3px);
  transition: opacity var(--fs-motion-fast), transform var(--fs-motion-fast);
}
.btn-icon:hover::after,
.btn-icon:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.btn-icon-svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* Primary — 밝은 초록 (핵심 진행) */
.btn-primary { background: var(--fs-green-bright); color: var(--fs-text-dark); }
/* 제출은 주황으로 더 눈에 띄게 */
.btn-submit { background: var(--fs-orange-bright); }
/* Secondary — 파랑 (저장·입장 등 보조 행동) */
.btn-blue { background: var(--fs-blue-bright); color: var(--fs-text-on-blue); }
/* Ghost — 어두운 배경 위 크림 외곽 (나가기·되돌아가기) */
.btn-ghost {
  background: transparent;
  color: var(--fs-text-light);
  border-color: var(--fs-outline-soft);
  box-shadow: none;
}
.btn-ghost:hover { transform: translateY(-1px); box-shadow: none; background: rgba(255, 248, 234, 0.06); }
.btn-ghost:active { transform: translateY(1px); box-shadow: none; }

.btn:disabled {
  background: var(--fs-disabled);
  color: rgba(255, 248, 234, 0.65);
  cursor: default;
  transform: none;
  box-shadow: 0 5px 0 rgba(9, 4, 15, 0.5);
  filter: none;
}
.btn-ghost:disabled { background: transparent; box-shadow: none; opacity: 0.5; }

/* 서버 응답 대기: 기존 문구가 버튼 폭을 계속 예약하고, 중앙 spinner만 보인다.
   전체 화면을 막지 않아 다른 참가자의 상태 업데이트와 타이머는 그대로 읽을 수 있다. */
.btn.server-action-pending,
.btn.server-action-pending:disabled {
  position: relative;
  color: transparent !important;
  text-shadow: none;
}
.btn.server-action-pending::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 248, 234, 0.42);
  border-top-color: var(--fs-text-light);
  border-radius: 50%;
  animation: serverActionSpin 700ms linear infinite;
  pointer-events: none;
}
@keyframes serverActionSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ── 입력창 ────────────────────────── */

input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fs-text-dark);
  background: #ffffff;
  border: var(--fs-border-default) solid var(--fs-outline);
  border-radius: var(--fs-radius-md);
  outline: none;
}
input::placeholder { color: #9a8fa6; font-weight: 500; }
input:focus { border-color: var(--fs-purple); box-shadow: 0 0 0 3px rgba(144, 57, 187, 0.25); }
input:disabled { background: #e8e2d6; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--fs-text-dark);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fs-text-muted);
  font-size: 0.85rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 2px;
  background: rgba(201, 189, 211, 0.25);
  border-radius: 2px;
}
/* 크림 패널 안의 divider는 어두운 선 */
.fs-paper .divider { color: #6b6270; }
.fs-paper .divider::before, .fs-paper .divider::after { background: rgba(23, 19, 28, 0.18); }

.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; }
.join-row .btn { flex-shrink: 0; padding: 12px 22px; }
.join-block {
  display: grid;
  gap: 8px;
  min-width: 0;
}

#input-code {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  text-align: center;
  font-weight: 800;
}

.error {
  margin: 0;
  padding: 10px 14px;
  color: var(--fs-text-on-danger);
  background: var(--fs-danger);
  border: 2px solid var(--fs-outline);
  border-radius: var(--fs-radius-sm);
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
}
.error[hidden] { display: none; }
.join-block > .error {
  padding: 8px 11px;
  font-size: 0.84rem;
  line-height: 1.35;
  text-align: left;
  overflow-wrap: anywhere;
}

/* ── 홈 (장식 100%) ────────────────── */
/* 모바일은 입장 폼 → 튜토리얼, 데스크톱은 튜토리얼 → 입장 폼 2단이다. */
.view-home { align-items: stretch; }

.tagline {
  margin: 0;
  text-align: center;
  color: var(--fs-text-light);
  font-size: 1.3rem;
}
.tagline b { color: var(--fs-green-bright); font-weight: 400; }

.hero-figure {
  margin: 0;
  border: var(--fs-border-default) solid var(--fs-outline);
  border-radius: var(--fs-radius-lg);
  overflow: hidden;
  box-shadow: var(--fs-shadow-card);
  line-height: 0;
}
.hero-figure img { width: 100%; height: auto; }

/* 히어로 + 입장 카드 묶음. 기본(좁은 화면)은 세로 스택, 넓은 화면에선 가로 2단(아래 media). */
.home-cols {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  width: 100%;
}

#view-home .home-panel {
  order: 1;
  height: auto;
  min-height: 0;
  align-self: start;
  width: 100%;
}
#view-home .home-tutorial {
  order: 2;
  height: auto;
  min-height: 0;
  align-self: start;
  width: 100%;
}

.home-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 2vw, 24px);
}
.home-entry-actions {
  --home-stack-gap: 12px;
  display: flex;
  flex-direction: column;
  gap: var(--home-stack-gap);
  width: min(88%, 580px);
  min-height: 0;
}

.invite-banner {
  margin: 0;
  padding: 12px 14px;
  border: 2px dashed var(--fs-outline);
  border-radius: var(--fs-radius-sm);
  background: color-mix(in srgb, var(--fs-green) 32%, var(--fs-paper));
  color: var(--fs-text-dark);
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: 1.18rem;
  text-align: center;
}
.invite-banner[hidden] { display: none; }
.home-panel.invite-active .invite-banner { order: 1; }
.home-panel.invite-active .field { order: 2; }
.home-panel.invite-active .join-block { order: 3; }
.home-panel.invite-active .divider { order: 4; }
.home-panel.invite-active #btn-create { order: 5; }
.home-panel.invite-active .home-entry-meta { order: 6; }
.home-panel.invite-active .join-row .btn { min-width: 124px; }

.home-entry-meta {
  display: grid;
  gap: 7px;
  padding-top: 2px;
  text-align: center;
}
.home-player-meta {
  margin: 0;
  color: var(--fs-text-dark);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
}
.home-footer {
  /* @decision D-234 — Home keeps one visible, wrapping utility group with 44px targets. */
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px clamp(20px, 3.5vw, 52px);
  border-top: 1px solid rgba(255, 248, 234, 0.15);
  color: var(--fs-text-muted);
  font-size: 0.78rem;
  line-height: 1.25;
}
.home-footer-discord {
  width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  text-decoration: none;
}
.home-footer-discord img {
  display: block;
  width: 21.6px;
  height: 16.2px;
}
.home-footer-discord:hover,
.home-footer-discord:focus-visible {
  background: color-mix(in srgb, var(--fs-purple) 28%, transparent);
}
.home-footer-discord:focus-visible {
  outline: 3px solid var(--fs-info);
  outline-offset: 2px;
}
.home-footer-links {
  width: 100%;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0 12px;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}
.home-footer-links li { display: inline-flex; align-items: center; }
.home-footer-links li + li::before {
  content: '·';
  margin-right: 12px;
  color: rgba(255, 248, 234, 0.35);
}
.home-footer-links span { color: rgba(201, 189, 211, 0.68); }
.home-footer-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--fs-text-light);
  font-weight: 700;
  text-underline-offset: 3px;
}
.home-footer-delete {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fs-text-light);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.home-footer-delete:focus-visible {
  border-radius: 4px;
  outline: 3px solid var(--fs-info);
  outline-offset: 2px;
}

/* ── 로비 (장식 70%) ───────────────── */

.view-lobby { align-items: stretch; }

.code-panel {
  padding: 14px 18px 16px;
  text-align: center;
}
.code-label {
  margin: 0;
  color: #6b6270;
  font-size: 1rem;
}
.room-code {
  margin: 4px 0 6px;
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: 3.2rem;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: var(--fs-purple);
  -webkit-text-stroke: 1.5px var(--fs-outline);
  user-select: all;
}
.room-code-copy {
  appearance: none;
  display: inline-block;
  min-width: 0;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  line-height: 1;
  cursor: copy;
  transition: background-color 150ms ease, transform 150ms ease;
}
.room-code-copy:hover { background: rgba(144, 57, 187, 0.1); }
.room-code-copy:active { transform: translateY(1px); }
.room-code-copy:focus-visible {
  outline: 3px solid var(--fs-blue);
  outline-offset: 3px;
}
.room-code-copy.copied { background: color-mix(in srgb, var(--fs-success) 34%, transparent); }
.code-panel .lobby-hint { color: #6b6270; margin: 0; }

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.player-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  position: relative;
  background: var(--fs-paper);
  color: var(--fs-text-dark);
  border: var(--fs-border-default) solid var(--fs-outline);
  border-radius: var(--fs-radius-md);
  box-shadow: 0 4px 0 rgba(9, 4, 15, 0.85);
  font-size: 1.08rem;
  font-weight: 700;
  overflow: hidden;
}
/* 로비는 아직 분면 배정 전 — 4색을 입장순 장식으로 쓰면 실제 분면색과 충돌하므로 중립. */
.player-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 10px;
  background: var(--fs-purple);
}
.player-list li.you-row {
  background: color-mix(in srgb, var(--fs-green) 16%, var(--fs-paper));
  outline: 2px solid var(--fs-green);
  outline-offset: -5px;
}
.player-list .you { color: #3d3145; font-size: 0.84rem; font-weight: 800; }
.player-list .player-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.player-list .player-name {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-list .player-reconnect-status {
  max-width: 100%;
  color: #765300;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.player-list li.reconnecting {
  background: color-mix(in srgb, var(--fs-warning) 17%, var(--fs-paper));
}
.player-list li.reconnecting::before { background: var(--fs-warning); }
.player-list li.player.reconnecting .player-dot { background: var(--fs-warning); }
.player-list .host-badge {
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  color: var(--fs-text-dark);
  background: var(--fs-warning);
  border: 2px solid var(--fs-outline);
  padding: 0;
  border-radius: 999px;
}
.player-list .host-badge::before {
  content: '♛';
  font-size: 1.05rem;
  line-height: 1;
}

/* 실제 참가자 뒤에 정원까지 약한 대기 슬롯을 표시해 로비의 남은 자리를 시각화한다. */
.player-dot { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; }
.player.filled .player-dot { background: var(--fs-success); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18); }
.player-list li.empty {
  border-color: color-mix(in srgb, var(--fs-outline) 46%, transparent);
  background: color-mix(in srgb, var(--fs-purple) 9%, var(--fs-paper));
  color: color-mix(in srgb, var(--fs-text-muted-on-paper) 82%, var(--fs-outline));
  box-shadow: 0 3px 0 rgba(9, 4, 15, 0.52);
  opacity: 0.72;
}
.player-list li.empty::before {
  background: color-mix(in srgb, var(--fs-purple) 42%, transparent);
}
.player.empty .player-dot {
  background: color-mix(in srgb, var(--fs-purple) 18%, var(--fs-paper));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--fs-outline) 18%, transparent);
}

/* 로비 우측 헤더: Players (N/5) */
.players-head { margin: 0 0 2px; font-weight: 800; font-size: 1.05rem; color: var(--fs-text-light); }
.player-count { color: var(--fs-text-muted); font-weight: 700; }
.lobby-waiting {
  margin: 0;
  text-align: center;
  color: var(--fs-text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

/* ── 공통: 중앙 정렬 화면 ──────────── */

.view-center { align-items: center; text-align: center; padding-top: 0; }
.finished-hero {
  width: min(170px, 46vw);
  height: auto;
  margin: 0;
  filter: drop-shadow(0 8px 0 rgba(9, 4, 15, 0.42));
}
body[data-view="finished"] .finished-hero { animation: finishedPop 420ms cubic-bezier(0.22, 1.25, 0.4, 1) both; }
@keyframes finishedPop {
  from { opacity: 0; transform: scale(0.72) rotate(-4deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}
.center-title {
  margin: 0;
  font-size: 2rem;
  color: var(--fs-text-light);
  -webkit-text-stroke: 0.5px var(--fs-outline);
}
.center-sub {
  margin: 0;
  color: var(--fs-text-muted);
  font-size: 0.98rem;
  font-weight: 500;
  max-width: 320px;
}
.lobby-hint {
  margin: 0;
  color: var(--fs-text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: center;
}
.lobby-hint[hidden] { display: none; }
.view-center .btn { align-self: stretch; }

/* ── 행동 타이머 ─────────────────────
   그리기·추측 중 남은 시간은 숫자 하나만 보여 준다.
   5초 이하 주의, 3초 이하 위험은 색과 숫자 정밀도로 함께 구분한다. */

.draw-clock,
.guess-timer-value {
  transition: color var(--fs-motion-fast);
}
.draw-clock.caution,
.guess-timer.caution .guess-timer-value {
  color: var(--fs-orange-bright);
}
.draw-clock.warn,
.guess-timer.warn .guess-timer-value {
  color: var(--fs-danger-text-on-dark);
  animation: timerClockPulse 900ms ease-in-out infinite;
}
.draw-clock.expired,
.guess-timer.expired .guess-timer-value {
  color: var(--fs-danger-text-on-dark);
  animation: none;
}

/* ── 작화 화면 (장식 30% — 가장 절제) ── */

.view-draw {
  padding-top: 10px;
  gap: 10px;
  /* touch-action은 캔버스에만 none(그리기), 여기엔 지정하지 않는다.
     조상에 pan-y를 주면 폰이 분면 전환 시 첫 획을 스크롤로 오인해
     pointercancel로 가로챈다. 캔버스 밖(팔레트·버튼)은 기본 스크롤 허용 —
     가로 모드 낮은 뷰포트에서도 제출 버튼에 도달한다. */
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.draw-prompt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}
.draw-piece {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.draw-piece-desktop { display: none; }
.draw-time-desktop { display: none; }
.draw-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  min-width: max-content;
}
.draw-info-label {
  color: var(--fs-text-muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
}
.draw-word {
  grid-area: auto;
  min-width: 0;
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--fs-green-bright); /* 그리는 중 제시어를 눈에 띄게 (브랜드색) */
  overflow-wrap: anywhere;
}
.draw-position-chip {
  grid-area: auto;
  align-self: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  color: var(--fs-text-light) !important;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}
.draw-clock {
  grid-area: auto;
  justify-self: auto;
  display: block;
  width: 100%;
  font-size: 1.5rem;
  color: var(--fs-green-bright);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}
#draw-minimap { grid-area: auto; justify-self: auto; }
.draw-error {
  margin: 0;
  padding: 8px 10px;
  border: 2px solid var(--fs-outline);
  border-radius: var(--fs-radius-sm);
  background: var(--fs-danger);
  color: var(--fs-text-on-danger);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}
.draw-error[hidden] { display: none; }

.canvas-notice-stack {
  position: absolute;
  z-index: 30;
  top: 8px;
  right: 8px;
  left: 8px;
  display: grid;
  justify-items: center;
  gap: var(--layout-gap-xs);
  min-width: 0;
  pointer-events: none;
}
.canvas-notice-stack:empty { display: none; }
.canvas-notice-stack .draw-error {
  width: 100%;
  max-width: var(--layout-status-max-width);
}

/* Workspace — desktop logical stage and mobile portrait are the only owners. */
#view-draw:not([hidden]) {
  --draw-frame-size: 8px;
  --draw-outer-w: calc(var(--draw-w, var(--canvas-max)) + (2 * var(--draw-frame-size)));
  --draw-mobile-w: min(100%, var(--draw-outer-w));
  display: grid;
  width: 100%;
  margin-inline: auto;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#view-draw .draw-info,
#view-draw .draw-workspace { min-width: 0; }
#view-draw .draw-prompt,
#view-draw .draw-info-rail,
#view-draw .draw-tool-rail,
#view-draw .drawing-toolbar {
  min-width: 0;
  border: 2px solid rgba(255, 248, 234, 0.1);
  border-radius: var(--fs-radius-md);
  background: rgba(19, 8, 36, 0.56);
  box-shadow: 0 4px 0 rgba(9, 4, 15, 0.55);
}
#view-draw .draw-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  text-align: center;
}
#view-draw .draw-info-rail {
  display: flex;
  flex-direction: column;
  gap: var(--layout-gap-md);
  padding: 16px 12px;
}
#view-draw .draw-piece,
#view-draw .draw-time { min-width: 0; }
#view-draw .draw-word {
  max-width: 100%;
  font-size: clamp(1.25rem, 2.1vw, 1.8rem);
  line-height: 1.06;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: none;
}
#view-draw .draw-position-chip {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
#view-draw .canvas-shell {
  --piece-accent: var(--fs-disabled);
  position: relative;
  display: flex;
  justify-content: center;
  width: var(--draw-mobile-w);
  max-width: 100%;
  margin: 0;
  padding: var(--draw-frame-size);
  border-radius: 14px;
  background: var(--piece-accent);
  box-shadow: 0 0 0 3px var(--fs-outline), 0 7px 0 rgba(9, 4, 15, 0.64);
}
#view-draw .canvas-shell.q-tl { --piece-accent: var(--fs-green); }
#view-draw .canvas-shell.q-tr { --piece-accent: var(--fs-purple); }
#view-draw .canvas-shell.q-bl { --piece-accent: var(--fs-blue); }
#view-draw .canvas-shell.q-br { --piece-accent: var(--fs-orange); }
#view-draw #piece-canvas {
  display: block;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
}
#view-draw .draw-tool-rail {
  display: flex;
  flex-direction: column;
  gap: var(--layout-gap-sm);
  padding: 10px;
}
#view-draw .draw-side-rail { min-width: 0; }
#view-draw .drawing-toolbar {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 8px;
  gap: 8px;
  box-shadow: none;
}
#view-draw .palette-colors {
  display: grid;
  width: 100%;
  margin: 0;
  justify-content: center;
}
#view-draw .swatch {
  position: relative;
  width: 100%;
  min-width: var(--touch-min);
  max-width: 54px;
  min-height: var(--touch-min);
  max-height: 54px;
  aspect-ratio: 1;
  justify-self: center;
  border-width: 3px;
}
#view-draw .swatch.selected { border-width: 5px; box-shadow: 0 3px 0 rgba(9, 4, 15, 0.6); }
#view-draw .swatch.selected::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 7px;
  box-shadow: 0 0 0 1px rgba(9, 4, 15, 0.48);
  pointer-events: none;
}
#view-draw .palette-tools,
#view-draw .width-group { min-width: 0; }
#view-draw .width-btn,
#view-draw .btn-tool,
#view-draw .draw-tool-panel .btn-submit { min-height: var(--touch-min); }
#view-draw .draw-tool-panel .btn-submit {
  width: 100%;
  max-width: none;
  margin: 0;
}
/* Desktop: compact HUD over a centered canvas, with a content-sized tool rail.
   The empty left track is an invisible centering spacer, not a visible information card. */
#view-draw[data-draw-layout="desktop"] {
  grid-template-columns: var(--game-side-rail) var(--game-work-column) var(--game-side-rail);
  grid-template-rows: 64px var(--game-work-column);
  width: calc((2 * var(--game-side-rail)) + var(--game-work-column) + (2 * var(--game-rail-gap)));
  height: 692px;
  justify-content: center;
  align-content: center;
  column-gap: var(--game-rail-gap);
  row-gap: var(--layout-gap-sm);
}
#view-draw[data-draw-layout="desktop"] > .draw-info {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: var(--game-work-column);
  padding: 6px 14px;
  border: 2px solid rgba(255, 248, 234, 0.1);
  border-radius: var(--fs-radius-md);
  background: rgba(19, 8, 36, 0.56);
  box-shadow: 0 4px 0 rgba(9, 4, 15, 0.55);
}
#view-draw[data-draw-layout="desktop"] > .draw-workspace { display: contents; }
#view-draw[data-draw-layout="desktop"] .draw-prompt {
  grid-column: 1;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  justify-content: center;
  text-align: center;
}
#view-draw[data-draw-layout="desktop"] .draw-info-rail {
  display: contents;
}
#view-draw[data-draw-layout="desktop"] .draw-piece-mobile {
  display: none;
}
#view-draw[data-draw-layout="desktop"] .draw-piece-desktop {
  display: flex;
  flex: 0 0 auto;
  /* @decision D-229 D-233 — 바깥 카드는 도구 카드와 같은 레일 전체 폭을
     쓰고, 시간과 84px 미니맵은 늘어난 좌우 여백 안에서 중앙을 유지한다. */
  align-self: stretch;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 146px;
  gap: 7px;
  padding: 8px;
  border: 2px solid rgba(255, 248, 234, 0.14);
  border-radius: var(--fs-radius-md);
  background: rgba(19, 8, 36, 0.72);
  box-shadow: 0 4px 0 rgba(9, 4, 15, 0.55);
  text-align: center;
}
#view-draw[data-draw-layout="desktop"] .draw-time-mobile {
  display: none;
}
/* @decision D-229 — Desktop에서는 숫자 시간을 담당 조각 카드 안의
   미니맵 위에 묶고, Canvas 상단 제시어는 전체 폭의 중심축을 단독 소유한다. */
#view-draw[data-draw-layout="desktop"] .draw-time-desktop {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
}
#view-draw[data-draw-layout="desktop"] .draw-piece-desktop .quad-map-mini {
  width: 84px;
}
#view-draw[data-draw-layout="desktop"] .draw-word {
  display: -webkit-box;
  max-height: 1.96em;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: clamp(1.4rem, 1.9vw, 1.5rem);
  line-height: 0.98;
  word-break: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
#view-draw[data-draw-layout="desktop"] .draw-time-desktop .draw-clock {
  font-size: 1.35rem;
  text-align: center;
}
#view-draw[data-draw-layout="desktop"] .canvas-shell {
  grid-column: 2;
  grid-row: 2;
  width: var(--game-work-column);
  height: var(--game-work-column);
}
#view-draw[data-draw-layout="desktop"] .draw-side-rail {
  grid-column: 3;
  /* @decision D-232 — 조각·시간부터 제출까지의 전체 레일을 제시어 행 상단에
     맞춰 제한 시간 행동까지의 포인터 이동 거리를 줄이고 남는 공간은 아래에 둔다. */
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: start;
  gap: 10px;
  height: auto;
}
#view-draw[data-draw-layout="desktop"] .draw-tool-rail {
  flex: 0 0 auto;
  align-self: stretch;
  height: auto;
  gap: 10px;
  padding: 10px;
}
#view-draw[data-draw-layout="desktop"] .drawing-toolbar {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#view-draw[data-draw-layout="desktop"] .palette-colors {
  grid-template-columns: repeat(2, minmax(44px, 48px));
  grid-template-rows: repeat(5, minmax(44px, 48px));
  gap: 6px;
}
#view-draw[data-draw-layout="desktop"] .draw-tool-panel { flex: 0 0 auto; }
#view-draw[data-draw-layout="desktop"] .draw-tool-panel .palette-tools {
  flex-direction: column;
  gap: 8px;
}
#view-draw[data-draw-layout="desktop"] .draw-tool-panel .width-group { width: 100%; }
#view-draw[data-draw-layout="desktop"] .draw-tool-panel .btn-icon {
  align-self: center;
  flex: 0 0 auto;
}
#view-draw[data-draw-layout="desktop"] .draw-tool-panel .btn-submit {
  margin-top: 0;
  min-height: var(--primary-height);
  padding-inline: 6px;
  font-size: 0.95rem;
  white-space: normal;
}

/* Mobile portrait drawing is a canvas-first immersive workbench. The square uses
   the safe inline width and yields only enough height to keep compact tools visible. */
#view-draw[data-draw-layout="mobile"] {
  --draw-frame-size: 0px;
  /* @decision D-236 — Narrow portraits shrink both symmetric HUD side tracks
     together, preserving the prompt center while giving current words room. */
  --draw-timer-slot-width: clamp(84px, 27vw, 104px);
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: start;
  row-gap: 8px;
  width: 100%;
  padding-top: env(safe-area-inset-top);
}
#view-draw[data-draw-layout="mobile"] > .draw-info,
#view-draw[data-draw-layout="mobile"] .draw-tool-rail {
  width: 100%;
}
#view-draw[data-draw-layout="mobile"] .canvas-shell {
  width: var(--draw-mobile-w);
}
/* @decision D-228 D-230 — Mobile HUD는 같은 폭의 조각·시간 측면 트랙 사이에서
   제시어를 Canvas 중심축에 맞추며 DOM의 접근성 상태와 Desktop 배치는 유지한다. */
#view-draw[data-draw-layout="mobile"] > .draw-info {
  display: grid;
  grid-template-columns:
    var(--draw-timer-slot-width)
    minmax(0, 1fr)
    var(--draw-timer-slot-width);
  grid-template-areas: "piece prompt time";
  align-items: center;
  gap: 6px 8px;
  padding: 8px 10px;
  border: 2px solid rgba(255, 248, 234, 0.1);
  border-radius: var(--fs-radius-md);
  background: rgba(19, 8, 36, 0.56);
  box-shadow: 0 4px 0 rgba(9, 4, 15, 0.55);
}
#view-draw[data-draw-layout="mobile"] .draw-prompt {
  grid-area: prompt;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
#view-draw[data-draw-layout="mobile"] .draw-info-rail {
  display: contents;
}
#view-draw[data-draw-layout="mobile"] .draw-piece {
  grid-area: piece;
  width: 100%;
  min-width: 0;
  gap: 5px;
  justify-self: start;
}
#view-draw[data-draw-layout="mobile"] .draw-piece-desktop {
  display: none;
}
#view-draw[data-draw-layout="mobile"] .draw-time {
  grid-area: time;
  width: 100%;
  justify-self: end;
}
#view-draw[data-draw-layout="mobile"] .draw-clock {
  font-size: 1.25rem;
}
#view-draw[data-draw-layout="mobile"] .draw-word {
  display: block;
  width: 100%;
  min-width: 0;
  font-size: clamp(1.15rem, 5.4vw, 1.45rem);
  line-height: 1.08;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  text-wrap: balance;
}
#view-draw[data-draw-layout="mobile"] .canvas-shell {
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#view-draw[data-draw-layout="mobile"] .canvas-shell::before {
  content: '';
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--piece-accent);
  pointer-events: none;
}
#view-draw[data-draw-layout="mobile"] #piece-canvas {
  border-radius: 0;
}
#view-draw[data-draw-layout="mobile"] > .draw-workspace { display: contents; }
#view-draw[data-draw-layout="mobile"] .draw-side-rail { display: contents; }
#view-draw[data-draw-layout="mobile"] .draw-tool-rail {
  gap: 8px;
  padding: 8px;
}
#view-draw[data-draw-layout="mobile"] .drawing-toolbar {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
#view-draw[data-draw-layout="mobile"] .palette-colors {
  grid-template-columns: repeat(5, minmax(44px, 56px));
  gap: 6px;
}
#view-draw[data-draw-layout="mobile"] .draw-tool-panel .palette-tools {
  display: contents;
}
#view-draw[data-draw-layout="mobile"] .draw-tool-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--icon-control) minmax(96px, 1.15fr);
  align-items: stretch;
  gap: 7px;
}
#view-draw[data-draw-layout="mobile"] .draw-tool-panel .width-group {
  grid-column: 1;
  gap: 6px;
}
#view-draw[data-draw-layout="mobile"] .draw-tool-panel .width-btn {
  min-height: var(--touch-min);
}
#view-draw[data-draw-layout="mobile"] .draw-tool-panel .btn-icon {
  grid-column: 2;
  min-height: var(--touch-min);
}
#view-draw[data-draw-layout="mobile"] .draw-tool-panel .btn-submit {
  grid-column: 3;
  min-height: var(--touch-min);
  padding: 5px 8px;
  font-size: clamp(0.88rem, 4vw, 1.05rem);
  line-height: 1.05;
  white-space: normal;
}
#view-draw[data-draw-layout="mobile"].submitted .draw-tool-panel {
  opacity: 0.4;
  pointer-events: none;
}

/* ── 담당 배치도(intro) · 미니맵(그리기) — 색 + 기호로 위치 안내 (§10) ── */
.intro-word {
  margin: 0;
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: clamp(1.45rem, 4vw, 2rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--fs-text-light);
  -webkit-text-stroke: 0.5px var(--fs-outline);
}
.view-intro:not(.guesser-mode):not([hidden]),
.view-intro.guesser-mode:not([hidden]) {
  min-height: min(480px, calc(100dvh - 170px));
  justify-content: center;
  gap: 0;
}
.intro-artist {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  width: min(100%, 620px);
  min-height: min(420px, calc(100dvh - 210px));
  margin-inline: auto;
}
.intro-artist[hidden] { display: none; }
.intro-artist-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: introInfoIn 200ms ease-out both;
}
.intro-artist-title {
  margin: 0;
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  line-height: 1.05;
  color: var(--fs-green-bright);
  -webkit-text-stroke: 1px var(--fs-outline);
}
.intro-assignment {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.intro-assignment[hidden] { display: none; }
.intro-assignment-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--fs-text-light);
  text-align: center;
}
.intro-assignment-title,
.intro-assignment-sub {
  margin: 0;
  font-size: clamp(1rem, 2.6vw, 1.2rem);
  font-weight: 900;
  line-height: 1.35;
}
.intro-assignment-sub { color: var(--fs-green-bright); }
.intro-order-number {
  display: inline-block;
  min-width: 1em;
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: 1.08em;
  line-height: 1;
  -webkit-text-stroke: 0.35px var(--fs-outline);
}
.intro-order-number.q-tl { color: var(--fs-green); }
.intro-order-number.q-tr { color: var(--fs-purple-bright); }
.intro-order-number.q-bl { color: var(--fs-blue); }
.intro-order-number.q-br { color: var(--fs-orange); }
.intro-assignment-copy[data-pieces="1"] .intro-assignment-sub {
  color: var(--fs-text-light);
}
.intro-artist[data-stage="assignment"] .intro-assignment {
  animation: introInfoIn 200ms ease-out both;
}
@keyframes introInfoIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.intro-guesser {
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  justify-items: center;
  align-items: center;
  width: min(100%, 620px);
  min-height: min(420px, calc(100dvh - 210px));
  margin-inline: auto;
}
.intro-guesser[hidden] { display: none; }
.intro-guesser-copy {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: introGuesserFadeIn 200ms ease-out both;
}
.intro-guesser-title {
  margin: 0;
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  line-height: 1.05;
  color: var(--fs-green-bright);
  -webkit-text-stroke: 1px var(--fs-outline);
}
.intro-guesser-sub {
  max-width: 620px;
  margin: 0;
  color: var(--fs-text-light);
  font-size: clamp(1rem, 2.4vw, 1.16rem);
  font-weight: 700;
  line-height: 1.65;
  text-align: center;
  white-space: pre-line;
}
.intro-artist-progress,
.intro-guesser-progress {
  width: min(360px, 70vw);
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.24);
}
.intro-guesser-progress {
  grid-row: 3;
  align-self: start;
  margin-top: 34px;
}
.intro-artist-progress-fill,
.intro-guesser-progress-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--fs-green-bright);
  transform: scaleX(0);
  transform-origin: left center;
}
@keyframes introGuesserFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.quad-map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  width: clamp(200px, 62vw, 300px);
  aspect-ratio: 1 / 1;
  margin: 4px auto 0;
}
/* hidden 속성이 display:grid에 지지 않게 — 술래 intro에서 배치도를 확실히 숨긴다 */
.quad-map[hidden] { display: none; }
.qm-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 3px solid var(--fs-outline);
  border-radius: 12px;
  background: rgba(255, 248, 234, 0.09);
  color: var(--fs-text-muted);
  opacity: 0.5; /* 남의 조각: 낮은 명도 (읽히되 우선순위 낮게) */
}
.qm-cell.mine { opacity: 1; color: var(--fs-text-dark); }
.qm-cell.q-tl.mine { background: var(--fs-green); }
.qm-cell.q-tr.mine { background: var(--fs-purple); color: var(--fs-text-light); }
.qm-cell.q-bl.mine { background: var(--fs-blue); color: var(--fs-text-light); }
.qm-cell.q-br.mine { background: var(--fs-orange); }
.qm-sym { font-size: 1.05rem; font-weight: 900; opacity: 0.85; }
/* 2조각 담당자 배치도의 그리는 순서 번호 (1,2) — 대각선 시작 순서 */
.qm-order {
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: 2.5rem;
  font-weight: 400;
  line-height: 1;
  padding: 4px 7px;
  border: 2px solid var(--fs-outline);
  border-radius: 10px;
  background: var(--fs-paper);
  box-shadow: 0 3px 0 var(--fs-outline);
  -webkit-text-stroke: 0;
}
.qm-cell.q-tl .qm-order { color: var(--fs-green); }
.qm-cell.q-tr .qm-order { color: var(--fs-purple); }
.qm-cell.q-bl .qm-order { color: var(--fs-blue); }
.qm-cell.q-br .qm-order { color: var(--fs-orange); }
.intro-assignment-map {
  width: min(190px, 46vw);
  margin-top: 0;
}
.intro-assignment-map .qm-sym { font-size: 2rem; }

/* 그리기 화면 미니맵 — 버튼처럼 보이지 않는 비조작 상태 표시. */
.quad-map-mini {
  width: clamp(48px, 12vw, 56px);
  gap: 2px;
  margin: 0;
  padding: 3px;
  border: 2px solid rgba(255, 248, 234, 0.28);
  border-radius: 9px;
  background: rgba(255, 248, 234, 0.08);
  flex-shrink: 0;
}
.quad-map-mini .qm-cell {
  border: 0;
  border-radius: 3px;
  opacity: 1;
  background: rgba(255, 248, 234, 0.15);
}
.quad-map-mini .qm-cell.active {
  opacity: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  animation: none;
}

#piece-canvas {
  background: #ffffff;
  border: var(--fs-border-default) solid var(--fs-outline);
  border-radius: 12px;
  box-shadow: 0 5px 0 rgba(9, 4, 15, 0.7);
  touch-action: none; /* 그리는 동안 스크롤·줌 차단 */
  max-width: 100%;
}

/* ── 제출 완료 대기 레이어 (담당 조각 전부 제출 후) ──
   내 그림은 어둡게 비쳐 계속 보이되, 캔버스 입력을 오버레이가 막는다(잠금). */
.draw-submitted {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(19, 8, 36, 0.58);
  color: var(--fs-text-light);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 0s linear 200ms;
}
.draw-submitted.on {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s, 0s;
  animation: submittedPop 200ms ease-out;
}
@keyframes submittedPop { 0% { transform: scale(0.95); } 100% { transform: scale(1); } }
.submitted-check {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; font-weight: 900;
  color: var(--fs-text-dark);
  background: var(--fs-green-bright);
  border: 3px solid var(--fs-outline);
  border-radius: 50%;
  box-shadow: 0 4px 0 var(--fs-outline);
}
.submitted-sub { margin: 0; color: var(--fs-text-muted); font-size: 0.92rem; }
.draw-artists {
  list-style: none; margin: 6px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
  width: 100%; max-width: 240px;
}
.draw-artists li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.9rem; font-weight: 700;
  background: rgba(255, 248, 234, 0.1);
  color: var(--fs-text-muted);
}
.draw-artists li.done { color: var(--fs-text-light); }
.draw-artists li.you { background: rgba(158, 203, 18, 0.22); color: var(--fs-text-light); }
.draw-artists .as-state { font-weight: 900; flex-shrink: 0; }
.draw-artists li.done .as-state { color: var(--fs-success); }

/* 제출 완료 상태: 작화 컨트롤 잠금 (시각 흐림 + 입력 차단). 제출 버튼은 숨김. */
.view-draw.submitted .palette-colors,
.view-draw.submitted .palette-tools { opacity: 0.4; pointer-events: none; }
.view-draw.submitted .btn-submit { display: none; }

@media (prefers-reduced-motion: reduce) {
  .draw-submitted.on { animation: none; }
}

.palette-colors {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.swatch {
  height: 46px;
  border-radius: 12px;
  border: 3px solid var(--fs-outline);
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
  box-shadow: 0 3px 0 rgba(9, 4, 15, 0.6);
  transition: box-shadow var(--fs-motion-fast), transform var(--fs-motion-fast);
}
.swatch:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(9, 4, 15, 0.6); }
.swatch.selected {
  box-shadow: 0 0 0 3px var(--fs-bg-deep), 0 0 0 6px var(--fs-warning), 0 3px 0 rgba(9, 4, 15, 0.6);
}

.palette-tools { display: flex; gap: 10px; align-items: stretch; }
.width-group { display: flex; gap: 8px; flex: 1; }
.width-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fs-paper);
  border: 3px solid var(--fs-outline);
  border-radius: 12px;
  cursor: pointer;
  min-height: 48px;
  touch-action: manipulation;
  box-shadow: 0 3px 0 rgba(9, 4, 15, 0.6);
  transition: box-shadow var(--fs-motion-fast), transform var(--fs-motion-fast);
}
.width-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(9, 4, 15, 0.6); }
.width-btn.selected { border-color: var(--fs-purple); background: #efe4ff; }
.width-btn .dot { border-radius: 50%; background: var(--fs-outline); }
.btn-tool { flex: 1; min-height: 48px; padding: 10px 14px; font-size: 1rem; }
.btn-submit { margin-top: 2px; }

/* ── 술래 대기: 공통 헤더의 라운드 + 중앙 숫자 시간·4분면 진행·안내 한 줄 ── */
#view-blind:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding-top: 0;
  text-align: center;
}
.blind-timer {
  margin: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--fs-text-light);
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: clamp(1.8rem, 5vw, 2.25rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.blind-sub {
  max-width: min(100%, 420px);
  margin: 0;
  color: var(--fs-text-muted);
  font-size: 1rem;
  font-weight: 700;
}

.assemble-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px; /* 얇은 십자 경계 */
  /* client.js가 리빌 캔버스와 같은 세로·가로 예산으로 실제 표시 폭을 전달한다. */
  width: min(100%, var(--reveal-w, var(--canvas-max)));
  /* @decision D-072 — 합체본은 정사각 1:1을 유지한다. */
  aspect-ratio: 1 / 1;
  padding: 6px;
  border-radius: 20px;
  background: rgba(9, 4, 15, 0.35);
  box-shadow: inset 0 0 0 2px rgba(255, 248, 234, 0.06);
}
.asm-slot {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 248, 234, 0.05); /* 빈 = 어두운 패치 실루엣 */
  outline: 2px dashed rgba(255, 248, 234, 0.16); /* 점선 스티치 경계 */
  outline-offset: -5px;
  transition: outline-color var(--fs-motion-default);
}
/* 이미지 로드 실패 대비 CSS 색상 fallback — 완료 칸은 분면색이 은은히 남는다 */
.asm-tl.filled { background: color-mix(in srgb, var(--fs-green) 34%, #1a0f2e); }
.asm-tr.filled { background: color-mix(in srgb, var(--fs-purple) 34%, #1a0f2e); }
.asm-bl.filled { background: color-mix(in srgb, var(--fs-blue) 34%, #1a0f2e); }
.asm-br.filled { background: color-mix(in srgb, var(--fs-orange) 34%, #1a0f2e); }
.asm-piece {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 200ms ease-out, transform 220ms cubic-bezier(0.22, 1.4, 0.4, 1);
}
.asm-slot.filled { outline-color: transparent; }
.asm-slot.filled .asm-piece { opacity: 1; transform: scale(1); }
/* 채워지는 순간 짧은 스파크 (한 번) */
.asm-slot.filled::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.85), rgba(184, 100, 203, 0) 55%);
  opacity: 0;
  pointer-events: none;
  animation: asmSpark 340ms ease-out;
}
@keyframes asmSpark { 0% { opacity: 0; transform: scale(0.4); } 30% { opacity: 0.7; } 100% { opacity: 0; transform: scale(1.15); } }

/* 전원 제출 완료 전환 — 짧은 플래시 뒤 실제 합체 그림을 바로 공개한다. */
.blind-finish {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.bf-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, #ffffff, #b864cb 70%);
  opacity: 0;
}
.blind-finish.flash .bf-flash { animation: bfFlash 190ms ease-out; }
@keyframes bfFlash { 0% { opacity: 0; } 35% { opacity: 0.92; } 100% { opacity: 0; } }
@keyframes bfFlashWeak { 0% { opacity: 0; } 50% { opacity: 0.32; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .asm-piece, .asm-slot.filled .asm-piece { transform: none !important; animation: none; }
  .asm-slot.filled::after { animation: none; }
  .blind-finish.flash .bf-flash { animation: bfFlashWeak 220ms ease-out; }
}

/* ── 합체 리빌 → 결과 (장식 100→75%) ── */

#view-reveal.verdict-mode .reveal-question { display: none; }
.reveal-stage {
  position: relative;
  box-sizing: border-box;
  width: min(100%, var(--reveal-stage-w, var(--canvas-max)));
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: var(--fs-border-brand) solid var(--fs-outline);
  border-radius: var(--fs-radius-md);
  box-shadow: var(--fs-shadow-card);
  line-height: 0;
}
#reveal-canvas {
  display: block;
  width: 100% !important;
  /* Safari는 aspect-ratio+border 부모 안의 100% 높이를 border-box 기준으로
     계산해 overflow:hidden에서 캔버스 하단을 자를 수 있다. 정사각 backing
     store의 고유 비율로 높이를 계산하면 위·아래 이름표 여백이 같아진다. */
  height: auto !important;
  max-width: none;
  aspect-ratio: 1 / 1;
  background: #ffffff;
}

/* Guesser Active Guess와 Desktop Verdict에서는 오른쪽 제어·결과 열로 재사용한다.
   Observer는 이 열을 예약하지 않고 캔버스 아래의 compact 상태 바로 바꾼다. */
.reveal-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  /* client.js가 화면 높이까지 반영한 실제 합체 캔버스 폭을 전달한다. */
  width: min(100%, var(--reveal-w, var(--canvas-max)));
  max-width: 100%;
  margin-inline: auto;
}
.reveal-side > * { width: 100%; }
.reveal-side .lobby-hint, .reveal-side .btn-ghost { width: auto; }

/* 실제 합체본을 처음 공개하는 짧은 반응 구간에는 그림만 남긴다.
   관전자는 질문 대상이 아니므로 Active Guess에서도 질문 카드를 반복하지 않는다. */
#view-reveal.reaction-mode .reveal-question,
#view-reveal.reaction-mode .reveal-side,
#view-reveal.observer-mode .reveal-question { display: none; }

.guess-timer {
  width: 100%;
  min-height: var(--control-height);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: rgba(17, 6, 31, 0.72);
  color: var(--fs-text-light);
}
.guess-timer[hidden] { display: none; }
.guess-action-timer:not([hidden]) { display: none; }
.guess-timer-copy {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0;
  margin: 0;
  font-size: 0.86rem;
  font-weight: 800;
}
.guess-timer-value {
  color: var(--fs-green);
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: clamp(1.4rem, 2.2vw, 1.75rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* 최종 추측 (장식 55%) */
.pick-form {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}
.pick-form.fs-stitch { max-width: none; }
.pick-form[hidden] { display: none; }
.pick-action-row { display: contents; }
.pick-form, #pick-input, #btn-pick { scroll-margin-bottom: 32vh; }
#pick-status:not([hidden])::after {
  content: '…';
  display: inline-block;
  width: 1.2em;
  overflow: hidden;
  vertical-align: bottom;
  animation: thinkingDots 1.2s steps(4, end) infinite;
}
@keyframes thinkingDots { from { width: 0; } to { width: 1.2em; } }
/* 결과 카드 (장식 75%) */
.verdict-area {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}
.verdict-area[hidden] { display: none; }
.verdict-area #return-hint {
  color: var(--fs-text-muted-on-paper);
}
.verdict-area #btn-return {
  background: transparent;
  color: var(--fs-text-dark);
  border-color: var(--fs-outline);
}
.verdict-area #btn-return:hover {
  background: var(--fs-paper-warm);
}
.verdict-area #btn-return:disabled {
  background: transparent;
  color: var(--fs-text-muted-on-paper);
  border-color: var(--fs-outline-soft);
  opacity: 0.7;
}
.verdict-answer {
  position: relative;
  margin: 0;
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  color: var(--fs-text-dark);
  opacity: 0;
  transform: scale(0.8);
}
.verdict-answer b { color: var(--fs-green); }
.verdict-answer::after {
  content: '⚡';
  display: inline-block;
  margin-left: 8px;
  opacity: 0;
}
.verdict-pick {
  position: relative;
  margin: 0;
  padding: 15px 16px;
  background: #fff;
  border: 3px solid var(--fs-outline);
  border-radius: var(--fs-radius-md);
  box-shadow: 0 4px 0 var(--fs-outline);
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--fs-text-dark);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 260ms cubic-bezier(0.22, 1.2, 0.4, 1);
}
.verdict-pick::after {
  content: '';
  position: absolute;
  left: 24px;
  bottom: -11px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-right: 3px solid var(--fs-outline);
  border-bottom: 3px solid var(--fs-outline);
  transform: rotate(45deg);
}
.verdict-area.show-pick .verdict-pick { opacity: 1; transform: translateY(0); }
.verdict-area.show-answer .verdict-answer {
  opacity: 1;
  transform: scale(1);
  animation: verdictAnswerPop 440ms cubic-bezier(0.22, 1.4, 0.4, 1);
}
.verdict-area.show-answer .verdict-answer::after { opacity: 1; animation: pop 360ms ease-out; }
.verdict-area:not(.show-answer) > .verdict-progress-actions { opacity: 0; pointer-events: none; }
.verdict-progress-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.verdict-progress-actions .btn {
  width: 100%;
  min-width: 0;
}
.next-round-hint { margin: 0; color: #6b6270; font-size: 0.92rem; font-weight: 800; }
.next-round-hint[hidden] { display: none; }
@keyframes verdictAnswerPop { 0% { opacity: 0; transform: scale(0.7); } 100% { opacity: 1; transform: scale(1); } }

a.btn { text-align: center; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

/* ── 애니메이션 ────────────────────── */

@keyframes pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* 타이머 경고: 마지막 3초 숫자만 약하게 강조한다. */
@keyframes timerClockPulse {
  50% { transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
  .btn:hover, .btn:active { transform: none; }
  .draw-clock.warn,
  .guess-timer.warn .guess-timer-value { animation: none !important; }
  #pick-status:not([hidden])::after { animation: none !important; }
}

/* ── 언어 선택기 ────────────────────── */
/* Game Stage 브랜드 lockup의 우측 열에서 화면 전환에도 같은 위치를 유지한다. */
.language-picker { position: relative; z-index: 1000; width: 70px; max-width: 70px; }
.lang-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-width: 70px;
  padding: 7px 8px;
  background: var(--fs-paper);
  border: var(--fs-border-default) solid var(--fs-outline);
  border-radius: 999px;
  box-shadow: var(--fs-shadow-button);
  cursor: pointer;
  color: var(--fs-text-dark);
  font-family: 'Lilita One', 'Black Han Sans', 'Hiragino Sans', 'Yu Gothic UI',
    'Noto Sans Thai', 'Thonburi', Tahoma, system-ui, sans-serif;
  font-size: 0.86rem;
  line-height: 1.15;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}
.lang-globe {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lang-toggle #lang-current { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-toggle:active { transform: translateY(2px); box-shadow: 0 2px 0 #09040f; }
.lang-toggle:focus-visible { outline: 3px solid var(--fs-info); outline-offset: 2px; }
.lang-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  width: min(270px, calc(100vw - 40px));
  max-height: min(62vh, 460px);
  overflow: auto;
  padding: 7px;
  border: var(--fs-border-default) solid var(--fs-outline);
  border-radius: 16px;
  background: var(--fs-paper);
  box-shadow: var(--fs-shadow-card);
}
.lang-menu[hidden] { display: none; }
.lang-menu [role="option"] {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--fs-text-dark);
  font: 800 0.95rem/1.2 Inter, 'Hiragino Sans', 'Yu Gothic UI', 'Noto Sans Thai',
    'Thonburi', Tahoma, system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
}
.lang-menu [role="option"]:hover,
.lang-menu [role="option"]:focus-visible { background: rgba(144, 57, 187, 0.14); outline: none; }
.lang-menu [role="option"].active { background: var(--fs-purple); color: var(--fs-text-light); }
/* 브랜드 lockup 안에 있어 작화 중에도 같은 위치를 유지한다. */

/* ── 초대 링크 (로비) ─────────────────── */
.copy-status {
  margin: 8px 0 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--fs-success);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 150ms ease, transform 150ms ease;
}
.copy-status.show { opacity: 1; transform: translateY(0); }
#btn-share-invite.copied { background: var(--fs-success); color: var(--fs-text-dark); }
.invite-url {
  width: 100%;
  margin-top: 8px;
  font-size: 0.82rem;
  text-align: center;
}
/* [hidden]는 다른 display 규칙에 질 수 있어 명시적으로 눌러둔다 */
.copy-status[hidden], .invite-url[hidden] { display: none; }

/* 초대 링크(?room=CODE)로 온 홈은 일반 레이아웃 그대로 — 코드만 pre-fill(보이게).
   방 만석·진행중·종료 시 코드를 바꿔 다른 방 입장하거나 새 방 생성 회복 경로 유지.
   (별도 초대 모드 레이아웃 없음 — 코드 입력란 숨김·Create 강등을 걷어냄) */

/* ── 결과 뷰어 (종료 화면) — 임시 UI. 카드 자체 디자인은 results.js가 소유 ── */
.result-viewer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: stretch;
  align-items: center;
}
.result-viewer[hidden] { display: none; }
/* @decision D-181 D-218 D-222 — 현재 Wrap의 최대 다섯 라운드 탭을 결과 폭 안에
   모두 표시하고, JS가 Canvas와 같은 계산 폭을 직접 전달한다. */
.result-tabs {
  --result-tab-count: 3;
  display: grid;
  grid-template-columns: repeat(var(--result-tab-count), minmax(44px, 1fr));
  gap: 6px;
  align-self: center;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;
}
.result-tabs .btn {
  width: 100%;
  min-width: 44px;
  min-height: 49px;
  padding: 8px 4px;
  border-bottom-width: 8px;
  box-shadow: none;
  font-size: clamp(0.82rem, 3.6vw, 0.95rem);
  line-height: 1;
  letter-spacing: 0.02em;
}
.result-tabs .btn:hover,
.result-tabs .btn:active,
.result-tabs .btn:disabled { box-shadow: none; }
.result-tabs .btn.selected {
  background: var(--fs-purple);
  color: var(--fs-text-light);
}
#result-canvas {
  max-width: 100%;
  background: #ffffff;
  border: var(--fs-border-default) solid var(--fs-outline);
  border-radius: var(--fs-radius-sm);
}

/* ── Common Stage modes ────────────────────────────────────────────
   Desktop owns one 1180×780 logical stage; mobile owns one portrait flow. */
.view,
.home-cols,
.home-panel,
.home-tutorial,
.lobby-left,
.lobby-player-panel,
.reveal-stage,
.reveal-side,
.result-viewer,
.finished-side { min-width: 0; }

body[data-layout-mode="desktop"] {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body[data-layout-mode="desktop"] .app {
  position: fixed;
  top: var(--game-stage-top);
  left: 50%;
  width: var(--game-stage-width);
  max-width: none;
  height: var(--game-stage-height);
  margin: 0;
  transform: translateX(-50%) scale(var(--game-stage-scale));
  transform-origin: top center;
}
body[data-layout-mode="desktop"] .stage-brand-inner {
  min-height: var(--game-active-header-height);
  height: var(--game-active-header-height);
  padding: var(--game-header-pad-top) var(--game-stage-pad) 0;
}
body[data-layout-mode="desktop"] .stage-content {
  display: flex;
  flex-direction: column;
  height: calc(var(--game-stage-height) - var(--game-active-header-height) - (2 * var(--fs-border-default)));
  padding: 13px var(--game-stage-pad);
  overflow: hidden;
}
body[data-layout-mode="desktop"] .view:not([hidden]) { height: 100%; }

body[data-layout-mode="desktop"][data-view="home"] .stage-brand-inner {
  min-height: var(--home-brand-band);
  height: var(--home-brand-band);
  padding: 18px var(--game-stage-pad) 12px;
}
body[data-layout-mode="desktop"][data-view="home"] .stage-content {
  height: calc(var(--game-stage-height) - var(--home-brand-band) - (2 * var(--fs-border-default)));
  padding: 0 var(--game-stage-pad) 12px;
}
body[data-layout-mode="desktop"][data-view="home"] .app-logo {
  width: auto;
  max-width: min(150px, 52vw);
  height: var(--home-logo-height);
  max-height: var(--home-logo-height);
}
body[data-layout-mode="desktop"][data-view="home"] .brand-lockup { gap: 2px; }
body[data-layout-mode="desktop"][data-view="home"] .tagline {
  max-width: 640px;
  font-size: 1rem;
  line-height: 1.1;
  white-space: nowrap;
}
body[data-layout-mode="desktop"][data-view="home"] .language-picker {
  align-self: start;
  margin-top: 2px;
}
body[data-layout-mode="desktop"][data-view="home"] #view-home {
  display: grid;
  grid-template-rows: var(--home-main-height) var(--home-footer-height);
  align-content: center;
  gap: var(--home-section-gap);
}

body[data-layout-mode="mobile"] {
  --layout-outer-pad: 12px;
  --layout-card-pad: 16px;
  --layout-card-max: 480px;
  --layout-canvas-max: 380px;
  --layout-gap-lg: 16px;
  display: block;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
}
body[data-layout-mode="mobile"] .app {
  position: relative;
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  margin: 0;
  overflow: visible;
  background: var(--fs-bg-raised);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: none;
}
body[data-layout-mode="mobile"][data-view="home"] .app {
  display: flex;
  flex-direction: column;
}
body[data-layout-mode="mobile"][data-view="home"] .stage-content {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}
body[data-layout-mode="mobile"][data-view="home"] #view-home {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  min-height: 0;
}
body[data-layout-mode="mobile"] .stage-brand-inner {
  grid-template-columns: minmax(0, 1fr) minmax(90px, 118px) minmax(0, 1fr);
  min-height: 60px;
  padding: 8px 10px 2px;
  gap: 4px;
}
body[data-layout-mode="mobile"] .round-badge {
  max-width: 100%;
  padding-inline: 7px;
  font-size: 0.78rem;
}
body[data-layout-mode="mobile"] .app-logo {
  width: auto;
  max-width: min(76px, 100%);
  height: 48px;
}
body[data-layout-mode="mobile"][data-view="home"] .stage-brand-inner {
  grid-template-columns: 70px minmax(0, 1fr) 70px;
  min-height: 112px;
  padding-top: 10px;
}
body[data-layout-mode="mobile"][data-view="home"] .brand-lockup {
  transform: translateY(8px);
}
body[data-layout-mode="mobile"][data-view="home"] .app-logo {
  width: auto;
  max-width: min(108px, 100%);
  height: 86px;
}
body[data-layout-mode="mobile"] .stage-brand .tagline {
  width: min(100%, 220px);
  font-size: 0.84rem;
  line-height: 1.12;
}
body[data-layout-mode="mobile"] .stage-brand .language-picker {
  width: 70px;
  min-width: 70px;
  max-width: 70px;
}
body[data-layout-mode="mobile"] .stage-brand .lang-toggle {
  width: 100%;
  min-width: 70px;
  min-height: var(--touch-min);
  padding-inline: 7px;
}
body[data-layout-mode="mobile"] #lang-current {
  font-size: 0.7rem;
  line-height: 1;
  white-space: nowrap;
}
body[data-layout-mode="mobile"] .stage-brand .round-badge {
  max-width: 96px;
  padding: 5px 7px;
  font-size: 0.74rem;
}

/* Active drawing uses the stable small viewport as the workbench. Browser bars may resize
   visualViewport, but they must not resize the app or create an outer-page scrollbar. */
body[data-layout-mode="mobile"][data-view="draw"] {
  height: 100vh;
  height: 100svh;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
}
body[data-layout-mode="mobile"][data-view="draw"] .app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
body[data-layout-mode="mobile"][data-view="draw"] .stage-brand-inner {
  display: none;
}
body[data-layout-mode="mobile"][data-view="draw"] .stage-content {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 env(safe-area-inset-right) calc(10px + env(safe-area-inset-bottom))
    env(safe-area-inset-left);
  overflow: hidden;
}
body[data-layout-mode="mobile"][data-view="draw"] #view-draw:not([hidden]) {
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}
body[data-layout-mode="mobile"][data-view="draw"] #view-draw::-webkit-scrollbar {
  display: none;
}

/* Mobile Home keeps the shared session header: no left utility button, centered logo,
   and the compact language control on the right. The role intros and Lobby teach the
   game, so Home keeps only entry and low-priority footer utilities on small screens. */
body[data-layout-mode="mobile"][data-view="home"] .tagline { display: none; }
body[data-layout-mode="mobile"][data-view="home"] .home-tutorial-overlay { display: none; }
body[data-layout-mode="mobile"][data-view="home"] #view-home .home-panel {
  width: min(100%, var(--layout-card-max));
  margin-inline: auto;
  padding: 18px 16px;
  align-self: center;
}
body[data-layout-mode="mobile"][data-view="home"] .home-cols {
  flex: 0 0 auto;
  margin-top: auto;
}
body[data-layout-mode="mobile"][data-view="home"] .home-entry-actions {
  width: 100%;
  gap: 12px;
}
body[data-layout-mode="mobile"][data-view="home"] .home-footer {
  flex: 0 0 auto;
  width: min(100%, var(--layout-card-max));
  margin: auto auto 0;
  padding: 4px 4px calc(2px + env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  text-align: center;
}
body[data-layout-mode="mobile"][data-view="home"] .home-footer-discord {
  flex: 0 0 44px;
  width: 44px;
  min-height: 44px;
}
body[data-layout-mode="mobile"][data-view="home"] .home-footer-links {
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 8px;
  overflow: visible;
  white-space: normal;
  font-size: clamp(0.56rem, 2.4vw, 0.72rem);
  text-align: center;
}
body[data-layout-mode="mobile"][data-view="home"] .home-footer-links a {
  min-height: 44px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
body[data-layout-mode="mobile"][data-view="home"] .home-footer-delete {
  min-height: 44px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
body[data-layout-mode="mobile"][data-view="home"] .home-footer-links li + li::before {
  content: none;
}

/* Two-panel */
body[data-layout-mode="mobile"] .home-cols,
body[data-layout-mode="mobile"] #view-lobby,
body[data-layout-mode="mobile"] #view-finished {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--layout-gap-lg);
}
body[data-layout-mode="mobile"] .home-cols > *,
body[data-layout-mode="mobile"] #view-lobby > *,
body[data-layout-mode="mobile"] #view-finished > * {
  width: min(100%, var(--layout-card-max));
  height: auto;
  min-height: 0;
  align-self: center;
}
body[data-layout-mode="mobile"] #view-home .home-cols > * {
  width: min(100%, var(--layout-card-max));
}
body[data-layout-mode="mobile"] #view-home .home-entry-actions { width: 100%; }
body[data-layout-mode="mobile"] #view-home .join-row { gap: 8px; }
body[data-layout-mode="mobile"] #view-home .join-row .btn,
body[data-layout-mode="mobile"] #view-home .home-panel.invite-active .join-row .btn {
  min-width: 96px;
  padding-inline: 10px;
}
body[data-layout-mode="mobile"] #view-home #input-code {
  min-width: 0;
  padding-inline: 8px;
  letter-spacing: 0.18em;
}
body[data-layout-mode="mobile"] #view-home .home-tutorial-title {
  padding: 16px 16px 8px;
}
body[data-layout-mode="mobile"] #home-tutorial .tutorial-controls {
  grid-template-columns: 44px minmax(176px, 1fr) 44px;
  gap: 0;
  padding-inline: 0;
}
body[data-layout-mode="mobile"] #home-tutorial .tutorial-dots {
  justify-self: stretch;
  justify-content: center;
}
body[data-layout-mode="mobile"] .vside { gap: 10px; }
body[data-layout-mode="mobile"] #view-lobby .player-list { gap: 6px; }
body[data-layout-mode="mobile"] #view-lobby .player-list li.empty { display: none; }
body[data-layout-mode="mobile"] #view-lobby > .lobby-left { display: contents; }
body[data-layout-mode="mobile"] #view-lobby > .lobby-left.fs-stitch::before { display: none; }
body[data-layout-mode="mobile"] #view-lobby .lobby-invite-section,
body[data-layout-mode="mobile"] #view-lobby .lobby-player-panel {
  width: min(100%, var(--layout-card-max));
  height: auto;
  min-height: 0;
  align-self: center;
}
body[data-layout-mode="mobile"] #view-lobby .lobby-invite-section { order: 1; }
body[data-layout-mode="mobile"] #view-lobby .lobby-player-panel { order: 2; }
body[data-layout-mode="mobile"] #view-lobby .lobby-how-to-button {
  --stitch-card-width: min(100%, var(--layout-card-max));
  --stitch-card-min-height: 56px;
  display: block;
  order: 3;
  height: auto;
  align-self: center;
}
body[data-layout-mode="mobile"] #view-lobby .lobby-invite-section {
  position: relative;
  padding: 14px 16px 16px;
  overflow: hidden;
  border: var(--fs-border-default) solid var(--fs-outline);
  border-radius: var(--fs-radius-lg);
  background: var(--fs-paper);
  box-shadow: var(--fs-shadow-card);
}
body[data-layout-mode="mobile"] #view-lobby .lobby-invite-section::before { display: block; }
body[data-layout-mode="mobile"] #view-lobby .lobby-invite-section { border-bottom-style: solid; }
body[data-layout-mode="mobile"] #view-lobby .room-code {
  margin-block: 0 2px;
  font-size: 2rem;
  letter-spacing: 0.12em;
  text-indent: 0.12em;
}
body[data-layout-mode="mobile"] #view-lobby .code-panel .lobby-hint { font-size: 0.78rem; }
body[data-layout-mode="mobile"] #view-lobby .player-list li { padding: 8px 12px 8px 16px; }
/* @decision D-203 D-204 — Mobile Lobby만 인라인 튜토리얼 카드를 한 줄
   진입점과 로비 폭 카드형 모달로 바꾼다. Desktop의 D-154 인라인 영역은 그대로다. */
body.lobby-sheet-open { overflow: hidden; }
.lobby-sheet-overlay { display: contents; }
.lobby-sheet-overlay[hidden] { display: none; }
.lobby-sheet-header,
.lobby-how-to-button { display: none; }
/* 진입 애니메이션의 transform은 fixed 모달의 containing block을 로비 카드로
   바꾼다. 모달이 열릴 때만 모든 animated ancestor를 viewport 기준으로 복원한다. */
body[data-layout-mode="mobile"].lobby-sheet-open #view-lobby,
body[data-layout-mode="mobile"].lobby-sheet-open #view-lobby > .lobby-left {
  animation: none;
  transform: none;
}
body[data-layout-mode="mobile"] #view-lobby .lobby-sheet-overlay {
  position: fixed;
  z-index: 1200;
  inset: 0;
  display: grid;
  place-items: center;
  width: auto;
  height: 100vh;
  height: 100dvh;
  padding:
    max(var(--layout-outer-pad), env(safe-area-inset-top))
    max(var(--stage-pad), env(safe-area-inset-right))
    max(var(--layout-outer-pad), env(safe-area-inset-bottom))
    max(var(--stage-pad), env(safe-area-inset-left));
  overflow: hidden;
  background: rgba(9, 4, 15, 0.76);
  backdrop-filter: blur(4px);
}
body[data-layout-mode="mobile"] #view-lobby .lobby-sheet-overlay[hidden] {
  display: none;
}
body[data-layout-mode="mobile"] #view-lobby .lobby-tutorial-panel {
  position: relative;
  display: block;
  width: min(100%, var(--layout-card-max));
  max-width: none;
  height: auto;
  max-height: 100%;
  min-height: 0;
  padding: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: var(--fs-border-default) solid var(--fs-outline);
  border-radius: var(--fs-radius-lg);
  background: var(--fs-paper);
  box-shadow: var(--fs-shadow-card);
}
body[data-layout-mode="mobile"] #view-lobby .lobby-tutorial-panel::before {
  display: block;
}
/* @decision D-203 D-204 — 모달 제목과 닫기를 한 헤더 줄이 소유한다. 떠 있는 닫기 버튼은
   실밥(inset 7px) 위에 앉고 제목 자리를 빈 여백으로 남겨 카드에 속하지 않아 보였다. */
body[data-layout-mode="mobile"] #view-lobby .lobby-sheet-header {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-bottom: 8px;
  padding-left: 8px;
}
/* 제목은 접근성 이름을 겸하므로 320px의 긴 locale에서도 잘라내지 않고 줄바꿈한다.
   `lobby.qrAria`는 스페인어에서 33자까지 길어진다. */
body[data-layout-mode="mobile"] #view-lobby .lobby-sheet-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
body[data-layout-mode="mobile"] #view-lobby .lobby-sheet-close {
  z-index: 2;
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  font-family: Inter, system-ui, sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}
body[data-layout-mode="mobile"] #view-lobby .lobby-tutorial-stage {
  /* Keep the purple content surface inside the stitched paper card. Eight-pixel panel padding
     still leaves exactly enough room for six adjacent 44px controls at the 320px baseline. */
  width: 100%;
  margin-inline: 0;
  align-self: stretch;
}
body[data-layout-mode="mobile"] #view-lobby .lobby-qr-panel {
  min-height: 0;
}
body[data-layout-mode="mobile"] #view-lobby .lobby-qr-close { display: none; }
body[data-layout-mode="mobile"] #view-finished .finished-side {
  align-items: stretch;
  text-align: center;
}
body[data-layout-mode="mobile"] #view-finished .finished-sketch-icon {
  display: none;
}

body[data-layout-mode="desktop"] .home-cols,
body[data-layout-mode="desktop"] #view-lobby,
body[data-layout-mode="desktop"] #view-finished {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: var(--layout-gap-lg);
  width: 100%;
  height: 100%;
}
/* @decision D-150 D-151 — 내부 행동 위계와 공통 외곽 셸의 소유권을 분리한다.
   주요 행동(방 만들기·입장) 카드가 보조 설명(게임 방법) 카드보다 커야 한다.
   56:44는 보조 카드가 더 커서 시선이 분산되고 좁아진 입장 카드가 먼저 끝난다.
   D-150의 내부 42:58 행동 위계는 유지한다.
   외곽 데스크톱 셸은 D-151의 공통 1180×780 계약을 따른다. */
body[data-layout-mode="desktop"] #view-home .home-cols {
  grid-template-columns: minmax(0, 42fr) minmax(0, 58fr);
  gap: var(--layout-gap-lg);
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  align-self: stretch;
}
body[data-layout-mode="desktop"] #view-lobby {
  height: min(100%, 640px);
  max-height: 640px;
  margin-block: auto;
  align-self: center;
}
body[data-layout-mode="desktop"][data-view="lobby"] {
  --game-active-header-height: 78px;
  --game-header-pad-top: 14px;
}
body[data-layout-mode="desktop"][data-view="lobby"] .app-logo {
  height: 62px;
  max-width: min(92px, 46vw);
}
body[data-layout-mode="desktop"] .home-cols > *,
body[data-layout-mode="desktop"] #view-lobby > *,
body[data-layout-mode="desktop"] #view-finished > * {
  width: 100%;
  height: 100%;
  min-height: 0;
  align-self: stretch;
}
body[data-layout-mode="desktop"] #view-home .home-tutorial {
  order: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  align-self: stretch;
}
body[data-layout-mode="desktop"] #view-home .home-panel {
  order: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  align-self: stretch;
  overflow: hidden;
}
/* 방 카드의 요소 스케일. 폼 컨트롤이 본문과 같은 크기면 카드가 넓어져도 밀도가 안 생기고
   "얇은 띠"처럼 읽힌다. 입력은 본문의 약 1.6배로 키우고, 주 버튼은 폭보다 두께를 준다.
   내용 그룹을 세로로 고르게 분산해 카드 하단이 비지 않게 한다. */
body[data-layout-mode="desktop"] #view-home .home-entry-actions {
  height: auto;
  max-height: 100%;
  margin-block: auto;
  padding: 4px;
  justify-content: flex-start;
  gap: clamp(14px, 1.8dvh, 22px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
/* 초대·오류는 폼에 실제 행을 추가한다. 고정 Landing 카드 안에서 글자와 44px
   터치 목표를 유지하되, 선택적 여백과 큰 기본 컨트롤부터 줄인다. 아주 긴 번역이나
   복합 오류만 위의 내부 스크롤 안전망을 사용하고 카드 밖으로 그리지 않는다. */
body[data-layout-mode="desktop"] #view-home .home-panel:is(.invite-active, .home-notice-active) {
  padding-block: 14px;
}
body[data-layout-mode="desktop"] #view-home .home-panel:is(.invite-active, .home-notice-active) .home-entry-actions {
  gap: 9px;
}
body[data-layout-mode="desktop"] #view-home .home-panel:is(.invite-active, .home-notice-active) .invite-banner {
  padding: 8px 12px;
  font-size: 1rem;
  line-height: 1.2;
}
body[data-layout-mode="desktop"] #view-home .field > span {
  font-size: 1.02rem;
  letter-spacing: 0.02em;
}
body[data-layout-mode="desktop"] #view-home #input-name {
  height: 62px;
  font-size: 1.6rem;
  text-align: center;
}
body[data-layout-mode="desktop"] #view-home #btn-create {
  min-height: 64px;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
}
body[data-layout-mode="desktop"] #view-home #input-code {
  height: 58px;
  font-size: 1.5rem;
  letter-spacing: 0.28em;
}
body[data-layout-mode="desktop"] #view-home #btn-join {
  min-height: 58px;
  font-size: 1.12rem;
  padding-inline: 22px;
}
body[data-layout-mode="desktop"] #view-home .home-panel:is(.invite-active, .home-notice-active) #input-name,
body[data-layout-mode="desktop"] #view-home .home-panel:is(.invite-active, .home-notice-active) #input-code {
  height: 52px;
}
body[data-layout-mode="desktop"] #view-home .home-panel:is(.invite-active, .home-notice-active) #btn-create,
body[data-layout-mode="desktop"] #view-home .home-panel:is(.invite-active, .home-notice-active) #btn-join {
  min-height: 52px;
}
body[data-layout-mode="desktop"] #view-finished {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.78fr);
  align-items: center;
}
body[data-layout-mode="desktop"] #view-finished #result-viewer {
  align-self: stretch;
  justify-content: center;
}
body[data-layout-mode="desktop"] #view-finished .finished-side {
  align-self: center;
  justify-self: stretch;
  justify-content: center;
  align-items: stretch;
  min-height: 560px;
  max-height: 100%;
  padding-block: 20px;
  text-align: center;
}
body[data-layout-mode="desktop"] #view-finished .finished-sketch-icon { margin-inline: auto; }

/* Focus: 역할 인트로와 술래 대기는 하나의 읽기 중심 폭을 공유한다. */
#view-intro,
#view-blind {
  width: min(100%, var(--layout-content-max));
  margin-inline: auto;
  justify-content: center;
}
body[data-layout-mode="desktop"] #view-intro,
body[data-layout-mode="desktop"] #view-blind { min-height: 100%; }
body[data-layout-mode="mobile"] #view-intro,
body[data-layout-mode="mobile"] #view-blind {
  min-height: min(440px, calc(100dvh - var(--layout-header-height) - (2 * var(--stage-pad))));
}

/* Reveal */
/* @decision D-228 — Reaction·술래·관전자·Verdict는 헤더 표시 여부와 무관하게
   같은 Mobile inline inset을 사용하고 세로 scrollbar가 inline gutter를 예약하지
   않게 해 합체 그림의 바깥 폭을 유지한다. 스크롤 동작 자체는 보존한다. */
html:has(body[data-layout-mode="mobile"][data-view="reveal"]),
body[data-layout-mode="mobile"][data-view="reveal"] {
  scrollbar-width: none;
}
html:has(body[data-layout-mode="mobile"][data-view="reveal"])::-webkit-scrollbar,
body[data-layout-mode="mobile"][data-view="reveal"]::-webkit-scrollbar {
  display: none;
}
body[data-layout-mode="mobile"][data-view="reveal"] .stage-content {
  --mobile-reveal-inline-inset: 8px;
  display: flex;
  min-height: calc(100dvh - 76px);
  flex-direction: column;
  padding-inline:
    calc(var(--mobile-reveal-inline-inset) + env(safe-area-inset-left))
    calc(var(--mobile-reveal-inline-inset) + env(safe-area-inset-right));
}
body[data-layout-mode="mobile"] #view-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--layout-gap-md);
}
body[data-layout-mode="mobile"] #view-reveal.reaction-mode,
body[data-layout-mode="mobile"] #view-reveal.observer-mode {
  flex: 1 0 auto;
  justify-content: center;
}
body[data-layout-mode="mobile"] #view-reveal > :not(.reveal-stage) {
  width: min(100%, var(--reveal-w, var(--layout-canvas-max)));
  max-width: 100%;
}
/* @decision D-225 — Canvas의 콘텐츠 폭과 프레임을 구분해 Active Guess에서도
   Verdict와 같은 바깥 크기를 쓴다. */
body[data-layout-mode="mobile"] #view-reveal > .reveal-stage {
  width: min(100%, var(--reveal-stage-w, var(--layout-canvas-max)));
  max-width: 100%;
}

/* @decision D-202 D-217 — Mobile 술래는 확정 행동과 숫자 타이머를 한 행에 두고,
   가장 긴 15초 표기를 담는 타이머 열을 예약해 카운트다운 중 버튼 폭을 고정한다.
   Desktop 술래와 관전자의 기존 타이머 surface는 그대로 유지한다. */
body[data-layout-mode="mobile"] #view-reveal.guesser-mode .reveal-side > #guess-timer {
  display: none;
}
body[data-layout-mode="mobile"] #view-reveal.guesser-mode .pick-action-row {
  --guess-action-timer-width: 5.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--guess-action-timer-width);
  align-items: stretch;
  gap: 8px;
}
body[data-layout-mode="mobile"] #view-reveal.guesser-mode .pick-action-row #btn-pick {
  width: 100%;
  min-width: 0;
  margin: 0;
}
body[data-layout-mode="mobile"] #view-reveal.guesser-mode .guess-action-timer:not([hidden]) {
  display: flex;
  width: var(--guess-action-timer-width);
  min-width: var(--guess-action-timer-width);
  min-height: var(--primary-height);
  padding: 8px 10px;
  justify-self: end;
  border-radius: var(--fs-radius-sm);
  white-space: nowrap;
}

/* @decision D-199 — Mobile Verdict는 합체 그림·결론·현재 진행 행동만 남긴다.
   공유와 저장은 결과 묶음이 완성된 Wrap이 소유한다. */
body[data-layout-mode="mobile"][data-view="reveal"][data-reveal-mode="verdict"] .stage-brand-inner {
  display: none;
}
body[data-layout-mode="mobile"][data-view="reveal"][data-reveal-mode="verdict"] .stage-content {
  min-height: 100dvh;
  padding-block: 12px calc(12px + env(safe-area-inset-bottom));
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode {
  flex: 0 0 auto;
  width: 100%;
  margin-block: auto;
  gap: 10px;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode > * {
  width: 100%;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode .reveal-stage {
  width: min(100%, var(--reveal-stage-w, 100%));
  justify-self: center;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode .reveal-side {
  width: 100%;
  gap: 8px;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode .verdict-area {
  box-sizing: border-box;
  width: 100%;
  gap: 8px;
  padding: 15px 16px 20px;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode .verdict-pick {
  padding: 10px 12px;
  border-width: 2px;
  border-radius: 14px;
  box-shadow: 0 3px 0 var(--fs-outline);
  font-size: clamp(1rem, 4.6vw, 1.2rem);
  line-height: 1.25;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode .verdict-pick::after {
  left: 20px;
  bottom: -8px;
  width: 13px;
  height: 13px;
  border-right-width: 2px;
  border-bottom-width: 2px;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode .verdict-answer {
  font-size: clamp(1.18rem, 5.8vw, 1.5rem);
  line-height: 1.18;
  text-align: center;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode .verdict-answer::after {
  margin-left: 5px;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode #next-round-hint {
  display: none;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode #return-hint:not([hidden]) {
  min-height: 0;
  margin: 2px 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fs-text-muted-on-dark);
  font-size: clamp(0.76rem, 3.2vw, 0.9rem);
  font-weight: 650;
  line-height: 1.3;
  text-align: center;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode .verdict-progress-actions {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 8px;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode .verdict-progress-actions .btn:not([hidden]) {
  grid-column: 1 / -1;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode .verdict-progress-actions:has(#btn-return:not([hidden])) :is(#btn-next, #btn-finish):not([hidden]) {
  grid-column: 1;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode .verdict-progress-actions:has(#btn-return:not([hidden])) #btn-return {
  grid-column: 2;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode .verdict-progress-actions .btn {
  min-height: 48px;
  padding: 8px 6px;
  font-size: clamp(0.72rem, 3.45vw, 0.95rem);
  line-height: 1.08;
  letter-spacing: 0.025em;
  white-space: normal;
  overflow-wrap: anywhere;
}
body[data-layout-mode="mobile"] #view-reveal.verdict-mode #btn-return {
  min-width: 0;
  padding-inline: 6px;
  text-align: center;
}
body[data-layout-mode="desktop"] #view-reveal {
  display: grid;
  grid-template-columns: var(--game-work-column) var(--reveal-side-width);
  /* 캔버스는 전체 행을 차지하고, 술래의 타이머·입력·확정 묶음은
     같은 크기의 위/아래 여유 행 사이에서 캔버스 세로 중앙에 놓인다. */
  grid-template-rows: 1fr auto 1fr;
  grid-template-areas:
    "canvas ."
    "canvas side"
    "canvas .";
  align-content: center;
  align-items: start;
  justify-content: center;
  gap: var(--layout-gap-md) var(--layout-gap-lg);
  width: 100%;
  height: 100%;
}
body[data-layout-mode="desktop"] #view-reveal .reveal-stage {
  grid-area: canvas;
  width: min(100%, var(--reveal-stage-w, var(--layout-canvas-max)));
  justify-self: center;
  align-self: center;
}
body[data-layout-mode="desktop"] #view-reveal .reveal-side {
  grid-area: side;
  width: 100%;
  align-self: start;
}
/* Observer Active Guess: 입력이 없는 사용자를 술래용 380px 빈 열에 가두지 않는다.
   600px 합체본을 중심에 두고 필요한 상태와 타이머만 같은 폭의 짧은 바로 붙인다. */
body[data-layout-mode="desktop"] #view-reveal.reaction-mode,
body[data-layout-mode="desktop"] #view-reveal.observer-mode {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--layout-gap-sm);
}
body[data-layout-mode="desktop"] #view-reveal.reaction-mode .reveal-stage,
body[data-layout-mode="desktop"] #view-reveal.observer-mode .reveal-stage {
  width: min(100%, var(--reveal-stage-w, var(--game-work-column)));
  flex: 0 0 auto;
}
body[data-layout-mode="desktop"] #view-reveal.observer-mode .reveal-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "status timer";
  align-items: center;
  gap: 12px;
  width: min(100%, var(--reveal-stage-w, var(--game-work-column)));
  min-height: var(--control-height);
  margin: 0 auto;
  padding: 7px 10px 7px 14px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--fs-radius-sm);
  background: rgba(17, 6, 31, 0.72);
  box-shadow: 0 4px 0 rgba(9, 4, 15, 0.55);
}
body[data-layout-mode="desktop"] #view-reveal.observer-mode #pick-status {
  grid-area: status;
  width: 100%;
  min-height: 0;
  align-items: center;
  justify-content: flex-start;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fs-text-light);
  text-align: left;
}
body[data-layout-mode="desktop"] #view-reveal.observer-mode #pick-status:not([hidden]) {
  display: flex;
}
body[data-layout-mode="desktop"] #view-reveal.observer-mode #pick-status[hidden] {
  display: none;
}
body[data-layout-mode="desktop"] #view-reveal.observer-mode #guess-timer {
  grid-area: timer;
  width: auto;
  min-width: 72px;
  min-height: 0;
  margin: 0;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}
body[data-layout-mode="desktop"] #view-reveal.verdict-mode {
  display: grid;
  /* @decision D-225 D-231 — Active Guess와 같은 오른쪽 열 폭을 사용해
     정답 공개 전후 합체 그림의 크기와 왼쪽 좌표를 함께 유지한다. */
  grid-template-columns: var(--game-work-column) var(--reveal-side-width);
  grid-template-rows: 1fr;
  grid-template-areas: "canvas side";
  align-items: center;
  align-content: center;
  justify-content: center;
  gap: var(--layout-gap-lg);
}
body[data-layout-mode="desktop"] #view-reveal.verdict-mode .reveal-stage {
  justify-self: center;
  align-self: center;
}
body[data-layout-mode="desktop"] #view-reveal.verdict-mode .reveal-side {
  width: 100%;
  margin-inline: 0;
  align-self: center;
  gap: 10px;
}
body[data-layout-mode="desktop"] #view-reveal.verdict-mode .verdict-area {
  width: 100%;
  align-self: center;
  gap: 10px;
  padding: 16px;
}
body[data-layout-mode="desktop"] #view-reveal.verdict-mode .verdict-area #return-hint,
body[data-layout-mode="desktop"] #view-reveal.verdict-mode .verdict-area #btn-return {
  width: 100%;
}
body[data-layout-mode="desktop"] #view-reveal.verdict-mode .verdict-area #return-hint {
  margin: 0;
  text-align: center;
}

/* 공통 헤더·상태가 없는 곳은 공간을 만들지 않는다. */
.stage-status[hidden],
.room-status-stack[hidden],
.connection-banner[hidden],
.host-status-banner[hidden] { display: none; }

/* Product-flow pass: 4-step explanation, compact lobby, direct piece task.
   ══════════════════════════════════════════════════════════════════ */
.home-tutorial {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height: normal;
  border: var(--fs-border-default) solid var(--fs-outline);
  border-radius: var(--fs-radius-md);
  background: rgba(19, 8, 36, 0.72);
  box-shadow: var(--fs-shadow-card);
}
.home-tutorial-title {
  margin: 0;
  color: var(--fs-text-light);
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: clamp(1.35rem, 1.9vw, 1.75rem);
  font-weight: 400;
  line-height: 1.1;
  text-align: center;
}
.tutorial-viewport { display: grid; }
#home-tutorial > .tutorial-viewport {
  flex: 1 1 auto;
  min-height: 0;
}
#home-tutorial > .tutorial-viewport > .tutorial-slide {
  height: 100%;
  grid-template-rows: minmax(0, 1fr) auto;
}
#home-tutorial > .tutorial-viewport > .tutorial-slide > img {
  height: 100%;
  min-height: 0;
}
.tutorial-slide {
  grid-area: 1 / 1;
  display: grid;
  grid-template-rows: auto auto;
  opacity: 0;
  transform: translateX(18px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.tutorial-slide.active { opacity: 1; transform: none; }
.tutorial-slide[hidden] { display: none; }
.tutorial-slide > img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; }
.tutorial-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 82px;
  padding: 12px 14px 14px;
  text-align: center;
  background: rgba(19, 8, 36, 0.94);
}
.tutorial-copy b { color: var(--fs-green-bright); font-size: 1.08rem; }
.tutorial-copy span { color: var(--fs-text-light); font-size: 0.9rem; }
.tutorial-controls {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 13px;
  background: rgba(19, 8, 36, 0.94);
}
body[data-layout-mode="desktop"] #home-tutorial {
  justify-content: flex-start;
  gap: 8px;
  padding: 24px 14px 18px;
}
body[data-layout-mode="desktop"] #home-tutorial > .tutorial-viewport { flex: 0 0 auto; }
body[data-layout-mode="desktop"] #home-tutorial > .tutorial-viewport > .tutorial-slide {
  height: auto;
  grid-template-rows: auto auto;
}
body[data-layout-mode="desktop"] #home-tutorial > .tutorial-viewport > .tutorial-slide > img {
  width: min(96%, 456px);
  height: auto;
  margin-inline: auto;
  aspect-ratio: 1.6 / 1;
  object-fit: contain;
  object-position: center;
  border-radius: var(--fs-radius-sm);
}
#home-tutorial .tutorial-slide[data-slide="3"] > img {
  object-fit: contain;
  background: transparent;
  transform: scale(0.84);
  transform-origin: center;
}
body[data-layout-mode="desktop"] #home-tutorial .tutorial-copy {
  min-height: 0;
  gap: 2px;
  padding: 5px 8px 0;
  background: transparent;
}
body[data-layout-mode="desktop"] #home-tutorial .tutorial-copy b {
  font-size: clamp(1.18rem, 1.5vw, 1.42rem);
  line-height: 1.12;
}
body[data-layout-mode="desktop"] #home-tutorial .tutorial-copy span {
  font-size: clamp(1rem, 1.18vw, 1.12rem);
  line-height: 1.22;
}
body[data-layout-mode="desktop"] #home-tutorial .tutorial-controls {
  width: min(100%, 430px);
  grid-template-columns: 44px minmax(176px, 1fr) 44px;
  gap: clamp(0px, calc((100% - 264px) / 2), 12px);
  margin-inline: auto;
  padding: 10px 0 0;
  background: transparent;
}
.tutorial-arrow {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 3px solid var(--fs-outline);
  border-radius: 999px;
  background: var(--fs-paper);
  color: var(--fs-outline);
  box-shadow: 0 3px 0 var(--fs-outline);
  font: 2rem/1 'Lilita One', sans-serif;
  cursor: pointer;
}
.tutorial-dots {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 0;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.tutorial-dot {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: none;
}
.tutorial-dot::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  transform: translate(-50%, -50%);
  transition: width 160ms ease, background-color 160ms ease;
}
.tutorial-dot.active {
  width: 44px;
  background: transparent;
}
.tutorial-dot.active::before {
  width: 38px;
  background: rgba(255, 255, 255, 0.18);
}
.tutorial-dot.active::after {
  content: '';
  position: absolute;
  top: calc(50% - 2.5px);
  left: 5px;
  width: 34px;
  height: 5px;
  border-radius: 999px;
  background: var(--fs-green-bright);
  transform: scaleX(1);
  transform-origin: left center;
}
.tutorial-autoplay .tutorial-dot.active::after {
  animation: tutorialIndicatorProgress var(--tutorial-auto-duration, 5000ms) linear forwards;
}
.tutorial-autoplay.tutorial-auto-paused .tutorial-dot.active::after {
  animation-play-state: paused;
}
.tutorial-dot:focus-visible {
  outline: 3px solid var(--fs-blue);
  outline-offset: 3px;
}
@keyframes tutorialIndicatorProgress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.invite-actions { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 10px; }
.qr-panel { text-align: center; }
.qr-panel[hidden] { display: none; }
.qr-panel canvas { display: block; width: min(232px, 100%); height: auto; margin: 0 auto; background: white; border: 4px solid white; border-radius: 10px; }
/* Lobby is an admin surface inside the shared Stage, not a timed screen that fills all height. */
.lobby-card {
  width: 100%;
  min-height: 0;
  animation: lobbyCardFade 160ms ease-out both;
}
.lobby-left {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px 20px 20px;
  overflow: hidden;
}
.lobby-invite-section {
  display: grid;
  gap: 10px;
  min-height: 0;
  padding-bottom: 14px;
  border-bottom: 2px dashed color-mix(in srgb, var(--fs-outline) 34%, transparent);
}
/* On desktop both sections belong to the outer paper card. */
.lobby-left > .fs-paper,
.lobby-left > .lobby-sheet-overlay > .fs-paper {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.lobby-left > .fs-stitch::before,
.lobby-left > .lobby-sheet-overlay > .fs-stitch::before { display: none; }
.code-panel.lobby-invite-section { padding: 0; }
.lobby-room-summary,
.lobby-room-id,
.lobby-room-guidance,
.lobby-invite-tools,
.lobby-player-actions {
  display: grid;
}
.lobby-room-summary { gap: 6px; }
.lobby-room-id { gap: 2px; }
.lobby-room-guidance { gap: 0; }
.lobby-invite-tools { gap: 10px; }
.code-panel .code-label,
.code-panel .room-code,
.code-panel .lobby-hint,
.code-panel .invite-url,
.code-panel .copy-status {
  margin: 0;
}
.lobby-tutorial-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.lobby-tutorial-stage,
#lobby-tutorial-mount {
  display: grid;
  flex: 1;
  min-height: 0;
  place-items: stretch;
}
.lobby-tutorial-stage {
  width: 100%;
  align-self: stretch;
}
#lobby-tutorial-mount {
  grid-area: 1 / 1;
  width: 100%;
  overflow: hidden;
}
#lobby-tutorial-mount[hidden] { display: none; }
#lobby-tutorial {
  width: 100%;
  border-width: 2px;
  box-shadow: none;
}
#lobby-tutorial {
  height: 100%;
}
#lobby-tutorial > .tutorial-viewport {
  flex: 1 1 auto;
  min-height: 0;
}
#lobby-tutorial > .tutorial-viewport > .tutorial-slide:not([hidden]) {
  display: flex;
  flex-direction: column;
  height: 100%;
}
#lobby-tutorial .tutorial-media {
  position: relative;
  display: grid;
  flex: 1 1 0;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  background: rgba(19, 8, 36, 0.94);
}
#lobby-tutorial .tutorial-slide[data-slide="3"] .tutorial-media > img {
  object-fit: contain;
  transform: translateY(6px) scale(0.78);
  transform-origin: center;
}
#lobby-tutorial .tutorial-media > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: translateY(6px) scale(0.9);
  transform-origin: center;
}
#lobby-tutorial .tutorial-copy { min-height: 82px; padding: 8px 14px 9px; }
#lobby-tutorial .tutorial-copy b { font-size: 1.08rem; line-height: 1.12; }
#lobby-tutorial .tutorial-copy span { font-size: 0.82rem; line-height: 1.24; }
#lobby-tutorial .tutorial-controls {
  /* @decision D-235 — Six adjacent Lobby tutorial targets remain 44px at 320px. */
  display: grid;
  grid-template-columns: 44px minmax(176px, 1fr) 44px;
  align-items: center;
  gap: 0;
  min-height: 44px;
  padding: 0 2px;
  background: rgba(19, 8, 36, 0.94);
}
#lobby-tutorial .tutorial-controls .tutorial-arrow {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  isolation: isolate;
  font-size: 1.45rem;
}
#lobby-tutorial .tutorial-controls .tutorial-arrow::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 5px;
  border: 2px solid var(--fs-outline);
  border-radius: 50%;
  background: color-mix(in srgb, var(--fs-paper) 92%, transparent);
  box-shadow: 0 2px 0 var(--fs-outline);
}
body[data-layout-mode="mobile"] #lobby-tutorial {
  height: auto;
}
body[data-layout-mode="mobile"] #lobby-tutorial > .tutorial-viewport {
  flex: 0 0 auto;
}
body[data-layout-mode="mobile"] #lobby-tutorial > .tutorial-viewport > .tutorial-slide {
  height: auto;
}
body[data-layout-mode="mobile"] #lobby-tutorial .tutorial-media {
  flex: 0 0 auto;
  aspect-ratio: 16 / 9;
}
/* 320px·10개 locale의 가장 긴 제목+설명을 기준으로 copy 영역을 고정한다.
   장마다 2/3/4줄이 달라도 이미지 카드의 바깥 높이는 움직이지 않는다. */
body[data-layout-mode="mobile"] #lobby-tutorial .tutorial-copy {
  min-height: 124px;
}
.lobby-qr-panel {
  position: relative;
  grid-area: 1 / 1;
  align-self: stretch;
  width: 100%;
  min-height: 0;
  border: 2px solid var(--fs-outline);
  border-radius: 24px;
  background: rgba(19, 8, 36, 0.94);
  overflow: hidden;
}
.lobby-qr-panel:not([hidden]) {
  display: grid;
  place-items: center;
}
.lobby-qr-content {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(100%, 300px);
  padding: 18px;
}
.lobby-qr-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 3px 0 var(--fs-outline);
  font-family: Inter, system-ui, sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}
.tutorial--manual .tutorial-dots { gap: 0; background: transparent; }
.tutorial--manual .tutorial-dot,
.tutorial--manual .tutorial-dot.active { width: 44px; height: 44px; }
.tutorial--manual .tutorial-dot::before,
.tutorial--manual .tutorial-dot.active::before {
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.38);
}
.tutorial--manual .tutorial-dot.active::before {
  width: 10px;
  height: 10px;
  background: var(--fs-green-bright);
}
.tutorial--manual .tutorial-dot.active::after { display: none; }
.lobby-player-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: stretch;
  min-height: 0;
  padding: 18px 20px 20px;
  gap: 12px;
  text-align: left;
  overflow: hidden;
}
.lobby-player-panel .players-head {
  color: var(--fs-text-dark);
}
.lobby-player-panel .player-count,
.lobby-player-panel .lobby-waiting {
  color: #6b6270;
}
.lobby-player-panel .player-list {
  --player-card-shadow-depth: 4px;
  min-height: 0;
  max-height: none;
  padding-block-end: var(--player-card-shadow-depth);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-block-end: var(--player-card-shadow-depth);
  gap: 6px;
}
.lobby-player-panel .player-list li {
  min-height: 46px;
  padding: 8px 12px 8px 16px;
  font-size: 1rem;
}
.lobby-player-actions { gap: 10px; margin-top: 2px; }
.lobby-player-actions > .btn { width: 100%; }
.lobby-leave-button {
  min-height: 44px;
  border-color: color-mix(in srgb, var(--fs-outline) 45%, transparent);
  color: var(--fs-text-dark);
  background: transparent;
  box-shadow: none;
  font-size: 0.92rem;
}
.lobby-leave-button:hover {
  background: color-mix(in srgb, var(--fs-purple) 9%, var(--fs-paper));
  box-shadow: 0 3px 0 rgba(9, 4, 15, 0.32);
}
@keyframes lobbyCardFade {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

.stage-status {
  display: grid;
  justify-items: center;
  gap: var(--layout-gap-xs);
  position: absolute;
  z-index: 80;
  top: calc(100% + var(--layout-gap-xs));
  left: 50%;
  width: min(calc(100% - (2 * var(--stage-pad))), var(--layout-content-max));
  margin: 0;
  pointer-events: none;
  transform: translateX(-50%);
}

/* Desktop 작화의 상태 알림은 비본질적인 로고 영역을 우선 사용한다. */
body[data-layout-mode="desktop"][data-view="draw"] .stage-status {
  top: 50%;
  width: min(var(--game-work-column), calc(100% - (2 * var(--stage-pad))));
  transform: translate(-50%, -50%);
}
/* @decision D-226 — Mobile 작화에서는 상태 스택을 JS가 Canvas 알림 묶음으로 옮긴다.
   긴 문구는 Canvas 폭 안에서 모두 줄바꿈하고, 일시 알림이 드로잉 입력을 가로채지 않는다. */
body[data-layout-mode="mobile"][data-view="draw"] .canvas-notice-stack > .stage-status:not([hidden]) {
  position: static;
  top: auto;
  left: auto;
  width: 100%;
  margin: 0;
  transform: none;
}
body[data-layout-mode="mobile"][data-view="draw"]
  .canvas-notice-stack :is(.connection-banner, .host-status-banner) {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  pointer-events: none;
}
.stage-status[hidden],
.room-status-stack[hidden] { display: none; }
.connection-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--layout-status-min-height);
  width: max-content;
  max-width: min(var(--layout-status-max-width), 100%);
  padding: 10px 14px;
  border: 3px solid var(--fs-outline);
  border-radius: var(--fs-radius-md);
  background: var(--fs-paper);
  color: var(--fs-outline);
  box-shadow: 0 4px 0 rgba(9, 4, 15, 0.52);
  font-weight: 900;
  pointer-events: auto;
}
.connection-banner[hidden] { display: none; }
.connection-spinner { width: 18px; height: 18px; border: 3px solid rgba(23,19,28,.2); border-top-color: var(--fs-purple); border-radius: 50%; animation: spin .7s linear infinite; }
.game-error-banner {
  border-color: var(--fs-outline);
  background: var(--fs-danger);
  color: var(--fs-text-on-danger);
}
.game-error-mark {
  flex: 0 0 auto;
  font-size: 1.1em;
  line-height: 1;
}
@keyframes spin { to { transform: rotate(360deg); } }

.room-status-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--layout-gap-xs);
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.host-status-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: var(--layout-status-min-height);
  width: max-content;
  max-width: min(var(--layout-status-max-width), 100%);
  padding: 10px 14px;
  border: 3px solid var(--fs-outline);
  border-radius: 16px;
  background: var(--fs-paper);
  color: var(--fs-outline);
  box-shadow: 0 5px 0 rgba(9, 4, 15, 0.52);
  font-weight: 800;
  text-align: left;
  pointer-events: auto;
}
.host-status-banner[hidden] { display: none; }
.host-status-banner.complete { border-color: var(--fs-green); }
.host-status-mark {
  flex: 0 0 auto;
  color: var(--fs-purple);
  font-size: 1.15rem;
  line-height: 1;
}
.player-status-banner { border-color: var(--fs-blue); }
.player-status-banner.complete { border-color: var(--fs-green); }
.player-status-mark {
  color: var(--fs-blue);
  font-size: 0.72rem;
}
#connection-message,
#game-error-message,
#host-status-message,
#player-status-message {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* @decision D-200 — Mobile 상태 알림은 아이콘을 고정하고 본문 전체를
   Stage 안전 폭 안에서 여러 줄로 표시한다. */
body[data-layout-mode="mobile"] .stage-status,
body[data-layout-mode="mobile"] .room-status-stack {
  min-width: 0;
  max-width: 100%;
}
body[data-layout-mode="mobile"] :is(.connection-banner, .host-status-banner) {
  align-items: flex-start;
  width: fit-content;
  min-width: 0;
  max-width: 100%;
  line-height: 1.35;
}
/* @decision D-227 — Mobile intrinsic max-content 계산에 기대지 않고 알림의 모든
   border-box와 본문을 실제 부모 폭 안에 가둔다. Canvas 알림은 항상 한 행 전체 폭이다. */
body[data-layout-mode="mobile"][data-view="draw"]
  .canvas-notice-stack :is(.connection-banner, .host-status-banner) {
  width: 100%;
}
body[data-layout-mode="mobile"] :is(.connection-spinner, .game-error-mark, .host-status-mark) {
  margin-top: 0.12em;
}

.lobby-progress,
.lobby-join-note {
  margin: 0;
  padding: 8px 10px;
  border-radius: 12px;
  text-align: center;
  line-height: 1.3;
}
.lobby-progress {
  border: 2px solid color-mix(in srgb, var(--fs-purple) 60%, transparent);
  background: color-mix(in srgb, var(--fs-purple) 10%, var(--fs-paper));
  color: var(--fs-purple);
  font-weight: 800;
}
.lobby-join-note {
  border: 2px dashed var(--fs-green);
  background: color-mix(in srgb, var(--fs-green-bright) 16%, var(--fs-paper));
  color: var(--fs-outline);
  font-weight: 700;
}
.lobby-progress[hidden],
.lobby-join-note[hidden] { display: none; }

body[data-layout-mode="mobile"] .tutorial-copy {
  min-height: 96px;
  padding-block: 9px 11px;
}
#view-lobby #btn-start,
#view-lobby #btn-lobby-finish {
  position: static;
  width: 100%;
  max-width: none;
  margin: 0;
}
.lobby-left,
.lobby-card,
.lobby-player-panel { min-height: 0; }

@media (prefers-reduced-motion: reduce) {
  .tutorial-slide { transition: none; }
  .tutorial-dot { transition: none; }
  .tutorial-autoplay .tutorial-dot.active::after { animation: none; }
  .lobby-card { animation: none; }
  .view-intro:not([hidden]),
  .view-blind:not([hidden]) { animation: none; }
  .intro-guesser-copy,
  .intro-artist-copy,
  .intro-artist[data-stage] .intro-assignment { animation: none; }
  .connection-spinner { animation: none; }
  .btn.server-action-pending::after {
    animation: none;
    border-top-color: var(--fs-green-bright);
  }
}

/* Wrap 결과 저장 선택창 */
body.save-results-open { overflow: hidden; }
.save-results-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9, 4, 15, 0.76);
  backdrop-filter: blur(4px);
}
.save-results-modal[hidden] { display: none; }
.save-results-dialog {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(100%, 520px);
  max-height: min(680px, calc(100dvh - 40px));
  overflow-y: auto;
  padding: 26px;
  color: var(--fs-text-dark);
  text-align: left;
}
.save-results-dialog h2 {
  margin: 0;
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: clamp(1.7rem, 5vw, 2.2rem);
  line-height: 1.1;
}
.save-results-options {
  display: grid;
  gap: 12px;
}
.save-results-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  width: 100%;
  padding: 17px 18px;
  border: 3px solid var(--fs-outline);
  border-radius: var(--fs-radius-md);
  background: #fff;
  color: var(--fs-text-dark);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--fs-outline);
}
.save-results-option:hover,
.save-results-option:focus-visible {
  background: color-mix(in srgb, var(--fs-green-bright) 18%, #fff);
  transform: translateY(-1px);
}
.save-results-option:focus-visible {
  outline: 3px solid var(--fs-blue);
  outline-offset: 3px;
}
.save-results-option strong {
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: 1.12rem;
}
.save-results-option span {
  color: var(--fs-text-muted-on-paper);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.45;
}
.save-results-option:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}
.save-results-status {
  margin: 0;
  min-height: 1.4em;
  color: #4f7000;
  font-weight: 800;
  text-align: center;
}
.save-results-status.error { color: var(--fs-danger-text-on-paper); }
.save-results-status[hidden] { display: none; }
#save-results-cancel {
  align-self: center;
  min-width: 120px;
  min-height: var(--touch-min);
  color: var(--fs-text-dark);
  border-color: var(--fs-outline);
  box-shadow: none;
}
#save-results-cancel:hover { background: rgba(28, 16, 48, 0.08); }

body[data-layout-mode="mobile"] .save-results-dialog { padding: 21px 18px; }
body[data-layout-mode="mobile"] .save-results-option { padding: 15px; }

/* 이 기기의 FrankenSketch 데이터 삭제 확인 */
body.local-data-open { overflow: hidden; }
.local-data-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9, 4, 15, 0.8);
  backdrop-filter: blur(4px);
}
.local-data-modal[hidden] { display: none; }
.local-data-dialog {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(100%, 560px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 26px;
  color: var(--fs-text-dark);
  text-align: left;
}
.local-data-dialog h2 {
  margin: 0;
  font-family: 'Lilita One', 'Black Han Sans', system-ui, sans-serif;
  font-size: clamp(1.55rem, 5vw, 2.05rem);
  line-height: 1.15;
}
.local-data-dialog > p {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
  line-height: 1.55;
}
.local-data-error {
  padding: 11px 13px;
  border: 2px solid var(--fs-danger);
  border-radius: var(--fs-radius-sm);
  background: color-mix(in srgb, var(--fs-danger) 12%, #fff);
  color: var(--fs-danger-text-on-paper);
  font-weight: 800 !important;
}
.local-data-error[hidden] { display: none; }
.local-data-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
.local-data-actions .btn {
  min-width: 0;
  min-height: 48px;
  white-space: normal;
}
/* @decision D-084 — 크림 표면의 보조 행동은 읽을 수 있는 대비를 유지한다. */
.local-data-actions #local-data-cancel {
  background: transparent;
  color: var(--fs-text-dark);
  border-color: var(--fs-outline);
}
.local-data-actions #local-data-cancel:hover {
  background: var(--fs-paper-warm);
}
.local-data-danger {
  border-color: var(--fs-outline);
  background: #b52d25;
  color: #fff;
  box-shadow: var(--fs-shadow-button);
}
.local-data-danger:hover,
.local-data-danger:focus-visible {
  background: #8f211c;
}
.local-data-danger:focus-visible {
  outline: 3px solid var(--fs-warning);
  outline-offset: 3px;
}
.local-data-dialog[aria-busy="true"] .local-data-actions {
  opacity: 0.68;
}
.local-data-complete {
  position: fixed;
  z-index: 1150;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(calc(100% - 32px), 560px);
  margin: 0;
  transform: translateX(-50%);
  padding: 13px 16px;
  border: 2px solid var(--fs-outline);
  border-radius: var(--fs-radius-sm);
  background: var(--fs-success);
  color: var(--fs-text-dark);
  box-shadow: 0 4px 0 var(--fs-outline);
  font-weight: 850;
  line-height: 1.35;
  text-align: center;
}
.local-data-complete[hidden] { display: none; }
body[data-layout-mode="mobile"] .local-data-modal { padding: 12px; }
body[data-layout-mode="mobile"] .local-data-dialog {
  max-height: calc(100dvh - 24px);
  padding: 21px 18px;
}

/* @decision D-240 — 종료 화면의 Discord 안내는 선행 조건 없이 항상 보이는 한 줄과 링크다. */
#view-finished .finished-community {
  display: grid;
  gap: 5px;
  width: 100%;
  min-width: 0;
  padding: 11px 13px;
  border: 2px solid color-mix(in srgb, var(--fs-purple) 58%, transparent);
  border-radius: 14px;
  color: var(--fs-text-light);
  background: color-mix(in srgb, var(--fs-purple) 15%, transparent);
  text-align: left;
}

#view-finished .finished-community-info {
  margin: 0;
  color: color-mix(in srgb, var(--fs-text-light) 88%, transparent);
  font-size: 0.82rem;
  line-height: 1.45;
}

#view-finished .finished-discord-link {
  width: 100%;
  min-height: var(--touch-min);
  margin-top: 3px;
  padding: 8px 10px;
  border: 2px solid color-mix(in srgb, var(--fs-purple) 72%, var(--fs-paper));
  box-shadow: none;
  color: var(--fs-text-light);
  background: color-mix(in srgb, var(--fs-purple) 30%, transparent);
  font-size: 0.78rem;
  text-align: center;
  text-decoration: none;
}

#view-finished .finished-discord-link[hidden] { display: none; }

body[data-layout-mode="mobile"] #view-reveal #btn-pick {
  font-size: max(1rem, 16px);
}
.finished-replay-actions {
  display: grid;
  gap: 7px;
  margin-top: 4px;
}
#view-finished #btn-replay {
  width: 100%;
  min-height: 61px;
  border-bottom-width: 8px;
  box-shadow: none;
  font-size: 1.08rem;
}
#view-finished #btn-replay:hover,
#view-finished #btn-replay:active,
#view-finished #btn-replay:disabled { box-shadow: none; }
.finished-share-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}
/* @decision D-199 — 공유·선택 저장·전체 저장은 기능별 SVG와 현지화된
   접근성 이름을 가진 같은 크기 터치 목표다. 진행·이동 행동은 텍스트를 유지한다. */
#view-finished .finished-share-actions .finished-icon-action {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  min-width: 52px;
  height: 57px;
  min-height: 57px;
  padding: 0;
  border-bottom-width: 8px;
  box-shadow: none;
}
#view-finished .finished-share-actions .finished-icon-action:hover,
#view-finished .finished-share-actions .finished-icon-action:active,
#view-finished .finished-share-actions .finished-icon-action:disabled { box-shadow: none; }
.finished-action-icon {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.finished-icon-action[aria-busy="true"] .finished-action-icon {
  opacity: 0.4;
}
.finished-action-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid var(--fs-outline);
  border-radius: 999px;
  background: var(--fs-green-bright);
  color: var(--fs-outline);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}
.finished-action-badge:empty {
  display: none;
}
.finished-save-status {
  min-height: 1.35em;
  margin: -2px 0 0;
  color: var(--fs-green-bright);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}
.finished-save-status.error { color: var(--fs-danger); }
.finished-save-status[hidden] { display: none; }
.finished-secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
}
#view-finished .finished-secondary-actions .btn {
  width: 100%;
  min-width: 0;
  min-height: var(--touch-min);
  padding: 7px 9px;
  border-width: 2px;
  background: transparent;
  box-shadow: none;
  color: var(--fs-text-muted);
  font-size: 0.78rem;
}
.finished-secondary-actions > :only-child,
.finished-secondary-actions:has(#btn-feedback[hidden]) #btn-new-room {
  grid-column: 1 / -1;
}
#view-finished .finished-secondary-actions .btn:hover,
#view-finished .finished-secondary-actions .btn:focus-visible {
  color: var(--fs-text-light);
}
#view-finished #result-canvas {
  box-shadow: 0 5px 0 rgba(9, 4, 15, 0.42);
}

body[data-layout-mode="desktop"] #view-finished .finished-sketch-icon {
  width: min(180px, 13vw);
}
body[data-layout-mode="desktop"] #view-finished .finished-side .center-title {
  font-size: clamp(2rem, 2.25vw, 2.5rem);
  text-align: center;
}
body[data-layout-mode="desktop"] #view-finished .finished-side > .lobby-hint {
  font-size: 1.04rem;
  line-height: 1.45;
  text-align: center;
}
body[data-layout-mode="desktop"] #view-finished .finished-secondary-actions .btn {
  min-height: 48px;
  font-size: 0.88rem;
}
