:root {
  color-scheme: light;
  --background: #f4f3f8;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --ink: #17151f;
  --muted: #73707d;
  --hairline: rgba(30, 26, 42, 0.08);
  --violet: #6d5dfc;
  --violet-deep: #5141df;
  --cyan: #22c7d8;
  --pink: #fa6eaa;
  --orange: #ff9b5c;
  --radius-large: 30px;
  --radius-medium: 22px;
  --radius-small: 16px;
  --shadow-large: 0 28px 80px rgba(56, 45, 92, 0.16);
  --shadow-soft: 0 14px 36px rgba(56, 45, 92, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html, body { margin: 0; min-height: 100%; background: var(--background); color: var(--ink); overscroll-behavior-x: none; }

body {
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

button, input { font: inherit; }
button { border: 0; cursor: pointer; color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(109, 93, 252, 0.3); outline-offset: 2px; }

[hidden] { display: none !important; }

.ambient {
  position: fixed;
  z-index: 0;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.22;
}

.ambient-one { top: -180px; right: -180px; background: var(--violet); }
.ambient-two { bottom: -220px; left: -170px; background: var(--pink); }

.app-shell { position: relative; z-index: 1; width: min(100%, 520px); min-height: 100dvh; margin: 0 auto; overscroll-behavior-x: none; }

.screen {
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  animation: screen-enter 320ms cubic-bezier(.2,.8,.2,1) both;
}

@keyframes screen-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.topbar, .floating-nav, .game-nav {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 12px;
}

.topbar { grid-template-columns: 50px 1fr 48px; }

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  grid-template-columns: repeat(2, 12px);
  grid-template-rows: repeat(2, 12px);
  place-content: center;
  gap: 3px;
  border-radius: 15px;
  background: #1c1923;
  box-shadow: 0 10px 24px rgba(28, 25, 35, 0.18);
}

.brand-mark span { border-radius: 3px; }
.brand-mark span:nth-child(1) { background: var(--pink); }
.brand-mark span:nth-child(2) { background: var(--orange); }
.brand-mark span:nth-child(3) { background: var(--cyan); }
.brand-mark span:nth-child(4) { background: var(--violet); }

.topbar-title p { margin: 0 0 3px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1.8px; }
.topbar-title h1 { margin: 0; font-size: 20px; line-height: 1.1; letter-spacing: -0.5px; }

.icon-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: 0 8px 22px rgba(49, 41, 75, 0.08);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  transition: transform 160ms ease, background 160ms ease;
}

.icon-button:active { transform: scale(.92); }
.icon-button svg, .secondary-button svg, .control-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.home-copy { margin: 74px 4px 32px; }
.eyebrow, .game-tag, .modal-kicker { color: var(--violet); font-size: 10px; font-weight: 800; letter-spacing: 1.8px; }
.home-copy h2 { margin: 10px 0 10px; max-width: 330px; font-size: clamp(34px, 10vw, 44px); line-height: 1.08; letter-spacing: -1.8px; }
.home-copy p { margin: 0; max-width: 300px; color: var(--muted); font-size: 15px; line-height: 1.65; }

.game-card {
  position: relative;
  width: 100%;
  min-height: 330px;
  padding: 0;
  overflow: hidden;
  text-align: left;
  border-radius: var(--radius-large);
  background: linear-gradient(145deg, #211d2d 0%, #17141f 72%);
  color: #fff;
  box-shadow: var(--shadow-large);
  transform: translateZ(0);
  isolation: isolate;
}

.game-card:active { transform: scale(.985); }
.game-card-glow { position: absolute; width: 250px; height: 250px; top: -80px; right: -40px; border-radius: 50%; background: radial-gradient(circle, rgba(109,93,252,.7), transparent 66%); filter: blur(10px); }

.game-art { position: absolute; inset: 0; }
.pixel { position: absolute; width: 68px; height: 68px; border-radius: 17px; box-shadow: inset 0 1px 1px rgba(255,255,255,.48), 0 18px 30px rgba(0,0,0,.24); transform: rotate(-8deg); }
.pixel::after { content: ""; position: absolute; inset: 7px; border-radius: 12px; border: 1px solid rgba(255,255,255,.14); }
.pixel-a { top: -8px; right: 72px; background: linear-gradient(145deg, #9b90ff, #6552eb); }
.pixel-b { top: 58px; right: 137px; background: linear-gradient(145deg, #9b90ff, #6552eb); }
.pixel-c { top: 58px; right: 72px; background: linear-gradient(145deg, #9b90ff, #6552eb); }
.pixel-d { top: 58px; right: 7px; background: linear-gradient(145deg, #42dbe7, #18aebe); }
.pixel-e { top: 123px; right: 7px; background: linear-gradient(145deg, #42dbe7, #18aebe); }
.pixel-f { top: 123px; right: 72px; background: linear-gradient(145deg, #ff96c3, #eb5798); }
.pixel-g { top: 188px; right: 72px; background: linear-gradient(145deg, #ffb77d, #f58143); }
.pixel-h { top: 188px; right: 137px; background: linear-gradient(145deg, #ffb77d, #f58143); }

.game-card-content { position: absolute; left: 24px; right: 80px; bottom: 25px; display: flex; flex-direction: column; align-items: flex-start; z-index: 2; }
.game-card-content .game-tag { color: #ada3ff; }
.game-card-content strong { margin: 8px 0 6px; font-size: 29px; letter-spacing: -1px; }
.game-card-content > span:last-child { color: rgba(255,255,255,.58); font-size: 13px; line-height: 1.5; }
.round-arrow { position: absolute; right: 22px; bottom: 27px; z-index: 2; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: #18151f; background: #fff; }
.round-arrow svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mini-game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 13px; }
.mini-game-card { position: relative; min-height: 150px; padding: 17px; overflow: hidden; border-radius: 24px; color: #fff; text-decoration: none; box-shadow: var(--shadow-soft); transition: transform 150ms ease; }
.mini-game-card:active { transform: scale(.975); }
.mini-game-card:last-child { min-height: 150px; }
.mini-game-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 24px; border-radius: 16px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.18); font-size: 23px; font-weight: 800; box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
.mini-game-card strong, .mini-game-card small { position: relative; z-index: 1; display: block; }
.mini-game-card strong { font-size: 17px; }
.mini-game-card small { margin-top: 5px; color: rgba(255,255,255,.65); font-size: 9px; line-height: 1.4; }
.snake-card { background: radial-gradient(circle at 90% 0, #84f1c4, transparent 50%), linear-gradient(145deg,#238d70,#165545); }
.quiz-list-card { background: radial-gradient(circle at 90% 0, #ffd282, transparent 50%), linear-gradient(145deg,#e87a4d,#a94267); }
.reaction-card { background: radial-gradient(circle at 90% 0, #ff96cb, transparent 50%), linear-gradient(145deg,#834fdc,#43308e); }
.merge-card { background: radial-gradient(circle at 90% 0, #7cebf2, transparent 50%), linear-gradient(145deg,#247aa3,#174768); }
.planet-card { background: radial-gradient(circle at 88% 0, #ffbe78, transparent 46%), linear-gradient(145deg,#5142c8,#2a215f); }
.gold-miner-card { background: radial-gradient(circle at 88% 0, #ffe48a, transparent 46%), linear-gradient(145deg,#9a5b20,#3b2316); }
.miner-sprite-icon { background-color: rgba(255,255,255,.14); background-image: url('/assets/minery-icons-cc0.png'); background-position: 0 0; background-repeat: no-repeat; background-size: 240px 240px; image-rendering: pixelated; }
.gomoku-card { background: radial-gradient(circle at 90% 0, #a6efe2, transparent 48%), linear-gradient(145deg,#39314d,#17151f); }

.home-footer { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 24px; color: #9a97a3; font-size: 12px; }
.home-footer .icp-link { color: inherit; text-decoration: none; opacity: .8; }
.home-footer .icp-link:hover { opacity: 1; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 4px rgba(34,199,216,.12); }

.floating-nav { font-weight: 650; text-align: center; }
.screen-detail { display: flex; flex-direction: column; }
.detail-hero { position: relative; height: min(36vh, 300px); margin: 22px 0 14px; overflow: hidden; border-radius: var(--radius-large); background: radial-gradient(circle at 50% 45%, #7264f7 0%, #4f3ed7 42%, #251f5d 100%); box-shadow: 0 25px 60px rgba(82, 64, 213, .3); }
.detail-orbit { position: absolute; left: 50%; top: 50%; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; transform: translate(-50%,-50%) rotate(-12deg); }
.orbit-one { width: 280px; height: 130px; }
.orbit-two { width: 210px; height: 210px; }
.detail-blocks { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 42px); grid-auto-rows: 42px; justify-content: center; align-content: center; filter: drop-shadow(0 18px 20px rgba(18,10,75,.35)); transform: rotate(-7deg); }
.detail-blocks i { border: 1px solid rgba(255,255,255,.3); border-radius: 11px; background: linear-gradient(145deg, rgba(255,255,255,.95), rgba(255,255,255,.62)); box-shadow: inset 0 1px 0 #fff; }
.detail-blocks i:nth-child(1), .detail-blocks i:nth-child(5) { visibility: hidden; }
.detail-blocks i:nth-child(7), .detail-blocks i:nth-child(8) { background: linear-gradient(145deg, #54e4eb, #20b7ce); }

.detail-copy { padding: 10px 4px 8px; }
.detail-copy h2 { margin: 8px 0 8px; font-size: 33px; letter-spacing: -1.2px; }
.detail-copy p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.detail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.detail-stats div { padding: 15px 16px; border-radius: var(--radius-small); background: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.8); box-shadow: var(--shadow-soft); }
.detail-stats span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.detail-stats strong { font-size: 20px; letter-spacing: -.4px; }

.detail-actions { display: grid; gap: 10px; margin-top: auto; }
.primary-button, .secondary-button {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 24px;
  border-radius: 19px;
  font-weight: 700;
  transition: transform 150ms ease, filter 150ms ease;
}
.primary-button { color: #fff; background: linear-gradient(135deg, var(--violet), var(--violet-deep)); box-shadow: 0 15px 30px rgba(81,65,223,.28); }
.secondary-button { background: rgba(255,255,255,.78); border: 1px solid rgba(255,255,255,.92); box-shadow: var(--shadow-soft); }
.primary-button:active, .secondary-button:active { transform: scale(.98); filter: brightness(.96); }
.play-symbol { width: 0; height: 0; margin-left: 3px; border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-left: 11px solid currentColor; }
.secondary-button svg { width: 20px; }

.screen-game { padding: max(10px, env(safe-area-inset-top)) 6px max(10px, env(safe-area-inset-bottom)); color: #f8f7ff; background: radial-gradient(circle at 50% -10%, #3c3262 0%, #191622 48%, #100e15 100%); touch-action: none; overscroll-behavior: none; }
.game-nav { grid-template-columns: 44px 1fr 44px; text-align: center; }
.game-nav { margin: 0 8px; }
.game-nav > div { display: flex; flex-direction: column; }
.game-nav span { font-size: 15px; font-weight: 700; }
.game-nav small { margin-top: 2px; color: rgba(255,255,255,.45); font-size: 10px; }
.dark-button { width: 42px; height: 42px; color: #fff; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.08); box-shadow: none; }

.game-options { display: flex; justify-content: flex-end; gap: 6px; width: min(calc(100% - 16px), 410px); height: 28px; margin: 5px auto 5px; }
.controls-visibility-button, .sound-button { display: flex; align-items: center; gap: 7px; padding: 4px 8px 4px 6px; border-radius: 999px; color: rgba(255,255,255,.52); background: rgba(255,255,255,.055); font-size: 9px; font-weight: 600; }
.sound-button[aria-pressed="true"] { color: rgba(255,255,255,.8); background: rgba(109,93,252,.28); }
.visibility-switch { position: relative; width: 25px; height: 15px; border-radius: 999px; background: rgba(255,255,255,.18); transition: background 180ms ease; }
.visibility-switch i { position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: rgba(255,255,255,.82); transition: transform 180ms ease; }
.screen-game.controls-hidden .visibility-switch { background: var(--violet); }
.screen-game.controls-hidden .visibility-switch i { transform: translateX(10px); }

.game-playfield { display: grid; grid-template-columns: minmax(0,1fr) 88px; align-items: center; gap: 8px; width: min(100%, calc((100dvh - 176px) / 2 + 96px), 430px); margin: 0 auto; }
.screen-game.controls-hidden .game-playfield { width: min(100%, calc((100dvh - 96px) / 2 + 96px), 430px); }
.board-side { display: grid; align-content: center; gap: 7px; min-width: 0; }
.board-side > div { min-width: 0; padding: 10px 7px; overflow: hidden; text-align: left; border-radius: 13px; color: rgba(255,255,255,.48); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.075); }
.board-side span, .board-side strong { display: block; }
.board-side span { font-size: 9px; line-height: 1.3; }
.board-side strong { margin-top: 5px; overflow-wrap: anywhere; color: rgba(255,255,255,.92); font-size: 14px; line-height: 1.2; letter-spacing: -.3px; }
.board-side .is-passed { color: #ffd166; }
.board-side-right { gap: 6px; }
.board-side .next-box { padding: 8px 7px 5px; text-align: center; }
.next-box canvas { width: 52px; height: 52px; margin-top: 2px; }
.score-card strong { color: #fff; font-size: 18px; }
.target-card strong { font-size: 11px; line-height: 1.3; }

.board-wrap { position: relative; justify-self: start; width: min(100%, calc((100dvh - 176px) / 2)); aspect-ratio: 1 / 2; border-radius: 8px; overflow: hidden; background: rgba(5,4,9,.72); border: 1px solid rgba(255,255,255,.1); box-shadow: 0 20px 60px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.05); touch-action: none; transition: width 260ms cubic-bezier(.2,.8,.2,1); }
.screen-game.controls-hidden .board-wrap { width: min(100%, calc((100dvh - 96px) / 2)); }
#game-canvas, #fireworks-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#fireworks-canvas { pointer-events: none; z-index: 3; }
#fireworks-canvas.is-celebrating { position: fixed; z-index: 30; inset: 0; width: 100vw; height: 100dvh; }
.clear-effect-layer { position: absolute; z-index: 3; inset: 0; overflow: hidden; pointer-events: none; }
.clear-band { position: absolute; left: -12%; width: 124%; height: 4.9%; border-radius: 999px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.95), #68f1ff, transparent); box-shadow: 0 0 22px #6d5dfc, 0 0 38px rgba(255,111,174,.8); transform: scaleX(0); animation: clear-sweep 520ms cubic-bezier(.2,.8,.2,1) both; }
.clear-particle { position: absolute; width: var(--particle-size); height: var(--particle-size); border-radius: 50%; background: var(--particle-color); box-shadow: 0 0 9px var(--particle-color); animation: clear-particle 720ms ease-out both; }
.effect-title { position: absolute; z-index: 2; top: 42%; left: 50%; padding: 8px 13px; border-radius: 999px; color: #fff; background: rgba(15,12,24,.7); border: 1px solid rgba(255,255,255,.2); font-size: 12px; font-weight: 800; letter-spacing: 1.2px; white-space: nowrap; transform: translate(-50%, -50%); animation: effect-title 760ms cubic-bezier(.2,.8,.2,1) both; }
.board-wrap.effect-2 { animation: board-pulse 300ms ease-out; }
.board-wrap.effect-3, .board-wrap.effect-4, .board-wrap.effect-milestone { animation: board-celebrate 520ms ease-out; }
@keyframes clear-sweep { 0% { opacity: 0; transform: scaleX(.05); } 38% { opacity: 1; transform: scaleX(1); } 100% { opacity: 0; transform: scaleX(1.08); } }
@keyframes clear-particle { from { opacity: 1; transform: translate(0,0) scale(1); } to { opacity: 0; transform: translate(var(--particle-x),var(--particle-y)) scale(.15); } }
@keyframes effect-title { 0% { opacity: 0; transform: translate(-50%,-20%) scale(.75); } 25% { opacity: 1; transform: translate(-50%,-50%) scale(1.08); } 100% { opacity: 0; transform: translate(-50%,-90%) scale(.95); } }
@keyframes board-pulse { 50% { box-shadow: 0 0 45px rgba(56,215,228,.5), inset 0 0 30px rgba(109,93,252,.25); } }
@keyframes board-celebrate { 20% { transform: scale(1.012) rotate(.2deg); box-shadow: 0 0 60px rgba(255,111,174,.45); } 45% { transform: scale(.995) rotate(-.2deg); } }

.pause-overlay { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: rgba(8,7,12,.56); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.pause-card { width: 76%; padding: 24px 20px; text-align: center; border-radius: 22px; background: rgba(39,35,51,.88); border: 1px solid rgba(255,255,255,.12); box-shadow: 0 24px 60px rgba(0,0,0,.4); }
.pause-glyph { display: inline-block; width: 42px; height: 42px; margin-bottom: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--violet), var(--pink)); }
.pause-card strong { display: block; font-size: 20px; }
.pause-card p { margin: 7px 0 17px; color: rgba(255,255,255,.5); font-size: 12px; }
.pause-card button { width: 100%; min-height: 44px; border-radius: 14px; color: #1b1721; background: #fff; font-weight: 700; }

.control-deck { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; width: min(100%, 390px); margin: 12px auto 0; padding: 7px; border-radius: 22px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.control-button { min-height: 52px; display: grid; place-items: center; border-radius: 16px; color: rgba(255,255,255,.8); background: rgba(255,255,255,.075); transition: transform 90ms ease, background 90ms ease; touch-action: manipulation; }
.control-button:active, .control-button.is-pressed { transform: scale(.92); background: rgba(255,255,255,.15); }
.accent-control { color: #fff; background: linear-gradient(135deg, rgba(109,93,252,.85), rgba(109,93,252,.5)); }
.drop-control { color: #fff; background: linear-gradient(135deg, rgba(250,110,170,.8), rgba(250,110,170,.42)); }
.gesture-hint { margin: 7px 0 0; text-align: center; color: rgba(255,255,255,.27); font-size: 9px; }
.screen-game.controls-hidden .control-deck, .screen-game.controls-hidden .gesture-hint { display: none; }

.screen-ranking { display: flex; flex-direction: column; }
.ranking-hero { padding: 38px 0 22px; text-align: center; }
.ranking-crown { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 13px; border-radius: 18px; color: #fff; font-size: 25px; background: linear-gradient(135deg, var(--orange), var(--pink)); box-shadow: 0 15px 35px rgba(250,110,170,.25); }
.ranking-hero h2 { margin: 0; font-size: 34px; letter-spacing: -1.3px; }
.ranking-hero p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.my-record-card { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding: 18px; border-radius: var(--radius-medium); color: #fff; background: linear-gradient(135deg, #6252ec, #8c6ff5); box-shadow: 0 18px 38px rgba(91,75,222,.22); }
.my-record-card > div { display: flex; flex-direction: column; }
.my-record-card > div:last-child { text-align: right; }
.my-record-card span { color: rgba(255,255,255,.65); font-size: 10px; }
.my-record-card strong { margin-top: 4px; font-size: 18px; }
.my-record-card > div:last-child strong { font-size: 25px; }
.ranking-tabs { display: flex; gap: 7px; margin: 0 -20px 14px; padding: 0 20px 3px; overflow-x: auto; scrollbar-width: none; }
.ranking-tabs::-webkit-scrollbar { display: none; }
.ranking-tabs button { flex: 0 0 auto; min-height: 34px; padding: 0 13px; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.68); border: 1px solid rgba(255,255,255,.8); font-size: 10px; font-weight: 700; }
.ranking-tabs button.is-active { color: #fff; background: linear-gradient(135deg,var(--violet),var(--violet-deep)); box-shadow: 0 8px 20px rgba(81,65,223,.2); }
.ranking-list { display: grid; gap: 8px; }
.ranking-loading { padding: 42px 12px; text-align: center; color: var(--muted); font-size: 12px; }
.ranking-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; padding: 14px 15px; border-radius: 18px; background: rgba(255,255,255,.76); border: 1px solid rgba(255,255,255,.9); box-shadow: 0 9px 24px rgba(50,42,77,.06); }
.ranking-row.is-me { border-color: rgba(109,93,252,.24); background: rgba(240,237,255,.88); }
.rank-badge { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); background: #eeedf3; font-size: 12px; font-weight: 800; }
.ranking-row:nth-child(1) .rank-badge { color: #fff; background: linear-gradient(135deg, #ffc45d, #f59048); }
.ranking-row:nth-child(2) .rank-badge { color: #fff; background: linear-gradient(135deg, #b8bfcb, #8d96a5); }
.ranking-row:nth-child(3) .rank-badge { color: #fff; background: linear-gradient(135deg, #d69a72, #ae6949); }
.rank-name { display: flex; flex-direction: column; min-width: 0; }
.rank-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.rank-name span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.rank-score { text-align: right; }
.rank-score strong { display: block; font-size: 18px; letter-spacing: -.5px; }
.rank-score span { color: var(--muted); font-size: 9px; }
.ranking-empty { margin: auto 0; padding: 50px 20px; text-align: center; color: var(--muted); }
.ranking-empty > span { display: block; font-size: 48px; color: var(--violet); }
.ranking-empty strong { display: block; margin-top: 14px; color: var(--ink); font-size: 17px; }
.ranking-empty p { font-size: 12px; }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; align-items: end; padding: 18px 16px max(18px, env(safe-area-inset-bottom)); background: rgba(17,14,25,.52); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.modal-card { position: relative; width: min(100%, 480px); margin: 0 auto; padding: 28px 24px 22px; overflow: hidden; border-radius: 30px; background: rgba(255,255,255,.96); box-shadow: 0 30px 90px rgba(16,12,29,.35); animation: modal-enter 360ms cubic-bezier(.18,.89,.32,1.2) both; }
@keyframes modal-enter { from { opacity: 0; transform: translateY(32px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-card h2 { margin: 9px 0 8px; font-size: 29px; letter-spacing: -1px; }
.modal-card > p { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.username-card label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 650; }
.username-card input { width: 100%; height: 54px; padding: 0 16px; border: 1px solid var(--hairline); border-radius: 16px; color: var(--ink); background: #f4f3f7; font-size: 16px; }
.field-message { display: block; min-height: 25px; padding: 6px 2px 4px; color: #d84268; font-size: 11px; }
.username-card .primary-button { width: 100%; }
.result-card { text-align: center; }
.result-orb { position: relative; display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 25px; background: linear-gradient(135deg, var(--violet), var(--cyan)); box-shadow: 0 18px 38px rgba(90,75,222,.3); }
.result-orb::before, .result-orb::after { content: ""; position: absolute; width: 18px; height: 18px; border: 4px solid #fff; border-radius: 5px; transform: rotate(12deg); }
.result-orb::after { width: 11px; height: 11px; transform: translate(15px,-14px) rotate(-10deg); opacity: .72; }
.result-card.is-record .result-orb { background: linear-gradient(135deg, var(--orange), var(--pink)); animation: orb-celebrate 900ms ease-in-out infinite alternate; }
@keyframes orb-celebrate { to { transform: translateY(-4px) rotate(4deg); box-shadow: 0 24px 48px rgba(250,110,170,.38); } }
.result-score { margin: 18px 0; padding: 16px; border-radius: 19px; background: #f4f3f7; }
.result-score span { display: block; color: var(--muted); font-size: 10px; }
.result-score strong { display: block; margin-top: 4px; font-size: 38px; letter-spacing: -1.5px; }
.result-actions { display: grid; gap: 4px; }
.text-button { min-height: 46px; color: var(--violet); background: transparent; font-weight: 700; }
.centered-modal { align-items: center; }
.help-card, .resume-card { text-align: left; }
.gesture-guide { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 20px 0 22px; }
.gesture-guide > div { padding: 14px 12px; border-radius: 17px; background: #f3f2f7; }
.gesture-symbol { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 10px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--violet), var(--pink)); font-size: 18px; font-weight: 700; }
.gesture-guide strong, .gesture-guide small { display: block; }
.gesture-guide strong { font-size: 12px; }
.gesture-guide small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.full-width-button { width: 100%; }
.resume-icon { display: block; width: 64px; height: 64px; margin-bottom: 18px; border-radius: 21px; background: linear-gradient(135deg, var(--cyan), var(--violet)); box-shadow: 0 16px 34px rgba(78,95,215,.25); }
.resume-icon::after { content: ""; display: block; width: 0; height: 0; margin: 0 auto; padding-top: 23px; transform: translateX(2px); border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-left: 15px solid #fff; }
.saved-game-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 18px 0 20px; }
.saved-game-summary > div { padding: 14px; border-radius: 17px; background: #f3f2f7; }
.saved-game-summary span, .saved-game-summary strong { display: block; }
.saved-game-summary span { color: var(--muted); font-size: 10px; }
.saved-game-summary strong { margin-top: 5px; font-size: 20px; }
.resume-actions { display: grid; gap: 9px; }
.quiz-card { padding-top: 23px; }
.quiz-heading { display: flex; align-items: center; gap: 13px; }
.quiz-heading h2 { margin: 4px 0 0; font-size: 24px; }
.quiz-life { display: grid; place-items: center; align-content: center; width: 54px; height: 54px; flex: 0 0 auto; border-radius: 18px; color: #fff; background: linear-gradient(135deg, var(--pink), var(--orange)); box-shadow: 0 14px 30px rgba(250,110,170,.3); animation: heart-beat 850ms ease-in-out infinite alternate; }
.quiz-life strong { font-size: 22px; line-height: 1; }
.quiz-life small { margin-top: 2px; font-size: 8px; opacity: .72; }
.quiz-life.is-urgent { background: linear-gradient(135deg, #ff466f, #ff8a3d); animation-duration: 360ms; }
.quiz-category { display: inline-block; margin-top: 19px; padding: 5px 9px; border-radius: 999px; color: var(--violet); background: #eeebff; font-size: 10px; font-weight: 800; }
.quiz-question { min-height: 48px; margin: 10px 0 15px !important; color: var(--ink) !important; font-size: 16px !important; font-weight: 700; line-height: 1.5 !important; }
.quiz-options { display: grid; gap: 8px; }
.quiz-option { min-height: 47px; padding: 10px 13px; border-radius: 14px; color: var(--ink); background: #f3f2f7; border: 1px solid transparent; text-align: left; font-size: 13px; font-weight: 650; }
.quiz-option:active { transform: scale(.985); }
.quiz-option.is-correct { color: #116b4a; background: #e6f8ef; border-color: #84d8b2; }
.quiz-option.is-wrong { color: #a72f51; background: #fff0f4; border-color: #f2a3ba; }
.quiz-option:disabled { opacity: .72; }
.quiz-feedback { min-height: 35px; margin: 10px 0 2px !important; font-size: 11px !important; }
@keyframes heart-beat { to { transform: scale(1.07); box-shadow: 0 18px 40px rgba(250,110,170,.42); } }

.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); max-width: calc(100% - 40px); padding: 11px 16px; border-radius: 14px; color: #fff; background: rgba(25,22,32,.9); box-shadow: 0 14px 40px rgba(0,0,0,.22); opacity: 0; transform: translate(-50%, 18px); pointer-events: none; transition: opacity 220ms ease, transform 220ms ease; font-size: 12px; white-space: nowrap; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 560px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100dvh - 48px); border-radius: 36px; overflow: hidden; box-shadow: 0 30px 90px rgba(40,32,70,.16); }
  .screen { min-height: calc(100dvh - 48px); }
  .modal-backdrop { align-items: center; }
}

@media (max-height: 720px) {
  .home-copy { margin-top: 42px; }
  .game-card { min-height: 280px; }
  .pixel { width: 58px; height: 58px; }
  .detail-hero { height: 220px; }
  .gesture-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 1ms !important; }
}
