@charset "UTF-8";
:root {
  color-scheme: dark;
  --bg: #11121a;
  --surface: #1a1c28;
  --panel: #202231;
  --line: #343646;
  --ink: #f6f5ef;
  --muted: #a5a6b7;
  --lime: #c2ff67;
  --purple: #b19cff;
  --orange: #ff8964;
  --red: #ff697b;
  --radius: 20px;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-width: 320px;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  color: inherit;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
a {
  color: inherit;
  text-decoration: none;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 4px;
}
button {
  border: 0;
}
svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
h1,
h2,
h3,
p {
  margin: 0;
}
button {
  transition:
    background 0.16s,
    transform 0.16s,
    border-color 0.16s;
}
button:active:not(:disabled) {
  transform: translateY(2px);
}
#app {
  max-width: 1440px;
  margin: auto;
  padding: 0 42px;
  position: relative;
  z-index: 1;
}
.topbar {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 20px;
}
.brand {
  background: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-align: left;
  padding: 0;
}
.brand .dim {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 2px;
  letter-spacing: 1px;
}
.brand-badge {
  background: var(--lime);
  color: #151b13;
  width: 39px;
  height: 39px;
  border-radius: 12px 12px 12px 3px;
  display: grid;
  place-items: center;
  font-size: 19px;
  font-weight: 1000;
  transform: rotate(-6deg);
}
.header-label {
  color: #828495;
  font-size: 10px;
  letter-spacing: 3px;
}
.utilities {
  display: flex;
  gap: 8px;
}
.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #20222e;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
}
.icon-button:hover {
  background: #303344;
  color: var(--ink);
}
.icon-button.off {
  opacity: 0.5;
}
.icon-button.off:after {
  content: "";
  position: absolute;
  width: 25px;
  height: 2px;
  background: currentColor;
  transform: rotate(-45deg);
}
.icon-button.off {
  position: relative;
}
main {
  min-height: calc(100svh - 150px);
  outline: none;
}
footer {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  color: #858798;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  border-top: 1px solid var(--line);
}
footer a {
  color: var(--lime);
}
#watermark {
  font-weight: 400;
  letter-spacing: 0;
}
.status-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--lime);
  border-radius: 100%;
  margin-right: 7px;
}
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 80% 25%, #6c50b512, transparent 50%),
    radial-gradient(ellipse at 10% 70%, #bed98708, transparent 50%);
}
.ambient span {
  position: absolute;
  font-size: 240px;
  font-weight: 1000;
  color: #ffffff02;
  transform: rotate(-16deg);
}
.ambient span:nth-child(1) {
  left: -80px;
  top: 20%;
}
.ambient span:nth-child(2) {
  right: -40px;
  top: 50%;
}
.ambient span:nth-child(3) {
  right: 25%;
  top: -70px;
}
.ambient span:nth-child(4) {
  left: 35%;
  bottom: -150px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 800;
  color: var(--lime);
  display: block;
}
.button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 12px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
}
.button:hover {
  background: #323547;
}
.button.primary {
  background: var(--lime);
  color: #18220d;
  border-color: var(--lime);
  box-shadow: 0 4px 0 #759a3c;
}
.button.primary:hover {
  background: #d2ff92;
}
.button.purple {
  background: var(--purple);
  color: #201b37;
  border-color: var(--purple);
  box-shadow: 0 4px 0 #69578d;
}
.button.danger {
  color: var(--red);
}
.button.wide {
  width: 100%;
}
.text-link {
  font-size: 11px;
  color: var(--lime);
  font-weight: 800;
  letter-spacing: 0.6px;
}
.muted {
  color: var(--muted);
}
.home-hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 45px;
  align-items: center;
  padding: 40px 0 32px;
}
.hero-copy .eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.pill {
  border: 1px solid #c2ff6740;
  background: #c2ff670a;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 9px;
  letter-spacing: 1px;
}
.title-logo {
  width: min(100%, 520px);
  height: auto;
  display: block;
  margin: 0 0 18px;
}
.hero-copy p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  max-width: 430px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 23px;
}
.hero-actions .button {
  min-width: 154px;
  height: 53px;
}
.hero-note {
  font-size: 10px;
  color: #858798;
  margin-top: 16px;
  display: flex;
  gap: 20px;
}
.hero-note b {
  color: #cccddd;
  font-weight: 500;
}
.hero-art {
  height: 280px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  isolation: isolate;
}
.orbit {
  position: absolute;
  width: 265px;
  height: 265px;
  border: 1px solid #ffffff0b;
  border-radius: 50%;
  transform: rotate(-20deg);
}
.orbit:nth-child(2) {
  width: 365px;
  height: 205px;
  transform: rotate(-30deg);
}
.orbit:nth-child(3) {
  width: 360px;
  height: 205px;
  transform: rotate(40deg);
}
.keycap {
  position: absolute;
  display: grid;
  place-items: center;
  width: 122px;
  height: 135px;
  border-radius: 22px;
  font-size: 88px;
  font-weight: 1000;
  line-height: 1;
  color: #262333;
  border: 2px solid #ffffff60;
  box-shadow:
    inset 0 -12px 0 #00000026,
    0 18px 35px #0004;
  text-shadow: 0 2px 0 #ffffff50;
}
.keycap.a {
  background: var(--lime);
  left: 13%;
  top: 33px;
  transform: rotate(-14deg);
  z-index: 3;
}
.keycap.b {
  background: var(--purple);
  left: 40%;
  top: 5px;
  transform: rotate(9deg);
  z-index: 2;
}
.keycap.c {
  background: var(--orange);
  left: 63%;
  top: 96px;
  transform: rotate(18deg);
  z-index: 1;
}
.keycap:after {
  content: "↑";
  position: absolute;
  font-size: 13px;
  right: 12px;
  top: 11px;
  opacity: 0.4;
}
.speed-tag {
  position: absolute;
  bottom: 12px;
  left: 24%;
  display: flex;
  gap: 9px;
  align-items: center;
  background: #252837;
  border: 1px solid #404256;
  border-radius: 9px;
  padding: 10px 14px;
  transform: rotate(-4deg);
  box-shadow: 0 7px 25px #0004;
  font-size: 11px;
  font-weight: 700;
  z-index: 4;
}
.speed-tag svg {
  color: var(--lime);
  width: 18px;
}
.art-star {
  position: absolute;
  color: var(--lime);
  font-size: 32px;
  left: 9%;
  bottom: 44px;
}
.art-star.second {
  left: auto;
  right: 12%;
  top: 8px;
  font-size: 19px;
  color: var(--purple);
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 14px;
}
.section-heading h2 {
  font-size: 13px;
  letter-spacing: 1px;
}
.section-heading span {
  color: var(--muted);
  font-size: 10px;
}
.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.mode-card {
  position: relative;
  overflow: hidden;
  text-align: left;
  padding: 19px 18px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  min-height: 133px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.mode-card:hover {
  background: #242735;
  border-color: var(--accent);
  transform: translateY(-3px);
}
.mode-card .mode-icon {
  color: var(--accent);
  margin-bottom: 14px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 23px;
  font-weight: 900;
}
.mode-card h3 {
  font-size: 13px;
  margin-bottom: 5px;
}
.mode-card p {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 90%;
}
.mode-card .card-arrow {
  position: absolute;
  right: 15px;
  top: 19px;
  color: #747688;
}
.mode-card .card-arrow svg {
  width: 17px;
}
.mode-card.featured {
  background: linear-gradient(115deg, #302a44, #20212f);
  border-color: #625179;
}
.mode-card .tag {
  position: absolute;
  right: 14px;
  bottom: 14px;
  font-size: 8px;
  background: #b19cff1a;
  border: 1px solid #b19cff40;
  color: var(--purple);
  border-radius: 4px;
  padding: 3px 5px;
}
.daily-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  background: #22271c;
  border: 1px solid #c2ff6733;
  border-radius: 16px;
  padding: 19px 23px;
  margin: 19px 0;
}
.daily-icon {
  width: 45px;
  height: 45px;
  background: #c2ff6712;
  border: 1px solid #c2ff6733;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--lime);
}
.daily-banner h3 {
  font-size: 13px;
  margin-bottom: 5px;
}
.daily-banner p {
  font-size: 11px;
  color: #b3b8a9;
}
.daily-banner .eyebrow {
  font-size: 8px;
  margin-bottom: 6px;
}
.daily-banner .button {
  font-size: 11px;
  min-height: 42px;
}
.home-bottom {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 2px 0 22px;
}
.home-bottom button {
  background: none;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px;
}
.home-bottom svg {
  width: 16px;
  height: 16px;
}
.home-bottom .saved-hint {
  margin-left: auto;
  font-size: 9px;
  color: #6e7082;
}
.screen-head {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 25px 0 20px;
}
.screen-head h1 {
  font-size: 25px;
}
.screen-head .eyebrow {
  margin-bottom: 5px;
}
.screen-head .right {
  margin-left: auto;
}
.setup {
  max-width: 700px;
  margin: 20px auto 50px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px;
}
.setup p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
  margin: 15px 0 23px;
}
.field {
  display: block;
  margin: 20px 0;
}
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 10px;
  color: var(--muted);
}
.segments {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.segments button {
  flex: 1;
  padding: 12px;
  background: #12141e;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 44px;
  font-size: 12px;
}
.segments button.selected {
  border-color: var(--lime);
  background: #c2ff6715;
  color: var(--lime);
}
.setup .button.primary {
  margin-top: 10px;
}
.control-note {
  padding: 15px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  margin: 20px 0;
}
kbd {
  display: inline-block;
  border: 1px solid #535669;
  border-bottom-width: 3px;
  border-radius: 5px;
  background: #2a2c3c;
  padding: 1px 6px;
  color: var(--ink);
  font-size: 11px;
}
.game-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 0 17px;
  gap: 10px;
}
.game-head h1 {
  font-size: 17px;
  margin-top: 4px;
}
.game-head .eyebrow {
  font-size: 8px;
}
.game-head .game-actions {
  display: flex;
  gap: 8px;
}
.hud {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  margin-bottom: 15px;
  overflow: hidden;
}
.hud-cell {
  padding: 13px 18px;
  border-right: 1px solid var(--line);
}
.hud-cell:last-child {
  border: 0;
}
.hud-label {
  font-size: 8px;
  letter-spacing: 1.3px;
  color: var(--muted);
  display: block;
  margin-bottom: 5px;
}
.hud-value {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.hud-cell:first-child .hud-value {
  color: var(--lime);
}
.arena {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 110%, #b19cff10, transparent 60%),
    linear-gradient(#ffffff02 1px, transparent 1px),
    linear-gradient(90deg, #ffffff02 1px, transparent 1px), #151721;
  background-size:
    auto,
    35px 35px,
    35px 35px,
    auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 17px;
  margin-bottom: 15px;
}
.arena.fever {
  border-color: var(--lime);
  background-color: #1d281b;
  box-shadow: inset 0 0 60px #c2ff6709;
}
.prompt-label {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 800;
  margin-bottom: 10px;
  z-index: 2;
}
.target {
  font-weight: 1000;
  font-size: 105px;
  line-height: 1.15;
  color: var(--lime);
  min-height: 121px;
  text-align: center;
  text-shadow: 0 5px 0 #6b91452b;
  z-index: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.target.sequence {
  font-size: clamp(25px, 5vw, 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 10px;
  max-width: 100%;
}
.feedback {
  height: 23px;
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px;
  z-index: 2;
}
.progress-strip {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 auto 18px;
}
.progress-letter {
  display: grid;
  place-items: center;
  width: 28px;
  height: 29px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: #626579;
  font-size: 11px;
  font-weight: 800;
}
.progress-letter.done {
  color: var(--lime);
  background: #c2ff6710;
  border-color: #c2ff6730;
}
.progress-letter.current {
  background: var(--lime);
  border-color: var(--lime);
  color: #1b2613;
}
.keyboard {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  padding-bottom: 17px;
  max-width: 800px;
  margin: 0 auto;
}
.key-row {
  display: flex;
  justify-content: center;
  gap: 7px;
  width: 100%;
}
.letter-key {
  height: 46px;
  width: calc((100% - 63px) / 10);
  max-width: 64px;
  border: 1px solid #424557;
  border-bottom: 3px solid #373a4c;
  background: #252837;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 800;
  touch-action: none;
  user-select: none;
}
.letter-key:hover {
  background: #35394b;
}
.letter-key.hint {
  border-color: var(--lime);
  color: var(--lime);
  background: #c2ff671a;
}
.letter-key.flash {
  background: var(--lime);
  color: #172010;
}
.play-tip {
  text-align: center;
  font-size: 10px;
  color: #7d8091;
  margin: 0 0 17px;
}
.feedback.good {
  color: var(--lime);
}
.feedback.bad {
  color: var(--red);
}
.countdown {
  position: absolute;
  inset: 0;
  background: #151721ed;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  font-size: 75px;
  font-weight: 1000;
  color: var(--lime);
}
.countdown small {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--muted);
}
.distractor {
  position: absolute;
  opacity: 0.08;
  font-size: 65px;
  font-weight: 900;
}
.distractor:nth-of-type(1) {
  left: 12%;
  top: 30px;
}
.distractor:nth-of-type(2) {
  right: 12%;
  bottom: 25px;
}
.arena.wrong {
  border-color: var(--red);
}
.shake-normal {
  animation: shake 0.16s;
}
.shake-low {
  animation: shake 0.16s;
  --shake: 2px;
}
@keyframes shake {
  25% {
    transform: translateX(var(--shake, 4px));
  }
  75% {
    transform: translateX(calc(-1 * var(--shake, 4px)));
  }
}
.pop {
  animation: pop 0.13s ease-out;
}
@keyframes pop {
  50% {
    transform: scale(1.055);
  }
}
.result {
  max-width: 720px;
  margin: 24px auto 40px;
  text-align: center;
  padding: 35px;
  background:
    radial-gradient(ellipse at top, #c2ff6710, transparent 55%), var(--surface);
  border: 1px solid var(--line);
  border-radius: 25px;
}
.result-medal {
  width: 65px;
  height: 65px;
  margin: 0 auto 18px;
  border: 1px solid #c2ff6740;
  background: #c2ff6710;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: var(--lime);
}
.result-medal svg {
  width: 32px;
  height: 32px;
}
.result h1 {
  font-size: 24px;
  margin: 10px 0;
}
.result-score {
  font-size: clamp(45px, 9vw, 82px);
  font-weight: 1000;
  letter-spacing: -4px;
  line-height: 1.1;
  margin: 20px 0 8px;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}
.result-score small {
  font-size: 18px;
  letter-spacing: 0;
  margin-left: 9px;
}
.result-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.result-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 25px 0;
}
.result-metrics div {
  background: #11131c;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px 5px;
}
.result-metrics strong {
  display: block;
  font-size: 22px;
}
.result-metrics span {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-top: 7px;
}
.result-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}
.result .text-link {
  display: inline-block;
  margin-top: 18px;
}
.stats-grid,
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 30px;
}
.stat-card,
.achievement {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
}
.stat-card strong {
  display: block;
  font-size: 30px;
  color: var(--lime);
  margin: 8px 0;
}
.stat-card span {
  font-size: 11px;
  color: var(--muted);
}
.achievement {
  display: flex;
  gap: 15px;
  align-items: center;
}
.achievement svg {
  color: #636578;
  width: 25px;
}
.achievement h3 {
  font-size: 13px;
  margin-bottom: 5px;
}
.achievement p {
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted);
}
.achievement.unlocked {
  border-color: #c2ff6740;
}
.achievement.unlocked svg {
  color: var(--lime);
}
.achievement.locked {
  opacity: 0.65;
}
.settings-list {
  display: grid;
  gap: 12px;
}
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.setting input[type="checkbox"] {
  appearance: none;
  width: 42px;
  height: 24px;
  background: #36394a;
  border-radius: 30px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.setting input[type="checkbox"]:before {
  content: "";
  width: 16px;
  height: 16px;
  position: absolute;
  background: #fff;
  border-radius: 100%;
  top: 4px;
  left: 4px;
  transition: left 0.15s;
}
.setting input:checked {
  background: #779e40;
}
.setting input:checked:before {
  left: 22px;
}
.setting select {
  background: var(--panel);
  color: var(--ink);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.setting input[type="range"] {
  width: 135px;
  accent-color: var(--lime);
}
.settings-section {
  color: var(--lime);
  font-size: 10px;
  letter-spacing: 1.5px;
  margin: 17px 0 4px;
}
.reset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}
.reset-actions .button {
  font-size: 10px;
  min-height: 42px;
  padding: 9px;
}
.help-list {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}
.help-list li {
  margin-bottom: 10px;
}
.help-list strong {
  color: var(--ink);
}
dialog {
  padding: 0;
  border: 1px solid #4c4f61;
  border-radius: 22px;
  background: #1a1c28;
  color: var(--ink);
  width: min(540px, calc(100% - 30px));
  max-height: 85svh;
  box-shadow: 0 30px 100px #0009;
}
dialog::backdrop {
  background: #060712c9;
  backdrop-filter: blur(4px);
}
#modal-content {
  padding: 27px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 17px;
}
.modal-head h2 {
  font-size: 22px;
}
.modal-actions {
  display: grid;
  gap: 10px;
}
.modal-copy {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 20px;
}
.copy-box {
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  font-size: 12px;
  margin: 12px 0;
}
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  width: 100%;
  height: 100%;
}
#toasts {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 7px;
  z-index: 100;
  width: max-content;
  max-width: calc(100% - 24px);
  pointer-events: none;
}
.toast {
  background: #303925;
  border: 1px solid #c2ff6755;
  padding: 13px 18px;
  border-radius: 12px;
  color: #e4f8ca;
  font-size: 12px;
  box-shadow: 0 8px 30px #0005;
}
#loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: grid;
  place-items: center;
}
.loader-content {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-direction: column;
  padding: 20px;
}
.loader-content progress {
  width: 230px;
  height: 7px;
  accent-color: var(--lime);
}
#load-status {
  font-size: 11px;
  color: var(--muted);
}
.studio-link {
  font-size: 14px;
  color: var(--lime);
}
[hidden] {
  display: none !important;
}
.survival-arena {
  height: 260px;
  padding: 0;
  display: block;
}
.hazard {
  position: absolute;
  top: 0;
  width: 42px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #29243c;
  color: var(--purple);
  border: 1px solid #81709b;
  border-bottom-width: 4px;
  border-radius: 9px;
  font-size: 26px;
  font-weight: 900;
  will-change: transform;
}
.danger-line {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  border-top: 2px dashed #ff697b55;
  text-align: center;
  font-size: 8px;
  color: var(--red);
  letter-spacing: 2px;
  padding-top: 3px;
}
.boss-bar {
  position: absolute;
  top: 10px;
  left: 15%;
  right: 15%;
  z-index: 3;
  background: #14131fec;
  border: 1px solid #ff697b66;
  border-radius: 10px;
  padding: 8px 12px;
  text-align: center;
}
.boss-bar span {
  font-size: 10px;
  color: var(--red);
  font-weight: 800;
  letter-spacing: 2px;
}
.boss-bar progress {
  display: block;
  width: 100%;
  height: 7px;
  margin-top: 7px;
  accent-color: var(--red);
}
.power-strip {
  font-size: 11px;
  text-align: center;
  min-height: 25px;
  color: var(--lime);
  margin-bottom: 10px;
}
.battle-arena {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 0 0 20px;
  position: relative;
}
.player-panel {
  background: var(--surface);
  border: 1px solid #c2ff6740;
  border-radius: 18px;
  padding: 20px;
  text-align: center;
  --player: var(--lime);
}
.player-panel.p2 {
  border-color: #b19cff66;
  --player: var(--purple);
}
.player-panel h2 {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--player);
  margin-bottom: 12px;
}
.player-panel .battle-letter {
  font-size: 78px;
  font-weight: 1000;
  line-height: 1.2;
  color: var(--player);
  margin: 12px 0;
}
.player-panel progress {
  width: 100%;
  height: 8px;
  accent-color: var(--player);
  display: block;
}
.player-small {
  font-size: 10px;
  color: var(--muted);
  margin: 10px 0;
  min-height: 15px;
}
.battle-pad {
  display: flex;
  gap: 7px;
  margin-top: 18px;
}
.battle-key {
  flex: 1;
  min-width: 0;
  height: 60px;
  border: 1px solid var(--line);
  border-bottom: 4px solid #383b4c;
  border-radius: 10px;
  background: #262937;
  font-size: 19px;
  font-weight: 900;
  touch-action: none;
  user-select: none;
}
.battle-key.lit {
  background: var(--player);
  color: #1a1c22;
  border-color: var(--player);
}
.battle-key small {
  display: block;
  font-size: 8px;
  margin-top: 4px;
  opacity: 0.7;
}
.timing-lane {
  height: 110px;
  position: relative;
  border-radius: 10px;
  background: #11141d;
  border: 1px solid var(--line);
  overflow: hidden;
}
.hit-zone {
  position: absolute;
  left: 0;
  right: 0;
  top: 65%;
  height: 25%;
  background: #c2ff6720;
  border-top: 1px solid var(--player);
  border-bottom: 1px solid var(--player);
  font-size: 9px;
  color: var(--player);
  padding-top: 7px;
}
.timing-token {
  position: absolute;
  width: 30px;
  height: 26px;
  left: calc(50% - 15px);
  top: 0;
  background: var(--player);
  color: #151720;
  border-radius: 5px;
  font-weight: 900;
  display: grid;
  place-items: center;
}
.match-score {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 18px;
}
.match-score strong {
  color: var(--ink);
  font-size: 20px;
  margin: 0 14px;
}
.friend-banner {
  border: 1px solid #b19cff66;
  padding: 14px 20px;
  background: #b19cff12;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  font-size: 13px;
  gap: 10px;
}
.large {
  font-size: 18px;
}
.large .button,
.large .mode-card h3,
.large .setting {
  font-size: 16px;
}
.contrast {
  --bg: #050509;
  --surface: #11121b;
  --panel: #191b29;
  --line: #77798c;
  --muted: #d0d1df;
}
.reduced *,
.reduced *:before,
.reduced *:after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
.reduced .ambient {
  display: none;
}
@media (min-width: 1500px) {
  .home-hero {
    padding-top: 55px;
    padding-bottom: 45px;
  }
  .hero-art {
    height: 310px;
  }
  .mode-card {
    min-height: 145px;
  }
  .arena {
    min-height: 260px;
  }
  .survival-arena {
    height: 300px;
  }
}
@media (max-width: 1000px) {
  #app {
    padding: 0 24px;
  }
  .home-hero {
    gap: 15px;
  }
  .hero-art {
    transform: scale(0.9);
  }
  .keycap.a {
    left: 5%;
  }
  .keycap.b {
    left: 35%;
  }
  .keycap.c {
    left: 63%;
  }
  .header-label {
    display: none;
  }
  .mode-card {
    padding: 16px 13px;
  }
  .mode-card p {
    font-size: 10px;
  }
  .stats-grid,
  .achievements-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 700px) {
  #app {
    padding: 0 16px;
  }
  .topbar {
    height: 72px;
  }
  .utilities {
    gap: 5px;
  }
  .icon-button {
    width: 37px;
    height: 37px;
    border-radius: 10px;
  }
  .brand {
    font-size: 10px;
    gap: 7px;
  }
  .brand .dim {
    font-size: 8px;
  }
  .brand-badge {
    width: 32px;
    height: 34px;
    font-size: 16px;
  }
  .home-hero {
    grid-template-columns: 1fr;
    padding: 30px 0 24px;
    gap: 0;
  }
  .hero-copy {
    position: relative;
    z-index: 2;
  }
  .hero-copy p {
    font-size: 13px;
    max-width: 300px;
  }
  .hero-art {
    display: none;
  }
  .title-logo {
    max-width: 400px;
    margin-bottom: 15px;
  }
  .hero-copy .eyebrow {
    font-size: 8px;
    margin-bottom: 15px;
  }
  .hero-actions {
    margin-top: 20px;
  }
  .hero-actions .button {
    flex: 1;
    min-width: 0;
  }
  .hero-note {
    font-size: 9px;
  }
  .mode-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .mode-card {
    min-height: 125px;
    padding: 16px;
  }
  .mode-card h3 {
    font-size: 12px;
  }
  .mode-card p {
    font-size: 10px;
  }
  .daily-banner {
    grid-template-columns: 1fr auto;
    padding: 16px;
    gap: 12px;
  }
  .daily-icon {
    display: none;
  }
  .daily-banner p {
    font-size: 10px;
  }
  .daily-banner .button {
    padding: 10px;
    min-height: 44px;
  }
  .daily-banner h3 {
    font-size: 12px;
  }
  .home-bottom {
    gap: 8px;
    flex-wrap: wrap;
  }
  .home-bottom button {
    font-size: 10px;
  }
  .home-bottom .saved-hint {
    display: none;
  }
  footer {
    flex-wrap: wrap;
    font-size: 8px;
    padding: 17px 0;
    min-height: 65px;
    gap: 10px;
  }
  #watermark,
  .footer-extra {
    display: none;
  }
  .screen-head h1 {
    font-size: 20px;
  }
  .screen-head {
    padding-top: 20px;
  }
  .setup {
    margin: 0 auto 25px;
    padding: 22px;
  }
  .hud-cell {
    padding: 11px 8px;
  }
  .hud-label {
    font-size: 7px;
    letter-spacing: 0.6px;
  }
  .hud-value {
    font-size: 17px;
  }
  .game-head {
    padding: 17px 0 13px;
  }
  .game-head h1 {
    font-size: 15px;
  }
  .arena {
    min-height: 195px;
  }
  .target {
    font-size: 86px;
    min-height: 99px;
  }
  .target.sequence {
    font-size: 28px;
    letter-spacing: 5px;
  }
  .keyboard {
    gap: 5px;
  }
  .key-row {
    gap: 4px;
  }
  .letter-key {
    width: calc((100% - 36px) / 10);
    height: 45px;
    border-radius: 5px;
    font-size: 14px;
  }
  .progress-strip {
    gap: 4px;
    margin-bottom: 15px;
  }
  .progress-letter {
    width: 21px;
    height: 23px;
    font-size: 9px;
  }
  .play-tip {
    font-size: 9px;
  }
  .result {
    padding: 25px 16px;
    margin: 14px auto 25px;
  }
  .result-metrics strong {
    font-size: 19px;
  }
  .result-buttons .button {
    font-size: 12px;
    padding: 12px;
  }
  .result-score {
    letter-spacing: -2px;
  }
  .stats-grid,
  .achievements-grid {
    gap: 9px;
  }
  .achievement {
    padding: 15px 12px;
    gap: 10px;
  }
  .achievement h3 {
    font-size: 11px;
  }
  .achievement p {
    font-size: 9px;
  }
  .achievement svg {
    width: 20px;
  }
  .stat-card {
    padding: 17px;
  }
  .stat-card strong {
    font-size: 25px;
  }
  .battle-arena {
    gap: 8px;
  }
  .player-panel {
    padding: 14px 9px;
  }
  .player-panel .battle-letter {
    font-size: 65px;
  }
  .battle-pad {
    gap: 4px;
    flex-wrap: wrap;
  }
  .battle-key {
    flex-basis: calc(50% - 4px);
    height: 57px;
  }
  .battle-key:only-child {
    height: 68px;
  }
  .survival-arena {
    height: 235px;
  }
  .setting {
    font-size: 12px;
    gap: 8px;
  }
  .friend-banner {
    font-size: 11px;
  }
  .friend-banner .button {
    font-size: 10px;
    padding: 10px;
  }
  .header-label {
    display: none;
  }
}
@media (max-width: 360px) {
  #app {
    padding: 0 10px;
  }
  .brand [data-brand] {
    display: none;
  }
  .hero-actions .button {
    font-size: 12px;
  }
  .hero-note {
    gap: 12px;
  }
  .mode-card {
    padding: 14px 12px;
  }
  .hud-cell {
    padding: 10px 5px;
  }
  .hud-value {
    font-size: 15px;
  }
  .letter-key {
    font-size: 12px;
  }
  .arena {
    min-height: 180px;
  }
  .progress-letter {
    width: 18px;
    height: 21px;
  }
  .result-metrics {
    gap: 6px;
  }
  .achievement {
    flex-direction: column;
    align-items: flex-start;
  }
  .segments button {
    font-size: 10px;
    padding: 10px 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}

@media (max-width: 480px) {
  .keyboard {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
  }
  .key-row {
    display: contents;
  }
  .letter-key {
    width: 100%;
    max-width: none;
    min-height: 44px;
  }
  .target {
    font-size: 72px;
    min-height: 82px;
  }
  .arena {
    min-height: 165px;
  }
  .survival-arena {
    height: 220px;
  }
  .section-heading span {
    max-width: 125px;
    text-align: right;
    line-height: 1.5;
  }
}

.brandless [data-brand],
.brandless .brand-badge,
.brandless #loader img,
.brandless #loader .eyebrow,
.brandless #watermark {
  display: none !important;
}
.linkless [data-external],
.linkless #loader a {
  display: none !important;
}
@media (max-width: 700px) {
  .icon-button {
    width: 44px;
    height: 44px;
  }
  .topbar {
    gap: 10px;
  }
  .utilities {
    gap: 4px;
  }
}

.brandless .brand:after {
  content: "⌂";
  font-size: 28px;
  color: var(--lime);
}
@media (max-width: 480px) {
  .playing .topbar,
  .playing footer {
    display: none;
  }
  .playing .game-head {
    padding: 12px 0;
  }
  .playing .game-head .game-actions .icon-button {
    width: 44px;
    height: 44px;
  }
  .playing .arena:not(.survival-arena) {
    min-height: 125px;
  }
  .playing .play-tip {
    font-size: 8px;
  }
  .playing .hud-cell {
    padding: 10px 7px;
  }
}

.mobile-fullscreen {
  display: none;
}
@media (max-width: 480px) {
  .mobile-fullscreen {
    display: grid;
  }
  .playing .game-head h1 {
    font-size: 13px;
  }
  .playing .game-head .eyebrow {
    font-size: 7px;
    letter-spacing: 0.8px;
  }
  .playing .game-head .game-actions {
    gap: 5px;
  }
}

/* Studio navigation and presentation, revision 1.1. */
.topbar {
  height: auto;
  min-height: 94px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  column-gap: 22px;
  row-gap: 10px;
  padding: 18px 0;
  position: relative;
  z-index: 5;
}
.header-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--muted);
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 9px;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}
.nav-link [data-nav-icon] {
  height: 17px;
  display: flex;
  align-items: center;
}
.nav-link svg {
  width: 17px;
  height: 17px;
}
.nav-link:hover {
  color: var(--ink);
  background: #ffffff06;
  border-color: var(--line);
}
.nav-link.active {
  color: var(--lime);
  background: #c2ff670b;
  border-color: #c2ff6728;
}
.nav-count {
  background: #c2ff6719;
  border-radius: 5px;
  min-width: 18px;
  padding: 3px;
  font-size: 9px;
  color: var(--lime);
}
.player-ribbon {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 14px 0 27px;
  color: var(--muted);
  font-size: 10px;
}
.player-ribbon > span {
  display: flex;
  gap: 7px;
  align-items: center;
}
.player-ribbon svg {
  width: 15px;
  height: 15px;
  color: var(--purple);
}
.player-ribbon b {
  color: var(--ink);
}
.mode-card {
  border-color: #ffffff10;
  box-shadow: 0 5px 15px #00000012;
  transition:
    transform 0.18s,
    border-color 0.18s,
    background 0.18s;
}
.mode-card:hover {
  box-shadow: 0 7px 24px #0003;
}
.mode-card .mode-icon {
  width: 39px;
  height: 39px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}
.hero-art {
  background: radial-gradient(ellipse at center, #b19cff0d, transparent 65%);
}
.keycap {
  animation: key-float 5s ease-in-out infinite;
}
.keycap.b {
  animation-delay: -1.4s;
}
.keycap.c {
  animation-delay: -2.8s;
}
@keyframes key-float {
  50% {
    translate: 0 -9px;
  }
}
.orbit {
  border-style: dashed;
}
.hero-copy p b {
  font-weight: 800;
}
.hero-actions .primary {
  box-shadow:
    0 4px 0 #759a3c,
    0 8px 25px #c2ff6715;
}
.arena {
  box-shadow: inset 0 0 45px #0000001a;
}
.target {
  font-variant-numeric: tabular-nums;
}
.result {
  border-color: #c2ff672b;
  box-shadow: 0 18px 65px #0002;
}
.result-medal {
  transform: rotate(-6deg);
  box-shadow: 0 0 35px #c2ff670b;
}
.result-medal svg {
  transform: rotate(6deg);
}
.mode-picker {
  display: grid;
  gap: 9px;
}
.mode-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  text-align: left;
  background: #141620;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px;
  color: var(--ink);
}
.mode-choice:hover {
  border-color: var(--accent);
  background: #252735;
}
.mode-choice > svg {
  margin-left: auto;
  color: var(--muted);
  width: 16px;
}
.choice-icon {
  display: grid;
  place-items: center;
  width: 41px;
  height: 41px;
  flex-shrink: 0;
  border-radius: 11px;
  color: var(--accent);
  background: #ffffff05;
}
.mode-choice b {
  font-size: 13px;
}
.mode-choice small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.6;
}
.collection-dialog {
  width: min(850px, calc(100% - 24px));
}
.collection-dialog .stats-grid,
.collection-dialog .achievements-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.collection-dialog .screen-head {
  display: none;
}
.collection-dialog .stat-card strong {
  font-size: 25px;
}
.collection-dialog .button.wide {
  position: sticky;
  bottom: 0;
  box-shadow: 0 -6px 15px #1a1c28;
}
.achievement-overview {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 24px;
  border: 1px solid #c2ff6730;
  background: linear-gradient(115deg, #28301f, #1a1c28);
  border-radius: 16px;
  margin: 0 0 20px;
}
.achievement-overview span {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--lime);
  letter-spacing: 1px;
}
.achievement-overview strong {
  font-size: 13px;
}
.achievement-overview progress {
  grid-column: 1/-1;
  width: 100%;
  height: 9px;
  accent-color: var(--lime);
}
.pause-summary {
  display: grid;
  gap: 13px;
  text-align: center;
  padding: 15px 0 26px;
}
.pause-summary strong {
  font-size: 47px;
  line-height: 1;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}
.pause-summary small {
  font-size: 13px;
}
.pause-summary > span:last-child {
  font-size: 12px;
  color: var(--muted);
}
.ad-active #app,
.ad-active #modal {
  pointer-events: none;
}
.large .nav-link {
  font-size: 12px;
}
.large .header-nav {
  flex-wrap: wrap;
}
@media (max-width: 1200px) {
  .topbar {
    grid-template-columns: 1fr auto;
    column-gap: 15px;
    min-height: 0;
    padding: 14px 0 12px;
  }
  .header-nav {
    grid-row: 2;
    grid-column: 1/-1;
    justify-content: space-between;
  }
  .utilities {
    grid-column: 2;
    grid-row: 1;
  }
  .nav-link {
    flex: 1;
    font-size: 11px;
    padding: 9px 7px;
  }
  .home-hero {
    padding-top: 30px;
  }
}
@media (max-width: 700px) {
  .topbar,
  .playing .topbar {
    display: grid;
    padding: 10px 0 12px;
    row-gap: 8px;
  }
  .header-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }
  .nav-link {
    font-size: 10px;
    min-height: 44px;
    gap: 5px;
    padding: 8px 3px;
    background: #ffffff02;
    border-color: #ffffff08;
  }
  .nav-count {
    display: none;
  }
  .player-ribbon {
    gap: 10px;
    flex-wrap: wrap;
    font-size: 9px;
    padding: 9px 0 20px;
  }
  .home-hero {
    padding-top: 24px;
  }
  .collection-dialog #modal-content {
    padding: 18px;
  }
  .collection-dialog .stat-card {
    padding: 12px;
  }
  .collection-dialog .stat-card strong {
    font-size: 20px;
  }
  .achievement-overview {
    padding: 16px;
    gap: 12px;
  }
  .achievement-overview span {
    font-size: 9px;
  }
  .achievement-overview strong {
    font-size: 11px;
  }
}
@media (max-width: 480px) {
  .playing .topbar {
    display: grid;
  }
  .playing .brand,
  .playing .utilities {
    display: none;
  }
  .playing .header-nav {
    grid-row: 1;
  }
  .playing .game-head {
    padding-top: 10px;
  }
  .playing .topbar {
    padding-top: 7px;
    padding-bottom: 7px;
  }
  .mobile-fullscreen {
    display: grid;
  }
  .collection-dialog .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .collection-dialog .achievements-grid {
    grid-template-columns: 1fr;
  }
  .achievement-overview {
    grid-template-columns: 1fr;
  }
  .achievement-overview progress {
    grid-column: 1;
  }
  .nav-link svg {
    width: 15px;
    height: 15px;
  }
  .keycap {
    animation: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .keycap {
    animation: none;
  }
}

/* Keep the target and full-size keys close together on short phones. */
@media (max-width: 480px) and (max-height: 740px) {
  .playing .topbar {
    padding: 4px 0;
  }
  .playing .header-nav {
    gap: 3px;
  }
  .playing .game-head {
    padding: 6px 0;
  }
  .playing .game-head .eyebrow {
    display: none;
  }
  .playing .hud {
    margin-bottom: 7px;
  }
  .playing .hud-cell {
    padding: 8px 5px;
  }
  .playing .hud-value {
    font-size: 15px;
  }
  .playing .arena:not(.survival-arena) {
    min-height: 78px;
    padding: 6px;
    margin-bottom: 7px;
  }
  .playing .target {
    font-size: 49px;
    min-height: 55px;
    line-height: 1.1;
  }
  .playing .target.sequence {
    font-size: 24px;
    letter-spacing: 4px;
  }
  .playing .prompt-label {
    font-size: 8px;
    margin-bottom: 2px;
  }
  .playing .progress-strip,
  .playing .feedback,
  .playing .play-tip {
    display: none;
  }
  .playing .power-strip {
    min-height: 14px;
    font-size: 9px;
    margin-bottom: 4px;
  }
  .playing .keyboard {
    padding-bottom: 7px;
    gap: 4px;
  }
  .playing .letter-key {
    height: 44px;
  }
  .playing .survival-arena {
    height: 185px;
  }
}

/* Fallback for embedded browsers that lack HTMLDialogElement.showModal(). */
dialog.dialog-fallback-open[open] {
  position: fixed; inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  z-index: 10000; display: block; max-height: 88vh; overflow: auto;
}
dialog.dialog-fallback-open[open]::backdrop { background: rgba(0,0,0,.72); }


/* =========================================================
   ALPHABET BATTLE — RESPONSIVE GAME / IFRAME FIX
   Desktop target: 16:9 (1280×720)
   Mobile: fluid width + vertical scrolling when required
========================================================= */

html {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
}

body {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

#app {
  width: 100%;
  max-width: 1440px;
  min-width: 0;
  margin: 0 auto;
  padding-left: clamp(12px, 3vw, 42px);
  padding-right: clamp(12px, 3vw, 42px);
}

/* Prevent wide children from forcing horizontal iframe scrolling. */
main,
.topbar,
.home-hero,
.hero-copy,
.hero-art,
.mode-grid,
.daily-banner,
.setup,
.game-head,
.hud,
.arena,
.keyboard,
.battle-arena,
.player-panel,
.result,
.stats-grid,
.achievements-grid,
footer {
  min-width: 0;
  max-width: 100%;
}

/* Images/media must never exceed the embedded viewport. */
img,
canvas,
video {
  max-width: 100%;
}

/* =========================================================
   SHORT DESKTOP / LAPTOP IFRAMES
   Optimized for a normal 16:9 player such as 1280×720.
========================================================= */

@media (min-width: 701px) and (max-height: 800px) {
  .topbar {
    height: auto;
    min-height: 58px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  main {
    min-height: 0;
  }

  .home-hero {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    gap: clamp(14px, 2.5vw, 30px);
    padding: 14px 0 12px;
  }

  .hero-copy .eyebrow {
    margin-bottom: 8px;
  }

  .title-logo {
    width: min(100%, 390px);
    margin-bottom: 8px;
  }

  .hero-copy p {
    max-width: 430px;
    font-size: 12px;
    line-height: 1.45;
  }

  .hero-actions {
    margin-top: 11px;
    gap: 8px;
  }

  .hero-actions .button {
    min-width: 125px;
    min-height: 42px;
    height: 42px;
    padding: 8px 14px;
    font-size: 11px;
  }

  .hero-note {
    margin-top: 7px;
    font-size: 8px;
    gap: 12px;
  }

  .hero-art {
    height: 176px;
    transform: scale(0.78);
    transform-origin: center center;
  }

  .orbit {
    width: 215px;
    height: 215px;
  }

  .orbit:nth-child(2),
  .orbit:nth-child(3) {
    width: 290px;
    height: 165px;
  }

  .keycap {
    width: 92px;
    height: 102px;
    border-radius: 17px;
    font-size: 64px;
  }

  .keycap.a {
    top: 22px;
  }

  .keycap.b {
    top: 0;
  }

  .keycap.c {
    top: 62px;
  }

  .speed-tag {
    bottom: 3px;
    padding: 6px 9px;
    font-size: 9px;
  }

  .section-heading {
    margin-bottom: 7px;
  }

  .section-heading h2 {
    font-size: 11px;
  }

  .section-heading span {
    font-size: 8px;
  }

  .mode-grid {
    gap: 8px;
  }

  .mode-card {
    min-height: 88px;
    padding: 9px 11px;
    border-radius: 11px;
  }

  .mode-card .mode-icon {
    width: 27px;
    height: 27px;
    margin-bottom: 5px;
    font-size: 17px;
  }

  .mode-card h3 {
    margin-bottom: 2px;
    font-size: 11px;
  }

  .mode-card p {
    font-size: 8px;
    line-height: 1.25;
  }

  .mode-card .card-arrow {
    top: 10px;
    right: 9px;
  }

  .mode-card .tag {
    right: 7px;
    bottom: 6px;
    font-size: 7px;
  }

  .daily-banner {
    gap: 12px;
    margin: 9px 0;
    padding: 10px 14px;
  }

  .daily-icon {
    width: 36px;
    height: 36px;
  }

  .daily-banner h3 {
    font-size: 11px;
  }

  .daily-banner p {
    font-size: 9px;
  }

  .daily-banner .button {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 9px;
  }

  .home-bottom {
    padding-bottom: 8px;
  }

  footer {
    min-height: 42px;
  }

  /* Active gameplay: reduce vertical waste without removing controls. */
  .playing .game-head {
    padding: 8px 0 7px;
  }

  .playing .hud {
    margin-bottom: 8px;
  }

  .playing .hud-cell {
    padding: 8px 10px;
  }

  .playing .hud-value {
    font-size: 18px;
  }

  .playing .arena:not(.survival-arena) {
    min-height: 150px;
    margin-bottom: 8px;
    padding: 10px;
  }

  .playing .target {
    min-height: 88px;
    font-size: 76px;
  }

  .playing .progress-strip {
    margin-bottom: 9px;
  }

  .playing .keyboard {
    gap: 5px;
    padding-bottom: 8px;
  }

  .playing .key-row {
    gap: 5px;
  }

  .playing .letter-key {
    height: 40px;
  }

  .playing .play-tip {
    margin-bottom: 8px;
  }
}

/* Very short desktop iframe: keep it usable and let the game scroll vertically. */
@media (min-width: 701px) and (max-height: 620px) {
  body {
    overflow-y: auto;
  }

  .topbar {
    min-height: 50px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .home-hero {
    padding-top: 8px;
    padding-bottom: 7px;
  }

  .title-logo {
    width: min(100%, 330px);
  }

  .hero-copy p {
    font-size: 11px;
    line-height: 1.35;
  }

  .hero-art {
    height: 135px;
    transform: scale(0.67);
  }

  .hero-actions {
    margin-top: 7px;
  }

  .hero-note {
    display: none;
  }

  .mode-card {
    min-height: 72px;
    padding: 7px 9px;
  }

  .mode-card p {
    display: none;
  }

  .daily-banner {
    margin: 6px 0;
    padding: 8px 12px;
  }
}

/* =========================================================
   TABLETS / MOBILE
========================================================= */

@media (max-width: 700px) {
  html,
  body {
    width: 100%;
    min-width: 0;
    min-height: 100%;
  }

  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  #app {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding-left: 12px;
    padding-right: 12px;
  }

  .topbar,
  .playing .topbar {
    width: 100%;
    height: auto;
    min-height: 0;
  }

  .header-nav {
    width: 100%;
    min-width: 0;
  }

  .nav-link {
    min-width: 0;
    white-space: normal;
    line-height: 1.15;
  }

  .home-hero {
    display: block;
    width: 100%;
    padding: 18px 0 14px;
  }

  .hero-copy {
    width: 100%;
  }

  .hero-art {
    display: none !important;
  }

  .title-logo {
    width: 100%;
    max-width: 360px;
    height: auto;
    margin-bottom: 10px;
  }

  .hero-copy p {
    width: 100%;
    max-width: none;
    font-size: 12px;
    line-height: 1.5;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
    margin-top: 14px;
  }

  .hero-actions .button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    height: auto;
    padding: 10px 8px;
  }

  .hero-note {
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 10px;
  }

  .section-heading {
    align-items: flex-start;
  }

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

  .mode-card {
    width: 100%;
    min-width: 0;
    min-height: 112px;
    padding: 13px 11px;
  }

  .mode-card p {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .daily-banner {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin: 12px 0;
    padding: 12px;
  }

  .daily-banner > * {
    min-width: 0;
  }

  .daily-banner p {
    overflow-wrap: anywhere;
  }

  .screen-head {
    width: 100%;
    padding: 14px 0 12px;
  }

  .screen-head .right {
    min-width: 0;
  }

  .setup {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 20px;
    padding: 18px 14px;
  }

  .segments {
    width: 100%;
  }

  .segments button {
    min-width: 90px;
  }

  .game-head {
    width: 100%;
    padding: 10px 0 8px;
  }

  .game-head .game-actions {
    flex-shrink: 0;
  }

  .hud {
    width: 100%;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .hud-cell {
    min-width: 0;
    padding: 8px 4px;
    text-align: center;
  }

  .hud-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hud-value {
    font-size: clamp(13px, 4.2vw, 18px);
  }

  .arena {
    width: 100%;
    min-height: 150px;
    padding: 10px;
  }

  .target {
    max-width: 100%;
    min-height: 75px;
    font-size: clamp(54px, 22vw, 82px);
  }

  .target.sequence {
    font-size: clamp(20px, 7vw, 30px);
    letter-spacing: clamp(2px, 1vw, 5px);
  }

  .progress-strip {
    width: 100%;
    gap: 3px;
  }

  .progress-letter {
    width: clamp(18px, 6vw, 24px);
    height: clamp(20px, 6.5vw, 26px);
  }

  .keyboard {
    width: 100%;
    max-width: 100%;
  }

  .key-row {
    width: 100%;
  }

  .letter-key {
    min-width: 0;
  }

  .battle-arena {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .player-panel {
    width: 100%;
    min-width: 0;
  }

  .player-panel .battle-letter {
    font-size: clamp(50px, 18vw, 68px);
  }

  .battle-pad {
    width: 100%;
  }

  .battle-key {
    min-width: 0;
  }

  .friend-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .friend-banner .button {
    width: 100%;
  }

  .result {
    width: 100%;
    max-width: 100%;
    margin: 12px auto 20px;
    padding: 20px 12px;
  }

  .result-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .result-buttons {
    width: 100%;
  }

  .result-buttons .button {
    flex: 1 1 140px;
  }

  .stats-grid,
  .achievements-grid {
    grid-template-columns: 1fr;
  }

  .setting {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  footer {
    width: 100%;
    min-height: 0;
    padding: 12px 0;
  }
}

/* =========================================================
   SMALL PHONES
========================================================= */

@media (max-width: 480px) {
  #app {
    padding-left: 8px;
    padding-right: 8px;
  }

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

  .nav-link {
    min-height: 40px;
    padding: 6px 2px;
    font-size: 9px;
  }

  .hero-actions {
    grid-template-columns: 1fr;
  }

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

  .mode-card {
    min-height: 0;
    padding: 12px;
  }

  .daily-banner {
    grid-template-columns: 1fr;
  }

  .daily-banner .button {
    width: 100%;
  }

  .hud {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .hud-label {
    font-size: 6px;
    letter-spacing: 0;
  }

  .hud-value {
    font-size: 13px;
  }

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

  .key-row {
    display: contents;
  }

  .letter-key {
    width: 100%;
    max-width: none;
    height: 42px;
    min-height: 42px;
    padding: 0;
    font-size: 13px;
  }

  .result-metrics {
    gap: 5px;
  }

  .result-metrics div {
    padding: 10px 3px;
  }

  .result-metrics strong {
    font-size: 17px;
  }

  dialog {
    width: calc(100% - 16px);
    max-height: 90svh;
  }

  #modal-content {
    padding: 16px;
  }
}

/* Narrow phones including 320–360px. */
@media (max-width: 360px) {
  #app {
    padding-left: 6px;
    padding-right: 6px;
  }

  .brand [data-brand] {
    display: none;
  }

  .nav-link {
    font-size: 8px;
  }

  .mode-card {
    padding: 10px;
  }

  .hud-cell {
    padding-left: 2px;
    padding-right: 2px;
  }

  .hud-value {
    font-size: 12px;
  }

  .progress-letter {
    width: 18px;
    height: 20px;
    font-size: 8px;
  }
}

/* =========================================================
   SHORT MOBILE SCREENS
   Keep controls visible; allow vertical scroll if needed.
========================================================= */

@media (max-width: 700px) and (max-height: 740px) {
  body {
    overflow-y: auto;
  }

  .playing .topbar {
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .playing .game-head {
    padding: 5px 0;
  }

  .playing .game-head .eyebrow {
    display: none;
  }

  .playing .hud {
    margin-bottom: 6px;
  }

  .playing .hud-cell {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .playing .arena:not(.survival-arena) {
    min-height: 85px;
    padding: 6px;
    margin-bottom: 6px;
  }

  .playing .target {
    min-height: 52px;
    font-size: 48px;
    line-height: 1.08;
  }

  .playing .prompt-label {
    margin-bottom: 2px;
  }

  .playing .feedback {
    height: auto;
    min-height: 16px;
    margin-top: 2px;
  }

  .playing .progress-strip {
    margin-bottom: 6px;
  }

  .playing .keyboard {
    gap: 3px;
    padding-bottom: 5px;
  }

  .playing .letter-key {
    height: 40px;
    min-height: 40px;
  }

  .playing .play-tip {
    margin-bottom: 5px;
  }