:root {
  color-scheme: light;
  font-family: system-ui, 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  color: #332040;
  background: #f7f3fa;
  --ink: #332040;
  --muted: #644f70;
  --plum: #58327d;
  --lilac: #ebdff8;
  --line: #dfd1eb;
  --white: #fffcf7;
  --yellow: #ffef9c;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #7841aa; outline-offset: 3px; }
p, h1, h2 { margin: 0; }
.shell { width: min(100% - 40px, 1080px); margin-inline: auto; }
.masthead { display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-size: 21px; font-weight: 850; letter-spacing: -.055em; }
.brand img { border-radius: 12px; }
.brand small { font-size: 10px; font-weight: 800; letter-spacing: .04em; margin-left: 2px; color: var(--muted); }
.hero { position: relative; min-height: 180px; padding: 26px 41px; display: grid; align-items: center; grid-template-columns: 1fr auto; gap: 24px; border: 1px solid #e0caef; border-radius: 28px; background: #ebdef8; }
.hero h1 { font-size: clamp(40px, 7vw, 70px); line-height: 1.1; font-weight: 900; letter-spacing: -.08em; }
.hero h1 span { color: #71419b; }
.hero p { margin-top: 12px; color: #523763; font-size: clamp(13px, 2vw, 18px); font-weight: 670; word-break: keep-all; }
.hero-cat { display: block; width: clamp(82px, 16vw, 150px); height: auto; margin-right: 9px; border-radius: 28px; transform: rotate(5deg); }
.lobby-grid, .game-grid { display: grid; grid-template-columns: minmax(0, 1fr) 265px; gap: 18px; align-items: start; }
.lobby-grid { margin-top: 18px; }
.modes { display: grid; gap: 16px; }
.modes h2 { margin-bottom: 8px; padding-left: 2px; font-size: 18px; letter-spacing: -.04em; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.mode { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; min-height: 89px; padding: 12px; text-align: left; border: 1px solid #e1d3e9; border-radius: 20px; background: #fffcf7; box-shadow: 0 3px 0 #e7d9eb; }
.mode:hover { border-color: #a47aba; }
.mode:active { translate: 0 2px; box-shadow: 0 1px 0 #e7d9eb; }
.mode-icon { display: grid; place-items: center; width: 40px; height: 42px; border-radius: 13px; font-weight: 800; font-size: 23px; background: #f6e9ff; color: #593880; }
.timed .mode-icon { background: #fff0a8; color: #644921; }
.cpu .mode-icon { background: #e4f1d9; color: #3d602c; }
.friend .mode-icon { background: #ffe5eb; color: #7d3756; }
.missing .mode-icon { background: #e3eaff; color: #4b568b; }
.speed .mode-icon { background: #ffefd4; color: #764822; }
.air .mode-icon { background: #e6defa; color: #60458e; }
.mode.air { grid-column: 1 / -1; }
.mode strong, .mode small { display: block; word-break: keep-all; }
.mode strong { font-size: 17px; letter-spacing: -.05em; }
.mode small { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.arrow { font-size: 24px; color: #755788; }
.panel { padding: 16px; background: #fffcf7; border: 1px solid var(--line); border-radius: 21px; }
.panel h2 { font-size: 17px; letter-spacing: -.045em; }
fieldset { min-width: 0; border: 0; margin: 12px 0 0; padding: 0; }
legend { margin-bottom: 4px; padding: 0; color: var(--muted); font-size: 12px; font-weight: 720; }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 3px; border-radius: 12px; background: #f1e9f7; }
.segmented button { min-height: 44px; padding: 3px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #563b66; font-size: 13px; font-weight: 720; }
.segmented button[aria-pressed='true'] { border-color: #dfa93c; background: #fff0ab; color: #452e37; }
.button { min-height: 44px; padding: 7px 14px; border: 1px solid #d9c5e6; border-radius: 13px; font-weight: 800; font-size: 14px; }
.button:disabled { opacity: .66; }
.light { background: #eee2f8; }
.primary { background: var(--yellow); border-color: #e4be65; box-shadow: 0 2px 0 #d4ac5b; }
.button:hover:not(:disabled) { border-color: #8b63a3; }
.room { max-width: 750px; margin-inline: auto; padding: clamp(16px, 4vw, 30px); }
.room h1, .play-head h1 { letter-spacing: -.06em; }
.room-grid { margin: 20px 0 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.room-grid > * { border: 1px solid var(--line); border-radius: 17px; padding: 14px; background: #f8f0fe; }
.room label, .room p { display: block; color: var(--muted); margin: 6px 0 10px; font-size: 14px; line-height: 1.55; }
.join-row, .room-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.join-row input { width: 104px; height: 44px; padding-inline: 7px; border: 1px solid #a98dbb; border-radius: 10px; background: white; text-transform: uppercase; font-weight: 850; letter-spacing: .08em; }
.room-code { display: block; margin: 6px 0 16px; color: var(--plum); font-family: ui-monospace, monospace; font-size: clamp(30px, 10vw, 55px); letter-spacing: .12em; }
.room-status:empty { display: none; }
.room-status[data-error='true'] { color: #88294b; }
.players { max-width: 265px; }
.speed-actions { margin-top: 12px; }
.play-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin: 2px 0 12px; }
.scores { display: flex; align-items: stretch; flex-wrap: wrap; gap: 6px; }
.score { min-width: 64px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 12px; text-align: center; background: #fffcf7; }
.score:nth-child(even) { background: #eee2f8; }
.score span { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }
.score strong { display: block; line-height: 1.2; font-size: 21px; font-weight: 850; font-variant-numeric: tabular-nums; }
.score[data-alert='true'] { background: #ffe6e8; border-color: #ca91a4; }
.arena { padding: 16px 20px 0; min-width: 0; border: 1px solid #dfcbec; border-radius: 24px; background: #f0e6fa; }
.arena-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.problem-type { color: #563a70; font-size: 12px; font-weight: 780; }
.round { font-size: 12px; font-weight: 810; color: #53346c; }
.progress { margin-top: 7px; height: 6px; border-radius: 6px; overflow: hidden; background: #e1d0ee; }
.progress i { display: block; background: #9a69be; height: 100%; width: 10%; }
.equation { text-align: center; font-size: clamp(27px, 6vw, 61px); font-weight: 900; line-height: 1.16; letter-spacing: -.07em; white-space: nowrap; margin: 18px 0 3px; }
.equation .sign { color: #75548d; font-weight: 800; }
.equation .blank { color: #734699; }
.equation .gap { display: inline-grid; place-items: center; width: 1ch; border-bottom: 3px solid #9266b1; border-radius: .14em; color: #674289; background: #fff3bb; }
.equation .gap.filled { color: #315c3e; background: #def2ce; border-color: #5c9463; }
.equation.vertical { display: grid; justify-content: center; gap: 3px; width: max-content; margin-inline: auto; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: clamp(24px, 5vw, 41px); letter-spacing: 0; text-align: center; }
.math-row { display: grid; grid-template-columns: repeat(5, 1.03ch); justify-content: end; gap: 2px; line-height: 1.15; }
.math-row:last-child { border-top: 2px solid #725782; padding-top: 3px; }
.equation.compare { font-size: clamp(25px, 5vw, 48px); white-space: normal; }
.equation.combo { display: flex; align-items: center; justify-content: center; gap: clamp(3px, 1.5vw, 13px); font-size: clamp(23px, 6vw, 55px); letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.math-slot { min-width: 2.1em; min-height: 1.28em; display: inline-grid; place-items: center; border: 1px dashed #a984c2; border-radius: .26em; color: #674386; background: #faf4ff; }
.math-slot[data-loaded] { background: #fff4bc; border: 1px solid #c8a85e; color: #4d3652; }
.equation .target { padding: .13em .20em; border-radius: .23em; color: #543273; background: #e5d5f8; }
.equation .target.complete { background: #def2ce; color: #315c3e; }
.field { position: relative; min-height: 240px; display: grid; align-items: center; padding: 15px 3% 18px; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-items: center; gap: 13px 17px; }
.choices[data-combo='true'] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice { display: flex; justify-content: center; align-items: center; gap: 8px; min-width: 0; width: min(100%, 228px); min-height: 77px; padding: 5px 8px; border: 1px solid #c9aed9; border-radius: 17px; background: #fff0a8; color: #392348; box-shadow: 0 4px 0 #d6bedf; }
.choice:nth-child(2) { background: #e6f0da; }
.choice:nth-child(3) { background: #fbf3ff; }
.choice:nth-child(4) { background: #ffe6ed; }
.choices[data-compare='true'] .choice { min-height: 112px; width: min(100%, 284px); flex-direction: column; }
.choice:hover:not(:disabled) { outline: 3px solid #8851a8; outline-offset: 2px; }
.choice.selected { outline: 3px solid #8851a8; outline-offset: 1px; background: #eee1ff; }
.choice.hinted { outline: 3px dashed #73439c; outline-offset: 1px; }
.choice .number { font-size: clamp(24px, 5vw, 43px); font-weight: 900; line-height: 1.1; letter-spacing: -.065em; font-variant-numeric: tabular-nums; }
.choice .key { align-self: center; background: #42205013; border-radius: 6px; padding: 2px 4px; min-width: 18px; min-height: 17px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.choice.correct { outline: 3px solid #498054; background: #def2ce; }
.choice.wrong { background: #f3d7dc; text-decoration: line-through; }
.choice.missed { opacity: .65; }
.next { justify-self: center; margin-top: 9px; }
.combo-hint { justify-self: center; margin-top: 9px; }
.route { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 9px; margin-top: 9px; border: 1px solid #ddc5ee; border-radius: 11px; background: #faf2ff; color: #563a70; font-size: 13px; font-weight: 800; }
.fuel { display: flex; gap: 4px; }
.fuel i { width: 13px; height: 13px; border-radius: 4px; border: 1px solid #ac88c2; background: #e4d1f1; }
.fuel .filled { border-color: #a77521; background: #ffe17e; }
.air-dock { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 7px; margin-top: 12px; padding: 6px 12px 12px; border: 2px solid #7b57a5; border-radius: 16px 16px 28px 28px; background: #e7d8fc; }
.air-dock-label { grid-column: 1 / -1; text-align: center; font-weight: 850; color: #583982; font-size: 13px; }
.air-rocket { display: inline-block; }
.drop-pad { display: grid; place-items: center; min-height: 69px; padding: 4px; border: 2px dashed #976db9; border-radius: 12px; background: #fcf4ff; color: #674382; font-size: 14px; font-weight: 800; }
.drop-pad.loaded { border-style: solid; border-color: #ac8a3a; background: #ffeeb2; font-size: 24px; }
.drop-pad.landing { outline: 3px solid #73479b; outline-offset: 2px; background: #fff2ac; }
.air-sign { font-weight: 900; }
.air-dock.launched { color: #27533a; border-color: #6b9869; background: #dcefd2; }
.air-dock.launched .air-rocket { animation: lift-off 640ms ease-out both; }
@keyframes lift-off { from { transform: translate(0); opacity: 1; } 45% { opacity: 1; } to { transform: translate(32px, -28px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .air-dock.launched .air-rocket { animation: none; } }
.air-cursor, .air-carried { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 3; }
.air-cursor { width: 22px; height: 22px; margin: -11px; border-radius: 50%; background: #ffe091; border: 2px solid #57307c; box-shadow: 0 0 0 2px white; }
.air-cursor.pinched { scale: .75; }
.air-carried { z-index: 4; padding: 3px 7px; margin: -29px 0 0 9px; border: 1px solid #975fb6; border-radius: 8px; background: #ffe793; color: #422454; font-weight: 900; box-shadow: 0 3px 0 #9072ac80; }
.result { grid-area: 1 / 1; text-align: center; display: grid; justify-items: center; gap: 9px; }
.result strong { font-size: clamp(35px, 7vw, 72px); font-weight: 900; line-height: 1.12; letter-spacing: -.06em; }
.result p { font-size: 14px; color: var(--muted); font-weight: 660; }
.arena-foot { margin-inline: -20px; min-height: 71px; padding: 10px 16px; border-radius: 0 0 23px 23px; border-top: 1px solid #ddc9ec; background: #fbf5ff; }
.feedback { font-size: 14px; line-height: 1.45; word-break: keep-all; }
.feedback strong { color: #4c315f; }
.feedback[data-tone='correct'] strong { color: #325b3e; }
.feedback[data-tone='retry'] strong { color: #872b4d; }
.feedback small { display: block; margin-top: 3px; color: #51425a; font-size: 13px; }
.support { display: grid; gap: 11px; min-width: 0; }
.guide p, .air-error { margin-top: 7px; color: #594368; font-size: 13px; line-height: 1.5; word-break: keep-all; }
#network-status { color: #852b4d; }
.air-camera { position: relative; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; padding: 7px 0 2px; }
.air-camera video { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); opacity: 0; pointer-events: none; }
.air-indicators { display: flex; gap: 6px; flex-wrap: wrap; }
.air-indicators span { border-radius: 8px; padding: 4px 6px; background: #e9d8f3; color: #55366d; font-size: 12px; font-weight: 800; }
.air-indicators [data-active='true'] { background: #e0eed3; color: #35593a; }
.air-error { color: #852b4d; }
footer { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 17px 0 21px; color: var(--muted); font-size: 12px; }
footer a { color: #5d347d; padding-block: 6px; }

@media (max-width: 785px) {
  .lobby-grid, .game-grid { grid-template-columns: minmax(0, 1fr) 215px; gap: 12px; }
  .mode { gap: 6px; padding: 8px; }
  .mode .arrow { display: none; }
  .mode-icon { width: 32px; height: 36px; }
}
@media (max-width: 620px) {
  .shell { width: calc(100% - 24px); }
  .masthead { min-height: 63px; }
  .hero { padding: 19px 13px 19px 17px; min-height: 138px; border-radius: 20px; gap: 4px; }
  .hero-cat { margin: 0; border-radius: 16px; }
  .lobby-grid, .game-grid { grid-template-columns: 1fr; }
  .mode { min-height: 74px; }
  .mode strong { font-size: 15px; }
  .mode small { font-size: 11px; }
  .modes { gap: 12px; }
  .settings { padding: 11px; }
  .play-head h1 { font-size: 24px; }
  .arena { padding-inline: 12px; }
  .arena-foot { margin-inline: -12px; min-height: 61px; padding: 8px 11px; }
  .field { min-height: 179px; padding-inline: 0; }
  .choices { gap: 11px; }
  .choice { min-height: 62px; gap: 4px; }
  .choices[data-combo='true'] { gap: 9px; }
  .choices[data-combo='true'] .choice { padding-inline: 2px; flex-direction: column-reverse; }
  .choices[data-combo='true'] .choice .number { font-size: clamp(21px, 6vw, 30px); }
  .equation { font-size: clamp(27px, 8vw, 48px); }
  .support { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .support .panel { padding: 9px; }
}
@media (max-width: 365px) {
  .brand small { display: none; }
  .room-grid { grid-template-columns: 1fr; }
  .choice .key { font-size: 9px; }
  .score { padding-inline: 6px; min-width: 50px; }
  .support { grid-template-columns: 1fr; }
}
