/* ============================================================
   落字 TYPE FALL — visual system
   ============================================================ */

:root {
  --bg: #070b14;
  --bg-soft: #0b1120;
  --surface: rgba(18, 26, 46, 0.72);
  --surface-solid: #111a2e;
  --line: rgba(148, 163, 184, 0.13);
  --line-strong: rgba(148, 163, 184, 0.24);
  --text: #e9eefc;
  --muted: #8b98b8;
  --dim: #64708d;
  --lime: #c8f560;
  --lime-soft: #d9ff8a;
  --cyan: #5eead4;
  --blue: #60a5fa;
  --violet: #a78bfa;
  --pink: #f472b6;
  --rose: #fb7185;
  --amber: #fbbf24;
  --radius: 18px;
  --font-sans: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "Space Grotesk", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", ui-monospace, Menlo, Consolas, monospace;
  --shadow-panel: 0 24px 70px -32px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body[data-screen="game"] {
  overflow: hidden;
}

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

button {
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: rgba(200, 245, 96, 0.3);
  color: #fff;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.4);
}

/* ---------- background ---------- */

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 55% at 50% -10%, #12213e 0%, transparent 65%),
    radial-gradient(ellipse 70% 60% at 100% 100%, #101c33 0%, transparent 60%),
    linear-gradient(180deg, #070b14 0%, #080d18 45%, #060a12 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.32;
  will-change: transform;
}
.orb-a {
  width: 620px;
  height: 620px;
  left: -180px;
  top: -240px;
  background: #1d4ed8;
  animation: orb-drift 24s ease-in-out infinite alternate;
}
.orb-b {
  width: 540px;
  height: 540px;
  right: -220px;
  top: 18%;
  background: #0f766e;
  opacity: 0.22;
  animation: orb-drift 30s ease-in-out infinite alternate-reverse;
}
.orb-c {
  width: 700px;
  height: 700px;
  left: 32%;
  bottom: -420px;
  background: #6d28d9;
  opacity: 0.18;
  animation: orb-drift 36s ease-in-out infinite alternate;
}

@keyframes orb-drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(70px, 40px, 0) scale(1.08);
  }
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 76px 76px;
  mask-image: radial-gradient(ellipse 85% 75% at 50% 30%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 30%, #000 0%, transparent 78%);
}

.noise {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  height: 74px;
  padding: 0 34px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  background: linear-gradient(180deg, rgba(7, 11, 20, 0.92), rgba(7, 11, 20, 0.6));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body[data-screen="game"] .topbar {
  display: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(160deg, #1a2740, #0c1322);
  border: 1px solid rgba(200, 245, 96, 0.36);
  box-shadow: 0 0 22px -6px rgba(200, 245, 96, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.brand-key {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 18px;
  color: var(--lime);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.brand-text strong {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.brand-text em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.28em;
  color: var(--dim);
}

.topbar-center {
  justify-self: center;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.025);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.live-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 10px var(--lime);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.topbar-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 12px;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}
.top-btn:hover {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}
.top-btn.is-on {
  color: var(--text);
  border-color: rgba(200, 245, 96, 0.22);
  background: rgba(200, 245, 96, 0.06);
}
.top-btn.is-on .top-btn-glyph {
  color: var(--lime);
}
.top-btn-glyph {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  color: var(--dim);
  transition: color 0.2s;
}

/* ---------- shared bits ---------- */

.screen {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 34px 76px;
  animation: screen-in 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.grad-text {
  background: linear-gradient(102deg, #dfff9a 4%, var(--lime) 28%, var(--cyan) 64%, #7dd3fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cyan);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 12px rgba(200, 245, 96, 0.9);
  animation: pulse 1.9s ease-in-out infinite;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(21, 30, 52, 0.82), rgba(11, 17, 31, 0.9));
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.1), transparent 34%, transparent 70%, rgba(200, 245, 96, 0.07));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-kicker {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--dim);
  text-transform: uppercase;
}

.panel h2 {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}
.pill.live {
  color: var(--lime);
  border-color: rgba(200, 245, 96, 0.28);
  background: rgba(200, 245, 96, 0.07);
}
.pill.live i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
}

.hint {
  color: var(--dim);
  font-size: 11.5px;
}
.muted {
  color: var(--muted);
  font-size: 13.5px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-bottom-color: rgba(148, 163, 184, 0.36);
  background: rgba(255, 255, 255, 0.05);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

code {
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(148, 163, 184, 0.12);
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--cyan);
}

/* ---------- buttons ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform 0.18s, box-shadow 0.22s, background 0.22s, border-color 0.22s, opacity 0.2s;
  user-select: none;
}
.btn:active {
  transform: translateY(1px) scale(0.99);
}
.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  color: #0a1006;
  background: linear-gradient(180deg, #e2ff9d 0%, var(--lime) 52%, #aee23e 100%);
  box-shadow:
    0 10px 32px -10px rgba(200, 245, 96, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -2px 0 rgba(72, 102, 10, 0.24);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 14px 40px -10px rgba(200, 245, 96, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -2px 0 rgba(72, 102, 10, 0.24);
}

.btn-ghost {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.025);
}
.btn-ghost:hover:not(:disabled) {
  border-color: rgba(200, 245, 96, 0.32);
  background: rgba(200, 245, 96, 0.05);
  transform: translateY(-1px);
}

.btn-lg {
  padding: 15px 25px;
  border-radius: 14px;
  font-size: 15px;
}
.btn-sm {
  padding: 8px 13px;
  border-radius: 9px;
  font-size: 12px;
}
.btn-block {
  width: 100%;
}

.btn .arrow {
  font-family: var(--font-mono);
  font-size: 15px;
  opacity: 0.8;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 38px;
  height: 38px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}
.icon-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}
.icon-btn-danger:hover {
  color: var(--rose);
  border-color: rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.08);
}

.text-btn {
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.3);
  padding: 0 0 2px;
  transition: color 0.2s, border-color 0.2s;
}
.text-btn:hover {
  color: var(--lime);
  border-color: var(--lime);
}

/* ============================================================
   HOME — hero
   ============================================================ */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 56px;
  align-items: center;
  min-height: 440px;
  padding: 8px 0 22px;
}

.hero-copy,
.hero-visual {
  min-width: 0;
}

.hero-copy h1 {
  margin: 20px 0 20px;
  font-family: var(--font-display);
  font-size: clamp(46px, 5.4vw, 78px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.hero-lede {
  max-width: 500px;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.85;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
}
.hero-cta .btn-primary {
  min-width: 178px;
}
.hero-cta kbd {
  background: rgba(10, 16, 6, 0.14);
  border-color: rgba(10, 16, 6, 0.22);
  color: rgba(10, 16, 6, 0.62);
  box-shadow: none;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-top: 28px;
  color: var(--dim);
  font-size: 12px;
}
.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  border-left: 1px solid var(--line);
}
.hero-meta span:first-child {
  padding-left: 0;
  border-left: 0;
}
.hero-meta b {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* hero stage */

.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 22px 10px;
}

.stage {
  position: relative;
  width: min(100%, 440px);
  padding: 13px 13px 15px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(165deg, rgba(25, 36, 60, 0.96), rgba(8, 13, 24, 0.97));
  box-shadow:
    0 50px 100px -40px rgba(0, 0, 0, 0.9),
    0 0 80px -30px rgba(56, 189, 248, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: perspective(1200px) rotateY(-7deg) rotateX(3deg);
  transform-style: preserve-3d;
  animation: stage-float 9s ease-in-out infinite;
}

@keyframes stage-float {
  0%, 100% { transform: perspective(1200px) rotateY(-7deg) rotateX(3deg) translateY(0); }
  50% { transform: perspective(1200px) rotateY(-5deg) rotateX(2deg) translateY(-10px); }
}

.stage::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(150deg, rgba(200, 245, 96, 0.22), transparent 38%, transparent 70%, rgba(94, 234, 212, 0.16));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 1px;
  pointer-events: none;
}

.stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px 12px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--dim);
}

.stage-dots {
  display: flex;
  gap: 4px;
}
.stage-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.3);
}
.stage-dots i:first-child {
  background: rgba(251, 113, 133, 0.7);
}
.stage-timer {
  color: var(--cyan);
}

.stage-field {
  position: relative;
  height: 238px;
  border-radius: 13px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(56, 189, 248, 0.1), transparent 62%),
    rgba(4, 8, 16, 0.72);
}

.stage-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 100% 10%, 10% 100%;
}

.stage-danger {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16%;
  background: linear-gradient(to top, rgba(251, 113, 133, 0.22), transparent);
  border-top: 1px dashed rgba(251, 113, 133, 0.28);
}

.fall-card,
.stage-target {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 50px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.03));
  box-shadow: 0 12px 26px -8px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: #f4f8ff;
}
.fall-card i,
.stage-target i {
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 5px;
  height: 2.5px;
  border-radius: 3px;
  background: var(--finger-c, var(--lime));
  box-shadow: 0 0 10px var(--finger-c, var(--lime));
  opacity: 0.8;
}
.fall-card.c1 {
  left: 16%;
  top: 14%;
  animation: mock-fall 6.4s linear infinite;
  --finger-c: #4ade80;
}
.fall-card.c2 {
  left: 62%;
  top: 4%;
  animation: mock-fall 7.8s linear infinite 1.1s;
  --finger-c: #60a5fa;
}
.fall-card.c3 {
  left: 40%;
  top: -2%;
  animation: mock-fall 6.9s linear infinite 2.6s;
  --finger-c: #facc15;
}

@keyframes mock-fall {
  0% { transform: translateY(-60px); opacity: 0; }
  12% { opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateY(200px); opacity: 0; }
}

.stage-target {
  left: 50%;
  bottom: 18%;
  width: 52px;
  height: 58px;
  margin-left: -26px;
  font-size: 27px;
  color: #0b1006;
  border-color: rgba(200, 245, 96, 0.6);
  background: linear-gradient(170deg, #e9ffad, #b9ed49);
  box-shadow:
    0 0 0 1px rgba(200, 245, 96, 0.4),
    0 0 38px -4px rgba(200, 245, 96, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  animation: target-breathe 2.4s ease-in-out infinite;
}
.stage-target i {
  background: rgba(11, 16, 6, 0.35);
  box-shadow: none;
}

@keyframes target-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.055); }
}

.stage-score {
  position: absolute;
  right: 14px;
  bottom: 12%;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--lime);
  text-shadow: 0 0 20px rgba(200, 245, 96, 0.5);
  animation: score-float 3.6s ease-in-out infinite;
}
.stage-score small {
  display: block;
  font-size: 7px;
  letter-spacing: 0.18em;
  color: var(--cyan);
  text-align: right;
  opacity: 0.85;
}

@keyframes score-float {
  0%, 100% { transform: translateY(0); opacity: 0.9; }
  50% { transform: translateY(-8px); opacity: 1; }
}

.stage-scan {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 38px;
  background: linear-gradient(to bottom, transparent, rgba(94, 234, 212, 0.055), transparent);
  animation: scan 5.5s linear infinite;
}

@keyframes scan {
  from { transform: translateY(-40px); }
  to { transform: translateY(250px); }
}

.stage-keys {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 13px;
  padding: 0 5px;
}
.stage-keyrow {
  display: flex;
  justify-content: center;
  gap: 5px;
}
.stage-keyrow span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 25px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--dim);
}
.stage-keyrow.row-b {
  padding: 0 10px;
}
.stage-keyrow.row-c {
  padding: 0 27px;
}
.stage-keyrow span.hot {
  color: var(--lime);
  border-color: rgba(200, 245, 96, 0.34);
  background: rgba(200, 245, 96, 0.09);
  box-shadow: 0 0 16px -4px rgba(200, 245, 96, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.stage-keyrow span.f-green {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(74, 222, 128, 0.12);
  box-shadow: 0 0 20px -4px rgba(74, 222, 128, 0.65);
}

.float-tag {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 11px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(13, 20, 36, 0.88);
  box-shadow: 0 16px 34px -18px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  animation: tag-float 7s ease-in-out infinite;
}
.tag-1 {
  top: 12%;
  left: -22px;
  animation-delay: 0.6s;
}
.tag-2 {
  right: -18px;
  bottom: 21%;
  animation-delay: 1.8s;
}
.tag-3 {
  top: -16px;
  right: 30px;
  animation-delay: 2.8s;
}
@keyframes tag-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
.tag-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c, var(--lime));
  box-shadow: 0 0 10px var(--c, var(--lime));
}
.tag-combo {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--lime);
}
.tag-wave {
  letter-spacing: 1px;
  color: var(--cyan);
  font-size: 9px;
}

/* feature row */

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 8px;
}
.feature {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 18px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}
.feature-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 10px;
  border: 1px solid rgba(200, 245, 96, 0.18);
  background: rgba(200, 245, 96, 0.05);
  font-size: 16px;
  color: var(--lime);
}
.feature b {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
}
.feature small {
  display: block;
  margin-top: 1px;
  color: var(--dim);
  font-size: 10.5px;
}

/* ============================================================
   HOME — settings / preview
   ============================================================ */

.config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.84fr);
  gap: 20px;
  margin-top: 26px;
  align-items: start;
}

.settings-panel {
  padding: 26px 26px 24px;
}
.preview-panel {
  padding: 26px 24px 24px;
}

.difficulty-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 6px 12px;
  border-radius: 11px;
  border: 1px solid rgba(200, 245, 96, 0.2);
  background: rgba(200, 245, 96, 0.05);
  line-height: 1.1;
}
.difficulty-chip span {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--dim);
}
.difficulty-chip b {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--lime);
}

.field-group {
  margin-top: 22px;
}

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}
.field-label span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.field-label small {
  color: var(--dim);
  font-size: 10.5px;
  text-align: right;
  line-height: 1.4;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(4, 8, 16, 0.55);
}
.seg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 9px 5px;
  border-radius: 9px;
  border: 1px solid transparent;
  color: var(--muted);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.seg-btn b {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.seg-btn small {
  font-size: 9px;
  color: var(--dim);
  transition: color 0.2s;
}
.seg-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}
.seg-btn[aria-pressed="true"] {
  color: var(--text);
  border-color: rgba(200, 245, 96, 0.28);
  background: linear-gradient(180deg, rgba(200, 245, 96, 0.13), rgba(200, 245, 96, 0.04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.seg-btn[aria-pressed="true"] b {
  color: var(--lime-soft);
}
.seg-btn[aria-pressed="true"] small {
  color: rgba(200, 245, 96, 0.6);
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}
.diff-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 13px 13px 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
  overflow: hidden;
  transition: transform 0.18s, border-color 0.2s, background 0.2s;
}
.diff-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--c, var(--lime));
  opacity: 0.55;
  transition: opacity 0.2s, height 0.2s;
}
.diff-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}
.diff-card[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--c, var(--lime)) 45%, transparent);
  background: color-mix(in srgb, var(--c, var(--lime)) 7%, transparent);
  box-shadow: 0 10px 30px -18px var(--c, var(--lime));
}
.diff-card[aria-pressed="true"]::before {
  opacity: 1;
  height: 3px;
}
.diff-card .diff-tag {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--c, var(--lime));
  opacity: 0.85;
}
.diff-card .diff-name {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}
.diff-card .diff-spec {
  font-size: 9.5px;
  line-height: 1.45;
  color: var(--dim);
}
.diff-card[aria-pressed="true"] .diff-name {
  color: #fff;
}

.advanced {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.advanced summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-size: 12.5px;
  font-weight: 600;
  user-select: none;
}
.advanced summary::-webkit-details-marker {
  display: none;
}
.advanced summary span {
  color: var(--dim);
  font-size: 10px;
  font-weight: 400;
}
.advanced summary i {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.25s;
}
.advanced[open] summary i {
  transform: rotate(-135deg);
}

.sliders {
  display: grid;
  gap: 15px;
  padding-top: 15px;
}
.slider-row label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.slider-row output {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--lime);
}

input[type="range"] {
  display: block;
  width: 100%;
  height: 6px;
  margin: 0;
  border-radius: 99px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background: linear-gradient(90deg, var(--lime) 0%, var(--lime) var(--fill, 50%), rgba(148, 163, 184, 0.16) var(--fill, 50%), rgba(148, 163, 184, 0.16) 100%);
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 99px;
  background: transparent;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -4.5px;
  border-radius: 50%;
  border: 2px solid #0a0f08;
  background: var(--lime-soft);
  box-shadow: 0 0 0 4px rgba(200, 245, 96, 0.1), 0 0 16px rgba(200, 245, 96, 0.5);
  transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.16);
}
input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 99px;
  background: var(--lime);
}
input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 2px solid #0a0f08;
  border-radius: 50%;
  background: var(--lime-soft);
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.inline-fields .chip {
  padding: 7px 9px;
}
.inline-fields .chips {
  gap: 5px;
}

@media (min-width: 981px) {
  .preview-panel {
    position: sticky;
    top: 90px;
  }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 11px;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}
.chip[aria-pressed="true"] {
  color: var(--lime-soft);
  border-color: rgba(200, 245, 96, 0.4);
  background: rgba(200, 245, 96, 0.08);
}
.chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.chip:disabled:hover {
  color: var(--muted);
  border-color: var(--line);
}
.chip small {
  font-size: 9px;
  opacity: 0.7;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.switch {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  flex: 1 1 150px;
}
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  border-radius: 99px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(148, 163, 184, 0.14);
  transition: background 0.22s, border-color 0.22s;
}
.switch-track i {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: transform 0.22s, background 0.22s;
}
.switch input:checked + .switch-track {
  background: rgba(200, 245, 96, 0.2);
  border-color: rgba(200, 245, 96, 0.5);
}
.switch input:checked + .switch-track i {
  transform: translateX(16px);
  background: var(--lime);
  box-shadow: 0 0 10px rgba(200, 245, 96, 0.7);
}
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}
.switch-copy b {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
}
.switch-copy small {
  display: block;
  font-size: 9.5px;
  color: var(--dim);
  line-height: 1.4;
}

.settings-foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.settings-foot .hint {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.settings-foot .btn {
  width: 100%;
}

/* preview */

.preview-panel .pill {
  margin-top: 4px;
}

.preview-target {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 13px;
  border-radius: 14px;
  border: 1px solid rgba(200, 245, 96, 0.14);
  background:
    radial-gradient(ellipse at 0% 0%, rgba(200, 245, 96, 0.1), transparent 60%),
    rgba(4, 8, 16, 0.35);
}

.preview-target-key {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--finger, var(--lime)) 55%, transparent);
  background: linear-gradient(170deg, color-mix(in srgb, var(--finger, var(--lime)) 26%, #f5f9ff), color-mix(in srgb, var(--finger, var(--lime)) 58%, #dce7f4));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--finger, var(--lime)) 30%, transparent), 0 0 26px -6px var(--finger, var(--lime)), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: #0b1006;
  transition: transform 0.2s;
}
.preview-target-key.flash {
  animation: key-flash 0.45s ease;
}
@keyframes key-flash {
  0% { transform: scale(1); }
  40% { transform: scale(1.14) rotate(-3deg); }
  100% { transform: scale(1); }
}

.preview-target-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}
.preview-target-copy span {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--dim);
}
.preview-target-copy b {
  font-size: 13px;
  color: var(--text);
}
.preview-target-copy small {
  color: var(--muted);
  font-size: 10.5px;
}

.preview-equalizer {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  margin-left: auto;
  padding-right: 6px;
}
.preview-equalizer i {
  width: 3px;
  border-radius: 2px;
  background: var(--cyan);
  opacity: 0.6;
  animation: eq 1.1s ease-in-out infinite;
}
.preview-equalizer i:nth-child(1) { height: 30%; animation-delay: 0s; }
.preview-equalizer i:nth-child(2) { height: 70%; animation-delay: 0.12s; }
.preview-equalizer i:nth-child(3) { height: 100%; animation-delay: 0.3s; }
.preview-equalizer i:nth-child(4) { height: 54%; animation-delay: 0.18s; }
.preview-equalizer i:nth-child(5) { height: 38%; animation-delay: 0.42s; }
@keyframes eq {
  0%, 100% { transform: scaleY(0.45); }
  50% { transform: scaleY(1); }
}

.keyboard {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.home-keyboard {
  margin-top: 18px;
}

.kb-row {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
}
.kb-row.row-2 {
  padding: 0 2.2%;
}
.kb-row.row-3 {
  padding: 0 4.4%;
}

.kb-key {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.018));
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: #b9c5de;
  transition: transform 0.12s, color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
  user-select: none;
}
.kb-key::after {
  content: "";
  position: absolute;
  left: 23%;
  right: 23%;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--finger, rgba(148, 163, 184, 0.4));
  opacity: 0.55;
}
.kb-key.is-target {
  color: #0a1006;
  border-color: color-mix(in srgb, var(--finger, var(--lime)) 72%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--finger, var(--lime)) 26%, #f5f9ff), color-mix(in srgb, var(--finger, var(--lime)) 58%, #dce7f4));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--finger, var(--lime)) 42%, transparent),
    0 0 26px -2px var(--finger, var(--lime)),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transform: translateY(-2px) scale(1.045);
  z-index: 2;
}
.kb-key.is-target::after {
  background: rgba(10, 16, 6, 0.35);
  opacity: 1;
}
.kb-key.is-pressed {
  animation: key-press 0.22s ease;
}
@keyframes key-press {
  0% { transform: translateY(1px) scale(0.97); filter: brightness(1.5); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}
.kb-space-row {
  display: flex;
  justify-content: center;
  margin-top: 1px;
}
.kb-space {
  width: 34%;
  height: 22px;
  border-radius: 7px;
  font-size: 8px;
  letter-spacing: 0.22em;
  color: var(--dim);
}
.kb-space::after {
  display: none;
}

/* ---------- two-hand finger guide ---------- */

.hand-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
}
.hand-figure {
  width: 100%;
  transition: filter 0.25s ease;
}
.hand-left .hand-figure {
  transform: rotate(5deg);
}
.hand-right .hand-figure {
  transform: rotate(-5deg);
}
.hand-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.hand-right .hand-svg {
  transform: scaleX(-1);
}
.hand-wrist {
  fill: rgba(148, 163, 184, 0.035);
  stroke: rgba(148, 163, 184, 0.12);
  stroke-width: 1.2;
}
.hand-palm {
  fill: rgba(148, 163, 184, 0.075);
  stroke: rgba(148, 163, 184, 0.3);
  stroke-width: 1.4;
  transition: fill 0.22s, stroke 0.22s;
}
.hand-thumb {
  fill: none;
  stroke: rgba(148, 163, 184, 0.28);
  stroke-width: 17;
  stroke-linecap: round;
  transition: stroke 0.22s;
}
.hand-finger {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform 0.16s ease, filter 0.2s ease;
}
.finger-body {
  fill: rgba(148, 163, 184, 0.12);
  stroke: rgba(148, 163, 184, 0.38);
  stroke-width: 1.3;
  transition: fill 0.2s, stroke 0.2s;
}
.finger-nail {
  fill: var(--c, #94a3b8);
  opacity: 0.5;
  transition: fill 0.2s, opacity 0.2s;
}
.hand-finger.is-active .finger-body {
  fill: color-mix(in srgb, var(--c) 42%, #0d1526);
  stroke: var(--c);
  stroke-width: 2;
  filter: drop-shadow(0 0 7px var(--c));
}
.hand-finger.is-active .finger-nail {
  fill: color-mix(in srgb, var(--c) 55%, #ffffff);
  opacity: 0.95;
}
.hand-finger.is-active {
  animation: hand-finger-ready 1.2s ease-in-out infinite;
}
.hand-finger.is-tapping {
  animation: hand-finger-tap 0.2s ease;
}
.hand-finger.is-error .finger-body {
  fill: rgba(251, 113, 133, 0.32);
  stroke: var(--rose);
  filter: drop-shadow(0 0 7px rgba(251, 113, 133, 0.75));
}
.hand-unit.is-active .hand-palm {
  fill: rgba(148, 163, 184, 0.085);
  stroke: color-mix(in srgb, var(--c) 45%, transparent);
}
.hand-unit.is-active .hand-thumb {
  stroke: color-mix(in srgb, var(--c) 35%, rgba(148, 163, 184, 0.22));
}
.hand-unit.is-active .hand-figure {
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--c) 26%, transparent));
}
.hand-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  transition: color 0.2s;
  white-space: nowrap;
}
.hand-label i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--c, var(--dim));
  opacity: 0.5;
  transition: opacity 0.2s, box-shadow 0.2s;
}
.hand-unit.is-active .hand-label {
  color: color-mix(in srgb, var(--c) 72%, var(--text));
}
.hand-unit.is-active .hand-label i {
  opacity: 1;
  box-shadow: 0 0 9px var(--c);
}

@keyframes hand-finger-ready {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}
@keyframes hand-finger-tap {
  0% { transform: translateY(0) scaleY(1); }
  45% { transform: translateY(7px) scaleY(0.94); }
  100% { transform: translateY(0) scaleY(1); }
}

.preview-hands {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(26px, 4.4vw, 52px);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.preview-hands .hand-unit {
  width: 84px;
}
.preview-hands .hand-label {
  font-size: 8px;
}

.finger-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.preview-hands + .finger-legend {
  border-top: 0;
  margin-top: 5px;
  padding-top: 5px;
}
.finger-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  color: var(--dim);
}
.finger-legend-item i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 7px var(--c);
}

.preview-notes {
  display: grid;
  gap: 9px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.preview-note {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10.5px;
  color: var(--muted);
}
.preview-note span {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--lime);
  opacity: 0.7;
}

.home-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 42px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
}
.home-footer > span:first-child {
  color: var(--muted);
}

/* ============================================================
   PK
   ============================================================ */

.screen-pk {
  max-width: 1160px;
  padding-top: 40px;
}

.pk-header {
  max-width: 720px;
}
.pk-header h1 {
  margin: 16px 0 14px;
  font-family: var(--font-display);
  font-size: clamp(38px, 4.4vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.03em;
}
.pk-lede {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
  max-width: 620px;
}
.back-link {
  margin-bottom: 26px;
  color: var(--dim);
  font-size: 12px;
  transition: color 0.2s;
}
.back-link:hover {
  color: var(--lime);
}

.pk-entry {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 22px;
  align-items: stretch;
  margin-top: 36px;
}
.pk-card {
  padding: 28px;
}
.pk-card h2 {
  margin-top: 5px;
  font-size: 25px;
}
.pk-card > p {
  margin: 10px 0 20px;
  min-height: 42px;
}
.pk-or {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.2em;
  padding: 12px 0;
}
.pk-or::before,
.pk-or::after {
  content: "";
  width: 1px;
  flex: 1;
  background: linear-gradient(to bottom, transparent, var(--line-strong), transparent);
}

.input-label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
  font-size: 11px;
  color: var(--muted);
}
.input-label input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: rgba(4, 8, 16, 0.55);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.input-label input::placeholder {
  color: var(--dim);
}
.input-label input:focus {
  border-color: rgba(200, 245, 96, 0.55);
  box-shadow: 0 0 0 3px rgba(200, 245, 96, 0.1);
  background: rgba(4, 8, 16, 0.75);
}
.input-label input.code-input {
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.38em;
  text-align: center;
  text-transform: uppercase;
  padding-left: 0.38em;
}
.fineprint {
  margin-top: 14px;
  color: var(--dim);
  font-size: 10.5px;
  line-height: 1.7;
}
.pk-card .btn {
  margin-top: 4px;
}

.pk-lobby {
  margin-top: 34px;
  display: grid;
  gap: 16px;
  animation: screen-in 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.lobby-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 16px;
}
.invite-panel,
.lobby-players,
.lobby-settings {
  padding: 24px;
}

.room-code-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0 16px;
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid rgba(200, 245, 96, 0.18);
  background:
    radial-gradient(ellipse at 0% 0%, rgba(200, 245, 96, 0.1), transparent 65%),
    rgba(4, 8, 16, 0.4);
}
.room-code {
  font-family: var(--font-mono);
  font-size: clamp(38px, 4.2vw, 54px);
  font-weight: 700;
  letter-spacing: 0.24em;
  line-height: 1;
  color: var(--lime-soft);
  text-shadow: 0 0 30px rgba(200, 245, 96, 0.35);
  padding-left: 0.24em;
}
.invite-link-row {
  display: flex;
  gap: 8px;
}
.invite-link-row input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(4, 8, 16, 0.5);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  outline: none;
}
.invite-panel .hint {
  margin-top: 13px;
  line-height: 1.7;
}

.player-list {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}
.player-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.player-slot.empty {
  border-style: dashed;
  color: var(--dim);
  font-size: 12px;
  justify-content: center;
  min-height: 60px;
}
.player-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: linear-gradient(150deg, #2b3d5f, #172238);
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--lime-soft);
}
.player-slot.guest .player-avatar {
  color: var(--cyan);
}
.player-info {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}
.player-info b {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-info small {
  color: var(--dim);
  font-size: 9.5px;
}
.player-slot .slot-tag {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(200, 245, 96, 0.08);
  border: 1px solid rgba(200, 245, 96, 0.22);
  color: var(--lime);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
}
.player-slot.guest .slot-tag {
  background: rgba(94, 234, 212, 0.08);
  border-color: rgba(94, 234, 212, 0.25);
  color: var(--cyan);
}
.player-ready {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 9px var(--lime);
}
.lobby-ready {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 10.5px;
}
.lobby-ready.ready {
  color: var(--lime);
}

.lobby-setting-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.3fr;
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}
.lobby-setting {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 10.5px;
  color: var(--dim);
}
.lobby-setting select {
  height: 42px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(4, 8, 16, 0.6);
  color: var(--text);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.lobby-setting select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.lobby-setting .chips {
  gap: 5px;
}
.lobby-setting .chip {
  padding: 9px 10px;
}
.lobby-spec-wrap {
  min-width: 0;
}
.lobby-spec {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(4, 8, 16, 0.35);
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
  line-height: 1.9;
}
.lobby-spec b {
  color: var(--text);
  font-weight: 500;
}

.lobby-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.lobby-actions .btn-primary {
  min-width: 220px;
}
.lobby-actions .hint {
  margin-left: auto;
}

/* ============================================================
   GAME
   ============================================================ */

.screen-game {
  max-width: none;
  height: 100vh;
  height: 100dvh;
  padding: 12px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  animation: none;
}

.game-hud {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(300px, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 9px 16px;
  border-radius: 17px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(21, 30, 52, 0.8), rgba(11, 17, 31, 0.86));
  box-shadow: 0 16px 40px -24px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
}

.hud-mode {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.mode-badge {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(200, 245, 96, 0.09);
  border: 1px solid rgba(200, 245, 96, 0.24);
  color: var(--lime);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
}
.mode-badge.pk {
  background: rgba(94, 234, 212, 0.09);
  border-color: rgba(94, 234, 212, 0.25);
  color: var(--cyan);
}
.hud-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-timer {
  justify-self: center;
}
.timer-ring {
  --p: 1;
  --timer-color: var(--lime);
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: conic-gradient(from -90deg, var(--timer-color) var(--sweep, 360deg), rgba(148, 163, 184, 0.13) 0);
  box-shadow: 0 0 26px -10px var(--timer-color);
  transition: box-shadow 0.3s;
}
.timer-ring::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #0b1120;
  border: 1px solid rgba(148, 163, 184, 0.08);
}
.timer-ring.is-low {
  --timer-color: var(--rose);
  animation: timer-low 1s ease-in-out infinite;
}
@keyframes timer-low {
  0%, 100% { box-shadow: 0 0 20px -10px var(--rose); }
  50% { box-shadow: 0 0 34px -6px var(--rose); }
}
.timer-inner {
  position: absolute;
  inset: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
}
.timer-inner span {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}
.timer-inner small {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.2em;
  color: var(--dim);
}

.hud-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(14px, 2.2vw, 30px);
}
.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
}
.hud-stat span {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  color: var(--dim);
}
.hud-stat b {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hud-stat b.bump {
  animation: number-bump 0.28s ease;
}
@keyframes number-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); color: var(--lime); }
  100% { transform: scale(1); }
}
.hud-lives b {
  color: var(--rose);
  font-size: 15px;
  letter-spacing: 0.1em;
  text-shadow: 0 0 12px rgba(251, 113, 133, 0.35);
}
.hud-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}
.hud-actions .icon-btn {
  height: 34px;
  min-width: 34px;
  border-radius: 9px;
  font-size: 10px;
}
.hud-actions .icon-btn.is-on {
  color: var(--lime);
  border-color: rgba(200, 245, 96, 0.32);
  background: rgba(200, 245, 96, 0.07);
}

.game-main {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 282px;
  gap: 12px;
}

.field-shell {
  position: relative;
  min-height: 0;
  padding: 1px;
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(200, 245, 96, 0.32), rgba(94, 234, 212, 0.08) 32%, rgba(148, 163, 184, 0.1) 62%, rgba(167, 139, 250, 0.2));
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.95);
}

.field {
  position: relative;
  height: 100%;
  min-height: 0;
  border-radius: 23px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(56, 189, 248, 0.08), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(200, 245, 96, 0.045), transparent 70%),
    #070c16;
}
.field.is-shaking {
  animation: field-shake 0.36s ease;
}
@keyframes field-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}
.field.is-danger {
  animation: field-danger 0.5s ease;
}
@keyframes field-danger {
  0%, 100% { box-shadow: inset 0 0 0 rgba(251, 113, 133, 0); }
  35% { box-shadow: inset 0 0 60px rgba(251, 113, 133, 0.28); }
}

.field-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 100% 10%, 10% 100%;
  mask-image: linear-gradient(to bottom, #000, #000 82%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000, #000 82%, transparent);
  pointer-events: none;
}
.field-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(3, 6, 12, 0.45));
  pointer-events: none;
}
.danger-zone {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12%;
  pointer-events: none;
  background: linear-gradient(to top, rgba(251, 113, 133, 0.14), transparent);
  border-top: 1px dashed rgba(251, 113, 133, 0.28);
}
.danger-zone span {
  position: absolute;
  right: 18px;
  bottom: 10px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.24em;
  color: rgba(251, 113, 133, 0.5);
}
.fall-layer,
.fx-layer {
  position: absolute;
  inset: 0;
}
.fx-layer {
  pointer-events: none;
  overflow: hidden;
}

.fall-item {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.028));
  box-shadow:
    0 14px 30px -12px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-family: var(--font-mono);
  font-weight: 700;
  color: #f7faff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  will-change: transform;
}
.fall-item::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 6px;
  height: 2.5px;
  border-radius: 3px;
  background: var(--finger, var(--lime));
  box-shadow: 0 0 12px var(--finger, var(--lime));
  opacity: 0.85;
}
.fall-char {
  line-height: 1;
  transform: translateY(-1px);
}
.fall-finger-dot {
  position: absolute;
  left: 50%;
  top: 6px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  opacity: 0.9;
  box-shadow: 0 0 7px currentColor;
}
.fall-item.is-target {
  border-color: color-mix(in srgb, var(--finger, var(--lime)) 70%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--finger, var(--lime)) 34%, transparent),
    0 0 34px -6px var(--finger, var(--lime)),
    0 14px 30px -12px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.fall-item.is-cleared {
  animation: clear-pop 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes clear-pop {
  0% { opacity: 1; filter: brightness(1); }
  35% { opacity: 1; filter: brightness(1.9); }
  100% { opacity: 0; filter: brightness(2.4); }
}
.fall-item.is-missed {
  border-color: rgba(251, 113, 133, 0.7);
  animation: miss-fade 0.5s ease forwards;
}
@keyframes miss-fade {
  0% { opacity: 1; filter: brightness(1); }
  30% { opacity: 1; filter: brightness(1.6) saturate(1.8); }
  100% { opacity: 0; filter: brightness(0.4) saturate(2.4); }
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--c, var(--lime));
  box-shadow: 0 0 10px var(--c, var(--lime));
  pointer-events: none;
  animation: particle-burst 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes particle-burst {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2); opacity: 0; }
}

.score-pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--lime);
  text-shadow: 0 0 16px rgba(200, 245, 96, 0.6);
  pointer-events: none;
  animation: score-rise 0.8s ease-out forwards;
}
@keyframes score-rise {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -60%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(1); }
}

.countdown {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  background: rgba(5, 9, 18, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.countdown span {
  font-family: var(--font-mono);
  font-size: clamp(76px, 12vh, 130px);
  font-weight: 700;
  line-height: 1;
  color: var(--lime);
  text-shadow: 0 0 60px rgba(200, 245, 96, 0.55);
  animation: count-pop 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.countdown span.go {
  font-size: clamp(60px, 9vh, 96px);
  letter-spacing: 0.08em;
  color: var(--lime-soft);
}
@keyframes count-pop {
  0% { transform: scale(1.4); opacity: 0; }
  30% { transform: scale(1); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: scale(0.92); opacity: 0.7; }
}

.combo-pop {
  position: absolute;
  left: 50%;
  top: 38%;
  z-index: 11;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: transparent;
  background: linear-gradient(100deg, var(--lime-soft), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 22px rgba(200, 245, 96, 0.4));
  pointer-events: none;
  opacity: 0;
}
.combo-pop.show {
  animation: combo-flash 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes combo-flash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  70% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1); }
}

.field-message {
  position: absolute;
  left: 50%;
  top: 16px;
  z-index: 13;
  transform: translateX(-50%);
  padding: 6px 13px;
  border-radius: 99px;
  border: 1px solid rgba(251, 113, 133, 0.3);
  background: rgba(20, 10, 18, 0.85);
  color: var(--rose);
  font-size: 10.5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.field-message.show {
  opacity: 1;
}

.pause-veil {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(5, 9, 18, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.pause-card {
  width: min(360px, 84%);
  padding: 28px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #141e34, #0b1220);
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.9);
  text-align: center;
}
.pause-card h3 {
  margin: 8px 0 8px;
  font-family: var(--font-display);
  font-size: 26px;
}
.pause-card p {
  color: var(--muted);
  font-size: 12px;
}
.pause-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 22px;
}

/* game side */

.game-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}
.game-side .panel {
  padding: 14px 16px;
  border-radius: 16px;
  flex: 0 0 auto;
}

.hint-panel {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(200, 245, 96, 0.1), transparent 65%),
    linear-gradient(180deg, rgba(21, 30, 52, 0.9), rgba(11, 17, 31, 0.92)) !important;
}
.hint-live {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--lime);
  opacity: 0.7;
}
.hint-key {
  display: grid;
  place-items: center;
  width: 100%;
  height: 82px;
  margin: 12px 0 10px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--finger, var(--lime)) 55%, transparent);
  background:
    radial-gradient(ellipse at 50% -20%, rgba(255, 255, 255, 0.5), transparent 60%),
    linear-gradient(170deg, color-mix(in srgb, var(--finger, var(--lime)) 26%, #f5f9ff), color-mix(in srgb, var(--finger, var(--lime)) 58%, #dce7f4));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--finger, var(--lime)) 34%, transparent),
    0 0 40px -8px var(--finger, var(--lime)),
    inset 0 2px 0 rgba(255, 255, 255, 0.75),
    0 8px 0 -2px rgba(64, 92, 10, 0.5);
  font-family: var(--font-mono);
  font-size: 44px;
  font-weight: 700;
  color: #0a1006;
  line-height: 1;
  transition: transform 0.2s;
}
.hint-key.enter {
  animation: hint-enter 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes hint-enter {
  from { transform: scale(0.9); opacity: 0.6; }
  to { transform: scale(1); opacity: 1; }
}
.hint-finger {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.finger-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--finger, var(--lime));
  box-shadow: 0 0 12px var(--finger, var(--lime));
  flex: 0 0 auto;
}
.hint-finger b {
  font-weight: 600;
}
.hint-tip {
  margin-top: 9px;
  font-size: 9.5px;
  line-height: 1.55;
  color: var(--dim);
}

.opponent-panel {
  border-color: rgba(94, 234, 212, 0.16) !important;
}
.opponent-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 11px 0 10px;
}
.opponent-name {
  font-size: 13px;
  color: var(--cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.opponent-score {
  font-family: var(--font-mono);
  font-size: 21px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.vs-bars {
  display: grid;
  gap: 6px;
}
.vs-row {
  display: grid;
  grid-template-columns: 48px 1fr 42px;
  align-items: center;
  gap: 7px;
  font-size: 9px;
  color: var(--dim);
}
.vs-row > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vs-row b {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  color: var(--muted);
  text-align: right;
}
.vs-row .bar {
  height: 5px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.13);
  overflow: hidden;
}
.vs-row .bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  transition: width 0.3s ease;
}
.vs-row .bar i.you {
  background: linear-gradient(90deg, var(--lime), #a9e03c);
  box-shadow: 0 0 10px rgba(200, 245, 96, 0.5);
}
.vs-row .bar i.opp {
  background: linear-gradient(90deg, var(--cyan), #2dd4bf);
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.45);
}
.opponent-meta {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 9.5px;
  color: var(--dim);
}
.opponent-meta b {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-weight: 500;
}

.live-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 8px;
  margin-top: 11px;
}
.live-grid > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.live-grid span {
  font-size: 9px;
  color: var(--dim);
}
.live-grid b {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.live-grid b small {
  font-size: 8px;
  color: var(--dim);
  font-weight: 400;
}

.combo-panel {
  display: grid;
  gap: 8px;
}
.combo-current {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.combo-current span {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--dim);
}
.combo-current b {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}
.combo-track {
  height: 4px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.13);
  overflow: hidden;
}
.combo-track i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lime), var(--cyan));
  box-shadow: 0 0 12px rgba(200, 245, 96, 0.5);
  transition: width 0.25s ease;
}
.combo-best {
  font-size: 9px;
  color: var(--dim);
  text-align: right;
}
.combo-best b {
  color: var(--muted);
  font-family: var(--font-mono);
}

/* game keyboard */

.keyboard-stage {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(16px, 2.2vw, 36px);
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}
.keyboard-stage .game-keyboard {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}
.typing-hand {
  flex: 0 0 auto;
  width: clamp(72px, min(9vw, 14vh), 112px);
  transition: opacity 0.3s;
}
.typing-hand .hand-unit {
  width: 100%;
}
.typing-hand .hand-label {
  font-size: 8.5px;
}

.game-keyboard-wrap {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 18px 7px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(21, 30, 52, 0.72), rgba(11, 17, 31, 0.8));
  box-shadow: 0 18px 50px -34px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.game-keyboard {
  max-width: 760px;
  gap: 5px;
}
.game-keyboard .kb-row {
  gap: 5px;
}
.game-keyboard .kb-key {
  height: clamp(30px, 4.4vh, 42px);
  border-radius: 7px;
  font-size: 11px;
}
.game-keyboard .kb-span-row {
  display: flex;
  justify-content: center;
}
.game-keyboard .kb-space {
  width: 32%;
  height: 17px;
  font-size: 7px;
  border-radius: 5px;
}
.keyboard-hint {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  color: var(--dim);
}
.keyboard-hint kbd {
  height: 16px;
  min-width: 17px;
  font-size: 8px;
}

body.hints-off .game-keyboard-wrap,
body.hints-off .hint-panel {
  display: none !important;
}
body.hints-off .fall-item::after,
body.hints-off .fall-finger-dot {
  display: none;
}
body.hints-off .game-main {
  grid-template-columns: minmax(0, 1fr) 282px;
}

/* ============================================================
   MODALS
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 6, 12, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: backdrop-in 0.25s ease;
  overflow-y: auto;
}
@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: relative;
  width: min(700px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 30px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background:
    radial-gradient(ellipse 80% 45% at 50% 0%, rgba(200, 245, 96, 0.075), transparent 65%),
    linear-gradient(180deg, #141e34 0%, #0a101d 100%);
  box-shadow:
    0 50px 120px -40px rgba(0, 0, 0, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: modal-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transition: color 0.2s, background 0.2s;
}
.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.result-head {
  display: flex;
  align-items: center;
  gap: 22px;
  padding-right: 30px;
}
.grade-badge {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  flex: 0 0 auto;
  border-radius: 22px;
  border: 1px solid rgba(200, 245, 96, 0.35);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.18), transparent 65%),
    linear-gradient(160deg, rgba(200, 245, 96, 0.15), rgba(94, 234, 212, 0.04));
  box-shadow: 0 0 44px -12px rgba(200, 245, 96, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  font-family: var(--font-mono);
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  color: var(--lime);
  text-shadow: 0 0 30px rgba(200, 245, 96, 0.45);
}
.result-heading h2 {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.1;
}
.result-heading p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12.5px;
}

.result-score-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-top: 24px;
  padding: 18px 22px;
  border-radius: 17px;
  border: 1px solid rgba(200, 245, 96, 0.14);
  background:
    linear-gradient(100deg, rgba(200, 245, 96, 0.075), transparent 55%),
    rgba(4, 8, 16, 0.35);
}
.result-score span,
.result-score-side span {
  display: block;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: var(--dim);
}
.result-score b {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  color: var(--lime-soft);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.result-score-side {
  text-align: right;
  padding-bottom: 4px;
}
.result-score-side b {
  display: block;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--text);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.result-stats > div {
  padding: 12px 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
}
.result-stats span {
  display: block;
  font-size: 9px;
  color: var(--dim);
}
.result-stats b {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pk-result {
  margin-top: 16px;
  padding: 16px;
  border-radius: 15px;
  border: 1px solid rgba(94, 234, 212, 0.18);
  background: rgba(94, 234, 212, 0.035);
}
.pk-result-title {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--cyan);
  margin-bottom: 11px;
}
.pk-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.pk-result-card {
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(4, 8, 16, 0.4);
}
.pk-result-card.winner {
  border-color: rgba(200, 245, 96, 0.4);
  background: rgba(200, 245, 96, 0.055);
  box-shadow: 0 0 26px -14px rgba(200, 245, 96, 0.6);
}
.pk-result-card .pk-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.pk-result-card .pk-player b {
  font-weight: 600;
}
.pk-result-card .pk-player em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--lime);
}
.pk-result-card .pk-player-stats {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  font-size: 9.5px;
  color: var(--dim);
}
.pk-result-card .pk-player-stats b {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.result-waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 15px;
  padding: 10px;
  border-radius: 10px;
  border: 1px dashed rgba(94, 234, 212, 0.22);
  color: var(--cyan);
  font-size: 11px;
}
.spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(94, 234, 212, 0.25);
  border-top-color: var(--cyan);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}
.result-actions .btn {
  min-width: 140px;
}

/* help */

.help-modal {
  width: min(860px, 100%);
}
.help-modal h2 {
  margin: 5px 0 20px;
  font-family: var(--font-display);
  font-size: 30px;
}
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 30px;
}
.help-grid h3 {
  margin-bottom: 9px;
  font-size: 13px;
  color: var(--lime-soft);
}
.help-grid li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}
.help-grid li::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--dim);
}
.help-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 10.5px;
}
.help-foot .btn {
  margin-left: auto;
}

/* toast */

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border-radius: 11px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(14, 21, 37, 0.95);
  box-shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(14px);
  font-size: 12px;
  color: var(--text);
  animation: toast-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 9px var(--lime);
}
.toast.error::before {
  background: var(--rose);
  box-shadow: 0 0 9px var(--rose);
}
.toast.cyan::before {
  background: var(--cyan);
  box-shadow: 0 0 9px var(--cyan);
}
.toast.out {
  animation: toast-out 0.28s ease forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1150px) {
  .typing-hand {
    display: none;
  }
  .keyboard-stage {
    display: block;
    max-width: 760px;
  }
}

@media (max-width: 1120px) {
  .hero {
    gap: 30px;
  }
  .float-tag.tag-1 {
    left: -8px;
  }
  .float-tag.tag-2 {
    right: -4px;
  }
  .game-hud {
    grid-template-columns: minmax(130px, 0.8fr) auto minmax(250px, 1fr) auto;
    gap: 14px;
  }
  .hud-stats {
    gap: 16px;
  }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-top: 14px;
  }
  .hero-visual {
    order: 2;
    margin-top: 12px;
  }
  .stage {
    transform: none;
    animation: none;
    width: min(100%, 520px);
  }
  .float-tag {
    display: none;
  }
  .config-layout {
    grid-template-columns: 1fr;
  }
  .feature-row {
    grid-template-columns: 1fr;
  }
  .pk-entry {
    grid-template-columns: 1fr;
  }
  .pk-or {
    flex-direction: row;
    padding: 0;
  }
  .pk-or::before,
  .pk-or::after {
    width: auto;
    height: 1px;
    flex: 1;
    background: linear-gradient(to right, transparent, var(--line-strong), transparent);
  }
  .lobby-grid {
    grid-template-columns: 1fr;
  }
  .lobby-setting-grid {
    grid-template-columns: 1fr 1fr;
  }
  .game-main {
    grid-template-columns: 1fr;
  }
  .game-side {
    display: none;
  }
  body.hints-off .game-main {
    grid-template-columns: 1fr;
  }
  .game-hud {
    grid-template-columns: 1fr auto auto;
    gap: 15px;
  }
  .hud-stats {
    display: none;
  }
  .screen-game {
    padding: 8px 10px 10px;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0 16px;
    height: 64px;
  }
  .topbar-center {
    display: none;
  }
  .topbar-actions .top-btn-label {
    display: none;
  }
  .screen {
    padding: 30px 16px 60px;
  }
  .hero-copy,
.hero-visual {
  min-width: 0;
}

.hero-copy h1 {
    font-size: clamp(40px, 11vw, 58px);
  }
  .hero-meta span {
    padding: 0 10px;
  }
  .settings-panel,
  .preview-panel {
    padding: 20px 16px;
  }
  .segmented {
    grid-template-columns: repeat(2, 1fr);
  }
  .difficulty-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .inline-fields {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .settings-foot {
    flex-direction: column;
    align-items: stretch;
  }
  .settings-foot .btn {
    min-width: 0;
  }
  .home-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .kb-key {
    height: 34px;
    border-radius: 7px;
    font-size: 10px;
  }
  .kb-row {
    gap: 4px;
  }
  .preview-equalizer {
    display: none;
  }
  .stage-keyrow {
    gap: 3px;
  }
  .stage-keyrow span {
    flex: 1 1 0;
    width: auto;
    max-width: 32px;
    min-width: 0;
    height: 23px;
    font-size: 8.5px;
  }
  .stage-keyrow.row-b {
    padding: 0 8px;
  }
  .stage-keyrow.row-c {
    padding: 0 20px;
  }
  .pk-header h1 {
    font-size: 38px;
  }
  .pk-card {
    padding: 22px 18px;
  }
  .room-code {
    font-size: 34px;
  }
  .invite-link-row {
    flex-direction: column;
  }
  .lobby-setting-grid {
    grid-template-columns: 1fr;
  }
  .lobby-actions {
    flex-wrap: wrap;
  }
  .lobby-actions .btn-primary {
    width: 100%;
  }
  .lobby-actions .hint {
    margin-left: 0;
    width: 100%;
  }
  .game-hud {
    padding: 8px 10px;
    border-radius: 13px;
  }
  .hud-sub {
    display: none;
  }
  .timer-ring {
    width: 52px;
    height: 52px;
  }
  .timer-inner span {
    font-size: 12px;
  }
  .hud-actions .icon-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 7px;
    font-size: 9px;
  }
  .game-keyboard-wrap {
    padding: 7px 8px 5px;
  }
  .game-keyboard .kb-key {
    height: 28px;
    font-size: 9px;
  }
  .keyboard-hint {
    font-size: 7.5px;
    letter-spacing: 0.06em;
  }
  .danger-zone span {
    font-size: 7px;
  }
  .modal {
    padding: 22px 17px;
    border-radius: 19px;
  }
  .result-head {
    gap: 15px;
    padding-right: 22px;
  }
  .grade-badge {
    width: 66px;
    height: 66px;
    border-radius: 17px;
    font-size: 34px;
  }
  .result-heading h2 {
    font-size: 24px;
  }
  .result-score b {
    font-size: 36px;
  }
  .result-stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .result-actions {
    flex-wrap: wrap;
  }
  .result-actions .btn {
    flex: 1 1 120px;
    min-width: 0;
  }
  .help-grid {
    grid-template-columns: 1fr;
  }
  .help-foot {
    flex-wrap: wrap;
    gap: 10px;
  }
  .help-foot .btn {
    margin-left: 0;
    width: 100%;
  }
  .pk-result-grid {
    grid-template-columns: 1fr;
  }
  .result-score-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .result-score-side {
    text-align: left;
  }
  .toast-stack {
    bottom: 14px;
    width: calc(100% - 28px);
  }
  .toast {
    font-size: 11px;
  }
}

@media (max-height: 760px) and (min-width: 981px) {
  .hint-key {
    height: 60px;
    font-size: 34px;
    margin: 8px 0 7px;
  }
  .game-side .panel {
    padding: 11px 14px;
  }
  .live-grid {
    gap: 6px 8px;
  }
  .game-hud {
    padding: 6px 14px;
  }
  .timer-ring {
    width: 54px;
    height: 54px;
  }
  .game-keyboard-wrap {
    padding: 7px 14px 5px;
  }
  .game-keyboard .kb-key {
    height: 30px;
  }
}

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