:root {
  --ink: #604478;
  --ink-soft: #86699e;
  --paper: #fff5fb;
  --paper-strong: #fffdfd;
  --mint: #79e3ba;
  --mint-dark: #42ae89;
  --coral: #ff8cad;
  --coral-dark: #d95582;
  --amber: #ffd166;
  --sky: #8fc8ff;
  --line: #f0cfe0;
  --line-strong: #d7abc5;
  --danger: #de5878;
  --success: #3eaf83;
  --shadow-lg: 0 24px 60px rgba(177, 116, 168, .18);
  --shadow-md: 0 12px 28px rgba(177, 116, 168, .14);
  --hero-start: #ad7be0;
  --hero-mid: #ff9dbc;
  --hero-end: #ffc86c;
  --hero-glow: rgba(121,227,186,.48);
  --hero-map: rgba(246,255,224,.42);
  --hero-map-line: rgba(255,255,255,.58);
  --primary-start: #ff8fad;
  --primary-mid: #ffa5bd;
  --primary-end: #ffc969;
  --dashboard-start: #a978d7;
  --dashboard-end: #8ebff3;
  --canvas-grid: rgba(192,119,180,.065);
  --canvas-spot-one: rgba(143,200,255,.30);
  --canvas-spot-two: rgba(255,140,173,.24);
  --shell-border: rgba(204,151,190,.40);
  --shell-bg: rgba(255,253,253,.82);
  --topbar-bg: rgba(255,255,255,.68);
  --surface-main: rgba(255,253,253,.93);
  --surface-soft: rgba(248,241,251,.84);
  --surface-mint: rgba(235,252,246,.86);
  --surface-pink: rgba(255,239,246,.74);
  --surface-lilac: rgba(244,237,251,.82);
  --input-bg: rgba(255,255,255,.94);
  --hero-ink: #fff;
  --hero-ink-soft: rgba(255,255,255,.90);
  --hero-kicker: #baffdf;
  --hero-highlight: #ffe18b;
  --dashboard-ink: #fff;
  --fullscreen-ink: #fff;
  --stat-ink: var(--ink);
  --action-ink: #fff;
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 17px;
  --font-sans: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --font-display: "Arial Rounded MT Bold", "Microsoft YaHei UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; background: var(--paper); }
body {
  margin: 0;
  min-width: 720px;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(var(--canvas-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--canvas-grid) 1px, transparent 1px),
    radial-gradient(circle at 15% 8%, var(--canvas-spot-one), transparent 30%),
    radial-gradient(circle at 88% 84%, var(--canvas-spot-two), transparent 28%),
    var(--paper);
  background-size: 34px 34px, 34px 34px, auto, auto, auto;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}
body.game-active { overflow: hidden; overscroll-behavior: none; }
body[data-theme="calm"] {
  --ink: #245d53; --ink-soft: #5d887f; --paper: #f7fff4; --paper-strong: #fefffb; --mint: #8eeac9; --mint-dark: #32ad93;
  --coral: #efa9a3; --coral-dark: #be6f71; --amber: #e7e160; --sky: #9bdcf8;
  --hero-start: #f1ffb8; --hero-mid: #c7f2cf; --hero-end: #9bdcf8; --hero-glow: rgba(255,255,255,.48); --hero-map: rgba(61,164,127,.28); --hero-map-line: rgba(255,255,255,.72);
  --primary-start: #35bca5; --primary-mid: #70d2aa; --primary-end: #dce061;
  --dashboard-start: #35bca5; --dashboard-end: #dce061;
  --canvas-grid: rgba(84,179,142,.06); --canvas-spot-one: rgba(210,255,157,.38); --canvas-spot-two: rgba(124,210,248,.29);
  --shell-border: rgba(143,211,174,.48); --shell-bg: rgba(253,255,252,.84); --topbar-bg: rgba(253,255,252,.77);
  --surface-main: rgba(254,255,251,.95); --surface-soft: rgba(241,255,245,.88); --surface-mint: rgba(226,255,239,.89); --surface-pink: rgba(237,250,255,.79); --surface-lilac: rgba(240,249,237,.86); --input-bg: rgba(255,255,255,.96);
  --hero-ink: #17473e; --hero-ink-soft: #3e7468; --hero-kicker: #137a67; --hero-highlight: #694a31; --dashboard-ink: #fff; --fullscreen-ink: #17473e; --action-ink: #fff;
}
body[data-theme="peach"] {
  --ink: #80485c; --ink-soft: #aa7181; --paper: #fff7f2; --paper-strong: #fffefd;
  --mint: #98dfc4; --mint-dark: #50ac8c; --coral: #ff9cab; --coral-dark: #cf657d; --amber: #ffd477; --sky: #a9d7ff;
  --line: #f1d4cf; --line-strong: #dcaeae; --danger: #d85773; --success: #43a882;
  --shadow-lg: 0 24px 60px rgba(221,133,130,.18); --shadow-md: 0 12px 28px rgba(221,133,130,.14);
  --hero-start: #ff9eaf; --hero-mid: #ffbea6; --hero-end: #ffe08a; --hero-glow: rgba(255,255,255,.4);
  --primary-start: #ff91aa; --primary-mid: #ffb09b; --primary-end: #ffd273;
  --dashboard-start: #ef8e9d; --dashboard-end: #ffbd91;
  --canvas-grid: rgba(211,143,134,.065); --canvas-spot-one: rgba(255,205,181,.36); --canvas-spot-two: rgba(255,165,188,.25);
  --shell-border: rgba(232,174,161,.42); --shell-bg: rgba(255,253,250,.83); --topbar-bg: rgba(255,254,251,.72);
  --surface-main: rgba(255,254,251,.94); --surface-soft: rgba(255,243,238,.88); --surface-mint: rgba(238,250,243,.86); --surface-pink: rgba(255,234,235,.78); --surface-lilac: rgba(252,238,241,.84); --input-bg: rgba(255,255,253,.96);
  --hero-ink: #713d4d; --hero-ink-soft: #824e5b; --hero-kicker: #7f475d; --hero-highlight: #88482c; --dashboard-ink: #fff; --fullscreen-ink: #713d4d; --action-ink: #713d4d;
}
body[data-theme="mint"] {
  --ink: #3e6970; --ink-soft: #67898d; --paper: #f1fffb; --paper-strong: #fcfffe;
  --mint: #70ddba; --mint-dark: #319e81; --coral: #ff9da5; --coral-dark: #d96375; --amber: #ffdb76; --sky: #90cfff;
  --line: #ccebe2; --line-strong: #9bcfc1; --danger: #d55873; --success: #2f9c7d;
  --shadow-lg: 0 24px 60px rgba(73,169,150,.17); --shadow-md: 0 12px 28px rgba(73,169,150,.13);
  --hero-start: #72d8c2; --hero-mid: #8fc9f3; --hero-end: #ffdc79; --hero-glow: rgba(255,255,255,.38);
  --primary-start: #68d6c0; --primary-mid: #91cdf4; --primary-end: #ffd36e;
  --dashboard-start: #50bfa8; --dashboard-end: #7cbef0;
  --canvas-grid: rgba(95,174,157,.065); --canvas-spot-one: rgba(135,211,196,.32); --canvas-spot-two: rgba(145,205,244,.26);
  --shell-border: rgba(126,194,180,.42); --shell-bg: rgba(251,255,254,.82); --topbar-bg: rgba(250,255,254,.72);
  --surface-main: rgba(252,255,254,.94); --surface-soft: rgba(238,251,248,.88); --surface-mint: rgba(228,251,243,.88); --surface-pink: rgba(238,248,255,.78); --surface-lilac: rgba(235,246,255,.84); --input-bg: rgba(255,255,255,.95);
  --hero-ink: #19565a; --hero-ink-soft: #2b686d; --hero-kicker: #23796d; --hero-highlight: #855318; --dashboard-ink: #fff; --fullscreen-ink: #19565a; --action-ink: #19565a;
}
body[data-theme="berry"] {
  --ink: #633d75; --ink-soft: #8d6898; --paper: #fff5fb; --paper-strong: #fffdfd;
  --mint: #91e1c7; --mint-dark: #46ad8d; --coral: #f783af; --coral-dark: #ca4f7a; --amber: #ffd56f; --sky: #a59cff;
  --line: #edc8e0; --line-strong: #d3a4c6; --danger: #d94b78; --success: #3da984;
  --shadow-lg: 0 24px 60px rgba(155,76,139,.2); --shadow-md: 0 12px 28px rgba(155,76,139,.15);
  --hero-start: #8e62c8; --hero-mid: #e96ea6; --hero-end: #ffbb76; --hero-glow: rgba(255,255,255,.3);
  --primary-start: #c466b5; --primary-mid: #f27da8; --primary-end: #ffbe72;
  --dashboard-start: #8054bb; --dashboard-end: #d867a5;
  --canvas-grid: rgba(157,94,139,.065); --canvas-spot-one: rgba(196,151,222,.28); --canvas-spot-two: rgba(244,153,188,.27);
  --shell-border: rgba(205,144,184,.42); --shell-bg: rgba(255,252,254,.82); --topbar-bg: rgba(255,252,254,.72);
  --surface-main: rgba(255,253,254,.94); --surface-soft: rgba(250,239,249,.88); --surface-mint: rgba(237,250,245,.87); --surface-pink: rgba(255,235,246,.79); --surface-lilac: rgba(245,237,252,.86); --input-bg: rgba(255,255,255,.95);
  --hero-ink: #fff; --hero-ink-soft: rgba(255,255,255,.91); --hero-kicker: #caffea; --hero-highlight: #fff0a5; --dashboard-ink: #fff; --fullscreen-ink: #fff; --action-ink: #fff;
}
body[data-theme="contrast"] {
  --ink: #07131f; --ink-soft: #1e3447; --paper: #fff; --paper-strong: #fff;
  --mint: #00d9a2; --mint-dark: #006d55; --coral: #e23c28; --coral-dark: #a51f10;
  --line: #50606c; --line-strong: #1b2e3d;
  --hero-start: #005b76; --hero-mid: #d92d62; --hero-end: #f4ad00; --hero-glow: rgba(255,255,255,.28);
  --primary-start: #c62357; --primary-mid: #df4a45; --primary-end: #e6a000;
  --dashboard-start: #005b76; --dashboard-end: #6750a4;
  --canvas-grid: rgba(20,52,70,.10); --canvas-spot-one: rgba(0,217,162,.14); --canvas-spot-two: rgba(255,210,35,.17);
  --shell-border: rgba(27,46,61,.65); --shell-bg: rgba(255,255,255,.94); --topbar-bg: rgba(255,255,255,.88);
  --surface-main: rgba(255,255,255,.96); --surface-soft: rgba(240,245,248,.93); --surface-mint: rgba(230,255,246,.91); --surface-pink: rgba(255,239,239,.90); --surface-lilac: rgba(239,244,255,.91); --input-bg: #fff;
  --hero-ink: #fff; --hero-ink-soft: rgba(255,255,255,.94); --hero-kicker: #c9ffe9; --hero-highlight: #fff0a0; --dashboard-ink: #fff; --fullscreen-ink: #fff; --action-ink: #fff;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, label, select { -webkit-user-select: none; user-select: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 4px solid rgba(143,200,255,.5);
  outline-offset: 2px;
}
button:disabled { cursor: not-allowed; opacity: .48; }
.hidden { display: none !important; }

.app-shell {
  width: min(1640px, calc(100% - 32px));
  min-height: calc(100svh - 32px);
  margin: 16px auto;
  overflow: hidden;
  border: 1px solid var(--shell-border);
  border-radius: 30px;
  background: var(--shell-bg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}
.app-shell:has(.home-screen.is-active) { height: calc(100svh - 32px); min-height: 0; }
.app-shell:has(.home-screen.is-active) main { height: calc(100% - 76px); min-height: 0; }

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  width: 43px;
  height: 43px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 15px 15px 18px 10px;
  background: linear-gradient(135deg, var(--primary-start), var(--primary-mid) 58%, var(--primary-end));
  transform: rotate(-3deg);
}
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; border-radius: 999px; }
.brand-mark::before { width: 25px; height: 25px; border: 3px solid #fff7d8; left: 7px; top: 7px; }
.brand-mark::after { width: 8px; height: 8px; right: 5px; top: 6px; background: var(--hero-highlight); }
.brand-mark i { width: 4px; height: 4px; z-index: 1; border-radius: 50%; background: #fff; box-shadow: 8px 0 #fff, 16px 0 #fff; transform: translateX(-8px); }
.brand strong { display: block; font: 900 1.15rem/1.1 var(--font-display); letter-spacing: .06em; }
.brand small { display: block; margin-top: 3px; color: var(--ink-soft); font-size: .72rem; letter-spacing: .08em; }

.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.save-status { display: inline-flex; align-items: center; gap: 7px; margin-right: 5px; color: var(--ink-soft); font-size: .76rem; white-space: nowrap; }
.save-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(255,209,102,.24); }
.save-status.saved i { background: var(--mint-dark); box-shadow: 0 0 0 4px rgba(66,174,137,.16); }
.save-status.warn i { background: var(--coral); box-shadow: 0 0 0 4px rgba(255,140,173,.18); }

.icon-btn, .quick-action, .hud-actions button, .library-toolbar button, .archive-cards button, .archive-cards label {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper-strong);
  box-shadow: 0 5px 12px rgba(170,102,160,.09);
  cursor: pointer;
  font-size: .86rem;
  font-weight: 800;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.icon-btn:hover, .quick-action:hover, .hud-actions button:hover, .library-toolbar button:hover, .archive-cards button:hover, .archive-cards label:hover { transform: translateY(-2px); border-color: var(--mint-dark); background: var(--surface-mint); }
.icon-btn.icon-only { width: 42px; padding: 0; font-size: 1.1rem; }
.icon-btn.is-off { color: #9d8ca8; background: #f6ecf3; }
.quick-action { min-width: 112px; min-height: 42px; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 5px; padding: 0 15px; color: var(--ink); border-color: var(--line); text-align: center; white-space: nowrap; background: var(--paper-strong); }
.quick-action span { color: var(--mint); font-size: .66rem; font-weight: 900; }
.quick-action b { font-size: .7rem; line-height: 1.2; }
.quick-action.single-action { min-width: 94px; flex-direction: row; align-items: center; padding: 0 15px; font-size: .86rem; font-weight: 800; }
.quick-action.fullscreen-board { color: var(--ink); background: var(--paper-strong); }
.quick-action.fullscreen-board span { color: inherit; }
.theme-menu-btn { min-width: 86px; font-size: .68rem; }
.sound-action { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.sound-action i { font-style: normal; font-size: 1.03rem; line-height: 1; }

main { min-height: calc(100svh - 109px); }
.screen { display: none; }
.screen.is-active { display: block; }

.home-screen {
  position: relative;
  height: 100%;
  box-sizing: border-box;
  padding: clamp(14px, 1.7vw, 26px);
  overflow: hidden;
}
.home-command-center { height: 100%; display: grid; grid-template-rows: minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface-main); box-shadow: var(--shadow-md); }
.mission-intro { min-height: 0; display: grid; grid-template-columns: minmax(360px, 1fr) minmax(340px, .94fr); align-items: center; gap: clamp(24px, 5vw, 84px); position: relative; overflow: hidden; padding: clamp(28px, 5vh, 62px) clamp(38px, 6.3vw, 92px); color: var(--hero-ink); background: linear-gradient(114deg, var(--hero-start), var(--hero-mid) 58%, var(--hero-end)); }
.mission-stage::before, .mission-stage::after { position: absolute; z-index: 0; pointer-events: none; content: ""; }
.mission-stage::before { inset: 7% 7% 10% 7%; opacity: .72; background: var(--hero-map); -webkit-mask: url("assets/explorer-map.svg") center / contain no-repeat; mask: url("assets/explorer-map.svg") center / contain no-repeat; }
.mission-stage::after { display: none; }
.explorer-decor { position: absolute; z-index: 0; inset: 0; overflow: hidden; pointer-events: none; }
.scene-cloud { width: 88px; height: 24px; position: absolute; display: block; border-radius: 999px; background: rgba(255,255,255,.78); box-shadow: 20px -14px 0 4px rgba(255,255,255,.78), 50px -5px 0 1px rgba(255,255,255,.78); }
.cloud-left { left: -22px; top: 18%; transform: scale(.78); }
.cloud-right { right: 2%; top: 21%; transform: scale(1.05); }
.scene-compass { width: 48px; height: 48px; position: absolute; left: 46%; top: 21%; border: 3px solid rgba(255,255,255,.76); border-radius: 50%; background: rgba(228,255,236,.4); box-shadow: 0 0 0 4px rgba(59,151,119,.12); }
.scene-compass::before, .scene-compass::after { position: absolute; left: 50%; top: 50%; content: ""; background: rgba(60,136,111,.68); transform: translate(-50%, -50%); }
.scene-compass::before { width: 2px; height: 34px; }
.scene-compass::after { width: 34px; height: 2px; }
.scene-compass i { width: 22px; height: 22px; position: absolute; left: 10px; top: 10px; display: block; background: linear-gradient(135deg, var(--mint-dark) 0 49%, transparent 50%), linear-gradient(315deg, var(--coral) 0 49%, transparent 50%); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); transform: rotate(18deg); }
.scene-star { position: absolute; color: #fff3a0; font: 900 clamp(1rem, 1.8vw, 2rem)/1 var(--font-display); text-shadow: 0 2px 4px rgba(93,109,73,.12); }
.star-one { right: 12%; top: 15%; }
.star-two { right: 5%; top: 32%; font-size: clamp(.8rem, 1.35vw, 1.35rem); }
.star-three { right: 19%; bottom: 23%; font-size: clamp(.8rem, 1.2vw, 1.2rem); }
.scene-route { height: 0; position: absolute; display: block; border-top: 2px dashed rgba(255,255,255,.76); border-radius: 50%; }
.route-one { width: min(34vw, 550px); left: 29%; top: 34%; transform: rotate(-6deg); }
.route-two { width: min(31vw, 490px); right: 1%; bottom: 16%; transform: rotate(8deg); }
.scene-mountains { width: min(16vw, 225px); height: min(8vw, 105px); position: absolute; left: 58%; bottom: 4%; display: flex; align-items: end; gap: 0; filter: drop-shadow(0 7px 0 rgba(255,255,255,.25)); }
.scene-mountains i { display: block; width: 0; height: 0; border-left: 48px solid transparent; border-right: 48px solid transparent; border-bottom: 78px solid var(--mint-dark); opacity: .8; }
.scene-mountains i:nth-child(1) { margin-right: -38px; border-bottom-color: #58bca0; transform: scale(.72); transform-origin: bottom; }
.scene-mountains i:nth-child(2) { z-index: 1; border-bottom-color: #429f8b; }
.scene-mountains i:nth-child(3) { margin-left: -38px; border-bottom-color: #8bcf8a; transform: scale(.66); transform-origin: bottom; }
.eyebrow, .section-kicker { color: var(--mint); font-size: .66rem; font-weight: 900; letter-spacing: .17em; }
.mission-copy { grid-column: 1; position: relative; z-index: 1; align-self: center; padding: 0; transform: translateY(-4%); }
.mission-copy h1 { max-width: 600px; margin: 8px 0 8px; font: 900 clamp(2.05rem, 3.45vw, 3.65rem)/1.08 var(--font-display); letter-spacing: -.045em; }
.mission-intro .eyebrow { color: var(--hero-kicker); }
.mission-copy h1 em { color: var(--hero-highlight); font-style: normal; }
.mission-copy p { margin: 0; color: var(--hero-ink-soft); font-size: .86rem; line-height: 1.55; }
.mission-mascot { grid-column: 2; z-index: 1; min-height: 0; position: relative; align-self: center; display: grid; place-items: center end; }
.mission-mascot::before { display: none; }
.mission-mascot img { z-index: 1; width: min(515px, 100%); max-height: min(70vh, 600px); object-fit: contain; filter: drop-shadow(0 19px 18px rgba(52,55,89,.24)); }
.stage-entry { z-index: 1; display: grid; justify-items: start; gap: 10px; margin-top: 19px; padding: 0; background: transparent; }
.stage-entry .game-launch-row { width: min(520px, 100%); grid-template-columns: minmax(0, 1fr); gap: 13px; margin: 0; padding: 0; background: transparent; }
.stage-entry .game-launch-row .primary-action { width: min(330px, 100%); min-height: 56px; border-radius: 18px; box-shadow: 0 14px 24px rgba(68,95,77,.22); font-size: 1rem; }
.stage-entry .resume-action { width: min(520px, 100%); margin-top: 0; }

.setup-card { min-height: 0; display: flex; flex-direction: column; padding: clamp(14px, 1.8vw, 22px) clamp(18px, 2.2vw, 30px); background: var(--surface-main); }
.setup-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.setup-heading h2, .modal-header h2 { margin: 3px 0 0; font: 900 1.3rem/1.15 var(--font-display); }
.word-total { padding: 6px 10px; border-radius: 999px; color: #2b886d; background: rgba(121,227,186,.25); font-size: .72rem; font-weight: 900; }
.setup-workspace { min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(0, .96fr) minmax(0, 1.04fr); gap: 12px; }
.setup-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.setup-field legend { margin-bottom: 8px; color: var(--ink-soft); font-size: .74rem; font-weight: 900; }
.unit-field { min-height: 0; padding: 12px; border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(145deg, var(--surface-mint), var(--surface-main)); }
.unit-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.unit-picker label { position: relative; cursor: pointer; }
.unit-picker input { position: absolute; opacity: 0; pointer-events: none; }
.unit-picker span { min-height: 56px; display: grid; grid-template-columns: 29px 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--input-bg); transition: .16s ease; }
.unit-picker i { grid-row: 1 / 3; display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; color: var(--ink); background: var(--surface-lilac); font-style: normal; font-weight: 900; font-size: .78rem; }
.unit-picker b { align-self: end; font-size: .75rem; }
.unit-picker small { align-self: start; color: var(--ink-soft); font-size: .61rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-picker input:checked + span { color: #23765f; border-color: var(--mint-dark); background: rgba(121,227,186,.18); box-shadow: inset 0 0 0 1px var(--mint-dark); }
.unit-picker input:checked + span i { color: #fff; background: var(--mint-dark); }

.setup-grid { min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 8px; margin: 0; }
.setup-grid .setup-field { padding: 9px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-pink); }
.setup-grid .player-names { grid-column: 1 / -1; }
.segmented { display: grid; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-lilac); }
.segmented.two { grid-template-columns: 1fr 1fr; }
.segmented.three { grid-template-columns: repeat(3, 1fr); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { min-height: 30px; display: grid; place-items: center; padding: 4px; border-radius: 8px; color: var(--ink-soft); font-size: .7rem; font-weight: 800; text-align: center; }
.segmented input:checked + span { color: var(--ink); background: var(--input-bg); box-shadow: 0 4px 10px var(--canvas-grid); }
select, input, textarea { border: 1px solid var(--line-strong); border-radius: 12px; color: var(--ink); background: var(--input-bg); }
select { width: 100%; height: 36px; padding: 0 28px 0 9px; cursor: pointer; font-size: .7rem; font-weight: 800; }
.time-row { display: flex; gap: 8px; }
.end-mode-row { align-items: stretch; }
.end-mode-row > select { min-width: 120px; }
#duration-controls { min-width: 0; flex: 1; display: flex; gap: 8px; }
#duration-controls.is-inactive { opacity: .46; }
.end-mode-help { display: block; min-height: 1.35em; margin-top: 7px; color: var(--ink-soft); font-size: .64rem; font-weight: 700; line-height: 1.4; }
.count-target { min-width: 118px; display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: var(--input-bg); }
.count-target input { min-width: 0; width: 62px; height: 34px; padding: 0 4px 0 10px; border: 0; }
.count-target span { padding-right: 9px; color: var(--ink-soft); font-size: .7rem; white-space: nowrap; }
.player-names > div { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.player-names input { min-width: 0; height: 36px; padding: 0 9px; font-size: .7rem; }
.custom-time { min-width: 105px; display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: var(--input-bg); }
.custom-time input { min-width: 0; width: 60px; height: 34px; padding: 0 4px 0 10px; border: 0; }
.custom-time span { padding-right: 9px; color: var(--ink-soft); font-size: .7rem; }

.primary-action, .secondary-action, .resume-action, .text-action {
  border: 0;
  cursor: pointer;
  font-weight: 900;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.primary-action { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; margin-top: 11px; padding: 0 10px 0 19px; border-radius: 15px; color: var(--action-ink); background: linear-gradient(105deg, var(--primary-start), var(--primary-mid) 56%, var(--primary-end)); box-shadow: 0 9px 18px rgba(222,85,130,.22); font-size: .9rem; }
.primary-action i { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: var(--coral-dark); background: #fff; font-style: normal; font-size: 1rem; }
.primary-action:hover, .secondary-action:hover, .resume-action:hover { transform: translateY(-2px); }
.primary-action:hover { filter: saturate(1.1); box-shadow: 0 14px 28px rgba(222,85,130,.3); }
.primary-action.compact { width: auto; min-width: 190px; min-height: 48px; margin: 0; gap: 20px; padding-left: 18px; }
.primary-action.compact i { width: 32px; height: 32px; border-radius: 10px; }
.secondary-action { min-height: 47px; padding: 0 17px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--input-bg); box-shadow: 0 6px 14px rgba(16,35,59,.07); }
.secondary-action.full { width: 100%; margin-top: 12px; }
.resume-action { width: 100%; min-height: 40px; margin-top: 8px; border: 1px dashed var(--mint-dark); border-radius: 12px; color: #287d64; background: rgba(121,227,186,.14); }
.text-action { color: var(--ink-soft); background: transparent; text-decoration: underline; text-underline-offset: 4px; }
.game-launch-row { display: grid; grid-template-columns: minmax(0, 1fr) 178px; gap: 10px; margin-top: 11px; padding: 8px; border-radius: 17px; background: linear-gradient(100deg, var(--surface-lilac), var(--surface-pink)); }
.game-launch-row .primary-action { width: auto; margin-top: 0; }
.classroom-password { min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 11px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 15px; background: linear-gradient(90deg, var(--surface-mint), var(--input-bg) 38%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.72); }
.classroom-password > span { flex: 0 0 auto; color: var(--mint-dark); font-size: .73rem; font-weight: 900; white-space: nowrap; }
.classroom-password input { min-width: 0; width: 100%; height: 32px; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: .8rem; }
.classroom-password input::placeholder { color: #a687a1; }
.classroom-password:focus-within { border-color: var(--mint-dark); box-shadow: 0 0 0 3px rgba(121,227,186,.19); }
.classroom-password input.is-invalid { color: var(--danger); }
.classroom-password:has(input.is-invalid) { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(232,95,126,.14); }

.dashboard-strip { align-self: center; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.dashboard-strip > div { min-height: 62px; padding: 9px 11px; border: 1px solid rgba(255,255,255,.4); border-radius: 14px; background: var(--input-bg); }
.dashboard-strip > div { display: flex; flex-direction: column; justify-content: center; }
.dashboard-strip span { color: var(--ink-soft); font-size: .62rem; font-weight: 800; }
.dashboard-strip strong { margin-top: 2px; color: var(--stat-ink); font: 900 1.35rem/1 var(--font-display); }

/* Game */
.game-screen { height: calc(100svh - 109px); min-height: 590px; padding: 16px 22px 22px; }
.game-hud { min-height: 66px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; padding: 0 8px 12px; }
.mission-label span { display: block; color: var(--mint-dark); font-size: .68rem; font-weight: 900; letter-spacing: .12em; }
.mission-label strong { display: block; margin-top: 3px; font-size: 1rem; }
.timer { width: 190px; text-align: center; }
.timer small { display: block; margin-bottom: -3px; color: var(--ink-soft); font-size: .63rem; font-weight: 800; }
.timer strong { font: 900 2rem/1 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: .05em; }
.timer > div { height: 5px; overflow: hidden; margin-top: 7px; border-radius: 99px; background: #f4dcec; }
.timer i { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--mint-dark); transition: width .3s linear, background .2s ease; }
.timer.is-low strong { color: var(--coral-dark); }
.timer.is-low i { background: var(--coral); }
.hud-actions { display: flex; justify-content: flex-end; gap: 8px; }
.hud-actions button { min-height: 39px; background: transparent; box-shadow: none; }

.player-grid { height: calc(100% - 66px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.player-grid.duel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.player-panel { min-width: 0; height: 100%; display: grid; grid-template-rows: auto minmax(132px, auto) auto auto minmax(168px, 1fr); gap: 10px; position: relative; overflow: hidden; padding: 16px; border: 1px solid var(--line); border-radius: 27px; background: linear-gradient(180deg, var(--input-bg), var(--surface-lilac)); box-shadow: var(--shadow-md); }
.player-panel.no-pronunciation { grid-template-rows: auto minmax(132px, auto) auto minmax(168px, 1fr); }
.player-grid.duel .player-panel:nth-child(2) { background: linear-gradient(180deg, var(--input-bg), var(--surface-pink)); }
.player-stats { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.player-name { display: flex; align-items: center; gap: 10px; font-weight: 900; }
.player-name i { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--mint-dark); font-style: normal; font-size: .72rem; }
.player-panel:nth-child(2) .player-name i { background: var(--coral); }
.stat-chips { display: flex; gap: 6px; }
.stat-chips span { min-width: 65px; padding: 6px 8px; border-radius: 10px; color: var(--ink-soft); background: rgba(183,128,207,.1); font-size: .68rem; font-weight: 800; text-align: center; }
.stat-chips b { color: var(--ink); font-size: .92rem; }

.spelling-error-popover { min-width: min(260px, calc(100% - 36px)); display: flex; align-items: center; gap: 10px; position: absolute; z-index: 7; left: 50%; top: clamp(54px, 8vh, 74px); padding: 10px 14px; border: 1px solid #f5a7c0; border-radius: 16px; color: #8e3858; background: linear-gradient(135deg, #fff7f9, #ffe7ef); box-shadow: 0 12px 24px rgba(210,84,126,.22); opacity: 0; pointer-events: none; transform: translate(-50%, -10px) scale(.94); transition: opacity .14s ease, transform .14s ease; }
.spelling-error-popover.is-visible { opacity: 1; transform: translate(-50%, 0) scale(1); animation: spelling-alert-pop .38s ease both; }
.spelling-error-popover > span { width: 25px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--danger); font: 900 1rem/1 var(--font-display); }
.spelling-error-popover strong, .spelling-error-popover small { display: block; }
.spelling-error-popover strong { font-size: .86rem; font-weight: 900; }
.spelling-error-popover small { margin-top: 2px; color: #a4687d; font-size: .68rem; font-weight: 800; }
.player-grid.duel .spelling-error-popover { min-width: min(220px, calc(100% - 22px)); top: 48px; padding: 8px 10px; border-radius: 13px; }
.player-grid.duel .spelling-error-popover > span { width: 22px; height: 22px; }
.player-grid.duel .spelling-error-popover strong { font-size: .75rem; }
.player-grid.duel .spelling-error-popover small { font-size: .58rem; }
@keyframes spelling-alert-pop { 0% { transform: translate(-50%, -14px) scale(.9); } 65% { transform: translate(-50%, 2px) scale(1.02); } 100% { transform: translate(-50%, 0) scale(1); } }

.prompt-card { display: grid; place-items: center; align-content: center; position: relative; overflow: hidden; min-height: 140px; padding: 14px 18px; border-radius: 21px; color: var(--hero-ink); background: linear-gradient(130deg, var(--hero-start), var(--hero-mid) 61%, var(--hero-end)); text-align: center; }
.prompt-card::after { content: ""; position: absolute; width: 130px; height: 130px; right: -60px; top: -70px; border: 26px solid rgba(255,255,255,.22); border-radius: 50%; }
.prompt-card .pos { position: absolute; left: 12px; top: 12px; padding: 5px 8px; border-radius: 8px; color: var(--hero-ink); background: rgba(255,255,255,.26); font-size: .65rem; font-weight: 900; }
.prompt-card h2 { position: relative; z-index: 1; margin: 0; font: 900 clamp(2rem, 4.1vw, 4rem)/1.05 var(--font-display); letter-spacing: .02em; }
.player-grid.duel .prompt-card h2 { font-size: clamp(1.8rem, 3vw, 3.1rem); }
.prompt-card p { position: relative; z-index: 1; max-width: 560px; margin: 9px 0 0; color: var(--hero-ink-soft); font-size: .72rem; line-height: 1.45; }

.pronunciation-card { min-width: 0; min-height: 48px; display: grid; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 15px; background: var(--input-bg); }
.pronunciation-card.is-locked { grid-template-columns: auto 1fr; color: var(--ink-soft); background: var(--surface-pink); }
.pronunciation-card.is-locked > span { padding: 5px 8px; border-radius: 9px; color: var(--coral-dark); background: #fff0f5; font-size: .66rem; font-weight: 900; white-space: nowrap; }
.pronunciation-card.is-locked strong { font-size: .68rem; line-height: 1.4; }
.pronunciation-card.is-unlocked { grid-template-columns: minmax(0, 1fr) auto; background: linear-gradient(105deg, var(--surface-pink), var(--surface-mint)); }
.pronunciation-card div { min-width: 0; }
.pronunciation-card div span, .pronunciation-card div strong { display: block; }
.pronunciation-card div span { color: var(--ink-soft); font-size: .61rem; font-weight: 900; }
.pronunciation-card div strong { margin-top: 2px; overflow: hidden; color: var(--ink); font: 900 .81rem/1.25 var(--font-display); text-overflow: ellipsis; white-space: nowrap; }
.pronunciation-speaker { min-height: 32px; display: inline-flex; align-items: center; gap: 5px; padding: 0 10px; border: 1px solid rgba(66,174,137,.28); border-radius: 11px; color: #25765f; background: #dcf8ed; cursor: pointer; font-size: .68rem; font-weight: 900; white-space: nowrap; }
.pronunciation-speaker:hover { filter: saturate(1.12); transform: translateY(-1px); }
.pronunciation-speaker i { font-style: normal; font-size: .9rem; }
.player-grid.duel .pronunciation-card { min-height: 42px; gap: 6px; padding: 6px 7px; border-radius: 11px; }
.player-grid.duel .pronunciation-card.is-unlocked { grid-template-columns: minmax(0, 1fr) 32px; }
.player-grid.duel .pronunciation-card.is-locked > span { padding: 4px 6px; font-size: .57rem; }
.player-grid.duel .pronunciation-card.is-locked strong, .player-grid.duel .pronunciation-card div span { font-size: .53rem; }
.player-grid.duel .pronunciation-card div strong { font-size: .64rem; }
.player-grid.duel .pronunciation-speaker { min-height: 30px; justify-content: center; padding: 0; }
.player-grid.duel .pronunciation-speaker span { display: none; }

.letter-slots.is-speakable { width: max-content; max-width: 100%; margin-inline: auto; padding: 3px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; font: inherit; }
.letter-slots.is-speakable:hover .letter-slot { transform: translateY(-2px); }
.letter-slots.is-speakable:focus-visible { outline: 3px solid var(--mint-dark); outline-offset: 3px; }

.answer-zone { min-height: 75px; display: grid; align-content: center; gap: 7px; }
.letter-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(4px, .7vw, 9px); }
.letter-slot { width: clamp(35px, 4.1vw, 56px); height: clamp(45px, 5vw, 65px); display: grid; place-items: center; position: relative; border: 1px solid var(--line-strong); border-radius: 13px; color: var(--ink); background: var(--input-bg); box-shadow: inset 0 -4px var(--canvas-grid); font: 900 clamp(1.25rem, 2.1vw, 2rem)/1 var(--font-display); text-transform: lowercase; transition: .17s ease; }
.player-grid.duel .letter-slot { width: clamp(27px, 3.25vw, 45px); height: clamp(39px, 4.1vw, 55px); font-size: clamp(1rem, 1.65vw, 1.55rem); }
.letter-slot.space { width: 22px; border: 0; box-shadow: none; background: transparent; }
.letter-slot.punctuation { width: 25px; border-color: transparent; box-shadow: none; background: transparent; }
.letter-slot.given { color: #806d97; border-style: dashed; background: #f1eafb; }
.letter-slot.pending::after { content: ""; width: 9px; height: 3px; position: absolute; bottom: 9px; border-radius: 3px; background: var(--line-strong); }
.letter-slot.filled { border-color: var(--sky); background: #edf7ff; transform: translateY(-2px); }
.answer-zone.correct .letter-slot { color: #25755f; border-color: var(--mint-dark); background: #dcfaed; animation: slot-pop .35s ease; }
.answer-zone.wrong { animation: answer-shake .34s ease; }
.answer-zone.wrong .letter-slot:not(.given) { color: #8e2530; border-color: var(--danger); background: #fff0f1; }
.answer-hint { min-height: 18px; color: var(--ink-soft); font-size: .66rem; font-weight: 800; text-align: center; }
@keyframes slot-pop { 50% { transform: translateY(-5px) scale(1.04); } }
@keyframes answer-shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

.keyboard-wrap { min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 9px; padding-top: 3px; }
.keyboard-row { display: flex; justify-content: center; gap: clamp(4px, .65vw, 9px); }
.key { width: clamp(39px, 4.9vw, 66px); height: clamp(44px, 5.2vh, 59px); display: grid; place-items: center; padding: 0; border: 1px solid var(--line-strong); border-bottom-width: 4px; border-radius: 12px; color: var(--ink); background: var(--input-bg); cursor: pointer; font: 900 clamp(.9rem, 1.4vw, 1.2rem)/1 var(--font-display); touch-action: none; transition: transform .08s ease, border-width .08s ease, background .1s ease; }
.key:active { transform: translateY(3px); border-bottom-width: 1px; background: #f3e9fb; }
.key.special { width: clamp(58px, 7.2vw, 105px); color: #24745f; background: #dcf8ed; font-size: .72rem; }
.key.skip { color: #a04a66; background: #fff0f4; }
.key:disabled { transform: none; }
.player-grid.duel .keyboard-row { gap: clamp(2px, .25vw, 5px); }
.player-grid.duel .key { width: clamp(27px, 3.25vw, 47px); height: clamp(44px, 5.2vh, 52px); border-radius: 9px; font-size: clamp(.72rem, 1.05vw, 1rem); }
.player-grid.duel .key.special { width: clamp(47px, 5.3vw, 80px); font-size: .58rem; }
.player-mascot { position: absolute; right: 8px; bottom: -4px; z-index: 2; width: 72px; height: 72px; object-fit: contain; pointer-events: none; filter: drop-shadow(0 6px 7px rgba(0,0,0,.2)); }
.player-grid.duel .player-mascot { width: 58px; height: 58px; }
.prompt-card.reveal-context p { color: var(--hero-ink-soft); }
.timer.is-count > div { background: #f4dcec; }

/* Results */
.results-screen { padding: clamp(24px, 3vw, 46px); }
.results-hero { min-height: 180px; display: flex; align-items: center; justify-content: space-between; overflow: hidden; padding: 24px 40px; border-radius: var(--radius-xl); color: var(--hero-ink); background: linear-gradient(130deg, var(--hero-start), var(--hero-mid) 62%, var(--hero-end)); }
.results-hero h2 { margin: 5px 0 7px; font: 900 clamp(2rem, 3.6vw, 3.5rem)/1.1 var(--font-display); }
.results-hero p { margin: 0; color: var(--hero-ink-soft); }
.results-hero img { width: 190px; height: 170px; object-fit: contain; object-position: center 34%; transform: translateY(20px); filter: drop-shadow(0 14px 18px rgba(133,67,120,.2)); }
.result-player-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; margin: 18px 0; }
.result-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--input-bg); box-shadow: var(--shadow-md); }
.result-card header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.result-card header span { color: var(--ink-soft); font-size: .75rem; font-weight: 900; }
.result-card header strong { color: var(--coral-dark); font: 900 2rem/1 var(--font-display); }
.result-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.result-metrics div { padding: 10px 6px; border-radius: 13px; background: var(--surface-lilac); text-align: center; }
.result-metrics span { display: block; color: var(--ink-soft); font-size: .64rem; }
.result-metrics b { display: block; margin-top: 3px; font-size: 1rem; }
.review-panel { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-main); }
.review-heading { display: flex; align-items: center; justify-content: space-between; }
.review-heading h3 { margin: 3px 0 0; font: 900 1.25rem var(--font-display); }
.review-heading > span { color: var(--ink-soft); font-size: .76rem; font-weight: 800; }
.review-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 14px; }
.review-word { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--input-bg); }
.review-word strong { display: block; font-size: .9rem; }
.review-word small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: .66rem; }
.speak-mini { width: 32px; height: 32px; flex: 0 0 auto; border: 0; border-radius: 10px; color: #28775f; background: #dcf8ed; cursor: pointer; }
.empty-state { grid-column: 1 / -1; padding: 20px; border: 1px dashed var(--line-strong); border-radius: 14px; color: var(--ink-soft); text-align: center; }
.result-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* Dialogs */
dialog { color: var(--ink); }
.modal { width: min(1180px, calc(100vw - 34px)); max-height: calc(100svh - 34px); padding: 0; overflow: visible; border: 0; border-radius: 28px; background: transparent; }
.modal::backdrop, .pause-dialog::backdrop { background: rgba(114,74,145,.52); backdrop-filter: blur(8px); }
.modal-frame { max-height: calc(100svh - 34px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(255,255,255,.7); border-radius: 28px; background: var(--paper-strong); box-shadow: 0 35px 100px rgba(120,71,126,.26); }
.modal-frame.narrow { width: min(720px, calc(100vw - 34px)); margin: auto; }
.modal-frame.import-frame { width: min(1180px, calc(100vw - 34px)); margin: auto; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 27px 18px; border-bottom: 1px solid var(--line); }
.modal-header p { margin: 6px 0 0; color: var(--ink-soft); font-size: .76rem; }
.close-btn { width: 41px; height: 41px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 13px; background: #fff; cursor: pointer; font-size: 1.45rem; line-height: 1; }
.modal-footer { min-height: 70px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 11px 24px; border-top: 1px solid var(--line); }
.modal-footer > span { margin-right: auto; color: var(--ink-soft); font-size: .72rem; }
.mission-settings-modal { width: min(1280px, calc(100vw - 34px)); }
.mission-settings-frame { width: min(1280px, calc(100vw - 34px)); margin: auto; }
.mission-settings-frame .setup-card { min-height: 0; flex: 1; overflow: auto; padding: 20px 26px 22px; }
.mission-settings-frame .setup-workspace { min-height: 360px; flex: 1 0 auto; }
.mission-settings-frame .setup-heading { margin-bottom: 14px; }
.mission-settings-frame .setup-heading h2 { font-size: 1.22rem; }

.library-layout { min-height: 0; display: grid; grid-template-columns: 240px minmax(0, 1fr); flex: 1; overflow: hidden; }
.unit-sidebar { padding: 16px; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface-lilac); }
.unit-list { display: grid; gap: 7px; }
.unit-list button { width: 100%; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; padding: 9px; border: 1px solid transparent; border-radius: 13px; background: transparent; cursor: pointer; text-align: left; }
.unit-list button:hover, .unit-list button.active { border-color: var(--line-strong); background: var(--input-bg); }
.unit-list i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #28775f; background: #dcf8ed; font-style: normal; }
.unit-list b { display: block; font-size: .78rem; }
.unit-list small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: .62rem; }
.unit-list em { color: var(--ink-soft); font-style: normal; font-size: .65rem; }
.library-main { min-width: 0; display: flex; flex-direction: column; padding: 18px; overflow: hidden; }
.library-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 13px; }
.library-toolbar h3 { margin: 0; font: 900 1.25rem var(--font-display); }
.library-toolbar p { margin: 3px 0 0; color: var(--ink-soft); font-size: .7rem; }
.library-toolbar > div:last-child { display: flex; gap: 7px; }
.library-toolbar > div:last-child { flex-wrap: wrap; justify-content: flex-end; }
.library-toolbar button { min-height: 37px; background: #fff; box-shadow: none; font-size: .72rem; }
.library-toolbar .danger-link { color: var(--danger); }
.word-table-wrap { min-height: 280px; flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; background: var(--input-bg); font-size: .75rem; }
th { position: sticky; top: 0; z-index: 1; padding: 12px; color: var(--ink-soft); background: var(--surface-lilac); text-align: left; }
td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
td:first-child { font-weight: 900; }
td { color: var(--ink-soft); line-height: 1.45; }
td:first-child { color: var(--ink); }
.word-actions-head { width: 126px; }
.word-row-actions { white-space: nowrap; }
.word-row-actions button { min-height: 31px; margin-right: 5px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; font-size: .66rem; font-weight: 800; }
.word-row-actions button:last-child { margin-right: 0; color: var(--danger); }

.import-body { padding: 22px 26px; overflow-y: auto; }
.form-field { display: grid; gap: 7px; margin-bottom: 14px; }
.form-field > span { color: var(--ink-soft); font-size: .72rem; font-weight: 900; }
.form-field input, .form-field textarea { width: 100%; padding: 11px 13px; resize: vertical; line-height: 1.55; }
.form-field input.invalid { border-color: #e15c6e; box-shadow: 0 0 0 3px rgba(225,92,110,.13); }
.field-message { min-height: 1em; color: #b33d4f; font-size: .66rem; font-weight: 800; line-height: 1.35; }
.format-hint { margin-bottom: 12px; padding: 11px 13px; border-radius: 12px; background: #edf9f4; font-size: .7rem; }
.format-hint b { margin-right: 8px; color: #28775f; }
.format-hint code { color: var(--ink-soft); white-space: normal; }
.format-hint small { display: block; margin-top: 6px; color: var(--ink-soft); font-size: .64rem; line-height: 1.45; }
.file-import-tools { display: flex; gap: 9px; align-items: stretch; margin-bottom: 14px; }
.file-button { flex: 1; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px dashed var(--mint-dark); border-radius: 13px; color: #28775f; background: rgba(121,227,186,.14); cursor: pointer; font-size: .76rem; font-weight: 900; }
.file-button small { color: var(--ink-soft); font-weight: 500; }
.import-sample-button { flex: 0 0 auto; min-height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 13px; color: #6f4c82; background: #fff; cursor: pointer; font-size: .68rem; font-weight: 900; }
.import-sample-button:hover { background: #fff6fb; }
.import-editor { margin: 2px 0 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.import-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 15px 16px 12px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #fff9fc, #f8fffc); }
.import-editor-head h3 { margin: 3px 0 0; font-size: 1rem; }
.import-editor-head p { margin: 5px 0 0; color: var(--ink-soft); font-size: .68rem; }
.import-editor-legend { display: flex; flex: 0 0 auto; gap: 6px; padding-top: 2px; }
.entry-badge { display: inline-flex; align-items: center; width: max-content; padding: 3px 6px; border-radius: 999px; font-style: normal; font-size: .58rem; font-weight: 900; line-height: 1; white-space: nowrap; }
.entry-badge.required { color: #a62f4a; background: #ffe8ed; }
.entry-badge.optional { color: #16735b; background: #e0f8ef; }
.import-editor-table-wrap { overflow: auto; }
.import-editor-table { width: 100%; min-width: 1060px; margin: 0; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.import-editor-table th { padding: 9px 10px; border-right: 1px solid #f2d8e5; border-bottom: 1px solid #f2d8e5; color: #6b4a7d; background: #fbedf5; text-align: left; font-size: .66rem; }
.import-editor-table th:last-child { border-right: 0; }
.import-editor-table th span { display: block; margin-bottom: 4px; }
.import-editor-table th:nth-child(1) { width: 16%; }
.import-editor-table th:nth-child(2) { width: 16%; }
.import-editor-table th:nth-child(3) { width: 11%; }
.import-editor-table th:nth-child(4) { width: 16%; }
.import-editor-table th:nth-child(5) { width: 24%; }
.import-editor-table th:nth-child(6) { width: 13%; }
.import-editor-table th:nth-child(7) { width: 76px; }
.import-editor-table td { padding: 7px; border-right: 1px solid #f7e4ec; border-bottom: 1px solid #f7e4ec; vertical-align: top; }
.import-editor-table td:last-child { border-right: 0; }
.import-editor-table tbody tr:last-child td { border-bottom: 0; }
.import-editor-table td.required-cell { background: #fff9fa; }
.import-editor-table td.optional-cell { background: #fbfffd; }
.import-editor-table input { width: 100%; min-height: 36px; padding: 7px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); font-size: .72rem; outline: none; }
.import-editor-table td.required-cell input:focus { border-color: #f092aa; background: #fff; box-shadow: 0 0 0 3px rgba(240,146,170,.15); }
.import-editor-table td.optional-cell input:focus { border-color: #75cfb0; background: #fff; box-shadow: 0 0 0 3px rgba(117,207,176,.16); }
.import-editor-table tr.invalid td { background: #fff0f2; }
.import-editor-table tr.invalid input { border-color: #e57385; background: #fff; }
.entry-actions { width: 76px; text-align: center; white-space: nowrap; }
.delete-entry-row { min-height: 34px; padding: 0 10px; border: 1px solid #f1bbc6; border-radius: 9px; color: #ad4255; background: #fff; cursor: pointer; font-size: .65rem; font-weight: 900; }
.delete-entry-row:hover { background: #fff0f2; }
.import-editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); background: #fffafd; }
.import-editor-footer small { color: var(--ink-soft); font-size: .66rem; }
.import-editor-footer small.warning { color: #b33d4f; font-weight: 900; }
.add-entry-row { min-height: 35px; padding: 0 12px; border: 1px solid #8cd7bd; border-radius: 10px; color: #16735b; background: #ecfbf4; cursor: pointer; font-size: .67rem; font-weight: 900; }
.add-entry-row:hover { background: #ddf7ec; }
.import-report { min-height: 42px; padding: 10px 12px; border-radius: 11px; color: var(--ink-soft); background: #f0f2ee; font-size: .72rem; line-height: 1.5; }
.import-report.success { color: #09634f; background: #def5ec; }
.import-report.error { color: #922e38; background: #ffeaec; }
.word-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; padding: 22px 26px 8px; overflow-y: auto; }
.word-editor-grid .wide { grid-column: 1 / -1; }
.danger-link { border: 0; color: var(--danger); background: transparent; cursor: pointer; font-weight: 900; }

.record-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 18px 24px 0; }
.record-summary div { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: #fbf0f8; }
.record-summary span { display: block; color: var(--ink-soft); font-size: .66rem; }
.record-summary strong { display: block; margin-top: 3px; font: 900 1.45rem var(--font-display); }
.records-layout { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; flex: 1; padding: 19px 24px; overflow: hidden; }
.records-layout section { min-height: 0; display: flex; flex-direction: column; }
.records-layout h3 { margin: 0 0 10px; font: 900 1rem var(--font-display); }
.wrong-book-list, .history-list { min-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.wrong-row, .history-row { display: grid; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #e8ebe7; }
.wrong-row:last-child, .history-row:last-child { border-bottom: 0; }
.wrong-row { grid-template-columns: 1fr auto auto; }
.wrong-row strong, .history-row strong { display: block; font-size: .78rem; }
.wrong-row small, .history-row small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: .63rem; }
.wrong-row > span { padding: 4px 7px; border-radius: 8px; color: #913442; background: #ffeaed; font-size: .65rem; font-weight: 900; }
.history-row { grid-template-columns: 1fr auto; }
.history-row > span { color: var(--ink-soft); font-size: .68rem; text-align: right; }

.archive-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 23px; }
.archive-cards article { display: flex; flex-direction: column; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface-pink); }
.archive-cards article > span { color: var(--mint-dark); font-size: .65rem; font-weight: 900; letter-spacing: .08em; }
.archive-cards h3 { margin: 4px 0 7px; font: 900 1rem var(--font-display); }
.archive-cards p { flex: 1; margin: 0 0 14px; color: var(--ink-soft); font-size: .7rem; line-height: 1.55; }
.archive-cards button, .archive-cards label { display: grid; place-items: center; min-height: 39px; background: #fff; text-align: center; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 22px 26px; overflow-y: auto; }
.settings-grid label { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-pink); }
.settings-grid label > span { color: var(--ink-soft); font-size: .72rem; font-weight: 900; }
.settings-grid .toggle-row { grid-template-columns: 1fr auto; align-items: center; }
.settings-grid input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--mint-dark); }
.settings-grid input[type="range"] { width: 100%; }
.settings-grid output { color: var(--ink-soft); font-size: .7rem; }
.theme-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 22px 26px; overflow-y: auto; }
.theme-choice { min-height: 112px; display: grid; grid-template-columns: 48px 1fr; grid-template-rows: 1fr auto; column-gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: #fff; cursor: pointer; text-align: left; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.theme-choice:hover { transform: translateY(-2px); border-color: var(--mint-dark); }
.theme-choice.active { border-color: var(--mint-dark); box-shadow: 0 0 0 3px rgba(66,174,137,.17); }
.theme-choice i { grid-row: 1 / -1; width: 48px; height: 48px; align-self: center; border-radius: 15px; background: linear-gradient(135deg, #a976d9, #f38db2 58%, #ffd271); box-shadow: inset 0 0 0 3px rgba(255,255,255,.6); }
.theme-choice strong { align-self: end; font: 900 .88rem var(--font-display); }
.theme-choice small { align-self: start; margin-top: 4px; color: var(--ink-soft); font-size: .67rem; }
.theme-choice.peach i { background: linear-gradient(135deg, #ff91aa, #ffb09b 58%, #ffd273); }
.theme-choice.mint i { background: linear-gradient(135deg, #68d6c0, #91cdf4 58%, #ffd36e); }
.theme-choice.berry i { background: linear-gradient(135deg, #c466b5, #f27da8 58%, #ffbe72); }
.theme-choice.calm i { background: linear-gradient(135deg, #f1ffb8, #c7f2cf 58%, #9bdcf8); }
.theme-choice.contrast i { background: linear-gradient(135deg, #00d9a2, #31a6ff 58%, #ffd223); }
.speech-setting-note { display: grid; gap: 5px; padding: 12px; border: 1px solid rgba(66,174,137,.24); border-radius: 14px; background: #effcf6; }
.speech-setting-note > span { color: #25765f; font-size: .7rem; font-weight: 900; }
.speech-setting-note strong { color: var(--ink); font-size: .77rem; }
.speech-setting-note small { color: var(--ink-soft); font-size: .67rem; line-height: 1.5; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; padding: 22px; }
.help-grid article { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fbf0f8; }
.help-grid b { color: var(--coral); font: 900 1.25rem var(--font-display); }
.help-grid h3 { margin: 5px 0 6px; font-size: .9rem; }
.help-grid p { margin: 0; color: var(--ink-soft); font-size: .7rem; line-height: 1.55; }

.pause-dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 27px; background: transparent; }
.pause-card { display: grid; justify-items: center; gap: 10px; padding: 34px 42px 38px; border-radius: 27px; background: var(--paper-strong); box-shadow: 0 35px 90px rgba(120,71,126,.28); text-align: center; }
.pause-card .section-kicker { margin: 0; }
.pause-card h2 { margin: 0; font: 900 2rem/1.15 var(--font-display); }
.pause-card p { margin: 0 0 10px; color: var(--ink-soft); font-size: .9rem; line-height: 1.55; }
.pause-actions { width: min(100%, 270px); display: grid; gap: 10px; }
.pause-actions button { width: 100%; min-height: 48px; margin: 0; font-size: .9rem; }
.pause-actions .primary-action { padding-left: 19px; }
.pause-actions .secondary-action { display: grid; place-items: center; color: var(--ink); background: rgba(255,255,255,.85); }

.countdown-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(131,82,157,.55); backdrop-filter: blur(10px); }
.countdown-ring { width: 280px; height: 280px; display: grid; place-items: center; align-content: center; border: 2px solid rgba(255,255,255,.55); border-radius: 50%; color: #fff; background: radial-gradient(circle, rgba(255,207,112,.72), rgba(255,144,180,.86) 48%, rgba(166,114,219,.94)); box-shadow: 0 0 0 28px rgba(255,255,255,.12); }
.countdown-ring span { color: #fffbe5; font-size: .75rem; font-weight: 900; letter-spacing: .2em; }
.countdown-ring strong { margin: 2px 0; font: 900 8rem/1 var(--font-display); }
.countdown-ring small { color: rgba(255,255,255,.65); }
.orientation-overlay { position: fixed; inset: 0; z-index: 1800; display: grid; place-items: center; padding: 26px; color: #fff; background: rgba(137,82,162,.96); text-align: center; }
.orientation-overlay > div { width: min(420px, 90vw); }
.orientation-overlay span { display: block; color: var(--mint); font-size: 6rem; line-height: 1; }
.orientation-overlay h2 { margin: 8px 0; font: 900 2.2rem var(--font-display); }
.orientation-overlay p { color: rgba(255,255,255,.72); line-height: 1.7; }
.orientation-overlay button { min-height: 45px; margin-top: 10px; padding: 0 18px; border: 1px solid rgba(255,255,255,.35); border-radius: 13px; color: #fff; background: transparent; cursor: pointer; font-weight: 900; }
.toast { position: fixed; z-index: 2000; left: 50%; bottom: 24px; max-width: min(520px, calc(100vw - 30px)); padding: 11px 17px; border-radius: 13px; color: #fff; background: linear-gradient(135deg, #aa78db, #ff8eae); box-shadow: 0 14px 30px rgba(140,74,135,.25); font-size: .78rem; font-weight: 800; opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: .22s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

body.large-text { font-size: 112%; }
body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }

@media (max-width: 1180px) {
  .topbar { padding: 0 18px; }
  .save-status { display: none; }
  .home-screen { padding: 16px; }
  .mission-intro { grid-template-columns: minmax(300px, 1fr) minmax(270px, .9fr); gap: 0 28px; padding-inline: 46px; }
  .mission-mascot img { width: min(360px, 100%); }
  .setup-workspace { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
  .quick-action { min-width: 104px; padding-inline: 9px; }
  .quick-action b { font-size: .66rem; }
  .player-panel { padding: 12px; }
  .player-grid.duel .prompt-card p { display: none; }
}

@media (max-height: 820px) {
  .app-shell { min-height: calc(100svh - 16px); margin: 8px auto; }
  .app-shell:has(.home-screen.is-active) { height: calc(100svh - 16px); }
  .app-shell:has(.home-screen.is-active) main { height: calc(100% - 68px); }
  main { min-height: calc(100svh - 92px); }
  .topbar { height: 68px; }
  .home-screen { height: 100%; padding: 10px 16px; }
  .home-command-center { grid-template-rows: minmax(0, 1fr); }
  .mission-intro { padding-block: 18px 22px; }
  .mission-copy h1 { margin-block: 5px; font-size: clamp(1.8rem, 3vw, 2.75rem); }
  .mission-copy p { font-size: .76rem; }
  .mission-mascot { min-height: 0; }
  .mission-mascot img { max-height: min(55vh, 390px); }
  .dashboard-strip > div { min-height: 50px; padding: 7px 9px; }
  .dashboard-strip strong { font-size: 1.18rem; }
  .setup-card { padding: 10px 18px; }
  .setup-heading { margin-bottom: 6px; }
  .setup-heading h2 { font-size: 1.12rem; }
  .setup-field legend { margin-bottom: 4px; font-size: .66rem; }
  .unit-field { padding: 8px; border-radius: 14px; }
  .unit-picker span { min-height: 47px; grid-template-columns: 25px 1fr; padding: 6px 8px; }
  .unit-picker i { width: 25px; height: 25px; }
  .unit-picker b { font-size: .69rem; }
  .unit-picker small { font-size: .56rem; }
  .setup-workspace { gap: 8px; }
  .setup-grid { gap: 7px; }
  .setup-grid .setup-field { padding: 6px 8px; }
  .segmented span { min-height: 26px; font-size: .64rem; }
  select { height: 31px; font-size: .64rem; }
  .count-target input, .custom-time input { height: 29px; }
  .primary-action { min-height: 42px; margin-top: 7px; font-size: .82rem; }
  .primary-action i { width: 28px; height: 28px; }
  .game-launch-row { grid-template-columns: minmax(0, 1fr) 148px; gap: 8px; margin-top: 7px; }
  .classroom-password { min-height: 42px; padding-inline: 11px; }
  .game-screen { height: calc(100svh - 92px); padding-top: 10px; }
  .game-hud { min-height: 57px; padding-bottom: 8px; }
  .player-grid { height: calc(100% - 57px); }
  .player-panel { grid-template-rows: auto minmax(102px, auto) auto auto minmax(150px, 1fr); gap: 7px; padding: 10px 12px; }
  .player-panel.no-pronunciation { grid-template-rows: auto minmax(102px, auto) auto minmax(150px, 1fr); }
  .prompt-card { min-height: 112px; padding: 9px 14px; }
  .prompt-card h2 { font-size: clamp(1.75rem, 3.5vw, 3.1rem); }
  .prompt-card p { margin-top: 5px; }
  .letter-slot { height: clamp(39px, 5.5vh, 52px); }
  .key { height: clamp(35px, 5.2vh, 47px); }
  .keyboard-wrap { gap: 5px; }
  .pronunciation-card { min-height: 41px; padding: 6px 9px; }
  .pronunciation-card div span { font-size: .56rem; }
  .pronunciation-card div strong { font-size: .72rem; }
  .pronunciation-speaker { min-height: 29px; padding: 0 8px; }
  .timer strong { font-size: 1.65rem; }
}

@media (orientation: portrait) and (max-width: 900px) {
  .app-shell { width: calc(100% - 16px); margin: 8px; }
  .topbar { padding: 0 13px; }
  .brand small { display: none; }
  .icon-btn { padding: 0 11px; }
  .topbar-actions { gap: 6px; }
  .quick-action { min-width: 42px; width: 42px; padding: 0; align-items: center; }
  .quick-action span { font-size: 0; }
  .quick-action span::after { font-size: 1rem; }
  .archive-action span::after { content: "▣"; }
  .quick-action.fullscreen-board span::after { content: "⛶"; }
  .quick-action b { display: none; }
  .quick-action.single-action { min-width: 42px; width: 42px; padding: 0; font-size: 0; }
  .quick-action.single-action::after { font-size: 1rem; }
  .archive-action.single-action::after { content: "▣"; }
  .fullscreen-board.single-action::after { content: "⛶"; }
  .theme-menu-btn, .mission-settings-btn { min-width: 42px; width: 42px; padding: 0; font-size: 0; }
  .theme-menu-btn::after { content: "◉"; font-size: 1rem; }
  .mission-settings-btn::after { content: "⚙"; font-size: 1rem; }
  .home-screen { padding: 10px; }
  .mission-intro { grid-template-columns: minmax(0, 1fr) minmax(150px, .64fr); gap: 0 9px; padding: 18px 20px 20px; }
  .mission-copy h1 { font-size: clamp(1.45rem, 4.2vw, 2rem); }
  .mission-copy p { display: none; }
  .mission-copy { padding-bottom: 18px; }
  .mission-mascot img { width: min(220px, 100%); max-height: 220px; }
  .stage-entry .game-launch-row { width: min(330px, 100%); gap: 8px; }
  .stage-entry .game-launch-row .primary-action { width: min(210px, 100%); }
  .dashboard-strip { gap: 5px; }
  .dashboard-strip > div { min-height: 48px; padding: 7px 5px; border-radius: 11px; text-align: center; }
  .dashboard-strip span { font-size: .56rem; }
  .dashboard-strip strong { font-size: 1.1rem; }
  .setup-workspace { gap: 7px; }
  .unit-field { padding: 7px; }
  .game-launch-row { grid-template-columns: minmax(0, 1fr) 116px; }
  .classroom-password { gap: 7px; padding-inline: 9px; }
  .classroom-password > span { font-size: .65rem; }
  .classroom-password input { font-size: .67rem; }
  .game-screen { padding: 12px; }
  .player-grid.duel { gap: 8px; }
  .player-grid.duel .player-panel { padding: 9px 7px; }
  .player-grid.duel .stat-chips span { min-width: 48px; padding: 5px 4px; }
  .player-grid.duel .stat-chips span:nth-child(3) { display: none; }
  .player-grid.duel .prompt-card { padding-inline: 7px; }
  .player-grid.duel .letter-slots { gap: 3px; }
  .player-grid.duel .letter-slot { width: clamp(24px, 4vw, 34px); height: 40px; }
  .player-grid.duel .key { width: clamp(24px, 4vw, 34px); }
  .player-grid.duel .key.special { width: 48px; }
  .records-layout { grid-template-columns: 1fr; overflow-y: auto; }
  .archive-cards { grid-template-columns: 1fr; overflow-y: auto; }
  .settings-grid { grid-template-columns: 1fr; }
  .theme-choice-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .file-import-tools { flex-direction: column; }
  .import-sample-button { min-height: 38px; }
  .import-editor-head { display: block; }
  .import-editor-legend { margin-top: 10px; }
  .import-editor-footer { align-items: flex-start; flex-direction: column; }
  .add-entry-row { width: 100%; }
}

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

/* Candy spelling stage */
.game-screen {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 18px 28px 24px;
  background:
    radial-gradient(circle at 4% 82%, rgba(255,255,255,.96) 0 7%, transparent 7.3%),
    radial-gradient(circle at 96% 78%, rgba(255,255,255,.82) 0 8%, transparent 8.3%),
    radial-gradient(circle at 10% 18%, rgba(255,164,191,.23) 0 2px, transparent 2.5px),
    radial-gradient(circle at 88% 24%, rgba(255,214,104,.32) 0 3px, transparent 3.5px),
    linear-gradient(130deg, color-mix(in srgb, var(--coral) 30%, #fff 70%), color-mix(in srgb, var(--mint) 28%, #fff 72%) 52%, color-mix(in srgb, var(--sky) 31%, #fff 69%));
}
.game-screen::before,
.game-screen::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 999px;
  pointer-events: none;
}
.game-screen::before { width: 270px; height: 270px; left: -122px; bottom: -158px; background: rgba(255,243,187,.58); box-shadow: 206px 65px 0 -74px rgba(255,178,202,.33), 1260px -94px 0 -80px rgba(141,224,204,.22); }
.game-screen::after { width: 164px; height: 164px; right: -54px; top: 116px; border: 30px solid rgba(255,255,255,.43); }

.game-hud { min-height: 82px; position: relative; z-index: 1; grid-template-columns: 1fr auto 1fr; gap: 16px; padding: 24px 10px 9px; }
.mission-label { grid-column: 2; grid-row: 1; min-width: min(255px, 34vw); padding: 7px 27px 9px; border: 2px solid rgba(255,255,255,.82); border-radius: 43% 43% 38% 38% / 55% 55% 45% 45%; color: #fff; background: radial-gradient(circle at 50% 130%, rgba(255,213,109,.55), transparent 46%), linear-gradient(145deg, var(--coral), color-mix(in srgb, var(--coral) 74%, #b970d8)); box-shadow: 0 4px 0 rgba(184,81,120,.2), 0 0 0 4px rgba(255,244,198,.75); text-align: center; }
.mission-label span { color: rgba(255,255,255,.82); font-size: .58rem; letter-spacing: .14em; }
.mission-label strong { margin-top: 2px; color: #fff; font: 900 1.03rem/1.15 var(--font-display); }
.timer { grid-column: 1; grid-row: 1; justify-self: start; width: 152px; padding: 6px 11px; border: 1px solid rgba(255,255,255,.9); border-radius: 17px; background: rgba(255,255,255,.58); box-shadow: 0 4px 0 rgba(150,120,169,.1); }
.timer small { color: var(--ink-soft); font-size: .59rem; }
.timer strong { color: var(--ink); font-size: 1.25rem; }
.timer > div { height: 6px; margin-top: 5px; background: rgba(255,174,201,.35); }
.timer i { background: linear-gradient(90deg, var(--mint-dark), var(--amber)); }
.hud-actions { grid-column: 3; grid-row: 1; align-items: center; }
.hud-actions button { min-height: 34px; padding: 0 13px; border: 1px solid rgba(255,255,255,.9); border-radius: 12px; color: var(--ink); background: rgba(255,255,255,.64); box-shadow: 0 3px 0 rgba(161,109,151,.13); font-size: .68rem; font-weight: 900; }
.hud-actions button:last-child { color: #a84f70; background: rgba(255,235,242,.84); }

.player-grid { height: calc(100% - 82px); position: relative; z-index: 1; }
.player-panel {
  grid-template-rows: auto minmax(128px, auto) auto auto minmax(172px, 1fr);
  gap: 9px;
  padding: 16px clamp(18px, 3vw, 42px) 18px;
  border: 2px solid rgba(255,158,190,.82);
  border-radius: 31px;
  background: linear-gradient(180deg, rgba(255,255,255,.76), rgba(255,253,231,.77));
  box-shadow: 0 0 0 4px rgba(255,251,219,.94), 0 0 0 6px rgba(130,232,208,.48), 0 18px 30px rgba(157,98,147,.16);
}
.player-panel.no-pronunciation { grid-template-rows: auto minmax(128px, auto) auto minmax(172px, 1fr); }
.player-grid.duel .player-panel:nth-child(2) { background: linear-gradient(180deg, rgba(255,255,255,.76), rgba(247,242,255,.8)); }
.player-stats { min-height: 31px; }
.player-name { color: var(--ink); font-size: .78rem; }
.player-name i { width: 27px; height: 27px; border: 2px solid rgba(255,255,255,.82); border-radius: 50%; background: linear-gradient(145deg, var(--mint-dark), var(--mint)); box-shadow: 0 2px 0 rgba(53,145,116,.2); }
.player-panel:nth-child(2) .player-name i { background: linear-gradient(145deg, var(--coral), #ffb068); }
.stat-chips { gap: 5px; }
.stat-chips span { min-width: 58px; padding: 5px 7px; border: 1px solid rgba(255,255,255,.8); border-radius: 999px; color: var(--ink-soft); background: rgba(255,255,255,.73); box-shadow: 0 2px 0 rgba(174,132,171,.1); font-size: .61rem; }
.stat-chips b { color: var(--ink); font-size: .8rem; }

.prompt-card {
  width: min(535px, calc(100% - 86px));
  min-height: 128px;
  justify-self: center;
  margin: 5px auto 0;
  padding: 25px clamp(62px, 9vw, 108px) 15px 26px;
  border: 2px solid rgba(255,251,217,.95);
  border-radius: 44% 44% 38% 38% / 52% 52% 45% 45%;
  color: #fff;
  background: radial-gradient(circle at 50% 120%, rgba(255,216,120,.55), transparent 47%), linear-gradient(145deg, color-mix(in srgb, var(--coral) 90%, #fff), color-mix(in srgb, var(--coral) 63%, #b66fd4));
  box-shadow: 0 4px 0 rgba(176,77,117,.22), 0 0 0 4px rgba(255,242,193,.76);
}
.prompt-card::before { content: "✦"; position: absolute; z-index: 1; left: 16px; top: 20px; color: #fff4a8; font-size: 1.15rem; transform: rotate(-14deg); }
.prompt-card::after { width: 34px; height: 34px; right: 18px; top: 21px; border: 0; border-radius: 0; color: #fff7be; background: transparent; box-shadow: none; content: "✦"; font-size: 1.18rem; line-height: 1; transform: rotate(12deg); }
.prompt-card .pos { left: 50%; top: -14px; z-index: 3; padding: 4px 12px; border: 2px solid rgba(255,255,255,.78); border-radius: 999px; color: var(--ink); background: #fff9d8; box-shadow: 0 2px 0 rgba(169,109,137,.16); font-size: .59rem; transform: translateX(-50%); }
.prompt-card h2 { max-width: 100%; color: #fff; font-size: clamp(2rem, 4.2vw, 3.4rem); text-shadow: 0 2px 0 rgba(143,61,103,.15); }
.prompt-card p { color: rgba(255,255,255,.91); font-size: .66rem; }
.player-mascot { right: -58px; bottom: -26px; width: 144px; height: 144px; filter: drop-shadow(0 9px 8px rgba(78,60,102,.2)); }

.pronunciation-card { min-height: 44px; padding: 7px 12px; border: 2px solid rgba(255,221,177,.68); border-radius: 17px; background: rgba(255,255,255,.72); box-shadow: inset 0 -3px rgba(255,232,190,.23); }
.pronunciation-card.is-unlocked { background: linear-gradient(100deg, rgba(255,247,217,.88), rgba(224,255,236,.86)); }
.pronunciation-speaker { border-color: rgba(255,255,255,.9); border-radius: 999px; color: #3d8770; background: linear-gradient(145deg, #d6f6d4, #9de5c9); box-shadow: 0 2px 0 rgba(72,151,121,.18); }

.answer-zone { min-height: 92px; align-content: center; padding: 12px 18px 8px; border: 2px solid rgba(255,225,170,.86); border-radius: 21px; background: rgba(255,255,255,.82); box-shadow: inset 0 0 0 4px rgba(255,247,219,.58), 0 3px 0 rgba(158,122,157,.08); }
.letter-slots { gap: clamp(5px, .75vw, 10px); }
.letter-slot { border: 2px solid rgba(255,255,255,.86); border-bottom-color: rgba(212,155,189,.4); border-bottom-width: 5px; border-radius: 13px; color: var(--ink); background: linear-gradient(180deg, #fff7f8, #ffd9e5); box-shadow: 0 2px 0 rgba(175,110,151,.14); }
.letter-slots .letter-slot:nth-child(4n + 2) { background: linear-gradient(180deg, #f2fff8, #c7f2e3); }
.letter-slots .letter-slot:nth-child(4n + 3) { background: linear-gradient(180deg, #f3fbff, #cceaff); }
.letter-slots .letter-slot:nth-child(4n) { background: linear-gradient(180deg, #fffce8, #ffe598); }
.letter-slot.pending::after { width: 11px; bottom: 8px; background: rgba(143,108,147,.45); }
.letter-slot.given { color: var(--ink); border-style: solid; background: linear-gradient(180deg, #f5efff, #ddcff9); }
.letter-slot.filled { border-color: rgba(130,210,234,.72); border-bottom-color: rgba(79,175,199,.54); background: linear-gradient(180deg, #f5fbff, #cbeeff); }
.answer-zone.correct .letter-slot { border-color: rgba(124,214,171,.8); border-bottom-color: rgba(60,159,119,.6); background: linear-gradient(180deg, #f1fff5, #bcf1d1); }
.answer-zone.wrong .letter-slot:not(.given) { border-color: rgba(255,151,177,.72); border-bottom-color: rgba(214,78,119,.56); background: linear-gradient(180deg, #fff8fb, #ffd4e0); }
.answer-hint { min-height: 15px; color: var(--ink-soft); font-size: .62rem; }

.keyboard-wrap { gap: 7px; padding: 3px 0 0; }
.keyboard-row { gap: clamp(5px, .75vw, 10px); }
.key { border: 2px solid rgba(255,255,255,.88); border-bottom: 5px solid rgba(167,113,152,.27); border-radius: 12px; color: var(--ink); background: linear-gradient(180deg, #fff6fa, #ffbfce); box-shadow: 0 3px 0 rgba(169,107,150,.11); }
.keyboard-row:nth-child(1) .key:nth-child(3n + 2), .keyboard-row:nth-child(2) .key:nth-child(3n + 1), .keyboard-row:nth-child(3) .key:nth-child(4n) { background: linear-gradient(180deg, #f5fff8, #bdf1d7); }
.keyboard-row:nth-child(1) .key:nth-child(3n), .keyboard-row:nth-child(2) .key:nth-child(4n + 2), .keyboard-row:nth-child(3) .key:nth-child(4n + 2) { background: linear-gradient(180deg, #f2fbff, #bde8f8); }
.keyboard-row:nth-child(1) .key:nth-child(4n), .keyboard-row:nth-child(2) .key:nth-child(5n), .keyboard-row:nth-child(3) .key:nth-child(4n + 3) { background: linear-gradient(180deg, #fffdeb, #ffe78d); }
.key:hover:not(:disabled) { filter: saturate(1.12) brightness(1.02); transform: translateY(-1px); }
.key:active { transform: translateY(3px); border-bottom-width: 2px; }
.key.special { border-bottom-color: rgba(72,155,120,.3); color: #347761; background: linear-gradient(180deg, #e8fff2, #a6e8c4); }
.key.skip { border-bottom-color: rgba(198,75,112,.3); color: #a54967; background: linear-gradient(180deg, #fff1f5, #ff9bb8); }

.player-grid.duel .player-panel { padding: 12px 16px; }
.player-grid.duel .prompt-card { width: calc(100% - 54px); min-height: 110px; padding: 22px 50px 10px 18px; }
.player-grid.duel .prompt-card h2 { font-size: clamp(1.7rem, 3vw, 2.7rem); }
.player-grid.duel .player-mascot { right: -42px; bottom: -20px; width: 104px; height: 104px; }
.player-grid.duel .answer-zone { min-height: 74px; padding: 8px; }
.player-grid.duel .keyboard-row { gap: clamp(3px, .4vw, 6px); }
.player-grid.duel .key { border-bottom-width: 4px; }

@media (max-height: 820px) {
  .game-screen { padding: 12px 22px 16px; }
  .game-hud { min-height: 70px; padding-top: 19px; }
  .mission-label { min-width: 205px; padding: 5px 19px 7px; }
  .player-grid { height: calc(100% - 70px); }
  .player-panel { grid-template-rows: auto minmax(104px, auto) auto auto minmax(138px, 1fr); gap: 6px; padding: 11px clamp(14px, 3vw, 28px) 12px; }
  .player-panel.no-pronunciation { grid-template-rows: auto minmax(104px, auto) auto minmax(138px, 1fr); }
  .prompt-card { min-height: 104px; margin-top: 2px; padding: 20px 70px 9px 22px; }
  .player-mascot { width: 108px; height: 108px; }
  .answer-zone { min-height: 73px; padding: 7px 12px 5px; }
  .letter-slot { height: clamp(38px, 5vh, 48px); }
  .keyboard-wrap { gap: 4px; }
  .key { height: clamp(34px, 4.6vh, 43px); }
}

@media (orientation: portrait) and (max-width: 900px) {
  .game-screen { padding: 10px 12px 14px; }
  .game-hud { min-height: 62px; padding: 5px 3px 7px; }
  .mission-label { min-width: 135px; padding: 5px 11px; }
  .mission-label span { display: none; }
  .mission-label strong { font-size: .78rem; }
  .timer { width: 98px; padding: 4px 7px; }
  .timer small { display: none; }
  .timer strong { font-size: .96rem; }
  .hud-actions button { min-height: 30px; padding: 0 7px; font-size: .56rem; }
  .player-grid { height: calc(100% - 62px); }
  .player-panel { padding: 9px; }
  .prompt-card { width: calc(100% - 46px); }
}

/* Cloud prompt and underline-only spelling slots */
.prompt-card {
  min-height: 154px;
  margin-top: 0;
  padding: 39px clamp(78px, 11vw, 140px) 31px 34px;
  border: 0;
  border-radius: 0;
  background: radial-gradient(circle at 50% 120%, rgba(255,214,117,.57), transparent 48%), linear-gradient(145deg, color-mix(in srgb, var(--coral) 88%, #fff), color-mix(in srgb, var(--coral) 59%, #b66fd4));
  box-shadow: none;
  filter: drop-shadow(0 4px 0 rgba(255,246,194,.96)) drop-shadow(0 8px 0 rgba(177,90,127,.2));
  -webkit-mask: url("assets/game-cloud-mask.svg") center / 100% 100% no-repeat;
  mask: url("assets/game-cloud-mask.svg") center / 100% 100% no-repeat;
}
.prompt-card::before,
.prompt-card::after { display: none; }
.prompt-card .pos { top: 14px; }
.prompt-card h2 { position: relative; top: 7px; }
.prompt-card p { position: relative; top: 7px; }
.player-mascot { right: -34px; bottom: -18px; width: 126px; height: 126px; }

.answer-zone {
  min-height: 106px;
  padding: 12px 22px 8px;
  border-color: rgba(255,224,165,.86);
  background: rgba(255,255,255,.82);
}
.letter-slot,
.letter-slots .letter-slot:nth-child(4n + 2),
.letter-slots .letter-slot:nth-child(4n + 3),
.letter-slots .letter-slot:nth-child(4n),
.letter-slot.given,
.letter-slot.filled {
  width: clamp(35px, 4.1vw, 56px);
  height: clamp(43px, 5vw, 61px);
  border: 0;
  border-bottom: 3px solid rgba(143,108,147,.48);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  transform: none;
}
.letter-slot.pending::after { display: none; }
.letter-slot.given { border-bottom-style: dashed; color: var(--ink-soft); }
.letter-slot.filled { border-bottom-color: var(--mint-dark); color: var(--ink); }
.answer-zone.correct .letter-slot { border-color: transparent; border-bottom-color: var(--success); background: transparent; }
.answer-zone.wrong .letter-slot:not(.given) { border-color: transparent; border-bottom-color: var(--danger); background: transparent; }
.answer-zone.correct .letter-slot,
.answer-zone.wrong .letter-slot:not(.given) { border-bottom-width: 3px; }

@media (max-height: 820px) {
  .prompt-card { min-height: 126px; padding: 31px 84px 20px 28px; }
  .prompt-card .pos { top: 8px; }
  .player-mascot { width: 98px; height: 98px; right: -25px; }
  .answer-zone { min-height: 81px; padding: 7px 12px 5px; }
  .letter-slot,
  .letter-slots .letter-slot:nth-child(4n + 2),
  .letter-slots .letter-slot:nth-child(4n + 3),
  .letter-slots .letter-slot:nth-child(4n),
  .letter-slot.given,
  .letter-slot.filled { height: clamp(37px, 4.7vh, 48px); }
}

/* Give the solo word prompt the presence of a real stage cloud. */
.player-grid:not(.duel) .prompt-card {
  width: min(1180px, calc(100% - 72px));
  min-height: 226px;
  padding: 61px clamp(185px, 19vw, 270px) 42px clamp(42px, 7vw, 104px);
}
.player-grid:not(.duel) .prompt-card .pos { top: 24px; padding: 5px 15px; }
.player-grid:not(.duel) .prompt-card h2 { top: 10px; font-size: clamp(2.65rem, 5vw, 4.75rem); }
.player-grid:not(.duel) .prompt-card p { top: 12px; font-size: .76rem; }
.player-grid:not(.duel) .player-mascot { right: -6px; bottom: -43px; width: 205px; height: 205px; }

.player-grid.duel .prompt-card {
  width: calc(100% - 54px);
  min-height: 110px;
  padding: 25px 55px 13px 18px;
}
.player-grid.duel .prompt-card .pos { top: 8px; }
.player-grid.duel .player-mascot { right: -42px; bottom: -20px; width: 104px; height: 104px; }

@media (max-height: 820px) {
  .player-grid:not(.duel) .prompt-card { width: min(1040px, calc(100% - 52px)); min-height: 150px; padding: 39px 132px 23px 40px; }
  .player-grid:not(.duel) .prompt-card .pos { top: 13px; }
  .player-grid:not(.duel) .prompt-card h2 { font-size: clamp(2.05rem, 4.5vw, 3.55rem); }
  .player-grid:not(.duel) .player-mascot { right: -9px; bottom: -26px; width: 132px; height: 132px; }
}

@media (max-width: 900px) {
  .player-grid:not(.duel) .prompt-card { width: calc(100% - 34px); min-height: 164px; padding: 44px 104px 24px 28px; }
  .player-grid:not(.duel) .player-mascot { width: 118px; height: 118px; right: -15px; }
}

/* The top bar is status-only; the large cloud belongs to the current word below. */
.mission-label {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  min-width: 0;
  max-width: min(390px, 34vw);
  padding: 6px 12px 7px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255,255,255,.62);
  box-shadow: 0 3px 0 rgba(150,120,169,.1);
  text-align: left;
}
.mission-label span { color: var(--mint-dark); font-size: .57rem; }
.mission-label strong { overflow: hidden; margin-top: 2px; color: var(--ink); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.mission-label strong:empty { display: none; }
.mission-label > small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: .57rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer { grid-column: 2; }
.hud-actions { grid-column: 3; }

@media (orientation: portrait) and (max-width: 900px) {
  .mission-label { max-width: 120px; padding: 4px 7px; }
  .mission-label span { display: block; }
  .mission-label strong { font-size: .61rem; }
}

/* Keep the word and its cloud on the same visual centreline. */
.player-grid:not(.duel) .prompt-card {
  width: min(1220px, calc(100% - 52px));
  display: grid;
  place-items: center;
  align-content: center;
  padding: 54px 54px 34px;
  text-align: center;
}
.player-grid:not(.duel) .prompt-card h2,
.player-grid:not(.duel) .prompt-card p { width: 100%; max-width: 100%; left: auto; right: auto; }
.player-grid:not(.duel) .prompt-card h2 { top: 5px; }
.player-grid:not(.duel) .prompt-card p { top: 7px; }
.player-grid:not(.duel) .player-mascot {
  right: 26px;
  bottom: 18px;
  width: 132px;
  height: 132px;
  z-index: 5;
}
.player-grid.duel .player-mascot { right: 14px; bottom: 13px; width: 74px; height: 74px; z-index: 5; }

@media (max-height: 820px) {
  .player-grid:not(.duel) .prompt-card { width: min(1080px, calc(100% - 38px)); padding: 36px 38px 20px; }
  .player-grid:not(.duel) .player-mascot { right: 18px; bottom: 10px; width: 95px; height: 95px; }
}

@media (max-width: 900px) {
  .player-grid:not(.duel) .prompt-card { width: calc(100% - 24px); padding: 42px 28px 24px; }
  .player-grid:not(.duel) .player-mascot { right: 12px; bottom: 9px; width: 82px; height: 82px; }
}

/* Desktop browser windows lose height to the browser chrome and app header. */
@media (max-height: 1060px) and (min-width: 901px) {
  .game-screen { padding: 11px 24px 17px; }
  .game-hud { min-height: 67px; padding: 17px 8px 7px; }
  .mission-label { padding: 5px 10px 6px; }
  .timer { padding: 4px 9px; }
  .player-grid { height: calc(100% - 67px); }
  .player-panel { grid-template-rows: auto minmax(156px, 1fr) auto minmax(80px, auto) minmax(148px, 1.1fr); gap: 7px; padding: 11px clamp(16px, 2.7vw, 34px) 13px; }
  .player-panel.no-pronunciation { grid-template-rows: auto minmax(156px, 1fr) minmax(80px, auto) minmax(148px, 1.1fr); }
  .player-grid:not(.duel) .prompt-card { width: min(1060px, calc(100% - 42px)); min-height: 158px; padding: 39px 34px 22px; }
  .player-grid:not(.duel) .prompt-card .pos { top: 12px; }
  .player-grid:not(.duel) .prompt-card h2 { font-size: clamp(2.1rem, 4.35vw, 3.6rem); }
  .player-grid:not(.duel) .player-mascot { right: 20px; bottom: 12px; width: 103px; height: 103px; }
  .answer-zone { min-height: 80px; padding: 7px 15px 4px; }
  .letter-slot,
  .letter-slots .letter-slot:nth-child(4n + 2),
  .letter-slots .letter-slot:nth-child(4n + 3),
  .letter-slots .letter-slot:nth-child(4n),
  .letter-slot.given,
  .letter-slot.filled { height: clamp(36px, 4.6vh, 48px); }
  .keyboard-wrap { gap: 4px; }
  .keyboard-row { gap: clamp(4px, .62vw, 8px); }
  .key { height: clamp(34px, 4.5vh, 46px); }
}

/* Compact dual IPA display below the word cloud. */
.pronunciation-card,
.pronunciation-card.is-unlocked {
  width: fit-content;
  max-width: calc(100% - 28px);
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-self: center;
  gap: 9px;
  padding: 6px 8px 6px 12px;
  border: 2px solid rgba(255,221,177,.68);
  border-radius: 999px;
  background: linear-gradient(100deg, rgba(255,247,217,.92), rgba(224,255,236,.9));
  box-shadow: 0 3px 0 rgba(158,122,157,.08);
}
.pronunciation-pair { min-width: 0; display: flex; align-items: center; gap: 9px; }
.pronunciation-variant { min-width: 0; display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.pronunciation-variant + .pronunciation-variant { padding-left: 9px; border-left: 1px solid rgba(155,109,150,.24); }
.pronunciation-variant em { color: var(--ink-soft); font-size: .6rem; font-style: normal; font-weight: 900; }
.pronunciation-variant strong { color: var(--ink); font: 900 .76rem/1.2 var(--font-display); }
.pronunciation-speaker { width: 30px; min-height: 30px; justify-content: center; padding: 0; border-radius: 50%; }
.pronunciation-speaker span { display: none; }
.player-grid.duel .pronunciation-card,
.player-grid.duel .pronunciation-card.is-unlocked { grid-template-columns: none; gap: 6px; padding: 5px 7px 5px 9px; }
.player-grid.duel .pronunciation-pair { gap: 6px; }
.player-grid.duel .pronunciation-variant + .pronunciation-variant { padding-left: 6px; }
.player-grid.duel .pronunciation-variant em { font-size: .51rem; }
.player-grid.duel .pronunciation-variant strong { font-size: .61rem; }
.player-grid.duel .pronunciation-speaker { width: 26px; min-height: 26px; }

/* Match the compact cream-edged pink cloud reference for the word prompt. */
.prompt-card {
  -webkit-mask: none;
  mask: none;
  filter: none;
  background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MDAgMzAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj4KICA8ZGVmcz4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0iY2xvdWRQaW5rIiB4MT0iMTI1IiB5MT0iMjUiIHgyPSI0ODAiIHkyPSIyODIiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI2ZmOWRjNCIvPgogICAgICA8c3RvcCBvZmZzZXQ9Ii41NCIgc3RvcC1jb2xvcj0iI2Y1OGJhYiIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNlZjkxYTYiLz4KICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImNsb3VkSGlnaGxpZ2h0IiB4MT0iMzAwIiB5MT0iMjAiIHgyPSIzMDAiIHkyPSIyNzAiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI2ZmZiIgc3RvcC1vcGFjaXR5PSIuMjQiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIuNjIiIHN0b3AtY29sb3I9IiNmZmYiIHN0b3Atb3BhY2l0eT0iMCIvPgogICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDxmaWx0ZXIgaWQ9InNoYWRvdyIgeD0iLTEwJSIgeT0iLTE0JSIgd2lkdGg9IjEyMCUiIGhlaWdodD0iMTM1JSI+CiAgICAgIDxmZURyb3BTaGFkb3cgZHg9IjAiIGR5PSI3IiBzdGREZXZpYXRpb249IjQiIGZsb29kLWNvbG9yPSIjYjg2OThkIiBmbG9vZC1vcGFjaXR5PSIuMjIiLz4KICAgIDwvZmlsdGVyPgogIDwvZGVmcz4KICA8cGF0aCBkPSJNODIgMjYwQzQ1IDI2MCAyMyAyMzIgMzEgMTk3YzgtMzMgMzktNTUgNzUtNTFDMTA5IDkyIDE1MSA0NyAyMTEgNDdjMzcgMCA3MCAxNiA5MiA0MiAyNC0yOCA1OC00NCA5Ni00MiA1NSAyIDk4IDQyIDEwNCA5NCA0Mi0zIDc1IDIyIDc4IDU3IDMgMzUtMjQgNjItNjQgNjJIODJaIiBmaWxsPSIjZmZmNGM4IiBmaWx0ZXI9InVybCgjc2hhZG93KSIvPgogIDxwYXRoIGQ9Ik04MiAyNTRDNDggMjU0IDMwIDIyOSAzNyAxOTljNy0yOCAzNi00NiA3MC00MkMxMTEgMTAyIDE1MyA1OSAyMTEgNTljMzcgMCA2OSAxNyA5MSA0NCAyNC0zMCA1OC00NiA5Ni00NCA1MiAyIDkxIDQwIDk1IDg5IDM5LTMgNjggMjAgNzEgNTEgMyAzMS0yMSA1NS01OCA1NUg4MloiIGZpbGw9InVybCgjY2xvdWRQaW5rKSIgc3Ryb2tlPSIjZjJjOThkIiBzdHJva2Utd2lkdGg9IjQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KICA8cGF0aCBkPSJNMTA0IDE1MUMxMTQgMTAyIDE1NCA3MCAyMTEgNzBjMzYgMCA2NyAxNyA4OSA0NCAyNS0yOCA1OS00MyA5NS00MSA0NSAyIDgwIDMwIDkxIDY5LTIyLTE3LTUwLTI1LTgwLTIzLTQxIDMtNzQgMjMtOTkgNTMtMjItMzAtNTctNDktOTctNDktNDAgMC03NiAxOC0xMDYgMjhaIiBmaWxsPSJ1cmwoI2Nsb3VkSGlnaGxpZ2h0KSIvPgo8L3N2Zz4K") center / 100% 100% no-repeat;
}
.player-grid:not(.duel) .prompt-card {
  width: min(590px, calc(100% - 48px));
  min-height: 252px;
  padding: 74px 84px 46px;
}
.player-grid:not(.duel) .prompt-card .pos { top: 23px; }
.player-grid:not(.duel) .prompt-card h2 { top: 4px; font-size: clamp(2.45rem, 4.25vw, 4.05rem); }
.player-grid:not(.duel) .prompt-card p { top: 8px; }
.player-grid.duel .prompt-card {
  width: min(390px, calc(100% - 34px));
  min-height: 172px;
  padding: 49px 55px 29px;
}
.player-grid.duel .prompt-card .pos { top: 14px; }
.player-grid.duel .prompt-card h2 { font-size: clamp(1.75rem, 3vw, 2.45rem); }
@media (max-height: 820px) {
  .player-grid:not(.duel) .prompt-card { width: min(490px, calc(100% - 38px)); min-height: 195px; padding: 55px 68px 32px; }
  .player-grid:not(.duel) .prompt-card .pos { top: 15px; }
  .player-grid:not(.duel) .prompt-card h2 { font-size: clamp(2rem, 3.9vw, 3.2rem); }
  .player-grid.duel .prompt-card { min-height: 134px; padding: 39px 43px 21px; }
}
@media (max-width: 900px) {
  .player-grid:not(.duel) .prompt-card { width: min(470px, calc(100% - 26px)); min-height: 190px; padding: 54px 54px 30px; }
}

/* Browser chrome reduces the vertical room: keep all practice elements separate. */
@media (max-height: 1060px) and (min-width: 901px) {
  .player-panel {
    grid-template-rows: auto minmax(182px, auto) auto minmax(80px, auto) minmax(148px, 1.1fr);
  }
  .player-panel.no-pronunciation {
    grid-template-rows: auto minmax(182px, auto) minmax(80px, auto) minmax(148px, 1.1fr);
  }
  .player-grid:not(.duel) .prompt-card {
    width: min(510px, calc(100% - 42px));
    min-height: 182px;
    padding: 52px 68px 27px;
  }
  .player-grid:not(.duel) .prompt-card .pos { top: 14px; }
  .player-grid:not(.duel) .prompt-card h2 { top: 2px; font-size: clamp(2rem, 3.8vw, 3.2rem); }
  .player-grid:not(.duel) .prompt-card p { top: 4px; }
  .player-grid:not(.duel) .player-mascot { width: 103px; height: 103px; right: 20px; bottom: 12px; }
}

/* In true fullscreen, group the answer and keyboard around the word instead of pinning the keys to the bottom edge. */
:fullscreen .player-grid:not(.duel) .player-panel {
  grid-template-rows: auto minmax(230px, auto) auto minmax(96px, auto) minmax(0, 230px);
  align-content: start;
  padding-top: 24px;
}
:fullscreen .player-grid:not(.duel) .keyboard-wrap {
  justify-content: center;
  padding-top: 0;
}

/* Candy-style mission report board. */
.results-screen {
  min-height: calc(100svh - 109px);
  padding: clamp(18px, 2.4vw, 34px);
  background: radial-gradient(circle at 8% 20%, rgba(255,205,226,.58), transparent 23%), radial-gradient(circle at 93% 31%, rgba(169,242,220,.48), transparent 27%), linear-gradient(135deg, #fff7f8, #f5fffb 52%, #fffde2);
}
.results-board { width: min(1160px, 100%); margin: 0 auto; padding: clamp(14px, 2vw, 25px); border: 2px solid rgba(255,255,255,.82); border-radius: 31px; background: rgba(255,255,255,.42); box-shadow: 0 16px 38px rgba(196,112,152,.14); }
.results-hero {
  min-height: 206px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 150px minmax(170px, .7fr);
  align-items: center;
  gap: 12px;
  overflow: hidden;
  position: relative;
  padding: 24px clamp(25px, 4vw, 48px);
  border: 0;
  border-radius: 25px;
  color: #754557;
  background: radial-gradient(circle at 14% 83%, rgba(255,253,196,.76), transparent 22%), radial-gradient(circle at 78% 18%, rgba(255,255,255,.7), transparent 25%), linear-gradient(112deg, #ffdbe7, #fff0e8 44%, #bdf5d8 100%);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.66), 0 6px 0 rgba(235,167,190,.19);
}
.results-hero::before,
.results-hero::after { content: "✦"; position: absolute; z-index: 0; color: #fff5a1; font-size: 1.8rem; text-shadow: 18px 31px 0 #ffc1d8, 54px -16px 0 #fff; }
.results-hero::before { right: 34px; top: 22px; }
.results-hero::after { left: 46%; bottom: 19px; color: #ffadcf; font-size: 1.15rem; text-shadow: 38px -30px 0 #fff5a1; }
.results-copy { position: relative; z-index: 1; }
.results-hero .section-kicker { display: inline-block; padding: 5px 10px; border-radius: 999px; color: #a74d70; background: rgba(255,255,255,.62); font-size: .58rem; letter-spacing: .1em; }
.results-hero h2 { margin: 10px 0 5px; color: #754557; font-size: clamp(2rem, 4vw, 3.2rem); text-shadow: 0 3px 0 rgba(255,255,255,.68); }
.results-hero p { max-width: 360px; color: #965d70; font-size: .72rem; font-weight: 800; }
.completion-medal { width: 114px; height: 114px; display: grid; place-content: center; position: relative; z-index: 1; border: 5px solid #fff5bf; border-radius: 50%; color: #fff; background: radial-gradient(circle at 50% 40%, #ffcf8d 0 7%, transparent 8%), linear-gradient(145deg, #ffb64d, #ff7e9d 62%, #f3a2d2); box-shadow: 0 0 0 4px #f5a44c, 0 9px 0 rgba(205,103,106,.22); text-align: center; transform: rotate(-4deg); }
.completion-medal::before,
.completion-medal::after { content: ""; position: absolute; z-index: -1; bottom: -25px; width: 31px; height: 43px; background: linear-gradient(#ff839d, #ee638c); }
.completion-medal::before { left: 18px; transform: rotate(24deg); }
.completion-medal::after { right: 18px; transform: rotate(-24deg); }
.completion-medal i { color: #fff6c5; font-style: normal; font-size: 1.05rem; line-height: 1; }
.completion-medal span { margin-top: 4px; color: #fff9df; font-size: .54rem; font-weight: 900; letter-spacing: .1em; }
.completion-medal b { font: 900 .74rem/1 var(--font-display); letter-spacing: .04em; }
.results-hero img { width: min(220px, 100%); height: 185px; justify-self: center; object-fit: contain; object-position: center 60%; transform: translateY(14px); filter: drop-shadow(0 12px 12px rgba(110,91,117,.17)); }
.result-mascot { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 10px; position: relative; z-index: 1; }
.result-mascot-message {
  width: 158px;
  flex: 0 0 158px;
  position: relative;
  margin: 0;
  padding: 10px 11px;
  border: 2px solid rgba(255,255,255,.88);
  border-radius: 16px 16px 5px 16px;
  color: #8f506b;
  background: rgba(255,253,255,.9);
  box-shadow: 0 4px 0 rgba(176,93,132,.14), 0 9px 16px rgba(135,94,132,.09);
  font-size: .68rem;
  font-weight: 900;
  line-height: 1.48;
  text-align: center;
}
.result-mascot-message::after { content: ""; width: 12px; height: 12px; position: absolute; right: -8px; bottom: 21px; border-top: 2px solid rgba(255,255,255,.88); border-right: 2px solid rgba(255,255,255,.88); background: inherit; transform: rotate(45deg); }
.result-mascot-message[data-tone="super"] { color: #9b6230; background: linear-gradient(145deg, #fff8bb, #ffe49a); }
.result-mascot-message[data-tone="great"] { color: #9a4c70; background: linear-gradient(145deg, #ffe4f0, #ffd1e1); }
.result-mascot-message[data-tone="growing"] { color: #347b67; background: linear-gradient(145deg, #dcfaee, #baf0d8); }
.result-mascot-message[data-tone="review"] { color: #8c5870; background: linear-gradient(145deg, #f7eaff, #eddcfc); }
.result-mascot img { width: 164px; height: 185px; flex: 0 0 164px; margin: 0; transform: translateY(14px); }
.result-player-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 15px 0; }
.result-stat-card { min-height: 74px; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 9px; padding: 9px 12px; overflow: hidden; position: relative; border: 2px solid rgba(255,255,255,.86); border-radius: 16px; background: linear-gradient(145deg, #ffd4e2, #ffb6cc); box-shadow: 0 4px 0 rgba(201,104,139,.16); }
.result-stat-card > i { width: 37px; height: 37px; display: grid; place-items: center; border: 3px solid rgba(255,255,255,.84); border-radius: 50%; color: #ff9bba; background: #fff8e9; font-style: normal; font-size: 1.08rem; }
.result-stat-card span { display: block; color: #92506b; font-size: .62rem; font-weight: 900; }
.result-stat-card strong { display: block; margin-top: 2px; color: #774455; font: 900 1.38rem/1 var(--font-display); }
.result-stat-card > b { align-self: start; color: #fff6a3; font-size: 1.08rem; }
.result-stat-card.is-correct { background: linear-gradient(145deg, #ccf8e8, #a6ebcf); }
.result-stat-card.is-correct > i { color: #67c7a7; }
.result-stat-card.is-skip { background: linear-gradient(145deg, #f2dfff, #d9c5fb); }
.result-stat-card.is-skip > i { color: #b08bdb; }
.result-stat-card.is-accuracy { background: linear-gradient(145deg, #fff1ab, #ffe08e); }
.result-stat-card.is-accuracy > i { color: #f2af5f; }
.duel-result-card { padding: 14px; border: 2px solid rgba(255,255,255,.8); border-radius: 18px; background: rgba(255,255,255,.78); }
.review-panel { padding: 13px 18px; border: 2px solid rgba(255,255,255,.82); border-radius: 18px; background: linear-gradient(110deg, #d5f9de, #b8f0d4); box-shadow: 0 4px 0 rgba(81,177,142,.14); }
.review-heading { align-items: center; }
.review-heading h3 { color: #387a68; font-size: 1.05rem; }
.review-heading .section-kicker { color: #4fa98e; font-size: .56rem; }
.review-heading > span { padding: 5px 9px; border-radius: 999px; color: #3b876f; background: rgba(255,255,255,.62); }
.review-list { max-height: 108px; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); margin-top: 9px; overflow: auto; }
.review-word { padding: 7px 9px; border-color: rgba(74,173,137,.23); background: rgba(255,255,255,.7); }
.empty-state { padding: 10px; border-color: rgba(73,165,132,.35); color: #448774; background: rgba(255,255,255,.38); }
.result-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); justify-content: stretch; gap: 11px; margin-top: 15px; }
.result-actions > button { width: 100%; min-height: 46px; justify-content: center; margin: 0; border: 2px solid rgba(255,255,255,.85); border-radius: 999px; box-shadow: 0 4px 0 rgba(183,111,145,.16); font-size: .76rem; }
#result-home-btn { color: #a65574; background: linear-gradient(#ffdce7, #ffb6cc); }
#retry-wrong-btn { color: #368169; background: linear-gradient(#d9faeb, #a8e9cd); }
.result-actions .primary-action { color: #845239; background: linear-gradient(105deg, #fff0a4, #ffcf73); box-shadow: 0 4px 0 rgba(202,144,77,.19); }
.result-actions .primary-action i { display: none; }
@media (max-width: 760px) {
  .results-hero { grid-template-columns: 1fr 92px; min-height: 180px; padding: 20px; }
  .completion-medal { width: 82px; height: 82px; border-width: 4px; }
  .completion-medal span { font-size: .44rem; }.completion-medal b { font-size: .55rem; }.completion-medal::before, .completion-medal::after { bottom: -18px; width: 22px; height: 31px; }
  .result-mascot { display: none; }
  .result-player-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-actions { grid-template-columns: 1fr; }
}

.classroom-password.is-verified { justify-content: center; border-color: rgba(75,173,137,.45); background: linear-gradient(100deg, rgba(212,250,232,.94), rgba(255,255,255,.94)); }
.classroom-password.is-verified > span,
.classroom-password.is-verified input { display: none; }
.classroom-password.is-verified::after { content: "本次会话已验证"; color: #34816a; font-size: .75rem; font-weight: 900; }

/* Per-word clock: the game header keeps only the play controls. */
.game-hud {
  min-height: 50px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 8px 8px 4px;
}
.game-hud .hud-actions {
  display: flex;
  grid-column: auto;
  grid-row: auto;
  margin-left: auto;
  gap: 8px;
}
.player-grid { height: calc(100% - 50px); }

/* The clock is deliberately part of the word cloud, rather than a second HUD. */
.prompt-card .word-timer {
  --timer-progress: 100%;
  width: 118px;
  height: 118px;
  display: grid;
  place-content: center;
  gap: 2px;
  position: absolute;
  z-index: 4;
  top: 50%;
  right: -142px;
  box-sizing: border-box;
  overflow: visible;
  padding: 7px;
  border: 3px solid rgba(255,255,255,.88);
  border-radius: 50%;
  color: #644479;
  background: conic-gradient(from -90deg, #62cbaa 0 var(--timer-progress), #f8dce7 var(--timer-progress) 100%);
  box-shadow: 0 4px 0 rgba(126,83,123,.21), 0 10px 17px rgba(116,79,114,.16);
  font-variant-numeric: tabular-nums;
  isolation: isolate;
  transform: translateY(-50%) rotate(4deg);
}
/* Let the clock sit beside the cloud instead of covering its right edge. */
.player-grid:not(.duel) .prompt-card { overflow: visible; }
.prompt-card .word-timer::before,
.prompt-card .word-timer::after {
  content: "";
  width: 34px;
  height: 17px;
  position: absolute;
  z-index: 0;
  top: -8px;
  border: 4px solid #ffd875;
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: #fff3b8;
  box-shadow: inset 0 3px rgba(255,255,255,.58);
}
.prompt-card .word-timer::before { left: 9px; transform: rotate(-29deg); }
.prompt-card .word-timer::after { right: 9px; transform: rotate(29deg); }
.word-timer-clock {
  position: absolute;
  z-index: 1;
  inset: 7px;
  border: 2px solid rgba(255,255,255,.76);
  border-radius: inherit;
  background: linear-gradient(145deg, #fffdf9, #fff5e8);
  box-shadow: inset 0 -3px rgba(246,203,184,.3);
}
.word-timer-clock > i,
.word-timer-clock > i::before,
.word-timer-clock > i::after { position: absolute; display: block; content: ""; }
.word-timer-clock > i { width: 6px; height: 6px; left: 50%; top: 50%; border-radius: 50%; background: #ef8eae; transform: translate(-50%, -50%); }
.word-timer-clock > i::before { width: 3px; height: 22px; left: 2px; bottom: 3px; border-radius: 9px; background: #ef8eae; transform-origin: 50% 100%; transform: rotate(32deg); }
.word-timer-clock > i::after { width: 3px; height: 17px; left: 2px; bottom: 2px; border-radius: 9px; background: #7acfb6; transform-origin: 50% 100%; transform: rotate(-68deg); }
.word-timer-label,
.word-timer strong { position: relative; z-index: 2; text-align: center; }
.word-timer strong { order: 1; margin-top: 2px; color: #624375; font: 900 1.25rem/1 var(--font-display); letter-spacing: .03em; }
.word-timer-label { order: 2; margin-top: 1px; color: #8f6681; font-size: .58rem; font-weight: 900; letter-spacing: .04em; }
.word-timer.is-elapsed { background: conic-gradient(from -90deg, #ffb3c9 0 45%, #f9cf7b 45% 68%, #8ee0c2 68% 100%); }
.word-timer.is-elapsed .word-timer-label { color: #a85576; }
.word-timer.is-low { background: conic-gradient(from -90deg, #ff9a83 0 var(--timer-progress), #f8dce7 var(--timer-progress) 100%); animation: word-timer-alert .8s ease-in-out infinite alternate; }
.word-timer.is-low strong { color: #ca5d60; }
@keyframes word-timer-alert { to { transform: translateY(-50%) rotate(4deg) scale(1.045); } }

/* Settings use the same compact controls and explain exactly what the timer does. */
.timer-mode-picker { margin-bottom: 8px; }
.question-time-row { align-items: center; }
.question-time-row > select { min-width: 0; flex: 1; }
.question-time-row > select:disabled { cursor: not-allowed; opacity: .5; }
.question-timer-help { display: block; min-height: 1.35em; margin-top: 7px; color: var(--ink-soft); font-size: .64rem; font-weight: 700; line-height: 1.4; }
.setup-grid .count-target { width: 100%; min-height: 36px; }
.setup-grid .count-target input { width: 100%; }

@media (max-height: 820px) {
  .game-hud { min-height: 44px; padding-top: 6px; padding-bottom: 3px; }
  .player-grid { height: calc(100% - 44px); }
  .prompt-card .word-timer { width: 92px; height: 92px; right: -108px; padding: 6px; }
  .prompt-card .word-timer::before, .prompt-card .word-timer::after { width: 27px; height: 14px; top: -7px; border-width: 3px; }
  .word-timer-clock { inset: 5px; }
  .word-timer-clock > i::before { height: 17px; }
  .word-timer-clock > i::after { height: 13px; }
  .word-timer-label { margin-top: 0; font-size: .51rem; }
  .word-timer strong { font-size: 1rem; }
}
@media (max-width: 900px) {
  .game-hud { min-height: 42px; padding: 5px 3px 2px; }
  .player-grid { height: calc(100% - 42px); }
  .prompt-card .word-timer { width: 82px; height: 82px; right: -94px; }
  .word-timer-label { font-size: .47rem; }
  .word-timer strong { font-size: .9rem; }
}
.player-grid.duel .prompt-card .word-timer { width: 68px; height: 68px; right: -46px; padding: 4px; }
.player-grid.duel .word-timer::before, .player-grid.duel .word-timer::after { width: 21px; height: 11px; top: -6px; border-width: 3px; }
.player-grid.duel .word-timer-clock { inset: 4px; }
.player-grid.duel .word-timer-clock > i::before { height: 12px; }
.player-grid.duel .word-timer-clock > i::after { height: 9px; }
.player-grid.duel .word-timer-label { margin-top: 0; font-size: .42rem; }
.player-grid.duel .word-timer strong { font-size: .76rem; }

/* A gentle, short review moment after the per-word timer reaches zero. */
.mascot-message {
  max-width: 174px;
  position: absolute;
  z-index: 6;
  right: 112px;
  bottom: 112px;
  margin: 0;
  padding: 9px 12px;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 16px 16px 5px 16px;
  color: #94556f;
  background: linear-gradient(145deg, #fffafd, #ffe7f0);
  box-shadow: 0 4px 0 rgba(176,93,132,.16), 0 9px 18px rgba(132,90,130,.12);
  font-size: .68rem;
  font-weight: 900;
  line-height: 1.45;
  text-align: center;
  animation: mascot-message-pop .28s ease-out both;
}
.mascot-message::after {
  content: "";
  width: 13px;
  height: 13px;
  position: absolute;
  right: 18px;
  bottom: -8px;
  border-right: 2px solid rgba(255,255,255,.9);
  border-bottom: 2px solid rgba(255,255,255,.9);
  background: #ffe9f1;
  transform: rotate(45deg);
}
.mascot-message p { margin: 0; }
.mascot-message button {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 7px;
  padding: 0 9px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 999px;
  color: #9b4e6e;
  background: linear-gradient(100deg, #ffd4e3, #ffc07f);
  box-shadow: 0 2px 0 rgba(181,87,124,.17);
  font-size: .57rem;
  font-weight: 900;
}
.mascot-message button:hover { filter: saturate(1.08); transform: translateY(-1px); }
.mascot-message button i { font-style: normal; font-size: .82rem; }
@keyframes mascot-message-pop { from { opacity: 0; transform: translateY(7px) scale(.92); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-height: 820px) {
  .mascot-message { right: 90px; bottom: 91px; padding: 7px 9px; border-radius: 13px 13px 4px 13px; font-size: .57rem; }
  .mascot-message button { min-height: 23px; margin-top: 4px; padding: 0 7px; font-size: .5rem; }
}
@media (max-width: 900px) {
  .mascot-message { right: 77px; bottom: 82px; max-width: 142px; padding: 6px 8px; font-size: .54rem; }
}
.player-grid.duel .mascot-message { right: 60px; bottom: 63px; max-width: 117px; padding: 5px 7px; border-radius: 11px 11px 3px 11px; font-size: .47rem; }
.player-grid.duel .mascot-message button { min-height: 20px; margin-top: 3px; padding: 0 6px; font-size: .42rem; }
