/* 잠깐 미친 오락실 — 정통 80년대 아케이드(검은 배경 + 원색, CRT 주사선). 외부 폰트·이미지 없음.
   애니메이션 규칙(플랜 §4.8): 반복 밝기·색 변화는 주기 ≥ 1s, 스프라이트(sprite-)는 transform·steps() 만,
   1회성 확대 허용, 동작 줄이기(prefers-reduced-motion / .reduce-motion)에서 모든 반복 애니메이션 정지. */

:root {
  --bg: #000000;
  --panel: #1a1a1a;
  --fg: #ffffff;
  --red: #ff3b30;
  --blue: #2f6bff;
  --yellow: #ffd600;
  --green: #2fd158;
  --cyan: #2ee6e6;
  --magenta: #ff3fd0;
  --orange: #ff8c1a;
  --font-ko: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --hud-h: 48px;
  --banner-h: 40px;
  --btnrow-h: 64px;
  --pad-h: 112px;
  --joy-d: 104px;
  --ab-d: 64px;
  --canvas-min: 240px;
  --sound-w: 92px;
  --rule-font: 14px;
  --attract-h: 120px;
}

@media (max-height: 559px) {
  :root {
    --banner-h: 40px;
    --btnrow-h: 56px;
    --pad-h: 88px;
    --joy-d: 88px;
    --ab-d: 48px;
    --canvas-min: 200px;
  }
}

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

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ko);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

button {
  min-width: 48px;
  min-height: 48px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

canvas.pixel {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: inline-block;
  vertical-align: middle;
}

[hidden] {
  display: none !important;
}

/* ---- 앱 프레임 ------------------------------------------------------------ */
.app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(env(safe-area-inset-bottom) + 8px)
    env(safe-area-inset-left);
}

.app.is-play {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.screens {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.screen {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---- 소리 버튼(로비·게임·일시정지·결과 위에 항상) ------------------------------------ */
.sound-btn {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 0px);
  right: calc(env(safe-area-inset-right) + 0px);
  z-index: 30;
  width: var(--sound-w);
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
  background: var(--panel);
  border: 2px solid #555555;
  color: #bbbbbb;
  font-size: 12px;
  font-weight: 700;
}

.sound-btn.is-on {
  border-color: var(--yellow);
  color: var(--yellow);
}

.sound-btn .snd-waves {
  display: none;
}

.sound-btn.is-on .snd-waves {
  display: inline;
}

.sound-btn.is-on .snd-mute {
  display: none;
}

.sound-btn.is-unsupported {
  opacity: 0.6;
}

.sound-note {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 52px);
  right: 4px;
  z-index: 30;
  max-width: 260px;
  margin: 0;
  padding: 6px 8px;
  background: var(--panel);
  border: 2px solid var(--yellow);
  font-size: 12px;
}

/* ---- 로비 ----------------------------------------------------------------- */
.screen-lobby {
  padding: 8px 12px 12px;
  gap: 10px;
}

.marquee {
  padding-right: calc(var(--sound-w) + 4px);
  text-align: left;
}

.marquee-title {
  margin: 4px 0 2px;
  font-size: clamp(20px, 6.4vw, 28px);
  font-weight: 900;
  color: var(--yellow);
  letter-spacing: -0.5px;
}

.marquee-sub {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan);
}

.marquee-tag {
  margin: 2px 0 0;
  font-size: 12px;
  color: #bbbbbb;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.attract {
  border: 2px solid var(--cyan);
  padding: 8px;
  background: var(--bg);
}

.attract > .pixel {
  max-width: 100%;
}

.attract-area {
  position: relative;
  height: var(--attract-h);
  overflow: hidden;
  margin-top: 8px;
}

.attract-label {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--cyan);
}

.card-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  min-height: 112px;
  padding: 8px 6px;
  background: var(--panel);
  border: 3px solid #333333;
  text-align: center;
}

.card.is-selected,
.card:focus-visible {
  border-color: var(--cyan);
  outline: none;
}

.demo-btn {
  min-height: 48px;
  padding: 0 6px;
  background: var(--panel);
  border: 2px solid #555555;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 800;
}

.demo-btn.is-selected,
.demo-btn:focus-visible {
  border-color: var(--cyan);
  outline: none;
}

.card-new {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 0 3px;
  background: var(--magenta);
  color: #000000;
  font-size: 10px;
  font-weight: 900;
  line-height: 14px;
  letter-spacing: 1px;
}

/* 카드 캐릭터 프레임 띠: 한 칸 48×40, transform·steps() 만(밝기 변화 없음, rAF 미사용) */
.card-sprite {
  display: block;
  width: 48px;
  height: 40px;
  overflow: hidden;
}

.card-frames {
  display: block;
  height: 40px;
  image-rendering: pixelated;
}

.card-frames.frames-2 {
  width: 96px;
  animation: sprite-card 0.8s steps(2) infinite;
}

.card-frames.frames-3 {
  width: 144px;
  animation: sprite-card 0.9s steps(3) infinite;
}

.card-frames.frames-4 {
  width: 192px;
  animation: sprite-card 1s steps(4) infinite;
}

@keyframes sprite-card {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

@media (max-width: 359px) {
  .card-rule {
    display: none;
  }
}

.card-title {
  font-size: clamp(14px, 4.2vw, 16px);
  font-weight: 800;
  color: var(--yellow);
  word-break: keep-all;
}

.card-rule {
  font-size: 12px;
  line-height: 1.3;
  color: #dddddd;
  word-break: keep-all;
}

.card-best {
  margin-top: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
}

/* 로비 카드 캐릭터: 네모 머리 + 점눈 + 소품. transform·steps() 만 쓰는 sprite- 애니메이션(rAF 미사용). */
.sprite {
  position: relative;
  display: block;
  width: 40px;
  height: 36px;
  animation: sprite-bob 0.8s steps(2, jump-none) infinite alternate;
}

.sprite::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 20px;
  height: 18px;
  background: radial-gradient(circle at 30% 45%, #000000 2px, transparent 2.5px),
    radial-gradient(circle at 70% 45%, #000000 2px, transparent 2.5px), #ffffff;
  border: 2px solid #000000;
  box-shadow: 0 16px 0 -4px var(--fg);
}

.sprite::after {
  content: "";
  position: absolute;
}

.sprite-approve::after {
  right: 0;
  top: 10px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
}

.sprite-escape::after {
  right: 0;
  top: 12px;
  width: 12px;
  height: 10px;
  background: var(--yellow);
}

.sprite-balloon::after {
  right: -2px;
  top: 2px;
  width: 16px;
  height: 14px;
  border-radius: 8px;
  background: var(--green);
}

.sprite-copier::after {
  right: 0;
  top: 8px;
  width: 14px;
  height: 18px;
  background: var(--orange);
}

@keyframes sprite-bob {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-3px);
  }
}

.lobby-settings {
  display: flex;
  justify-content: flex-end;
}

.setting-btn {
  padding: 0 12px;
  background: var(--panel);
  border: 2px solid #555555;
  font-size: 13px;
}

.setting-btn[aria-pressed="true"] {
  border-color: var(--cyan);
  color: var(--cyan);
}

.note {
  margin: 0;
  font-size: 12px;
  color: var(--orange);
}

.press-a {
  align-self: center;
  margin-top: 4px;
  animation: soft-pulse 2s ease-in-out infinite;
}

@keyframes soft-pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
  100% {
    opacity: 1;
  }
}

/* ---- 메뉴 화면(설명·일시정지·결과) ------------------------------------------------- */
.screen-brief,
.screen-demo-end,
.screen-result {
  padding: 56px 16px 12px;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.brief-title,
.result-game,
.pause-title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: var(--yellow);
}

.brief-preview {
  width: 240px;
  height: 150px;
  border: 2px solid #333333;
  image-rendering: pixelated;
}

.brief-preview.is-howto {
  height: 180px;
}

.brief-howto {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.howto-do {
  color: var(--green);
}

.howto-dont {
  color: var(--red);
}

.howto-do:empty,
.howto-dont:empty {
  display: none;
}

.photo-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 280px;
  padding: 8px;
  border: 2px dashed #555555;
}

.photo-thumb {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--panel);
}

.photo-btns {
  display: flex;
  gap: 8px;
  width: 100%;
}

.photo-btns .menu-btn {
  font-size: 14px;
}

.photo-note,
.photo-status,
.demo-end-reason {
  margin: 0;
  font-size: 12px;
  color: #bbbbbb;
  word-break: keep-all;
}

.demo-end-game {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.brief-controls {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  word-break: keep-all;
}

.brief-rev {
  margin: 0;
  font-size: 13px;
  color: var(--cyan);
  word-break: keep-all;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 280px;
}

.menu-btn {
  width: 100%;
  min-height: 48px;
  background: var(--panel);
  border: 3px solid #555555;
  font-size: 16px;
  font-weight: 800;
}

.menu-btn.is-primary {
  border-color: var(--yellow);
  color: var(--yellow);
}

.screen-pause {
  position: absolute;
  inset: 0;
  z-index: 20;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.88);
}

.result-score {
  margin: 4px 0;
}

.result-best {
  margin: 0;
  font-size: 14px;
  color: var(--cyan);
}

.result-best.is-new {
  color: var(--yellow);
  font-weight: 800;
}

.result-title {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
}

.result-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--magenta);
  font-weight: 700;
}

.result-reason,
.result-reversals {
  margin: 0;
  font-size: 14px;
  color: #dddddd;
  word-break: keep-all;
}

.copy-status {
  margin: 0;
  min-height: 18px;
  font-size: 13px;
  color: var(--green);
}

.copy-fallback {
  width: 100%;
  max-width: 320px;
  padding: 8px;
  background: var(--panel);
  color: var(--fg);
  border: 2px solid var(--cyan);
  font: inherit;
  font-size: 14px;
  resize: none;
  user-select: text;
  -webkit-user-select: text;
}

/* ---- 게임 화면(세로 배분 §4.11) ---------------------------------------------------- */
.screen-play {
  gap: 0;
}

.hud-bar {
  flex: 0 0 var(--hud-h);
  height: var(--hud-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 calc(var(--sound-w) + 4px) 0 4px;
}

.hud-pause {
  width: 56px;
  height: 48px;
  padding: 0 2px;
  background: var(--panel);
  border: 2px solid #555555;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
}

.hud-scores {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.hud-time {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.time-bar {
  display: block;
  width: 48px;
  height: 4px;
  background: #333333;
}

/* 무제한 판: 남은 시간 막대 대신 목숨 하트(.heart 재사용, 밝기 변화 없음) */
.hud-lives {
  display: flex;
  gap: 3px;
}

/* 무제한 판 이어하기 묻기: 게임 화면 위(일시정지 z 20 아래). 오락실 간판 이중 테두리 */
.continue-box {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.82);
}

.continue-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  padding: 18px 16px 16px;
  background: var(--bg);
  border: 4px solid var(--yellow);
  box-shadow: 0 0 0 4px var(--red);
  text-align: center;
}

.continue-title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: var(--yellow);
}

.continue-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  word-break: keep-all;
}

.time-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--yellow);
}

.rev-banner {
  position: relative;
  flex: 0 0 var(--banner-h);
  height: var(--banner-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 3px;
  overflow: hidden;
  font-size: var(--rule-font);
  font-weight: 800;
  line-height: 1.15;
}

.rev-banner.is-warning {
  background: var(--yellow);
  color: #000000;
}

.rev-banner.is-notice {
  background: var(--panel);
  color: var(--yellow);
}

.rev-banner.is-surprise {
  background: var(--panel);
  color: var(--magenta);
}

.rev-icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
}

.rev-label {
  flex: 0 0 auto;
  padding: 0 4px;
  border: 2px solid currentColor;
}

.rev-label:empty {
  display: none;
}

.rev-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: keep-all;
}

.rev-banner.pop .rev-text {
  animation: pop-once 0.3s ease-out 1;
}

@keyframes pop-once {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

.rev-remain {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
}

.rev-fill {
  display: block;
  height: 100%;
  width: 0;
  background: currentColor;
}

.game-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: var(--canvas-min);
  border: 4px solid var(--panel);
  overflow: hidden;
}

/* 예고 반전 = 노랑 점선, 기습 반전 = 마젠타 사선 줄무늬(색 + 무늬로 구분, 정적) */
.game-frame.rev-notice {
  border: 4px dashed var(--yellow);
}

.game-frame.rev-surprise {
  border: 4px solid transparent;
  border-image: repeating-linear-gradient(45deg, var(--magenta) 0 6px, #000000 6px 12px) 4;
}

/* CRT 주사선: 정적 오버레이, 애니메이션 없음 */
.game-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, #000000 0, #000000 1px, transparent 1px, transparent 2px);
  opacity: 0.12;
}

.reduce-motion .game-frame::after {
  opacity: 0.06;
}

.game-area {
  position: absolute;
  inset: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  touch-action: none;
}

/* 로비 데모 Canvas 는 조작 대상이 아니라 그 위에서 밀어도 로비가 스크롤돼야 한다 */
.attract-area .game-canvas {
  touch-action: pan-y;
}

.hud-meter {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.7);
  font-size: 12px;
  font-weight: 800;
}

.hud-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 3;
  display: flex;
  align-items: center;
  padding: 3px 6px;
  background: var(--yellow);
  color: #000000;
  font-size: 13px;
  font-weight: 900;
  pointer-events: none;
}

.hud-badge[data-kind="practice"] {
  background: var(--cyan);
}

/* 데모 봇 입력 표시: 눌림 + 아래쪽 손가락 표식(정적, 밝기 변화 없음) */
.is-demo-press {
  position: relative;
  transform: scale(0.92);
  border-color: var(--yellow) !important;
}

.is-demo-press::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 12px;
  height: 14px;
  margin-left: -6px;
  background: #ffc89a;
  border: 2px solid #ffffff;
  border-radius: 6px 6px 3px 3px;
  pointer-events: none;
}

.meter-label {
  margin-right: 2px;
}

.heart {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--red);
}

.heart.is-full {
  background: var(--red);
}

.heart.is-half {
  background: linear-gradient(90deg, var(--red) 50%, transparent 50%);
}

.meter-bar {
  display: inline-block;
  width: 80px;
  height: 10px;
  border: 2px solid var(--orange);
}

.meter-bar > span {
  display: block;
  height: 100%;
  background: var(--orange);
}

.hud-line {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  z-index: 2;
  margin: 0;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid var(--cyan);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  word-break: keep-all;
}

.hud-line[data-tone="fail"] {
  border-color: var(--red);
  color: #ffffff;
}

.hud-line[data-tone="surprise"] {
  border-color: var(--magenta);
}

.game-buttons {
  flex: 0 0 var(--btnrow-h);
  height: var(--btnrow-h);
  display: flex;
  gap: 8px;
  padding: 6px 4px 2px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.game-buttons.is-empty {
  display: none;
}

.game-btn {
  flex: 1 1 0;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 3px solid var(--cyan);
  font-size: 16px;
  font-weight: 900;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.game-btn-sub {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.85;
}

.game-btn-sub:empty {
  display: none;
}

.tone-red {
  border-color: var(--red);
  color: var(--red);
}

.tone-blue {
  border-color: var(--blue);
  color: #8fb0ff;
}

.tone-yellow {
  border-color: var(--yellow);
  color: var(--yellow);
}

.tone-green {
  border-color: var(--green);
  color: var(--green);
}

.tone-cyan {
  border-color: var(--cyan);
  color: var(--cyan);
}

.tone-magenta {
  border-color: var(--magenta);
  color: var(--magenta);
}

.tone-orange {
  border-color: var(--orange);
  color: var(--orange);
}

/* ---- 조이스틱 + A/B(실제 입력) -------------------------------------------------- */
.pad {
  flex: 0 0 var(--pad-h);
  height: var(--pad-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.joy {
  position: relative;
  width: var(--joy-d);
  height: var(--joy-d);
  border: 3px solid var(--cyan);
  border-radius: 50%;
  background: var(--panel);
  touch-action: none;
}

.joy-knob {
  position: absolute;
  left: 30%;
  top: 30%;
  width: 40%;
  height: 40%;
  border-radius: 50%;
  background: var(--cyan);
  pointer-events: none;
}

.ab {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ab-btn {
  width: var(--ab-d);
  height: var(--ab-d);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--panel);
  border: 3px solid var(--red);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.ab-a {
  border-color: var(--yellow);
  margin-bottom: 16px;
}

.ab-key {
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.ab-label {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.ab-btn.is-off {
  border-color: #444444;
  color: #888888;
}

/* ---- 부트·오류 문구 --------------------------------------------------------------- */
.boot-msg {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  z-index: 60; /* 바로가기 모달(50) 위 */
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 440px;
  margin: 0;
  padding: 10px 12px;
  background: var(--panel);
  border: 2px solid var(--yellow);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  pointer-events: none; /* 조작 패드 위에 떠도 터치를 막지 않음 */
}

/* ---- 동작 줄이기: 모든 반복·1회성 애니메이션 정지 ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  animation: none !important;
  transition: none !important;
}

button {
  touch-action: manipulation;
}

/* 홈 화면 바로가기 모달(휴대폰 로비에서 자동 1회). 오락실 간판처럼 원색 이중 테두리 */
.install-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.82);
}

.install-modal[hidden] {
  display: none;
}

.install-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 340px;
  padding: 20px 16px 16px;
  background: var(--bg);
  border: 4px solid var(--yellow);
  box-shadow: 0 0 0 4px var(--red), 0 0 0 8px var(--bg), 0 0 0 10px var(--magenta);
  text-align: center;
}

.install-title {
  margin: 0;
  font-size: clamp(18px, 5.4vw, 22px);
  font-weight: 900;
  color: var(--yellow);
}

.install-lead,
.install-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  word-break: keep-all;
}

.install-lead {
  color: var(--cyan);
  font-weight: 700;
}

.install-steps {
  margin: 0;
  padding-left: 22px;
  text-align: left;
  font-size: 14px;
  line-height: 1.6;
  word-break: keep-all;
}

.install-steps li::marker {
  color: var(--yellow);
  font-weight: 900;
}

/* ---- 로그인·내 정보(P2) ------------------------------------------------------------ */
/* 로비 오른쪽 위: 소리 버튼 바로 아래 같은 폭(가로 360px 에서도 간판 제목 줄을 좁히지 않게) */
.marquee {
  min-height: 100px;
}

.account-btn {
  position: absolute;
  top: 52px;
  right: 0;
  z-index: 30;
  width: var(--sound-w);
  height: 48px;
  padding: 0 6px;
  background: var(--panel);
  border: 2px solid var(--cyan);
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
}

.account-btn.is-signed-in {
  border-color: var(--yellow);
  color: var(--yellow);
}

.account-btn.is-offline {
  border-color: #555555;
  color: #888888;
}

.account-label {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* 로비 「앱 설치」: 「로그인」 바로 아래 같은 폭(브라우저로 연 휴대폰에서만 보임). 보일 때만 간판 높이를 늘려 시연 칸과 겹치지 않게 */
.install-btn {
  position: absolute;
  top: 104px;
  right: 0;
  z-index: 30;
  width: var(--sound-w);
  height: 48px;
  padding: 0 6px;
  background: var(--panel);
  border: 2px solid var(--yellow);
  color: var(--yellow);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.install-btn[hidden] {
  display: none;
}

.marquee.has-install {
  min-height: 160px; /* 버튼 아래끝 152px + 여유 */
}

.menu-btn.is-unlock {
  border-color: var(--cyan);
  color: var(--cyan);
}

.menu-btn.is-danger {
  border-color: var(--red);
  color: var(--red);
}

.brief-status,
.account-status {
  margin: 0;
  min-height: 1.4em;
  font-size: 13px;
  font-weight: 700;
  color: var(--orange);
  word-break: keep-all;
  text-align: center;
}

.account-modal {
  z-index: 55; /* 바로가기 모달(50) 위, 부트 문구(60) 아래 */
}

.account-modal .install-box {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.profile-main,
.profile-confirm {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.profile-label {
  align-self: stretch;
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
  text-align: left;
}

.profile-nick {
  width: 100%;
  min-height: 48px;
  padding: 0 10px;
  background: var(--panel);
  border: 3px solid #555555;
  color: var(--fg);
  font: inherit;
  font-size: 16px; /* 16px 미만이면 아이폰이 입력 때 화면을 확대함 */
}

.profile-nick:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
}

.install-note {
  color: #bbbbbb;
  font-size: 13px;
}

.install-hint {
  color: var(--orange);
  font-size: 13px;
  font-weight: 700;
}

.install-diag {
  color: #bbbbbb;
  font-size: 12px;
}
