/* ==========================================================
   キミならこう言う v3 — ことばのパレード

   触れられそうな厚紙、木のゲーム卓、スクリーン印刷の色ずれを
   デジタルの軽快さでまとめる。動的な文字と操作は常にHTMLに置き、
   Canvasは空気と祝福だけを担当する。
   ========================================================== */

:root {
  color-scheme: light;

  --ink: #172650;
  --ink-soft: #4a5573;
  --ink-muted: #6f7892;
  --cream: #fff8df;
  --paper: #fffdf3;
  --paper-deep: #f8edce;
  --cobalt: #3459cf;
  --cobalt-deep: #2345ac;
  --cobalt-soft: #dce5ff;
  --coral: #f45d68;
  --coral-deep: #d94351;
  --coral-soft: #ffd9d8;
  --mango: #f7c744;
  --mango-deep: #b97908;
  --mango-soft: #fff0b6;
  --teal: #1daf9f;
  --teal-deep: #087f75;
  --teal-soft: #cff4e9;
  --wood: #a95d35;
  --wood-deep: #764025;
  --wood-light: #d99560;
  --line: #d9cfb7;
  --danger: #be3345;
  --success: #087e62;

  --phase: var(--cobalt);
  --phase-deep: var(--cobalt-deep);
  --phase-soft: var(--cobalt-soft);
  --phase-shadow: #9eb3ee;

  --font-display: "Mochiy Pop One", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  --font-body: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;

  --outline: 2px solid var(--ink);
  --shadow-ink: 4px 5px 0 var(--ink);
  --shadow-phase: 5px 6px 0 var(--phase-shadow);
  --shadow-small: 2px 3px 0 rgba(23, 38, 80, 0.22);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 10px;
  --topbar-h: 66px;
  --content-gutter: clamp(16px, 3vw, 42px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body[data-view="create"] {
  --phase: var(--coral);
  --phase-deep: var(--coral-deep);
  --phase-soft: var(--coral-soft);
  --phase-shadow: #f3aca8;
}

body[data-view="join"],
body[data-view="connecting"],
body[data-view="vote"] {
  --phase: var(--cobalt);
  --phase-deep: var(--cobalt-deep);
  --phase-soft: var(--cobalt-soft);
  --phase-shadow: #9eb3ee;
}

body[data-view="lobby"],
body[data-view="answer"],
body[data-view="scores"] {
  --phase: var(--teal);
  --phase-deep: var(--teal-deep);
  --phase-soft: var(--teal-soft);
  --phase-shadow: #91dace;
}

body[data-view="question"] {
  --phase: var(--cobalt);
  --phase-deep: var(--cobalt-deep);
  --phase-soft: var(--cobalt-soft);
  --phase-shadow: #9eb3ee;
}

body[data-view="reveal"] {
  --phase: var(--mango);
  --phase-deep: var(--mango-deep);
  --phase-soft: var(--mango-soft);
  --phase-shadow: #e3ad26;
}

body[data-view="final"] {
  --phase: var(--coral);
  --phase-deep: var(--coral-deep);
  --phase-soft: var(--mango-soft);
  --phase-shadow: #f0a09b;
}

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

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--cream);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    repeating-linear-gradient(8deg, rgba(111, 83, 45, 0.025) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(96deg, rgba(255, 255, 255, 0.34) 0 1px, transparent 1px 11px);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.65;
  word-break: auto-phrase;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
}

::selection {
  color: var(--ink);
  background: var(--mango);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 4px solid var(--mango);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px var(--ink);
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 12px;
  padding: 10px 16px;
  color: var(--paper);
  border: var(--outline);
  border-radius: 999px;
  background: var(--ink);
  font-weight: 900;
  text-decoration: none;
  translate: 0 -160%;
}

.skip-link:focus-visible {
  translate: 0 0;
}

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

.noise {
  display: none;
}

/* Canvas / transition layers -------------------------------- */

.party-canvas {
  position: fixed;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.party-canvas.is-animating,
.kotodama-stamp.is-animating,
[data-gsap-active="true"] {
  will-change: transform, opacity;
}

.screen-transition-wipe {
  position: fixed;
  z-index: 300;
  inset: 0;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  overflow: hidden;
  pointer-events: none;
  background: transparent;
}

.screen-transition-wipe > i {
  width: 130%;
  height: calc(100% + 4px);
  margin: -2px 0 -2px -15%;
  display: block;
  border-block: 2px solid var(--ink);
  background: var(--cobalt);
  box-shadow: inset 0 -8px 0 rgba(255, 255, 255, 0.14);
  transform: translate3d(-130%, 0, 0);
  will-change: transform;
}

.screen-transition-wipe > i:nth-child(2) {
  background: var(--coral);
}

.screen-transition-wipe > i:nth-child(3) {
  background: var(--mango);
}

.kotodama-stamp {
  display: grid;
  width: 74px;
  aspect-ratio: 1.08;
  place-items: center;
  color: var(--ink);
  border: var(--outline);
  border-radius: 54% 52% 55% 18%;
  background: var(--phase-soft);
  box-shadow: 4px 4px 0 var(--phase);
  font-family: var(--font-display);
  font-size: 0.68rem;
  line-height: 1.2;
  text-align: center;
}

.kotodama-stamp > i {
  position: relative;
  width: 33px;
  height: 25px;
  display: block;
  border: 2px solid var(--ink);
  border-radius: 48% 48% 48% 18%;
  background: var(--paper);
}

.kotodama-stamp > i::before {
  content: "•••";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-style: normal;
  letter-spacing: 0.05em;
  line-height: 1;
}

#app {
  position: relative;
  z-index: 2;
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

/* ==========================================================
   Header / footer
   ========================================================== */

.topbar {
  position: sticky;
  z-index: 80;
  top: 0;
  min-height: var(--topbar-h);
  padding: 9px var(--content-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 2px solid var(--ink);
  background: var(--cream);
}

.topbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -6px;
  left: 0;
  height: 4px;
  background: var(--wood);
  box-shadow: 0 2px 0 var(--wood-deep);
  pointer-events: none;
}

.brand {
  min-width: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  font-family: var(--font-display);
  font-size: clamp(0.86rem, 1.6vw, 1rem);
  line-height: 1.2;
  cursor: pointer;
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 55% 52% 54% 22%;
  background: var(--coral);
  box-shadow: 3px 3px 0 var(--mango);
  font-size: 0.92rem;
}

.brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-name b {
  color: var(--coral-deep);
  font-weight: inherit;
}

.online-tag {
  padding: 3px 8px 4px;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--coral);
  font-family: var(--font-body);
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.topbar-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 2px 3px 0 var(--cobalt-soft);
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.icon-button:hover {
  color: var(--cobalt-deep);
  background: var(--cobalt-soft);
}

.icon-button:active {
  box-shadow: 0 1px 0 var(--ink);
}

.icon-button svg {
  width: 21px;
  height: 21px;
}

.icon-button .icon-off {
  display: none;
}

.icon-button.muted .icon-on {
  display: none;
}

.icon-button.muted .icon-off {
  display: block;
}

.icon-button.muted {
  color: var(--ink-muted);
  background: var(--paper-deep);
}

.room-pill {
  min-height: 42px;
  padding: 7px 14px;
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--mango-soft);
  box-shadow: 2px 3px 0 var(--mango);
  font-family: var(--font-display);
  font-size: 0.88rem;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.room-pill small {
  margin-right: 7px;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0;
}

.connection-dot {
  min-height: 38px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--paper);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.connection-dot i {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--ink-muted);
}

.connection-dot.connected i {
  background: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.connection-dot.connecting i,
.connection-dot.reconnecting i {
  background: var(--mango);
  animation: status-pulse 1s steps(2, end) infinite;
}

.connection-dot.offline,
.connection-dot.paused {
  color: var(--danger);
  border-color: var(--danger);
  background: #fff0f1;
}

.connection-dot.offline i,
.connection-dot.paused i {
  background: var(--danger);
}

@keyframes status-pulse {
  50% { opacity: 0.35; }
}

.site-footer {
  position: relative;
  z-index: 8;
  padding: 20px 18px calc(20px + var(--safe-bottom));
  color: var(--ink-soft);
  border-top: 2px solid var(--ink);
  background: var(--paper-deep);
  font-size: 0.76rem;
  line-height: 1.9;
  text-align: center;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
}

.site-footer-links a,
.site-credit a {
  font-weight: 900;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.site-footer-links a:hover,
.site-credit a:hover {
  color: var(--cobalt-deep);
  background: var(--mango-soft);
}

.site-credit {
  margin: 6px 0 0;
}

.is-home .site-footer {
  padding-top: 15px;
  padding-bottom: calc(15px + var(--safe-bottom));
  background: var(--cream);
}

/* ==========================================================
   Home — common pieces
   ========================================================== */

.home-stage {
  position: relative;
  min-height: calc(100svh - var(--topbar-h));
  isolation: isolate;
}

.home-visual,
.home-picture,
.home-art {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.home-picture {
  display: block;
  width: 100%;
  height: 100%;
}

.home-art-img,
.home-picture img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.home-art {
  background: var(--cobalt);
}

.home-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/assets/party-parade-desktop-v1.jpg") center / cover no-repeat;
}

.home-glow {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, var(--cream) 0%, transparent 16%);
}

.hero-sticker {
  position: absolute;
  z-index: 4;
  max-width: min(190px, 42%);
  padding: 9px 13px;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--mango);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: clamp(0.7rem, 1.6vw, 0.86rem);
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
}

.hero-sticker:nth-of-type(1) {
  top: 8%;
  right: 5%;
}

.hero-sticker:nth-of-type(2) {
  right: 7%;
  bottom: 8%;
  background: var(--teal-soft);
}

.hero-sticker.sticker-players {
  color: var(--ink);
  background: var(--mango);
}

.hero-sticker.sticker-browser {
  color: var(--paper);
  background: var(--teal);
}

.home-panel {
  position: relative;
  z-index: 5;
  min-width: 0;
}

.home-content {
  min-width: 0;
}

.logo-lockup {
  width: min(520px, 100%);
}

.logo-lockup img {
  width: 100%;
  height: auto;
  display: block;
}

.logo-kicker,
.dock-kicker {
  width: fit-content;
  margin: 0 0 12px;
  padding: 6px 12px 7px;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--cobalt);
  box-shadow: 3px 3px 0 var(--mango);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.09em;
}

.logo-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6.1vw, 5.6rem);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.logo-line {
  position: relative;
  z-index: 1;
  display: block;
  width: fit-content;
  padding-inline: 0.05em;
}

.logo-line:first-child {
  color: var(--coral);
  text-shadow: 3px 3px 0 var(--ink);
}

.logo-line:last-child {
  color: var(--cobalt);
  text-shadow: 3px 3px 0 var(--mango);
}

.logo-line-accent {
  color: var(--cobalt) !important;
}

.logo-pop {
  position: relative;
  top: -0.08em;
  margin-left: 0.04em;
  display: inline-block;
  color: var(--mango);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: none;
}

.home-tagline {
  width: fit-content;
  max-width: 100%;
  margin: 18px 0 0;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 3px 4px 0 var(--coral-soft);
  font-family: var(--font-display);
  font-size: clamp(0.76rem, 1.5vw, 0.92rem);
  line-height: 1.45;
}

.home-tagline span {
  color: var(--coral-deep);
}

.home-tagline i {
  color: var(--mango-deep);
  font-style: normal;
}

.home-proof {
  margin: 18px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.proof-pill {
  min-height: 34px;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-size: 0.76rem;
  font-weight: 900;
}

.proof-pill:nth-child(2n) {
  background: var(--teal-soft);
}

.proof-pill:nth-child(3n) {
  background: var(--mango-soft);
}

.home-dock {
  position: relative;
  z-index: 8;
}

.dock-inner {
  min-width: 0;
}

.how-summary > p {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 1.6vw, 1.12rem);
  line-height: 1.55;
}

.how-summary > p span {
  color: var(--coral-deep);
}

.how-summary > p em {
  color: var(--cobalt-deep);
  font-style: normal;
}

.how-summary ol {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
}

.how-summary li {
  position: relative;
  min-height: 68px;
  padding: 10px 8px 10px 40px;
  display: flex;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: 2px 3px 0 var(--cobalt-soft);
}

.how-summary li b {
  position: absolute;
  top: 50%;
  left: 9px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--coral);
  font-family: var(--font-display);
  font-size: 0.69rem;
  translate: 0 -50%;
}

.how-summary li:nth-child(2) b {
  color: var(--ink);
  background: var(--mango);
}

.how-summary li:nth-child(3) b {
  background: var(--cobalt);
}

.how-summary li span {
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.4;
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.home-actions .primary-button {
  min-height: 76px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: left;
}

.home-actions .create-button {
  color: var(--paper);
  background: var(--coral);
  box-shadow: 5px 6px 0 var(--ink);
}

.home-actions .join-button {
  color: var(--paper);
  background: var(--cobalt);
  box-shadow: 5px 6px 0 var(--ink);
}

.button-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.button-icon svg {
  width: 28px;
  height: 28px;
}

.home-actions button > span:last-child {
  font-family: var(--font-display);
  font-size: clamp(0.96rem, 1.8vw, 1.14rem);
  line-height: 1.25;
}

.home-actions button small {
  display: block;
  margin-bottom: 3px;
  font-family: var(--font-body);
  font-size: 0.69rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  opacity: 0.92;
}

.home-actions .rules-link {
  grid-column: 1 / -1;
  justify-self: start;
}

.rules-link {
  min-height: 48px;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cobalt-deep);
  border: 0;
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.rules-link u {
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

.rules-link > span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--cobalt);
}

.resume-strip {
  grid-column: 1 / -1;
  padding: 10px 10px 10px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--mango-soft);
  box-shadow: 3px 4px 0 var(--mango);
  font-size: 0.82rem;
}

.resume-strip > span {
  min-width: 0;
  flex: 1 1 auto;
}

.resume-strip b {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}

.resume-button {
  min-height: 44px;
  padding: 8px 15px;
  flex: 0 0 auto;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--cobalt);
  font-weight: 900;
  cursor: pointer;
}

.resume-dismiss {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  font-size: 1.15rem;
  cursor: pointer;
}

/* ==========================================================
   Shared game-stage layout
   ========================================================== */

.screen {
  position: relative;
  width: min(1180px, calc(100% - 2 * var(--content-gutter)));
  min-width: 0;
  flex: 1 1 auto;
  margin: 0 auto;
  padding: clamp(24px, 4vh, 42px) 0 48px;
}

.center-screen {
  display: grid;
  place-items: center;
}

.screen-shell {
  min-width: 0;
}

.screen-main,
.screen-aside {
  min-width: 0;
}

.phase-rail {
  min-width: 0;
}

.phase-rail > h2,
.phase-rail > p {
  margin: 0;
}

.phase-rail-title {
  margin: 0 3px 10px;
  padding: 10px 8px;
  display: block;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--wood);
  box-shadow: 3px 4px 0 var(--wood-light);
  font-family: var(--font-display);
  font-size: 0.78rem;
  line-height: 1.55;
  text-align: center;
}

.phase-node {
  position: relative;
  min-height: 44px;
  padding: 8px 10px 8px 36px;
  display: flex;
  align-items: center;
  color: var(--ink-soft);
  border: 2px solid transparent;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1.3;
}

.phase-node::before {
  content: "";
  position: absolute;
  left: 12px;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: var(--paper);
}

.phase-node:has(> i)::before {
  display: none;
}

.phase-node > i {
  position: absolute;
  left: 9px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  border: 2px solid currentColor;
  border-radius: 50%;
  background: var(--paper);
  font-size: 0.65rem;
  font-style: normal;
  line-height: 1;
}

.phase-node > b {
  font-weight: 900;
}

.phase-node.done,
.phase-node[data-state="done"] {
  color: var(--success);
}

.phase-node.done::before,
.phase-node[data-state="done"]::before {
  background: var(--teal);
}

.phase-node.done > i,
.phase-node.completed > i,
.phase-node[data-state="done"] > i {
  color: var(--paper);
  background: var(--teal);
}

.phase-node.active,
.phase-node[aria-current="step"] {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--phase-soft);
  box-shadow: 2px 3px 0 var(--phase);
}

.phase-node.active::before,
.phase-node[aria-current="step"]::before {
  background: var(--phase);
}

.phase-node.active > i,
.phase-node.current > i,
.phase-node[aria-current="step"] > i {
  color: var(--paper);
  background: var(--phase);
}

.screen-aside {
  align-self: start;
}

.player-gallery {
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: 4px 5px 0 var(--phase-shadow);
}

.player-gallery > h2,
.player-gallery > h3,
.player-gallery > p {
  margin-top: 0;
}

.gallery-title {
  padding-bottom: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 2px dashed var(--ink);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.45;
}

.gallery-title > b {
  min-width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--mango);
  font-family: var(--font-display);
  font-size: 0.69rem;
}

.gallery-progress {
  padding: 13px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px 10px;
  border-bottom: 2px dashed var(--ink);
}

.gallery-progress > span {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 900;
}

.gallery-progress > b {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-family: var(--font-display);
  font-size: 0.69rem;
  font-variant-numeric: tabular-nums;
}

.gallery-progress .progress-dots {
  grid-column: 1;
}

.gallery-players {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.gallery-player {
  min-width: 0;
  min-height: 52px;
  padding: 6px 7px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 2px solid transparent;
  border-radius: 13px;
}

.gallery-player.me {
  border-color: var(--ink);
  background: var(--mango-soft);
}

.gallery-player.offline {
  color: var(--ink-muted);
  background: #e9e5dc;
  opacity: 0.72;
}

.gallery-player .member-avatar {
  width: 38px;
  height: 38px;
  font-size: 0.69rem;
}

.gallery-player > span:last-child {
  min-width: 0;
}

.gallery-player b,
.gallery-player small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-player b {
  font-size: 0.79rem;
}

.gallery-player small {
  color: var(--ink-soft);
  font-size: 0.67rem;
}

.progress-dots {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.progress-dot {
  width: 15px;
  height: 15px;
  display: block;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
}

.progress-dot.done,
.progress-dot[data-state="done"] {
  background: var(--teal);
}

.progress-dot.active,
.progress-dot[aria-current="true"] {
  background: var(--mango);
  box-shadow: 0 0 0 3px var(--mango-soft);
}

.mobile-phase-bar {
  display: none;
}

.section-head {
  max-width: 800px;
  margin: 0 auto 24px;
  text-align: center;
}

.step-label {
  width: fit-content;
  margin: 0 auto 11px;
  padding: 5px 11px 6px;
  display: inline-flex;
  align-items: center;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--phase);
  box-shadow: 2px 3px 0 var(--phase-shadow);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1.2;
}

.section-head h1,
.section-head h2,
.waiting-card h1,
.waiting-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.6vw, 2.55rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.section-head p {
  max-width: 640px;
  margin: 10px auto 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.7;
  text-wrap: pretty;
}

.panel,
.waiting-card {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 36px);
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-phase);
}

.compact-panel {
  max-width: 610px;
}

.panel-title {
  margin: 28px 0 12px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
}

.form-label {
  display: block;
  margin: 19px 0 8px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 900;
}

.form-label:first-child {
  margin-top: 0;
}

.field {
  width: 100%;
  min-height: 56px;
  padding: 14px 15px;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: #fffef8;
  box-shadow: inset 0 -3px 0 var(--paper-deep);
  font-size: 1rem;
  font-weight: 700;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.field::placeholder {
  color: #80879a;
  opacity: 1;
}

.field:hover {
  background: #fff;
}

.field:focus {
  border-color: var(--phase-deep);
  outline: 0;
  box-shadow: inset 0 -3px 0 var(--phase-soft), 0 0 0 4px var(--phase-soft);
}

textarea.field {
  min-height: 126px;
  resize: vertical;
  line-height: 1.6;
}

.code-input {
  color: var(--cobalt-deep);
  background: var(--mango-soft);
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 6vw, 2.35rem);
  letter-spacing: 0.18em;
  text-align: center;
  text-indent: 0.18em;
  text-transform: uppercase;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.option-card {
  position: relative;
  display: block;
  cursor: pointer;
}

.option-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-body {
  height: 100%;
  padding: 16px;
  display: block;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: 3px 4px 0 var(--line);
  transition: background-color 130ms ease, box-shadow 130ms ease, color 130ms ease;
}

.option-card input:checked + .option-body {
  background: var(--phase-soft);
  box-shadow: 4px 5px 0 var(--phase);
}

.option-card input:focus-visible + .option-body {
  outline: 4px solid var(--mango);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px var(--ink);
}

.option-body b {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 400;
}

.option-body small {
  color: var(--ink-soft);
  font-size: 0.81rem;
  line-height: 1.6;
}

.round-picker {
  display: flex;
  align-items: center;
  gap: 16px;
}

.round-picker input {
  min-width: 0;
  height: 32px;
  flex: 1 1 auto;
  accent-color: var(--phase);
}

.round-value {
  min-width: 110px;
  min-height: 48px;
  padding: 9px 11px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--mango-soft);
  box-shadow: 2px 3px 0 var(--mango);
  font-family: var(--font-display);
  font-size: 0.84rem;
}

.form-actions,
.center-actions {
  margin-top: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.form-actions {
  justify-content: flex-end;
}

.primary-button,
.secondary-button {
  min-height: 56px;
  padding: 13px 22px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.primary-button {
  color: var(--paper);
  background: var(--phase);
  box-shadow: 4px 5px 0 var(--ink);
}

.secondary-button {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 3px 4px 0 var(--phase-shadow);
}

.primary-button:not(:disabled):hover,
.secondary-button:not(:disabled):hover {
  filter: saturate(1.12);
}

.primary-button:not(:disabled):active,
.secondary-button:not(:disabled):active {
  box-shadow: 1px 1px 0 var(--ink);
}

.primary-button:disabled {
  color: #5e6578;
  border-color: #73798a;
  background: #e4dfd5;
  box-shadow: 2px 2px 0 #a8a393;
}

.secondary-button:disabled {
  color: #73798a;
  border-color: #9ea2ab;
  background: #eee9de;
  box-shadow: none;
}

.text-button {
  min-height: 48px;
  padding: 8px 7px;
  border: 0;
  background: transparent;
  font-weight: 900;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
  cursor: pointer;
}

.text-button:hover {
  color: var(--cobalt-deep);
  background: var(--mango-soft);
}

.wide-button {
  width: 100%;
  margin-top: 20px;
}

.danger {
  color: var(--danger);
}

.error-text {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 900;
}

.counter {
  margin-top: 7px;
  color: var(--ink-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.waiting-card {
  max-width: 630px;
  text-align: center;
}

.waiting-card.compact {
  padding: 28px 24px;
}

.waiting-card h1,
.waiting-card h2 {
  font-size: clamp(1.35rem, 3.2vw, 1.9rem);
}

.waiting-card p {
  margin: 11px 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.75;
}

.loader {
  width: 46px;
  height: 46px;
  margin: 20px auto;
  border: 5px solid var(--phase-soft);
  border-top-color: var(--phase);
  border-radius: 50%;
  animation: spin 780ms steps(10, end) infinite;
  will-change: transform;
}

.loader.small {
  width: 22px;
  height: 22px;
  margin: 0;
  flex: 0 0 auto;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.lock-icon {
  width: 66px;
  height: 62px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 52% 52% 52% 20%;
  background: var(--mango-soft);
  box-shadow: 4px 4px 0 var(--mango);
  font-size: 2rem;
  line-height: 1;
}

.lock-icon > i {
  position: relative;
  width: 31px;
  height: 23px;
  display: block;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--coral-soft);
}

.lock-icon > i::before,
.lock-icon > i::after {
  content: "";
  position: absolute;
  top: 3px;
  width: 17px;
  height: 2px;
  background: var(--ink);
}

.lock-icon > i::before {
  left: 1px;
  transform: rotate(34deg);
  transform-origin: left center;
}

.lock-icon > i::after {
  right: 1px;
  transform: rotate(-34deg);
  transform-origin: right center;
}

.waiting-inline {
  padding: 14px 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 2px dashed var(--ink);
  border-radius: var(--radius-md);
  background: var(--phase-soft);
  font-size: 0.88rem;
  font-weight: 900;
}

.waiting-inline.standalone {
  width: min(700px, 100%);
  margin: 24px auto 0;
}

.member-avatar.big {
  width: 72px;
  height: 72px;
  margin: 0 auto 15px;
  font-size: 1.45rem;
}

.setup-screen,
.create-screen,
.join-screen,
.connection-screen,
.question-screen,
.answer-screen,
.vote-screen,
.reveal-screen,
.scores-screen,
.final-screen {
  min-width: 0;
}

.setup-screen .panel {
  position: relative;
}

.setup-screen .kotodama-stamp {
  position: absolute;
  z-index: 2;
  top: -24px;
  right: clamp(18px, 5vw, 38px);
}

.setup-screen .kotodama-stamp > i {
  position: absolute;
  top: 16px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--mango);
}

.setup-screen .kotodama-stamp > span {
  margin-top: 20px;
}

.create-screen .kotodama-stamp {
  background: var(--coral-soft);
  box-shadow: 4px 4px 0 var(--coral);
}

.join-screen .kotodama-stamp {
  background: var(--cobalt-soft);
  box-shadow: 4px 4px 0 var(--cobalt);
}

.choice-symbol {
  width: 28px;
  height: 28px;
  margin-right: 8px;
  display: inline-grid;
  place-items: center;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 55% 52% 54% 22%;
  background: var(--phase);
  box-shadow: 2px 2px 0 var(--mango);
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-style: normal;
  line-height: 1;
  vertical-align: middle;
}

.choice-symbol.people::before {
  content: "人";
}

.choice-symbol.shuffle::before {
  content: "↻";
  font-family: var(--font-body);
  font-size: 1rem;
}

.question-form {
  position: relative;
}

/* ==========================================================
   Lobby / connection states
   ========================================================== */

.lobby-layout {
  width: min(1020px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.22fr);
  align-items: start;
  gap: 24px;
}

.invite-card {
  position: sticky;
  top: calc(var(--topbar-h) + 22px);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--cobalt);
  box-shadow: 7px 8px 0 var(--mango);
  text-align: center;
}

.invite-card::before,
.invite-card::after {
  content: "";
  position: absolute;
  top: 48%;
  width: 18px;
  height: 36px;
  border: 2px solid var(--ink);
  background: var(--cream);
}

.invite-card::before {
  left: -10px;
  border-radius: 0 999px 999px 0;
  border-left: 0;
}

.invite-card::after {
  right: -10px;
  border-radius: 999px 0 0 999px;
  border-right: 0;
}

.invite-card > span {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.invite-card > strong {
  margin: 9px 0 18px;
  font-family: var(--font-display);
  font-size: clamp(2.15rem, 5vw, 3.1rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.11em;
  text-indent: 0.11em;
}

.invite-card .primary-button {
  width: 100%;
  color: var(--ink);
  background: var(--mango);
  box-shadow: 4px 5px 0 var(--ink);
}

.invite-card small {
  margin-top: 17px;
  font-size: 0.75rem;
  line-height: 1.6;
}

.lobby-panel {
  width: 100%;
  padding: 24px;
}

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

.lobby-title h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 400;
}

.lobby-title > span {
  min-width: 52px;
  padding: 5px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--mango-soft);
  font-size: 0.8rem;
  font-weight: 900;
  text-align: center;
}

.member-list {
  margin: 16px 0;
  display: grid;
  gap: 9px;
}

.member-row {
  min-height: 64px;
  padding: 9px 11px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: 2px 3px 0 var(--teal-soft);
}

.member-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 55% 52% 54% 22%;
  background: var(--player, var(--coral));
  box-shadow: 2px 3px 0 var(--mango);
  font-family: var(--font-display);
  font-size: 0.82rem;
  line-height: 1;
}

.member-row b {
  display: block;
  overflow: hidden;
  font-size: 0.96rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-row small {
  display: block;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.online-state {
  color: var(--ink-muted);
  font-size: 0.69rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.online-state.on {
  color: var(--success);
}

.kick-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
}

.kick-button:hover {
  color: var(--paper);
  background: var(--danger);
}

.host-settings {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 2px dashed var(--ink);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.segmented button {
  min-height: 54px;
  padding: 11px;
  border: 0;
  background: var(--paper);
  font-size: 0.91rem;
  font-weight: 900;
  cursor: pointer;
}

.segmented button + button {
  border-left: 2px solid var(--ink);
}

.segmented button.active {
  color: var(--ink);
  background: var(--teal-soft);
  box-shadow: inset 0 -4px 0 var(--teal);
}

.lobby-footer {
  margin-top: 16px;
  text-align: center;
}

.host-recovery,
.connection-notice {
  width: min(880px, 100%);
  margin: 0 auto 16px;
  padding: 13px 14px 13px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--mango-soft);
  box-shadow: 4px 5px 0 var(--mango);
}

.connection-notice {
  background: var(--cobalt-soft);
  box-shadow: 4px 5px 0 var(--cobalt);
}

.connection-notice.attention {
  background: var(--coral-soft);
  box-shadow: 4px 5px 0 var(--coral);
}

.host-recovery b,
.host-recovery span,
.connection-notice b,
.connection-notice span {
  display: block;
}

.host-recovery b,
.connection-notice b {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 400;
}

.host-recovery span,
.connection-notice span {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 0.77rem;
}

.host-recovery .secondary-button,
.connection-notice .secondary-button {
  min-height: 48px;
  padding: 9px 14px;
  flex: 0 0 auto;
  font-size: 0.82rem;
}

.connection-symbol {
  width: 62px;
  height: 58px;
  margin: 4px auto 15px;
  display: grid;
  place-items: center;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 55% 52% 54% 22%;
  background: var(--coral);
  box-shadow: 4px 5px 0 var(--mango);
  font-family: var(--font-display);
  font-size: 1.55rem;
}

.connection-card .wide-button {
  max-width: 370px;
}

.test-tools {
  margin-top: 19px;
  padding: 14px 15px;
  display: grid;
  gap: 8px;
  justify-items: start;
  border: 2px dashed var(--cobalt);
  border-radius: var(--radius-md);
  background: var(--cobalt-soft);
}

.test-tools b {
  color: var(--cobalt-deep);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.test-tools p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.6;
}

.test-tools .secondary-button {
  min-height: 48px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-size: 0.86rem;
  text-decoration: none;
}

.test-tools small {
  color: var(--ink-muted);
  font-size: 0.73rem;
}

/* ==========================================================
   Round / answer / vote / reveal
   ========================================================== */

.role-strip {
  width: min(880px, 100%);
  min-height: 52px;
  margin: 0 auto 20px;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 3px 4px 0 var(--phase-shadow);
  font-size: 0.88rem;
  font-weight: 900;
}

.role-strip.mine {
  background: var(--mango-soft);
  box-shadow: 3px 4px 0 var(--mango);
}

.role-strip > span {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-token {
  width: 22px;
  height: 20px;
  flex: 0 0 auto;
  display: inline-block;
  border: 2px solid var(--ink);
  border-radius: 55% 52% 54% 22%;
  background: var(--mango);
  box-shadow: 2px 2px 0 var(--coral-soft);
}

.role-strip b {
  flex: 0 0 auto;
  color: var(--phase-deep);
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.question-box {
  position: relative;
  width: min(880px, 100%);
  margin: 0 auto 24px;
  padding: clamp(32px, 5vw, 48px) clamp(22px, 4vw, 40px);
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: 7px 8px 0 var(--phase);
}

.question-box::before {
  content: "お題";
  position: absolute;
  top: -15px;
  left: 20px;
  padding: 5px 11px 6px;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--phase);
  font-family: var(--font-display);
  font-size: 0.72rem;
  line-height: 1;
}

.question-box p {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.22rem, 3.2vw, 1.9rem);
  font-weight: 400;
  line-height: 1.55;
  text-align: center;
  text-wrap: balance;
}

.question-box.compact {
  margin-bottom: 19px;
  padding: 15px 17px 15px 65px;
  border-radius: var(--radius-md);
  box-shadow: 4px 5px 0 var(--phase-shadow);
}

.question-box.compact::before {
  top: 50%;
  left: 12px;
  padding: 5px 8px;
  translate: 0 -50%;
}

.question-box.compact p {
  font-family: var(--font-body);
  font-size: clamp(0.98rem, 2vw, 1.12rem);
  font-weight: 900;
  text-align: left;
}

.question-box.compact.sticky {
  position: sticky;
  z-index: 30;
  top: calc(var(--topbar-h) + 12px);
  background: var(--paper);
}

.question-meta {
  margin-top: 13px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-align: center;
}

.your-turn {
  width: fit-content;
  margin-bottom: 7px;
  padding: 7px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--mango-soft);
  box-shadow: 2px 3px 0 var(--mango);
  font-size: 0.86rem;
  font-weight: 900;
}

.your-turn > i {
  width: 13px;
  height: 13px;
  margin-right: 6px;
  display: inline-block;
  vertical-align: -1px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 2px 2px 0 var(--ink);
}

.suggestion-list {
  margin-top: 17px;
  display: grid;
  gap: 9px;
}

.suggestion-list > span {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 900;
}

.suggestion-list button {
  min-height: 52px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: 2px 3px 0 var(--teal-soft);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

.suggestion-list button::before {
  content: "+";
  flex: 0 0 auto;
  color: var(--paper);
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--teal);
  font-family: var(--font-display);
  font-size: 0.72rem;
}

.suggestion-list button:hover {
  background: var(--teal-soft);
  box-shadow: 3px 4px 0 var(--teal);
}

.answer-form {
  width: min(710px, 100%);
  margin: 22px auto 0;
}

.answer-grid {
  width: min(940px, 100%);
  margin: 24px auto 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.vote-card {
  position: relative;
  min-height: 106px;
  padding: 19px 18px 35px 62px;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: 4px 5px 0 var(--phase-shadow);
  text-align: left;
  cursor: pointer;
  transition: background-color 130ms ease, box-shadow 130ms ease, color 130ms ease;
}

.vote-card:not(:disabled):hover {
  background: var(--cobalt-soft);
  box-shadow: 6px 7px 0 var(--cobalt);
}

.vote-card.selected {
  background: var(--mango-soft);
  box-shadow: 7px 8px 0 var(--mango);
}

.vote-card.mine {
  color: #626a7d;
  border-style: dashed;
  background: #ece8de;
  box-shadow: none;
  cursor: default;
}

.vote-letter {
  position: absolute;
  top: 17px;
  left: 16px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 55% 52% 54% 22%;
  background: var(--cobalt);
  box-shadow: 2px 2px 0 var(--mango);
  font-family: var(--font-display);
  font-size: 0.78rem;
}

.vote-card.selected .vote-letter {
  color: var(--ink);
  background: var(--mango);
}

.vote-card.mine .vote-letter {
  color: var(--paper);
  background: #8a8f9c;
  box-shadow: none;
}

.vote-letter.static {
  position: static;
}

.vote-text {
  display: block;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.vote-card small {
  position: absolute;
  right: 13px;
  bottom: 10px;
  color: var(--ink-muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.vote-check {
  position: absolute;
  right: 12px;
  bottom: 9px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--mango);
  font-size: 0.85rem;
  opacity: 0;
}

.vote-card.selected .vote-check {
  opacity: 1;
}

.sticky-action {
  position: sticky;
  z-index: 35;
  bottom: 0;
  margin: 20px calc(var(--content-gutter) * -1) 0;
  padding: 18px var(--content-gutter) calc(18px + var(--safe-bottom));
  display: flex;
  justify-content: center;
  border-top: 2px solid var(--ink);
  background: var(--cream);
}

.sticky-action .primary-button {
  min-width: min(380px, 100%);
}

.reveal-list {
  width: min(880px, 100%);
  margin: 22px auto;
  display: grid;
  gap: 11px;
}

.reveal-card {
  padding: 15px 16px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: 3px 4px 0 var(--line);
}

.reveal-card.parent-answer {
  border-width: 3px;
  background: var(--mango-soft);
  box-shadow: 6px 7px 0 var(--mango);
}

.reveal-card.fooled {
  background: var(--coral-soft);
  box-shadow: 3px 4px 0 var(--coral);
}

.reveal-author {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.reveal-author b {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 900;
}

.reveal-card.parent-answer .reveal-author b {
  color: var(--mango-deep);
}

.reveal-card.parent-answer .vote-letter {
  color: var(--ink);
  background: var(--mango);
}

.reveal-author span {
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.vote-bubbles {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.vote-bubble {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 55% 52% 54% 22%;
  background: var(--player, var(--cobalt));
  font-family: var(--font-display);
  font-size: 0.68rem;
}

.vote-bubbles > small {
  color: var(--ink-muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.points-pop {
  padding: 5px 9px;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--coral);
  font-family: var(--font-display);
  font-size: 0.71rem;
  white-space: nowrap;
}

.score-explain {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 12px 17px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: 3px 4px 0 var(--mango-soft);
  font-size: 0.85rem;
  text-align: center;
}

.score-explain b {
  color: var(--coral-deep);
}

.score-explain > span {
  min-width: 38px;
  min-height: 34px;
  margin-right: 6px;
  padding: 4px 7px;
  display: inline-grid;
  place-items: center;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--coral);
  box-shadow: 2px 2px 0 var(--ink);
  font-family: var(--font-display);
  font-size: 0.8rem;
}

/* ==========================================================
   Scores / final
   ========================================================== */

.scoreboard {
  width: min(740px, 100%);
  margin: 24px auto;
  display: grid;
  gap: 10px;
  counter-reset: score-position;
}

.score-row {
  min-height: 62px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: 3px 4px 0 var(--teal-soft);
}

.score-row:first-child {
  background: var(--mango-soft);
  box-shadow: 6px 7px 0 var(--mango);
}

.score-row > strong {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rank {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 55% 52% 54% 22%;
  background: var(--cobalt);
  font-family: var(--font-display);
  font-size: 0.76rem;
}

.score-row:first-child .rank {
  color: var(--ink);
  background: var(--mango);
}

.score-name {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.98rem;
  font-weight: 900;
}

.score-name i {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.score-name small,
.score-name em {
  padding: 3px 7px;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 900;
  line-height: 1.2;
}

.score-name small {
  background: var(--cobalt);
}

.score-name em {
  background: var(--coral);
  font-style: normal;
}

.winner-stage {
  width: min(820px, 100%);
  margin: 0 auto 22px;
  text-align: center;
}

.winner-stage h1,
.winner-stage h2 {
  margin: 10px 0 5px;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5vw, 3.2rem);
  font-weight: 400;
  line-height: 1.3;
  text-wrap: balance;
}

.winner-stage h1 span,
.winner-stage h2 span {
  color: var(--coral-deep);
  text-shadow: 2px 2px 0 var(--mango);
}

.winner-stage p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.winner-podium {
  position: relative;
  width: min(460px, 100%);
  min-height: 182px;
  margin: 14px auto 7px;
  padding: 25px 22px 20px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  border: 2px solid var(--ink);
  border-radius: 50% 50% 22px 22px;
  background: var(--mango-soft);
  box-shadow: 7px 8px 0 var(--mango);
}

.winner-crown {
  width: 66px;
  height: 50px;
  color: var(--mango);
}

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

.winner-avatars .member-avatar {
  width: 66px;
  height: 66px;
  font-size: 1.24rem;
  box-shadow: 4px 5px 0 var(--coral-soft);
}

/* ==========================================================
   Modal / notification / confetti
   ========================================================== */

.modal-backdrop {
  position: fixed;
  z-index: 200;
  inset: 0;
  padding: 18px;
  display: grid;
  place-items: center;
  background: rgba(23, 38, 80, 0.78);
}

.modal {
  width: min(640px, 100%);
  max-height: min(780px, 88svh);
  padding: clamp(23px, 4vw, 36px);
  overflow: auto;
  border: 2px solid var(--ink);
  border-radius: var(--radius-xl);
  background: var(--paper);
  box-shadow: 9px 10px 0 var(--mango);
  overscroll-behavior: contain;
}

.modal h2 {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 1.95rem);
  font-weight: 400;
  line-height: 1.4;
  text-align: center;
}

.modal-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-title-row h2 {
  margin: 3px 0 0;
  text-align: left;
}

.modal-close {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 2px 3px 0 var(--coral-soft);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--paper);
  background: var(--coral);
}

.game-menu {
  width: min(580px, 100%);
}

.menu-actions,
.transfer-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.menu-actions {
  margin-top: 22px;
}

.menu-section {
  margin-top: 23px;
  padding-top: 18px;
  border-top: 2px dashed var(--ink);
}

.menu-section > b {
  display: block;
  margin-bottom: 10px;
  font-family: var(--font-display);
  font-size: 0.84rem;
}

.menu-section p,
.menu-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.83rem;
  line-height: 1.7;
}

.menu-room-action {
  margin-top: 23px;
  padding-top: 13px;
  border-top: 2px solid var(--ink);
  text-align: center;
}

.rule-steps {
  display: grid;
  gap: 11px;
}

.rule-step {
  padding: 14px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: 3px 4px 0 var(--cobalt-soft);
}

.rule-step > b {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 55% 52% 54% 22%;
  background: var(--cobalt);
  font-family: var(--font-display);
  font-size: 0.82rem;
}

.rule-step:nth-child(2) > b {
  color: var(--ink);
  background: var(--mango);
}

.rule-step:nth-child(3) > b {
  background: var(--coral);
}

.rule-step:nth-child(4) > b {
  background: var(--teal);
}

.rule-step strong {
  font-size: 0.96rem;
}

.rule-step p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.6;
}

.toast {
  position: fixed;
  z-index: 250;
  top: calc(var(--topbar-h) + 16px);
  left: 50%;
  max-width: min(440px, calc(100% - 32px));
  padding: 12px 17px;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 4px 5px 0 var(--mango);
  font-size: 0.86rem;
  font-weight: 900;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  translate: -50% -12px;
  transition: opacity 180ms ease, translate 180ms ease;
}

.toast.show {
  opacity: 1;
  translate: -50% 0;
}

.toast[data-kind="error"] {
  background: var(--danger);
  box-shadow: 4px 5px 0 var(--coral-soft);
}

.confetti-layer {
  position: fixed;
  z-index: 220;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  top: -24px;
  width: 10px;
  height: 18px;
  border: 1px solid var(--ink);
  animation: confetti-fall 2.5s ease-in forwards;
  will-change: transform;
}

@keyframes confetti-fall {
  to { transform: translate3d(var(--drift), 110vh, 0) rotate(760deg); }
}

/* ==========================================================
   Information pages
   ========================================================== */

.info-page {
  --phase: var(--cobalt);
  --phase-soft: var(--cobalt-soft);
  --phase-shadow: #9eb3ee;
}

.info-page .info-shell {
  position: relative;
  z-index: 2;
  width: min(820px, calc(100% - 30px));
  flex: 1 1 auto;
  margin: 0 auto;
  padding: 30px 0 52px;
}

.info-header {
  margin-bottom: 19px;
}

.info-header a {
  min-height: 48px;
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 3px 4px 0 var(--cobalt-soft);
  font-weight: 900;
  text-decoration: none;
}

.info-header a:hover {
  background: var(--mango-soft);
  box-shadow: 3px 4px 0 var(--mango);
}

.info-card {
  padding: clamp(25px, 5vw, 48px);
  border: 2px solid var(--ink);
  border-radius: var(--radius-xl);
  background: var(--paper);
  box-shadow: 7px 8px 0 var(--cobalt-soft);
}

.info-card::before {
  content: "ことばのパレード";
  width: fit-content;
  margin: 0 0 14px;
  padding: 5px 10px;
  display: block;
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--cobalt);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.info-card h1 {
  margin: 0 0 23px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 5vw, 2.65rem);
  font-weight: 400;
  line-height: 1.4;
  text-wrap: balance;
}

.info-card h2 {
  margin: 32px 0 11px;
  padding-left: 13px;
  border-left: 7px solid var(--mango);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.55;
}

.info-card p,
.info-card li {
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.9;
}

.info-card li + li {
  margin-top: 7px;
}

.info-card .lead {
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 900;
}

.info-card a {
  color: var(--cobalt-deep);
  font-weight: 900;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.info-card a:hover {
  color: var(--coral-deep);
  background: var(--mango-soft);
}

/* ==========================================================
   Desktop: a horizontal game-show stage
   ========================================================== */

body[data-layout="desktop"] .home-stage {
  display: grid;
  grid-template-columns: minmax(420px, 48%) minmax(0, 52%);
  grid-template-areas: "panel visual";
}

body[data-layout="desktop"] .home-visual,
body[data-layout="desktop"] .home-art {
  grid-area: visual;
  min-height: calc(100svh - var(--topbar-h));
  border-left: 3px solid var(--ink);
  background: var(--cobalt);
}

body[data-layout="desktop"] .home-panel {
  grid-area: panel;
  padding: clamp(34px, 5vh, 68px) clamp(30px, 4vw, 70px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(24px, 4vh, 40px);
  background: var(--cream);
}

body[data-layout="desktop"] .home-content,
body[data-layout="desktop"] .home-dock {
  width: min(690px, 100%);
  margin-inline: auto;
}

body[data-layout="desktop"] .home-dock {
  padding-top: 22px;
  border-top: 3px dashed var(--ink);
}

body[data-layout="desktop"] .dock-inner {
  display: grid;
  gap: 17px;
}

body[data-layout="desktop"] .screen.has-shell,
body[data-layout="desktop"] .screen-shell {
  width: min(1380px, calc(100vw - 2 * var(--content-gutter)));
}

body[data-layout="desktop"] .screen-shell > .phase-rail {
  grid-column: 1;
}

body[data-layout="desktop"] .screen-shell > .screen-main {
  grid-column: 2;
}

body[data-layout="desktop"] .screen-shell > .player-gallery,
body[data-layout="desktop"] .screen-shell > .screen-aside {
  grid-column: 3;
}

body[data-layout="desktop"] .screen-shell > .host-recovery,
body[data-layout="desktop"] .screen-shell > .connection-notice {
  width: 100%;
  grid-column: 1 / -1;
}

body[data-layout="desktop"] .screen-shell {
  margin-inline: auto;
  display: grid;
  grid-template-columns: clamp(140px, 14vw, 190px) minmax(0, 1fr) clamp(190px, 20vw, 260px);
  align-items: start;
  gap: clamp(18px, 2.3vw, 30px);
}

body[data-layout="desktop"] .phase-rail {
  position: sticky;
  top: calc(var(--topbar-h) + 26px);
  padding: 15px 12px;
  display: grid;
  gap: 6px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: 4px 5px 0 var(--wood-light);
}

body[data-layout="desktop"] .screen-aside {
  position: sticky;
  top: calc(var(--topbar-h) + 26px);
}

body[data-layout="desktop"] .mobile-phase-bar {
  display: none;
}

body[data-layout="desktop"][data-view="lobby"] .lobby-layout {
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
}

body[data-layout="desktop"] .lobby-screen.screen-shell {
  display: block;
  width: min(1180px, calc(100vw - 2 * var(--content-gutter)));
}

body[data-layout="desktop"] .lobby-screen.screen-shell > .screen-main {
  width: 100%;
}

/* ==========================================================
   Mobile: a purpose-built vertical play dock
   ========================================================== */

body[data-layout="mobile"] {
  --topbar-h: 60px;
  --content-gutter: 14px;
}

body[data-layout="mobile"] .topbar {
  min-height: var(--topbar-h);
  padding: 7px 12px;
}

body[data-layout="mobile"] .brand-name,
body[data-layout="mobile"] .online-tag,
body[data-layout="mobile"] .connection-dot span {
  display: none;
}

body[data-layout="mobile"] .brand-mark {
  width: 40px;
  height: 36px;
}

body[data-layout="mobile"] .topbar-actions {
  gap: 6px;
}

body[data-layout="mobile"] .icon-button {
  width: 44px;
  height: 44px;
}

body[data-layout="mobile"] .room-pill {
  min-height: 40px;
  padding: 6px 10px;
  font-size: 0.81rem;
}

body[data-layout="mobile"] .connection-dot {
  min-height: 38px;
  padding: 7px;
}

body[data-layout="mobile"] .home-stage {
  min-height: auto;
  display: grid;
  grid-template-rows: minmax(310px, 42svh) auto;
  grid-template-areas: "visual" "panel";
}

body[data-layout="mobile"] .home-visual,
body[data-layout="mobile"] .home-art {
  grid-area: visual;
  min-height: 310px;
  border-bottom: 3px solid var(--ink);
}

body[data-layout="mobile"] .home-art::after {
  background-image: url("/assets/party-parade-mobile-v1.jpg");
  background-position: center;
}

body[data-layout="mobile"] .home-glow {
  background: linear-gradient(0deg, var(--cream) 0%, transparent 16%);
}

body[data-layout="mobile"] .home-panel {
  grid-area: panel;
  margin-top: -28px;
  padding: 24px 14px calc(20px + var(--safe-bottom));
  border-top: 2px solid var(--ink);
  border-radius: 28px 28px 0 0;
  background: var(--cream);
}

body[data-layout="mobile"] .home-content,
body[data-layout="mobile"] .home-dock {
  width: min(520px, 100%);
  margin-inline: auto;
}

body[data-layout="mobile"] .home-content {
  margin-bottom: 20px;
  text-align: center;
}

body[data-layout="mobile"] .logo-kicker,
body[data-layout="mobile"] .home-tagline,
body[data-layout="mobile"] .home-proof {
  margin-inline: auto;
  justify-content: center;
}

body[data-layout="mobile"] .logo-title {
  font-size: clamp(2.35rem, 14vw, 3.7rem);
}

body[data-layout="mobile"] .logo-line {
  margin-inline: auto;
}

body[data-layout="mobile"] .logo-lockup {
  width: min(350px, 88vw);
  margin-inline: auto;
}

body[data-layout="mobile"] .dock-inner {
  display: grid;
  gap: 14px;
}

body[data-layout="mobile"] .how-summary ol {
  gap: 6px;
}

body[data-layout="mobile"] .how-summary li {
  min-height: 82px;
  padding: 36px 6px 8px;
  justify-content: center;
  text-align: center;
}

body[data-layout="mobile"] .how-summary li b {
  top: 9px;
  left: 50%;
  translate: -50% 0;
}

body[data-layout="mobile"] .how-summary li span {
  font-size: 0.7rem;
}

body[data-layout="mobile"] .home-actions {
  grid-template-columns: 1fr;
  gap: 11px;
}

body[data-layout="mobile"] .home-actions .join-button {
  order: 1;
  min-height: 68px;
}

body[data-layout="mobile"] .home-actions .create-button {
  order: 2;
  min-height: 60px;
  color: var(--coral-deep);
  background: var(--paper);
  box-shadow: 4px 5px 0 var(--coral-soft);
}

body[data-layout="mobile"] .home-actions .rules-link {
  order: 3;
  justify-self: center;
}

body[data-layout="mobile"] .resume-strip {
  flex-wrap: wrap;
}

body[data-layout="mobile"] .resume-strip > span {
  flex-basis: calc(100% - 54px);
}

body[data-layout="mobile"] .resume-button {
  order: 3;
  width: 100%;
  min-height: 52px;
}

body[data-layout="mobile"] .screen {
  width: calc(100% - 28px);
  padding: 20px 0 calc(34px + var(--safe-bottom));
}

body[data-layout="mobile"] .screen-shell {
  width: 100%;
  display: block;
}

/* The room renderer places screen-shell on .screen itself. Keep the mobile
   stage gutter in that case so ticket notches never widen the viewport. */
body[data-layout="mobile"] .screen.screen-shell {
  width: calc(100% - 28px);
}

body[data-layout="mobile"] .phase-rail,
body[data-layout="mobile"] .screen-aside,
body[data-layout="mobile"] .player-gallery {
  display: none;
}

body[data-layout="mobile"] .mobile-phase-bar {
  min-height: 48px;
  margin: 0 0 18px;
  padding: 7px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--phase-soft);
  box-shadow: 3px 4px 0 var(--phase);
  font-size: 0.76rem;
  font-weight: 900;
}

body[data-layout="mobile"] .section-head {
  margin-bottom: 19px;
}

body[data-layout="mobile"] .section-head h1,
body[data-layout="mobile"] .section-head h2,
body[data-layout="mobile"] .waiting-card h1,
body[data-layout="mobile"] .waiting-card h2 {
  font-size: clamp(1.35rem, 7.2vw, 1.85rem);
}

body[data-layout="mobile"] .section-head p {
  font-size: 0.86rem;
}

body[data-layout="mobile"] .panel,
body[data-layout="mobile"] .waiting-card {
  padding: 21px 16px;
  border-radius: 20px;
}

body[data-layout="mobile"] .option-grid,
body[data-layout="mobile"] .answer-grid {
  grid-template-columns: 1fr;
}

body[data-layout="mobile"] .form-actions {
  flex-direction: column-reverse;
}

body[data-layout="mobile"] .form-actions button,
body[data-layout="mobile"] .center-actions button {
  width: 100%;
}

body[data-layout="mobile"] .primary-button,
body[data-layout="mobile"] .secondary-button {
  min-height: 58px;
}

body[data-layout="mobile"] .lobby-layout {
  grid-template-columns: 1fr;
  gap: 22px;
}

body[data-layout="mobile"] .invite-card {
  position: static;
}

body[data-layout="mobile"] .lobby-panel {
  padding: 20px 15px;
}

body[data-layout="mobile"] .member-row {
  grid-template-columns: 42px minmax(0, 1fr) auto;
}

body[data-layout="mobile"] .member-row .online-state {
  display: none;
}

body[data-layout="mobile"] .round-picker {
  gap: 10px;
}

body[data-layout="mobile"] .round-value {
  min-width: 104px;
}

body[data-layout="mobile"] .role-strip {
  min-height: 48px;
  padding: 8px 12px;
  font-size: 0.78rem;
}

body[data-layout="mobile"] .role-strip b {
  font-size: 0.66rem;
}

body[data-layout="mobile"] .question-box {
  padding: 28px 16px 23px;
  box-shadow: 5px 6px 0 var(--phase);
}

body[data-layout="mobile"] .question-box.compact {
  padding: 13px 12px 13px 55px;
  box-shadow: 3px 4px 0 var(--phase-shadow);
}

body[data-layout="mobile"] .question-box.compact::before {
  left: 9px;
}

body[data-layout="mobile"] .question-box.compact.sticky {
  top: calc(var(--topbar-h) + 10px);
}

body[data-layout="mobile"] .vote-card {
  min-height: 96px;
}

body[data-layout="mobile"] .sticky-action {
  margin-right: -14px;
  margin-left: -14px;
  padding: 16px 14px calc(16px + var(--safe-bottom));
}

body[data-layout="mobile"] .sticky-action .primary-button {
  width: 100%;
}

body[data-layout="mobile"] .reveal-card {
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
}

body[data-layout="mobile"] .reveal-card .vote-bubbles {
  grid-column: 2;
  justify-content: flex-start;
}

body[data-layout="mobile"] .score-row {
  padding: 11px 12px;
  gap: 9px;
}

body[data-layout="mobile"] .score-name {
  font-size: 0.91rem;
}

body[data-layout="mobile"] .host-recovery,
body[data-layout="mobile"] .connection-notice {
  align-items: stretch;
  flex-direction: column;
}

body[data-layout="mobile"] .host-recovery .secondary-button,
body[data-layout="mobile"] .connection-notice .secondary-button {
  width: 100%;
}

body[data-layout="mobile"] .menu-actions,
body[data-layout="mobile"] .transfer-list {
  grid-template-columns: 1fr;
}

body[data-layout="mobile"] .modal-backdrop {
  padding: 10px;
  align-items: end;
}

body[data-layout="mobile"] .modal {
  width: 100%;
  max-height: 90svh;
  padding: 22px 16px calc(22px + var(--safe-bottom));
  border-radius: 26px 26px 12px 12px;
  box-shadow: 0 -7px 0 var(--mango);
}

body[data-layout="mobile"] .site-footer {
  font-size: 0.71rem;
}

body[data-layout="mobile"] .site-footer-links {
  gap: 3px 14px;
}

body[data-layout="mobile"][data-view="lobby"] .site-footer,
body[data-layout="mobile"][data-view="question"] .site-footer,
body[data-layout="mobile"][data-view="answer"] .site-footer,
body[data-layout="mobile"][data-view="vote"] .site-footer,
body[data-layout="mobile"][data-view="reveal"] .site-footer,
body[data-layout="mobile"][data-view="scores"] .site-footer,
body[data-layout="mobile"][data-view="final"] .site-footer,
body[data-layout="mobile"][data-view="connecting"] .site-footer {
  display: none;
}

/* Safe fallback if data-layout has not been set yet. */
@media (min-width: 900px) {
  body:not([data-layout]) .home-stage {
    display: grid;
    grid-template-columns: minmax(420px, 48%) minmax(0, 52%);
  }

  body:not([data-layout]) .home-panel {
    padding: 44px clamp(30px, 4vw, 70px);
  }
}

@media (max-width: 899px) {
  body:not([data-layout]) {
    --topbar-h: 60px;
    --content-gutter: 14px;
  }

  body:not([data-layout]) .brand-name,
  body:not([data-layout]) .online-tag,
  body:not([data-layout]) .connection-dot span {
    display: none;
  }

  body:not([data-layout]) .lobby-layout,
  body:not([data-layout]) .option-grid,
  body:not([data-layout]) .answer-grid {
    grid-template-columns: 1fr;
  }
}

/* Short phones use a compact portrait composition so the first action stays
   within reach while the mobile-only hero remains recognisable. */
@media (max-width: 899px) and (max-height: 650px) and (orientation: portrait) {
  body[data-layout="mobile"] .home-stage {
    grid-template-rows: minmax(220px, 38svh) auto;
  }

  body[data-layout="mobile"] .home-visual,
  body[data-layout="mobile"] .home-art {
    min-height: 220px;
  }

  body[data-layout="mobile"] .home-panel {
    margin-top: -22px;
    padding-top: 18px;
  }

  body[data-layout="mobile"] .home-content {
    margin-bottom: 13px;
  }

  body[data-layout="mobile"] .logo-title {
    font-size: clamp(2.1rem, 13vw, 2.8rem);
  }

  body[data-layout="mobile"] .home-tagline {
    margin-top: 10px;
    font-size: 0.84rem;
  }

  body[data-layout="mobile"] .home-proof,
  body[data-layout="mobile"] .dock-kicker {
    display: none;
  }
}

/* Low-height screens keep actions reachable without shrinking text. */
@media (max-height: 650px) and (orientation: landscape) {
  body[data-layout="mobile"] .home-stage {
    grid-template-columns: minmax(300px, 46%) minmax(0, 54%);
    grid-template-rows: 1fr;
    grid-template-areas: "visual panel";
  }

  body[data-layout="mobile"] .home-panel {
    margin-top: 0;
    overflow: auto;
    border-top: 0;
    border-left: 3px solid var(--ink);
    border-radius: 0;
  }

  body[data-layout="mobile"] .how-summary ol,
  body[data-layout="mobile"] .home-proof {
    display: none;
  }

  body[data-layout="mobile"] .home-content {
    margin-bottom: 12px;
  }

  body[data-layout="mobile"] .logo-title {
    font-size: clamp(2rem, 9vh, 3rem);
  }

  .screen {
    padding-top: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .screen-transition-wipe {
    display: none !important;
  }
}

@media print {
  .topbar,
  .site-footer,
  .info-header,
  .party-canvas,
  .screen-transition-wipe {
    display: none !important;
  }

  body,
  .info-card {
    color: #000;
    border-color: #000;
    background: #fff;
    box-shadow: none;
  }

  .info-page .info-shell {
    width: 100%;
    padding: 0;
  }
}
