:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #687385;
  --line: #d9e0ea;
  --panel: #ffffff;
  --paper: #f5f7fb;
  --accent: #0f9f8f;
  --accent-dark: #087569;
  --warn: #e8583d;
  --good: #2a8f5d;
  --card-back: #23324a;
  --shadow: 0 22px 60px rgba(27, 38, 57, 0.16);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  font-family: Arial, "Noto Sans KR", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(15, 159, 143, 0.12), transparent 38%),
    linear-gradient(240deg, rgba(232, 88, 61, 0.10), transparent 42%),
    var(--paper);
}

button {
  font: inherit;
  color: inherit;
}

.game-shell {
  width: min(1280px, calc(100% - 32px));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 28px 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.topbar-side {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.account-button {
  min-height: 32px;
  padding: 0 2px;
  font-size: 0.92rem;
}

.account-control {
  position: relative;
  display: inline-grid;
  justify-items: end;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 12;
  width: 220px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  gap: 9px;
}

.account-menu[hidden] {
  display: none;
}

.account-menu div {
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: 8px;
  background: var(--paper);
}

.account-menu span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.account-menu strong {
  color: var(--ink);
  font-size: 1rem;
}

.account-logout-button {
  width: 100%;
  min-height: 38px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-dark);
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 8vw, 4.4rem);
  line-height: 0.95;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 8px;
  min-width: min(460px, 100%);
}

.stats div {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.stats span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.86rem;
}

.stats strong {
  font-size: 1.6rem;
}

.stage {
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
}

.home-screen {
  min-height: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto auto minmax(220px, 1fr);
  gap: 24px;
}

.home-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.home-logo {
  font-size: clamp(2rem, 6vw, 4.1rem);
  line-height: 0.95;
  font-weight: 900;
}

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

.text-button {
  min-height: 38px;
  border: 0;
  padding: 0 4px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.text-button:hover {
  color: var(--accent-dark);
}

.coin-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 900;
}

.coin-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #b87911;
  background: radial-gradient(circle at 35% 30%, #fff3a1, #e2a51d 58%, #9c650b);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.32);
}

.legal-links {
  display: flex;
  justify-content: center;
  padding: 8px 0 0;
  font-size: 0.76rem;
  font-weight: 800;
}

.legal-links a {
  color: #607086;
  text-decoration: none;
}

.legal-links a:hover {
  color: var(--accent-dark);
}

.mode-select {
  min-height: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  display: grid;
  align-content: center;
  gap: 22px;
}

.mode-heading {
  display: grid;
  gap: 8px;
}

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

.mode-card {
  min-height: 220px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 14px;
  text-align: left;
  box-shadow: 0 12px 28px rgba(28, 41, 61, 0.08);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.mode-card.is-selected {
  border-color: var(--accent);
  outline: 4px solid rgba(15, 159, 143, 0.18);
  box-shadow: 0 18px 34px rgba(15, 159, 143, 0.18);
}

.mode-card:hover,
.mode-card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(15, 159, 143, 0.18);
}

.mode-card.is-locked {
  cursor: default;
  opacity: 0.72;
}

.mode-icon {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #eef6f5;
  font-size: 2rem;
}

.mode-card strong,
.mode-card small,
.mode-play-button {
  display: block;
}

.mode-card strong {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 1.2rem;
}

.mode-card small {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.mode-play-button {
  justify-self: start;
  min-height: 34px;
  border: 0;
  padding: 7px 10px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.mode-play-button:hover,
.mode-play-button:focus-visible {
  background: var(--accent-dark);
}

.mode-card.is-locked .mode-play-button {
  color: var(--muted);
  background: var(--paper);
}

.mode-record {
  display: grid;
  gap: 6px;
}

.mode-record span {
  min-height: 44px;
  padding: 8px;
  border: 1px solid rgba(15, 159, 143, 0.16);
  border-radius: 8px;
  background: #f6fbfa;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.mode-record b {
  display: block;
  margin-top: 3px;
  color: var(--accent-dark);
  font-size: 1.08rem;
}

.mode-preview {
  min-height: 260px;
  border: 1px dashed rgba(24, 33, 47, 0.22);
  border-radius: 8px;
  background: rgba(246, 251, 250, 0.78);
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 18px;
}

.mode-preview-content {
  width: 100%;
  display: grid;
  place-items: center;
}

.mode-preview-content > p {
  color: var(--muted);
  font-weight: 800;
}

.mode-preview .stage {
  width: 100%;
  min-height: 360px;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.is-playing-home .mode-preview {
  padding: 18px;
  border-style: solid;
  background: rgba(255, 255, 255, 0.72);
}

.preview-card-grid {
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.preview-card {
  aspect-ratio: 1 / 1.05;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--card-back);
  font-size: clamp(1.8rem, 6vw, 3.2rem);
  box-shadow: 0 12px 28px rgba(28, 41, 61, 0.16);
  animation: preview-card-flip 3.2s ease-in-out infinite;
}

.preview-card:nth-child(2) {
  animation-delay: 0.14s;
}

.preview-card:nth-child(3) {
  animation-delay: 0.28s;
}

.preview-card:nth-child(4) {
  animation-delay: 0.42s;
}

.preview-card:nth-child(5) {
  animation-delay: 0.56s;
  outline: 4px solid rgba(15, 159, 143, 0.32);
}

.preview-card:nth-child(6) {
  animation-delay: 0.7s;
}

.preview-sequence {
  width: min(360px, 100%);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.preview-pad {
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(28, 41, 61, 0.16);
  animation: preview-pulse 3.2s linear infinite;
}

.preview-pad:nth-child(1) {
  background: #149f76;
  animation-delay: 0s;
}

.preview-pad:nth-child(2) {
  background: #d99b1c;
  animation-delay: 0.55s;
}

.preview-pad:nth-child(3) {
  background: #d94a38;
  animation-delay: 1.1s;
}

.preview-pad:nth-child(4) {
  background: #3478d6;
  animation-delay: 1.65s;
}

.preview-room {
  position: relative;
  width: min(760px, 100%);
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: url("assets/room-bg.png") center / cover no-repeat;
}

.preview-room img {
  position: absolute;
  width: 10%;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 9px 8px rgba(0, 0, 0, 0.25));
}

.preview-room img:nth-child(1) {
  left: 24%;
  top: 70%;
}

.preview-room img:nth-child(2) {
  left: 44%;
  top: 67%;
  animation: preview-missing 3.2s ease-in-out infinite;
}

.preview-room img:nth-child(3) {
  left: 74%;
  top: 68%;
}

@keyframes preview-card-flip {
  0%,
  22% {
    color: var(--ink);
    background: linear-gradient(145deg, #fff, #eef6f5);
    transform: rotateY(0);
  }

  36%,
  100% {
    color: transparent;
    background: var(--card-back);
    transform: rotateY(180deg);
  }
}

@keyframes preview-pulse {
  0%,
  22%,
  100% {
    filter: brightness(1);
    transform: scale(1);
  }

  9% {
    filter: brightness(1.38) saturate(1.3);
    transform: scale(1.06);
  }
}

@keyframes preview-missing {
  0%,
  48% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  62%,
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.86);
  }
}

.is-home .stats,
.is-mode-select .stats {
  display: none;
}

.is-home .topbar-side,
.is-mode-select .topbar-side {
  display: none;
}

.is-home .topbar {
  display: none;
}

.ready-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #fff;
  background: rgba(12, 18, 28, 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.ready-overlay.is-visible {
  opacity: 1;
}

.ready-overlay div {
  display: grid;
  gap: 12px;
  text-align: center;
  transform: scale(0.96);
  transition: transform 220ms ease;
}

.ready-overlay.is-visible div {
  transform: scale(1);
}

.ready-overlay span {
  font-size: clamp(1.05rem, 4vw, 1.7rem);
  font-weight: 800;
}

.ready-overlay strong {
  font-size: clamp(4rem, 18vw, 9rem);
  line-height: 0.9;
}

.ready-overlay strong.is-popping {
  animation: countdown-pop 360ms ease;
}

.fail-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #fff;
  background: rgba(12, 18, 28, 0.78);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.fail-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.fail-panel {
  display: grid;
  gap: 16px;
  justify-items: center;
  text-align: center;
  width: min(100%, 560px);
}

.fail-panel strong {
  font-size: clamp(3.5rem, 15vw, 8rem);
  line-height: 0.95;
}

.fail-panel p {
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1rem, 3.4vw, 1.35rem);
  font-weight: 700;
}

.fail-summary {
  width: min(100%, 480px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.fail-summary div {
  min-height: 72px;
  padding: 10px 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  display: grid;
  align-content: center;
  gap: 5px;
}

.fail-summary span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
}

.fail-summary b {
  color: #fff;
  font-size: clamp(1rem, 3vw, 1.35rem);
}

.continue-hint {
  max-width: 480px;
}

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

@keyframes countdown-pop {
  from {
    transform: scale(0.82);
    opacity: 0.35;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.time-limit {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 32px;
}

.time-limit span {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
}

.time-limit span:last-child {
  color: var(--accent-dark);
}

.prompt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.phase-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

h2 {
  font-size: clamp(1.25rem, 4vw, 2.1rem);
  line-height: 1.2;
}

.timer {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 8px solid rgba(15, 159, 143, 0.16);
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  background: #fff;
  flex: 0 0 auto;
}

.timer span {
  font-size: 1.15rem;
  font-weight: 800;
}

.board {
  align-self: center;
  width: min(780px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(80px, 1fr));
  gap: clamp(10px, 2.4vw, 18px);
}

.card {
  position: relative;
  aspect-ratio: 1 / 1.08;
  border: 0;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  perspective: 900px;
  cursor: pointer;
}

.card:disabled {
  cursor: default;
  opacity: 1;
}

.card-inner {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  transform-style: preserve-3d;
  transition: transform 320ms ease, box-shadow 180ms ease;
  box-shadow: 0 12px 28px rgba(28, 41, 61, 0.15);
}

.card.is-hidden .card-inner {
  transform: rotateY(180deg);
}

.card:not(:disabled):hover .card-inner,
.card:not(:disabled):focus-visible .card-inner {
  box-shadow: 0 16px 34px rgba(15, 159, 143, 0.28);
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  backface-visibility: hidden;
  display: grid;
  place-items: center;
}

.card-front {
  border: 1px solid rgba(24, 33, 47, 0.08);
  background: linear-gradient(145deg, #fff, #eef6f5);
}

.card-back {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(315deg, rgba(255, 255, 255, 0.08) 25%, transparent 25%) 0 0 / 18px 18px,
    var(--card-back);
  transform: rotateY(180deg);
}

.card-emoji {
  font-size: clamp(2.3rem, 9vw, 4.8rem);
  filter: drop-shadow(0 9px 10px rgba(0, 0, 0, 0.12));
}

.card-name {
  position: absolute;
  bottom: 12px;
  left: 10px;
  right: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}

.card.is-correct .card-inner {
  outline: 4px solid rgba(42, 143, 93, 0.45);
  animation: correct-bounce 360ms ease;
}

.card.is-wrong .card-inner {
  outline: 4px solid rgba(232, 88, 61, 0.45);
  animation: wrong-shake 280ms ease;
}

.sequence-board {
  width: min(520px, 100%);
  gap: clamp(12px, 3vw, 18px);
}

.sequence-pad {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 8px;
  color: #fff;
  box-shadow: 0 14px 30px rgba(28, 41, 61, 0.16);
  transform: scale(1);
  transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.sequence-pad:disabled {
  cursor: default;
  opacity: 1;
}

.sequence-pad span {
  font-size: clamp(2.4rem, 10vw, 4rem);
  line-height: 1;
}

.sequence-pad strong {
  font-size: clamp(0.95rem, 3vw, 1.2rem);
}

.sequence-pad.is-lit,
.sequence-pad:not(:disabled):active {
  filter: brightness(1.3) saturate(1.25);
  transform: scale(1.05);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.72), 0 18px 38px rgba(28, 41, 61, 0.24);
}

.pad-0 {
  background: #149f76;
}

.pad-1 {
  background: #d99b1c;
}

.pad-2 {
  background: #d94a38;
}

.pad-3 {
  background: #3478d6;
}

.missing-board {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.missing-scene {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: url("assets/room-bg.png") center / cover no-repeat;
  box-shadow: inset 0 -36px 60px rgba(24, 33, 47, 0.12);
}

.missing-object {
  position: absolute;
  transform: translate(-50%, -50%);
  display: block;
  filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.22));
}

.missing-object img {
  display: block;
  width: 100%;
  height: auto;
}

.missing-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 12px;
  width: min(760px, 100%);
  justify-self: center;
}

.missing-option {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-weight: 800;
  padding: 8px;
}

.missing-option:disabled {
  cursor: default;
  opacity: 1;
}

.missing-option img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.missing-option.is-correct {
  outline: 4px solid rgba(42, 143, 93, 0.45);
}

.missing-option.is-wrong {
  outline: 4px solid rgba(232, 88, 61, 0.45);
  animation: wrong-shake 280ms ease;
}

@keyframes correct-bounce {
  0%,
  100% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.05);
  }
}

@keyframes wrong-shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}

.controls {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.game-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.game-stage-header strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

.home-records {
  display: none;
}

.primary-button,
.secondary-button {
  min-width: 128px;
  min-height: 46px;
  border-radius: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: default;
  opacity: 0.55;
}

.primary-button:disabled:hover {
  background: var(--accent);
}

.secondary-button {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.secondary-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 16px;
  background: rgba(12, 18, 28, 0.58);
}

.modal.is-visible {
  display: grid;
}

.modal[hidden] {
  display: none !important;
}

.modal-panel {
  position: relative;
  width: min(390px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 22px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.modal-panel h2 {
  font-size: clamp(1.8rem, 8vw, 2.45rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.modal-panel p:not(.phase-label) {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.auth-form input:focus {
  outline: 3px solid rgba(15, 159, 143, 0.16);
  border-color: var(--accent);
}

.account-summary {
  display: grid;
  gap: 10px;
}

.account-summary[hidden] {
  display: none;
}

.account-summary div {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  display: grid;
  align-content: center;
  gap: 5px;
}

.account-summary span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.account-summary strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.auth-status {
  min-height: 20px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.auth-status.is-error {
  color: #c93c3c;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
  font-size: 1.3rem;
  font-weight: 800;
}

.auth-actions {
  display: grid;
  gap: 9px;
}

.auth-actions .primary-button,
.auth-actions .secondary-button {
  width: 100%;
  min-height: 44px;
}

.anonymous-notice {
  max-width: 320px;
  justify-self: center;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: center;
}

.anonymous-notice[hidden] {
  display: none;
}

@media (max-width: 720px) {
  body {
    background: #f3f6fb;
  }

  .game-shell {
    width: min(100%, 520px);
    min-height: auto;
    display: block;
    align-content: start;
    grid-template-rows: none;
    padding: max(10px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    gap: 8px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .topbar-side {
    justify-items: stretch;
  }

  .account-button {
    justify-self: end;
  }

  .is-home .topbar {
    display: none;
  }

  .eyebrow {
    margin-bottom: 3px;
    font-size: 0.72rem;
  }

  h1 {
    font-size: clamp(1.65rem, 8vw, 2.35rem);
  }

  .stats {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .stats div {
    min-height: 54px;
    padding: 8px 6px;
  }

  .stats span {
    margin-bottom: 4px;
    font-size: 0.72rem;
  }

  .stats strong {
    font-size: 1.15rem;
  }

  .stage {
    padding: 14px;
    gap: 12px;
    border: 1px solid rgba(24, 33, 47, 0.08);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(27, 38, 57, 0.08);
  }

  .home-screen {
    align-self: start;
    min-height: 0;
    padding: 4px 0 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    gap: 14px;
    align-content: start;
    grid-template-rows: auto auto auto;
  }

  .home-topline {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .home-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    font-size: 0.78rem;
  }

  .home-actions .text-button,
  .home-actions .coin-pill {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(24, 33, 47, 0.08);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 16px rgba(27, 38, 57, 0.05);
    font-size: 0.78rem;
    justify-content: center;
    text-align: center;
  }

  .home-logo {
    font-size: clamp(1.45rem, 8.4vw, 2.25rem);
    line-height: 1;
    overflow-wrap: anywhere;
  }

  .coin-icon {
    width: 18px;
    height: 18px;
    border-width: 1px;
  }

  .mode-preview {
    order: 3;
    min-height: 0;
    padding: 6px;
  }

  .is-home:not(.is-playing-home) .mode-preview {
    display: none;
  }

  .mode-preview-content > p {
    display: none;
  }

  .mode-preview .stage {
    min-height: auto;
    padding: 0;
  }

  .preview-card-grid {
    gap: 8px;
  }

  .preview-sequence {
    width: min(280px, 100%);
    gap: 10px;
  }

  .mode-select {
    padding: 14px;
    gap: 14px;
  }

  .mode-grid {
    order: 2;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .is-playing-home .mode-grid {
    display: none;
  }

  .is-playing-home .home-screen {
    display: grid;
    min-height: 0;
    padding: 0;
    gap: 0;
  }

  .is-playing-home .home-topline {
    display: none;
  }

  .is-playing-home .mode-preview {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    align-items: start;
  }

  .is-playing-home .mode-preview .stage {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .is-playing-home .board {
    width: min(100%, 390px);
    margin: 4px auto 0;
  }

  .is-playing-home .controls {
    justify-content: center;
    min-height: 0;
    margin-top: 0;
  }

  .exit-game-button {
    display: inline-flex;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid rgba(24, 33, 47, 0.1);
    border-radius: 8px;
    background: #f7fafc;
    font-size: 0.78rem;
  }

  .mode-card {
    min-height: 0;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto;
    align-items: center;
    justify-items: stretch;
    gap: 10px;
    padding: 12px;
    border-color: rgba(24, 33, 47, 0.08);
    box-shadow: 0 8px 22px rgba(27, 38, 57, 0.07);
  }

  .mode-record {
    display: none;
  }

  .mode-record span {
    min-height: 38px;
    padding: 7px 8px;
  }

  .mode-icon {
    width: 38px;
    height: 38px;
    font-size: 1.18rem;
  }

  .mode-card strong {
    margin-bottom: 0;
    font-size: 0.96rem;
    line-height: 1.18;
  }

  .mode-card small {
    display: none;
  }

  .mode-play-button {
    justify-self: end;
    min-height: 36px;
    min-width: 84px;
    padding: 4px 10px;
    white-space: nowrap;
    font-size: 0.78rem;
  }

  .prompt-row {
    align-items: start;
    gap: 10px;
  }

  .phase-label {
    margin-bottom: 3px;
    font-size: 0.72rem;
  }

  h2 {
    font-size: clamp(0.96rem, 4.7vw, 1.2rem);
  }

  .timer {
    width: 46px;
    height: 46px;
    border-width: 5px;
  }

  .timer span {
    font-size: 0.78rem;
  }

  .time-limit {
    min-height: 20px;
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .time-limit span {
    font-size: 0.78rem;
  }

  .board {
    width: 100%;
    gap: 7px;
  }

  .card {
    aspect-ratio: 1 / 1.02;
  }

  .sequence-board {
    width: min(100%, 360px);
    gap: 10px;
  }

  .missing-board {
    gap: 8px;
  }

  .missing-scene {
    aspect-ratio: 16 / 11;
  }

  .missing-object {
    width: calc(var(--mobile-object-size, 1) * 1%);
  }

  .missing-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .missing-option {
    min-height: 58px;
  }

  .missing-option img {
    width: 44px;
    height: 44px;
  }

  .card-name {
    bottom: 8px;
    left: 6px;
    right: 6px;
    font-size: 0.74rem;
  }

  .controls {
    min-height: 0;
  }

  .primary-button,
  .secondary-button {
    min-height: 40px;
    min-width: 112px;
    padding: 0 14px;
  }

  .fail-panel {
    width: min(100%, 320px);
  }

  .fail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fail-actions {
    width: 100%;
  }

  .fail-actions button {
    flex: 1 1 130px;
  }
}

@media (max-width: 390px) {
  .game-shell {
    width: min(100%, 520px);
    padding: 8px 10px 10px;
  }

  .stage {
    padding: 12px;
    gap: 10px;
  }

  .home-screen {
    min-height: 0;
    padding: 8px;
  }

  .home-logo {
    font-size: clamp(1.32rem, 7.6vw, 1.95rem);
  }

  .mode-card {
    gap: 8px;
    padding: 10px;
  }

  .mode-card strong {
    font-size: 0.9rem;
  }

  .mode-play-button {
    min-height: 34px;
    min-width: 78px;
    font-size: 0.72rem;
  }

  .stats div {
    min-height: 50px;
  }

  .board {
    gap: 5px;
  }

  .is-playing-home .board {
    width: min(100%, 360px);
  }

  .card-emoji {
    font-size: clamp(2rem, 13vw, 3.2rem);
  }

  .missing-option {
    min-height: 52px;
  }

  .missing-option img {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 720px) {
  body {
    background:
      linear-gradient(180deg, #ffffff 0, #f2f6fb 58%, #eef3f9 100%);
  }

  .game-shell {
    width: min(100%, 520px);
    padding: max(14px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  }

  .home-screen {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    gap: 18px;
  }

  .home-topline {
    gap: 12px;
  }

  .home-logo {
    font-size: clamp(1.8rem, 9vw, 2.65rem);
    line-height: 0.92;
    letter-spacing: 0;
  }

  .home-actions {
    display: grid;
    grid-template-columns: auto 1fr auto;
    width: 100%;
    gap: 8px;
  }

  .home-actions .text-button,
  .home-actions .coin-pill {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(24, 33, 47, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 8px 20px rgba(27, 38, 57, 0.06);
    font-size: 0.82rem;
    justify-content: center;
  }

  .home-actions .coin-pill {
    justify-self: center;
  }

  .home-actions .account-control {
    justify-self: end;
  }

  .home-actions .account-button {
    min-width: 104px;
  }

  .coin-icon {
    width: 19px;
    height: 19px;
  }

  .mode-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .home-records {
    display: grid;
    gap: 10px;
    padding: 13px;
    border: 1px solid rgba(24, 33, 47, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 26px rgba(27, 38, 57, 0.06);
  }

  .home-records-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 10px;
  }

  .home-records-header strong {
    font-size: 0.98rem;
    font-weight: 900;
  }

  .home-records-header span {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-align: right;
  }

  .record-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  .record-grid div {
    min-height: 64px;
    padding: 8px 6px;
    border-radius: 8px;
    background: #f5faf9;
    display: grid;
    align-content: center;
    gap: 4px;
    text-align: center;
  }

  .record-grid span {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
  }

  .record-grid strong {
    color: var(--accent-dark);
    font-size: 1rem;
    line-height: 1;
  }

  .mode-card {
    min-height: 108px;
    padding: 13px;
    border: 1px solid rgba(24, 33, 47, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 26px rgba(27, 38, 57, 0.08);
    display: grid;
    grid-template-columns: 44px 1fr 88px;
    grid-template-areas:
      "icon title play"
      "icon record play";
    gap: 7px 11px;
    align-items: center;
  }

  .mode-card:hover,
  .mode-card:focus-visible {
    transform: none;
  }

  .mode-icon {
    grid-area: icon;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #eef7f6;
    font-size: 1.32rem;
  }

  .mode-card > span:not(.mode-icon):not(.mode-record) {
    grid-area: title;
    min-width: 0;
  }

  .mode-card strong {
    display: block;
    font-size: 1.03rem;
    line-height: 1.18;
  }

  .mode-card small {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mode-record {
    grid-area: record;
    display: block;
  }

  .mode-record span {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.7rem;
  }

  .mode-record b {
    display: inline;
    margin: 0 0 0 4px;
    font-size: 0.76rem;
  }

  .mode-play-button {
    grid-area: play;
    justify-self: stretch;
    min-width: 0;
    min-height: 42px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 0.84rem;
  }

  .is-home:not(.is-playing-home) .mode-preview {
    display: none;
  }

  .is-playing-home .home-records {
    display: none;
  }

  .stage {
    padding: 14px;
    border: 1px solid rgba(24, 33, 47, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 32px rgba(27, 38, 57, 0.08);
  }

  .is-playing-home .home-screen {
    padding: 0;
  }

  .is-playing-home .mode-preview {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .is-playing-home .mode-preview .stage {
    gap: 12px;
  }

  .game-stage-header {
    padding-bottom: 2px;
  }

  .game-stage-header strong {
    font-size: 1.02rem;
    letter-spacing: 0;
  }

  .prompt-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start;
  }

  .phase-label {
    margin-bottom: 4px;
    font-size: 0.72rem;
  }

  h2 {
    font-size: clamp(1.08rem, 5.2vw, 1.38rem);
    line-height: 1.16;
  }

  .timer {
    width: 50px;
    height: 50px;
    border-width: 5px;
  }

  .time-limit {
    padding: 7px 9px;
    border-radius: 8px;
    background: #f6faf9;
  }

  .time-limit span {
    font-size: 0.78rem;
  }

  .is-playing-home .board {
    width: min(100%, 380px);
    margin: 2px auto 0;
    gap: 7px;
  }

  .card-inner {
    box-shadow: 0 8px 18px rgba(28, 41, 61, 0.13);
  }

  .card-emoji {
    font-size: clamp(2.1rem, 12vw, 3.7rem);
  }

  .card-name {
    font-size: 0.72rem;
  }

  .missing-board {
    width: 100%;
    gap: 9px;
  }

  .missing-scene {
    aspect-ratio: 16 / 10.5;
  }

  .missing-options {
    gap: 7px;
  }

  .missing-option {
    min-height: 56px;
    border-radius: 8px;
  }

  .missing-option img {
    width: 42px;
    height: 42px;
  }

  .controls {
    min-height: 0;
  }
}

@media (max-width: 390px) {
  .game-shell {
    padding: max(10px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  }

  .home-logo {
    font-size: clamp(1.55rem, 8.2vw, 2.15rem);
  }

  .home-actions .text-button,
  .home-actions .coin-pill {
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.74rem;
  }

  .mode-card {
    min-height: 98px;
    grid-template-columns: 40px 1fr 78px;
    gap: 6px 9px;
    padding: 10px;
  }

  .mode-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .mode-card strong {
    font-size: 0.94rem;
  }

  .mode-card small,
  .mode-record span {
    font-size: 0.66rem;
  }

  .mode-play-button {
    min-height: 38px;
    font-size: 0.76rem;
  }

  .home-records {
    padding: 11px;
  }

  .home-records-header {
    align-items: start;
    flex-direction: column;
    gap: 3px;
  }

  .home-records-header span {
    text-align: left;
  }

  .record-grid {
    gap: 6px;
  }

  .record-grid div {
    min-height: 58px;
  }

  .stage {
    padding: 12px;
  }

  .is-playing-home .board {
    width: min(100%, 350px);
  }
}

@media (max-width: 720px) {
  .is-playing-home .home-screen,
  .is-playing-home .mode-preview {
    min-height: calc(100dvh - 28px);
  }

  .is-playing-home .mode-preview .stage {
    min-height: calc(100dvh - 28px);
    display: flex;
    flex-direction: column;
  }

  .is-playing-home .board {
    width: min(100%, 390px);
    margin: 4px auto 0;
  }

  .is-playing-home .controls {
    margin-top: auto;
    padding-top: 8px;
  }

  .fail-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    overflow-y: auto;
    padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
    align-items: center;
  }

  .fail-panel {
    width: min(100%, 390px);
    gap: 12px;
  }

  .fail-panel strong {
    font-size: clamp(3rem, 15vw, 5rem);
  }

  .fail-panel p {
    font-size: 0.98rem;
    line-height: 1.35;
  }

  .fail-summary {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .fail-summary div {
    min-height: 64px;
    padding: 9px 8px;
  }

  .fail-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .fail-actions button {
    width: 100%;
    min-height: 44px;
  }
}

@media (max-width: 390px) {
  .is-playing-home .home-screen,
  .is-playing-home .mode-preview,
  .is-playing-home .mode-preview .stage {
    min-height: calc(100dvh - 20px);
  }

  .is-playing-home .board {
    width: min(100%, 355px);
  }

  .fail-overlay {
    padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  }

  .fail-panel {
    gap: 10px;
  }

  .fail-summary div {
    min-height: 58px;
  }
}

@media (max-width: 720px) {
  .game-status-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .game-status-strip span {
    min-height: 42px;
    padding: 7px 6px;
    border-radius: 8px;
    background: #f5faf9;
    color: var(--muted);
    display: grid;
    align-content: center;
    gap: 2px;
    text-align: center;
    font-size: 0.68rem;
    font-weight: 800;
  }

  .game-status-strip b {
    color: var(--accent-dark);
    font-size: 0.92rem;
  }

  .mission-hint {
    margin: 0;
    padding: 9px 10px;
    border-radius: 8px;
    background: #eef7f6;
    color: var(--accent-dark);
    font-size: 0.8rem;
    font-weight: 900;
    line-height: 1.3;
    text-align: center;
  }

  .is-playing-home .mode-preview .stage {
    justify-content: start;
  }

  .is-playing-home .board {
    flex: 1 1 auto;
    align-self: center;
    align-content: center;
  }

  .sequence-board,
  .missing-board {
    flex: 0 1 auto;
  }
}

@media (max-width: 390px) {
  .game-status-strip {
    gap: 6px;
  }

  .game-status-strip span {
    min-height: 38px;
    padding: 6px 4px;
    font-size: 0.64rem;
  }

  .game-status-strip b {
    font-size: 0.84rem;
  }

  .mission-hint {
    padding: 8px;
    font-size: 0.74rem;
  }
}

@media (max-width: 720px) {
  .is-playing-home .mode-preview .stage {
    gap: 8px;
    justify-content: start;
  }

  .game-stage-header {
    min-height: 34px;
  }

  .game-stage-header strong {
    font-size: 0.92rem;
  }

  .exit-game-button {
    min-height: 30px;
    padding: 0 9px;
    font-size: 0.72rem;
  }

  .game-status-strip {
    gap: 6px;
  }

  .game-status-strip span {
    min-height: 34px;
    padding: 5px 4px;
    gap: 1px;
    font-size: 0.62rem;
  }

  .game-status-strip b {
    font-size: 0.8rem;
  }

  .prompt-row {
    gap: 8px;
  }

  .phase-label {
    margin-bottom: 2px;
    font-size: 0.66rem;
  }

  h2 {
    font-size: clamp(0.96rem, 4.5vw, 1.16rem);
    line-height: 1.15;
  }

  .timer {
    width: 42px;
    height: 42px;
    border-width: 4px;
  }

  .timer span {
    font-size: 0.72rem;
  }

  .time-limit {
    min-height: 0;
    padding: 6px 8px;
  }

  .time-limit span {
    font-size: 0.72rem;
  }

  .mission-hint {
    padding: 7px 8px;
    font-size: 0.74rem;
  }

  .is-playing-home .board {
    flex: 0 0 auto;
    width: min(100%, 390px);
    margin: 6px auto 0;
    align-self: center;
    align-content: start;
    gap: 7px;
  }

  .is-playing-home .controls {
    margin-top: auto;
    padding-top: 8px;
  }
}

@media (max-width: 390px) {
  .is-playing-home .mode-preview .stage {
    gap: 7px;
  }

  .game-stage-header {
    min-height: 32px;
  }

  .game-status-strip span {
    min-height: 32px;
  }

  h2 {
    font-size: clamp(0.9rem, 4.3vw, 1.08rem);
  }

  .timer {
    width: 40px;
    height: 40px;
  }

  .mission-hint {
    padding: 7px;
    font-size: 0.7rem;
  }

  .is-playing-home .board {
    width: min(100%, 360px);
    margin-top: 5px;
    gap: 6px;
  }
}

@media (max-width: 720px) {
  .is-playing-home .board:not(.missing-board):not(.sequence-board) {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  .is-playing-home .card {
    aspect-ratio: 1 / 1.18;
  }
}

@media (max-width: 390px) {
  .is-playing-home .board:not(.missing-board):not(.sequence-board) {
    gap: 8px;
  }

  .is-playing-home .card {
    aspect-ratio: 1 / 1.22;
  }
}

@media (max-width: 720px) {
  .is-playing-home .board:not(.missing-board):not(.sequence-board) {
    width: 100%;
    gap: 9px;
  }

  .is-playing-home .card {
    aspect-ratio: 1 / 1.42;
  }

  .is-playing-home .controls {
    margin-top: 0;
    padding-top: 6px;
  }
}

@media (max-width: 390px) {
  .is-playing-home .board:not(.missing-board):not(.sequence-board) {
    gap: 7px;
  }

  .is-playing-home .card {
    aspect-ratio: 1 / 1.48;
  }
}

@media (max-width: 720px) {
  body.is-playing-home {
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.is-playing-home .game-shell,
  body.is-playing-home .home-screen,
  body.is-playing-home .mode-preview,
  body.is-playing-home .stage {
    min-height: 0;
    max-height: none;
    overflow: hidden;
  }

  body.is-playing-home .game-shell {
    padding-bottom: 0;
  }

  body.is-playing-home .home-screen,
  body.is-playing-home .mode-preview {
    height: auto;
  }

  body.is-playing-home .fail-overlay.is-visible {
    overflow-y: auto;
  }
}

.stage.is-success-pulse {
  animation: stage-success-flash 520ms ease;
}

.stage.is-fail-pulse {
  animation: stage-fail-flash 520ms ease;
}

.card {
  position: relative;
}

.card.is-correct .card-inner {
  outline: 4px solid rgba(16, 163, 127, 0.82);
  box-shadow:
    0 0 0 7px rgba(16, 163, 127, 0.16),
    0 18px 34px rgba(16, 163, 127, 0.24);
}

.card.is-selected-wrong .card-inner {
  outline: 4px solid rgba(232, 88, 61, 0.86);
  box-shadow:
    0 0 0 7px rgba(232, 88, 61, 0.16),
    0 18px 34px rgba(232, 88, 61, 0.24);
}

.card.is-dimmed .card-inner {
  opacity: 0.42;
  filter: saturate(0.75);
}

.card.is-correct::after,
.card.is-selected-wrong::after {
  position: absolute;
  z-index: 4;
  top: 10px;
  right: 10px;
  min-width: 42px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 10px 22px rgba(28, 41, 61, 0.18);
}

.card.is-correct::after {
  content: "정답";
  background: #0f8f78;
}

.card.is-selected-wrong::after {
  content: "선택";
  background: #df5b48;
}

.card.is-correct.is-selected-wrong::after {
  content: "정답";
  background: #0f8f78;
}

@keyframes stage-success-flash {
  0%,
  100% {
    box-shadow: none;
  }

  42% {
    box-shadow: inset 0 0 0 999px rgba(16, 163, 127, 0.08);
  }
}

@keyframes stage-fail-flash {
  0%,
  100% {
    box-shadow: none;
  }

  42% {
    box-shadow: inset 0 0 0 999px rgba(232, 88, 61, 0.09);
  }
}

@media (max-width: 720px) {
  .card.is-correct::after,
  .card.is-selected-wrong::after {
    top: 7px;
    right: 7px;
    min-width: 36px;
    padding: 5px 7px;
    font-size: 0.68rem;
  }
}

@media (max-width: 720px) {
  body.is-playing-home {
    height: 100%;
    overflow: hidden;
  }

  body.is-playing-home {
    min-height: 100dvh;
    touch-action: manipulation;
  }

  body.is-playing-home .game-shell {
    width: 100%;
    min-height: 100dvh;
    height: 100dvh;
    padding: calc(env(safe-area-inset-top) + 10px) 12px calc(env(safe-area-inset-bottom) + 4px);
    overflow: hidden;
  }

  body.is-playing-home .home-screen,
  body.is-playing-home .mode-preview {
    display: block;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.is-playing-home .mode-preview {
    border: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  body.is-playing-home .mode-preview-content {
    height: 100%;
  }

  body.is-playing-home .mode-preview .stage {
    display: grid;
    grid-template-rows: auto auto auto auto auto minmax(0, 1fr) auto;
    align-content: stretch;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
  }

  body.is-playing-home .game-stage-header {
    margin-bottom: 4px;
  }

  body.is-playing-home .game-stage-header strong {
    font-size: clamp(1.25rem, 6vw, 1.65rem);
  }

  body.is-playing-home .exit-game-button {
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 0.95rem;
  }

  body.is-playing-home .game-status-strip {
    min-height: 50px;
    margin-bottom: 6px;
    gap: 8px;
  }

  body.is-playing-home .game-status-strip span {
    padding: 8px 6px;
    border-radius: 14px;
    font-size: 0.74rem;
  }

  body.is-playing-home .game-status-strip b {
    font-size: 1.06rem;
  }

  body.is-playing-home .prompt-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 6px;
  }

  body.is-playing-home .phase-label {
    margin-bottom: 1px;
    font-size: 0.7rem;
  }

  body.is-playing-home #question {
    font-size: clamp(1.35rem, 7vw, 2rem);
    line-height: 1.08;
  }

  body.is-playing-home .timer {
    width: 72px;
    height: 72px;
    border-width: 9px;
    font-size: 1.12rem;
  }

  body.is-playing-home .time-limit {
    min-height: 42px;
    margin-bottom: 6px;
    padding: 0 12px;
    border-radius: 14px;
  }

  body.is-playing-home .time-limit span {
    font-size: 0.86rem;
  }

  body.is-playing-home .mission-hint {
    min-height: 40px;
    margin: 0 0 6px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 0.9rem;
  }

  body.is-playing-home .board {
    align-self: stretch;
    width: 100%;
    max-width: none;
    min-height: 0;
    height: 100%;
    gap: clamp(7px, 2.1vw, 10px);
    align-content: stretch;
    justify-content: stretch;
    overflow: hidden;
  }

  body.is-playing-home .board:not(.missing-board):not(.sequence-board) {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-rows: minmax(0, 1fr);
  }

  body.is-playing-home .card {
    min-height: 0;
    aspect-ratio: auto;
    height: 100%;
  }

  body.is-playing-home .card-inner {
    height: 100%;
    min-height: 0;
  }

  body.is-playing-home .card-emoji {
    font-size: clamp(2.15rem, 12vw, 4.4rem);
  }

  body.is-playing-home .card-name {
    bottom: 9px;
    font-size: clamp(0.75rem, 3.4vw, 0.92rem);
  }

  body.is-playing-home .controls {
    display: none;
  }
}

@media (max-width: 390px) {
  body.is-playing-home .game-shell {
    padding-inline: 10px;
  }

  body.is-playing-home .game-status-strip {
    min-height: 48px;
  }

  body.is-playing-home .timer {
    width: 62px;
    height: 62px;
    border-width: 7px;
    font-size: 1rem;
  }

  body.is-playing-home .mission-hint {
    min-height: 36px;
    padding-block: 8px;
  }
}
