:root {
  color: #30352f;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --background: #faf9f5;
  --foreground: #30352f;
  --card: #ffffff;
  --primary: #386c56;
  --primary-deep: #28513f;
  --primary-soft: #e3f0e9;
  --accent: #c96442;
  --accent-deep: #a34a2a;
  --accent-soft: #f6ded6;
  --yellow: #d6a33d;
  --yellow-soft: #fff2cc;
  --blue: #4e7fa3;
  --blue-soft: #e6f0f7;
  --purple: #80639a;
  --purple-soft: #eee7f4;
  --danger: #cc4e45;
  --danger-soft: #f9dedb;
  --muted: #7d817b;
  --secondary: #ece9df;
  --border: #dcd9cf;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; letter-spacing: 0; }
html, body, #app { width: 100%; min-width: 320px; min-height: 100%; margin: 0; }
body { background: var(--background); overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid rgb(56 108 86 / 24%);
  outline-offset: 3px;
}

.app-shell { height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--background); }
.app-header {
  z-index: 20; flex: 0 0 76px; height: 76px; display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 76px; align-items: center; gap: 12px;
  padding: 0 20px; border-bottom: 1px solid rgb(220 217 207 / 82%); background: rgb(250 249 245 / 96%);
  box-shadow: 0 8px 24px rgb(40 42 36 / 4%);
}
.module-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.home-link { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 36px; border-radius: 6px; color: var(--foreground); font-size: 25px; text-decoration: none; }
.brand-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-copy small { color: var(--primary); font-size: 9px; font-weight: 900; }
.brand-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.demo-tabs { width: 100%; min-width: 0; display: flex; justify-content: safe center; align-items: center; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.demo-tabs::-webkit-scrollbar { display: none; }
.demo-tabs button {
  min-width: 116px; height: 48px; display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  padding: 0 12px; border: 0; border-radius: 24px; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 900; white-space: nowrap; cursor: pointer;
}
.demo-tabs button:hover { color: var(--foreground); background: var(--secondary); }
.demo-tabs button.active { color: white; background: var(--primary); box-shadow: 0 8px 18px rgb(56 108 86 / 20%); }
.nav-number { opacity: .68; font-size: 10px; font-variant-numeric: tabular-nums; }
.lab-status { display: flex; justify-content: flex-end; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 900; }
.lab-status i { width: 8px; height: 8px; border-radius: 50%; background: #43a47f; box-shadow: 0 0 0 5px rgb(67 164 127 / 12%); }

.feature-page { width: min(100%, 1480px); height: 100%; min-height: 0; margin: 0 auto; padding: 14px 22px 18px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.feature-heading { flex: none; min-height: 64px; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.heading-copy { min-width: 0; }
.eyebrow { color: var(--primary); font-size: 10px; font-weight: 900; }
.feature-heading h1 { margin: 4px 0 2px; font-size: 25px; line-height: 1.15; }
.feature-heading p { max-width: 840px; margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.5; }
.feature-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; flex: none; }
.tool-button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 21px; cursor: pointer; }
.tool-button:hover { color: var(--primary); background: white; }

.guided-layout { flex: 1; min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 12px; }
.guided-layout.complete { grid-template-columns: minmax(0, 1fr); }
.workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.panel { border: 1px solid var(--border); border-radius: 8px; background: var(--card); box-shadow: 0 7px 20px rgb(40 42 36 / 5%); }
.status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 4px; background: var(--primary-soft); color: var(--primary-deep); font-size: 9px; font-weight: 900; }
.status-chip.orange { background: var(--accent-soft); color: var(--accent-deep); }
.status-chip.blue { background: var(--blue-soft); color: #345f80; }
.status-chip.yellow { background: var(--yellow-soft); color: #765a1d; }
.status-chip.purple { background: var(--purple-soft); color: #604775; }
.action-button {
  min-height: 42px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; padding: 8px 16px;
  border: 1px solid transparent; border-bottom-width: 4px; border-radius: 9px; font-size: 12px; font-weight: 900; cursor: pointer;
}
.action-button.primary { color: white; border-color: var(--primary-deep); background: var(--primary); box-shadow: 0 8px 17px rgb(56 108 86 / 17%); }
.action-button.accent { color: white; border-color: var(--accent-deep); background: var(--accent); box-shadow: 0 8px 17px rgb(201 100 66 / 17%); }
.action-button.secondary { border-color: #c4c0b6; background: white; }
.action-button:disabled { opacity: .38; cursor: default; }
.action-button:active:not(:disabled) { border-bottom-width: 1px; transform: translateY(3px); }
.text-button { min-height: 34px; border: 0; background: transparent; color: var(--primary-deep); font-size: 11px; font-weight: 900; cursor: pointer; }
.segmented { display: flex; align-items: center; gap: 3px; padding: 4px; border-radius: 7px; background: var(--secondary); width: fit-content; }
.segmented button { min-height: 32px; padding: 0 11px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 900; cursor: pointer; }
.segmented button.active { color: var(--foreground); background: white; box-shadow: 0 2px 7px rgb(40 42 36 / 10%); }

.duel-strip { min-height: 56px; padding: 9px 13px; display: grid; grid-template-columns: minmax(130px, 1fr) auto minmax(130px, 1fr); align-items: center; gap: 14px; }
.fighter { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.fighter.opponent { direction: rtl; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary-deep); font-size: 12px; font-weight: 950; }
.opponent .avatar { background: var(--accent-soft); color: var(--accent-deep); }
.fighter-copy { min-width: 0; direction: ltr; }
.fighter-copy div { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 9px; font-weight: 850; }
.health-track { height: 7px; overflow: hidden; border-radius: 4px; background: var(--secondary); }
.health-track i { height: 100%; display: block; border-radius: inherit; background: var(--primary); transition: width .25s; }
.opponent .health-track i { margin-left: auto; background: var(--accent); }
.duel-clock { text-align: center; }
.duel-clock span { display: block; color: var(--muted); font-size: 8px; font-weight: 900; }
.duel-clock strong { font-family: ui-monospace, monospace; font-size: 17px; }

.game-grid { flex: 1; min-height: 470px; display: grid; grid-template-columns: minmax(360px, .95fr) minmax(310px, 1.05fr); gap: 10px; }
.board-panel { min-width: 0; padding: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.board-toolbar { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.board-toolbar > div { display: flex; align-items: center; gap: 7px; }
.event-line { min-height: 28px; width: 100%; display: flex; justify-content: center; align-items: center; text-align: center; color: var(--muted); font-size: 10px; font-weight: 800; }
.match-board { --size: 7; width: min(52vh, 500px, 100%); aspect-ratio: 1; display: grid; grid-template-columns: repeat(var(--size), minmax(0, 1fr)); gap: 5px; padding: 7px; border-radius: 8px; background: #e7e4da; box-shadow: inset 0 0 0 1px #d4d0c4; touch-action: manipulation; }
.tile { min-width: 0; aspect-ratio: 1; display: grid; place-items: center; padding: 0; border: 2px solid transparent; border-bottom: 4px solid rgb(48 53 47 / 17%); border-radius: 7px; background: white; cursor: pointer; transition: transform .12s, filter .12s, border-color .12s; }
.tile span { width: 62%; aspect-ratio: 1; display: grid; place-items: center; color: var(--tile); font-size: clamp(14px, 2.2vw, 25px); line-height: 1; filter: drop-shadow(0 2px 0 rgb(48 53 47 / 13%)); }
.tile:hover { filter: brightness(1.02); transform: translateY(-1px); }
.tile.selected { border-color: var(--foreground); box-shadow: 0 0 0 3px rgb(48 53 47 / 13%); }
.tile.hint { border-color: var(--yellow); background: var(--yellow-soft); }

.side-panel { min-width: 0; padding: 17px 19px; display: flex; flex-direction: column; gap: 12px; }
.side-panel h2 { margin: 0; font-size: 19px; }
.side-panel p { margin: 0; color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.55; }
.direction-map { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.direction-map div { min-width: 0; padding: 8px 5px; border-top: 3px solid var(--primary); background: #f8f7f2; text-align: center; }
.direction-map b { display: block; font-size: 14px; }
.direction-map span { color: var(--muted); font-size: 8px; font-weight: 850; white-space: nowrap; }
.resource-section { padding: 11px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.resource-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.resource-heading b { font-size: 11px; }
.resource-heading span { color: var(--muted); font-size: 9px; font-weight: 800; }
.resource-rows { display: grid; gap: 7px; }
.resource-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 8px; }
.resource-row > span { color: var(--muted); font-size: 9px; font-weight: 850; }
.chip-list { min-height: 36px; display: flex; flex-wrap: wrap; gap: 6px; }
.resource-chip { min-width: 36px; height: 34px; border: 1px solid var(--border); border-radius: 6px; background: white; font-size: 13px; font-weight: 950; cursor: pointer; }
.resource-chip.selected { color: white; border-color: var(--primary); background: var(--primary); }
.resource-chip.operator.selected { border-color: var(--accent); background: var(--accent); }
.empty-chip { min-height: 34px; display: inline-flex; align-items: center; color: #aaa89f; font-size: 9px; font-weight: 800; }
.equation-builder { min-height: 70px; display: flex; justify-content: center; align-items: center; gap: 8px; padding: 10px; border-left: 4px solid var(--primary); background: #f7faf8; }
.equation-builder strong { font-family: ui-monospace, monospace; font-size: clamp(19px, 2.3vw, 28px); }
.equation-builder span { color: var(--muted); font-size: 9px; font-weight: 800; }
.builder-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.attack-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.attack-preview div { padding: 8px; border-left: 2px solid var(--border); }
.attack-preview span { display: block; color: var(--muted); font-size: 8px; font-weight: 850; }
.attack-preview b { font-size: 13px; }
.defense-box { flex: 1; min-height: 230px; display: grid; place-items: center; align-content: center; gap: 11px; text-align: center; }
.defense-box small { color: var(--accent); font-size: 9px; font-weight: 900; }
.defense-box h2 { font-family: ui-monospace, monospace; font-size: 34px; }
.number-answer { display: flex; align-items: center; gap: 8px; width: min(310px, 100%); }
.number-answer input { width: 100%; min-width: 0; height: 46px; padding: 0 12px; border: 2px solid var(--border); border-radius: 7px; background: #fcfbf8; text-align: center; font-size: 19px; font-weight: 900; }
.battle-log { display: grid; gap: 6px; max-height: 108px; overflow: auto; }
.battle-log div { display: grid; grid-template-columns: 58px 1fr; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); }
.battle-log time { color: var(--muted); font-size: 8px; font-weight: 850; }
.battle-log span { font-size: 10px; font-weight: 750; line-height: 1.4; }

.twist-layout { flex: 1; min-height: 470px; display: grid; grid-template-columns: minmax(380px, 1fr) 340px; gap: 10px; }
.twist-board { --size: 6; width: min(55vh, 520px, 100%); aspect-ratio: 1; display: grid; grid-template-columns: repeat(var(--size), 1fr); gap: 5px; padding: 7px; background: #e6e3d9; border-radius: 8px; }
.number-tile { min-width: 0; aspect-ratio: 1; display: grid; place-items: center; padding: 0; border: 2px solid transparent; border-bottom: 4px solid #c4c0b5; border-radius: 7px; background: white; font-size: clamp(17px, 3vw, 30px); font-weight: 950; cursor: pointer; }
.number-tile.region { border-color: var(--primary); background: var(--primary-soft); }
.number-tile.focus { color: white; border-color: var(--primary-deep); background: var(--primary); }
.rotate-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(420px, 100%); }
.rotate-controls button { min-height: 46px; }
.twist-movement { padding: 13px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.twist-movement span { color: var(--muted); font-size: 9px; font-weight: 850; }
.twist-movement strong { display: block; margin-top: 4px; font-size: 16px; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.stat-row div { padding: 9px; border-top: 3px solid var(--blue); background: #f7fafc; }
.stat-row span { display: block; color: var(--muted); font-size: 8px; font-weight: 850; }
.stat-row b { font-size: 15px; }

.config-panel { flex: 1; min-height: 470px; padding: 26px; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 26px; align-items: center; }
.config-copy h2 { margin: 7px 0; font-size: 25px; }
.config-copy p { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.65; }
.config-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.config-card { min-width: 0; min-height: 210px; padding: 16px; display: flex; flex-direction: column; border: 2px solid var(--border); border-bottom-width: 6px; border-radius: 8px; background: white; text-align: left; cursor: pointer; }
.config-card:hover, .config-card.selected { border-color: var(--primary); background: #f8fcfa; }
.config-card.selected { box-shadow: 0 0 0 3px var(--primary-soft); }
.config-card span { color: var(--primary); font-size: 9px; font-weight: 900; }
.config-card h3 { margin: 8px 0 12px; font-size: 18px; }
.config-card .quota { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.config-card .quota b { padding: 9px 4px; background: var(--secondary); text-align: center; font-size: 13px; }
.config-card p { margin-top: auto; color: var(--muted); font-size: 10px; font-weight: 700; line-height: 1.5; }
.config-start { margin-top: 12px; display: flex; justify-content: flex-end; }

.build-layout { flex: 1; min-height: 490px; display: grid; grid-template-columns: minmax(360px, .85fr) minmax(380px, 1.15fr); gap: 10px; }
.quota-strip { width: 100%; display: grid; grid-template-columns: 1fr 1fr auto auto; align-items: center; gap: 6px; }
.quota-strip div { padding: 7px 9px; border-left: 3px solid var(--primary); background: #f7faf8; }
.quota-strip span { display: block; color: var(--muted); font-size: 8px; font-weight: 850; }
.quota-strip b { font-size: 14px; }
.joker-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.joker { min-width: 0; padding: 9px 7px; border-top: 4px solid var(--joker); background: #faf9f5; }
.joker > b { width: 30px; height: 30px; display: grid; place-items: center; margin-bottom: 7px; border-radius: 50%; background: var(--joker); color: white; font-family: Georgia, serif; font-size: 11px; }
.joker strong { display: block; font-size: 10px; }
.joker span { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; font-weight: 750; line-height: 1.35; }
.joker i { display: inline-block; margin-top: 5px; color: var(--accent-deep); font-size: 9px; font-style: normal; font-weight: 900; }
.joker.active { background: var(--yellow-soft); box-shadow: inset 0 0 0 2px var(--yellow); }
.probability-band { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.probability-band div { padding: 8px; border: 1px dashed var(--border); }
.probability-band span { display: block; color: var(--muted); font-size: 8px; font-weight: 800; }
.probability-band b { font-size: 12px; }
.decision-bar { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 7px; padding-top: 10px; border-top: 1px solid var(--border); }
.decision-copy span { display: block; color: var(--muted); font-size: 8px; font-weight: 850; }
.decision-copy b { font-size: 13px; }

.mine-layout { flex: 1; min-height: 500px; display: grid; grid-template-columns: minmax(430px, 1fr) 330px; gap: 10px; }
.mine-board-panel { padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.mine-toolbar { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.level-controls { display: flex; flex-wrap: wrap; gap: 5px; }
.level-controls select { min-height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; background: white; font-size: 10px; font-weight: 850; }
.mine-board { --size: 8; width: min(61vh, 590px, 100%); aspect-ratio: 1; display: grid; grid-template-columns: repeat(var(--size), minmax(0, 1fr)); gap: 2px; padding: 5px; border: 1px solid #c9c5ba; border-radius: 7px; background: #d8d5cb; touch-action: manipulation; }
.mine-cell { min-width: 0; aspect-ratio: 1; display: grid; place-items: center; padding: 0; border: 1px solid #c6c1b6; border-bottom: 3px solid #aca79c; border-radius: 4px; background: #f1efe8; font-family: ui-monospace, monospace; font-size: clamp(10px, 1.55vw, 18px); font-weight: 950; cursor: pointer; }
.mine-cell:hover { background: white; }
.mine-cell.revealed { border-color: #e0ddd4; border-bottom-width: 1px; background: white; }
.mine-cell.pending { color: var(--accent-deep); background: var(--accent-soft); }
.mine-cell.solved { color: var(--number-color, var(--blue)); }
.mine-cell.flagged { color: var(--accent-deep); background: var(--yellow-soft); }
.mine-cell.mine { color: white; border-color: var(--danger); background: var(--danger); }
.mine-cell.selected { box-shadow: inset 0 0 0 3px var(--accent); }
.mine-side { min-width: 0; padding: 17px 19px; display: flex; flex-direction: column; gap: 12px; }
.mine-side h2 { margin: 0; font-size: 19px; }
.mine-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mine-metrics div { padding: 8px; border-top: 3px solid var(--primary); background: #f8faf8; }
.mine-metrics span { display: block; color: var(--muted); font-size: 8px; font-weight: 850; }
.mine-metrics b { font-size: 14px; }
.decoder { min-height: 190px; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; }
.decoder small { color: var(--accent); font-size: 9px; font-weight: 900; }
.decoder strong { font-family: ui-monospace, monospace; font-size: 28px; }
.decoder p { margin: 0; color: var(--muted); font-size: 10px; font-weight: 750; line-height: 1.5; }
.digit-pad { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; }
.digit-pad button { min-width: 0; height: 38px; padding: 0; border: 1px solid var(--border); border-bottom-width: 3px; border-radius: 5px; background: white; font-size: 13px; font-weight: 950; cursor: pointer; }
.digit-pad button:hover { border-color: var(--primary); background: var(--primary-soft); }
.mine-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mine-tools button { min-height: 40px; border: 1px solid var(--border); border-radius: 6px; background: white; font-size: 10px; font-weight: 900; cursor: pointer; }
.mine-tools button.active { color: white; border-color: var(--primary); background: var(--primary); }
.mine-result { padding: 12px 0; border-top: 4px solid var(--primary); }
.mine-result h2 { margin: 5px 0; }

.review-panel { padding: 18px; }
.review-panel header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.review-panel h2 { margin: 0; font-size: 19px; }
.review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.review-item { padding: 12px 0; border-top: 3px solid var(--primary); }
.review-item span { color: var(--muted); font-size: 8px; font-weight: 900; }
.review-item strong { display: block; margin: 4px 0; font-size: 14px; }
.review-item p { margin: 0; color: var(--muted); font-size: 10px; font-weight: 700; line-height: 1.5; }

.guide-sidebar { z-index: 60; min-width: 0; min-height: 0; padding: 17px; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; background: white; box-shadow: 0 10px 26px rgb(40 42 36 / 9%); position: relative; }
.guide-head { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; font-weight: 900; }
.guide-head b { margin-left: auto; color: var(--primary); }
.guide-head button { min-height: 29px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 5px; background: white; color: var(--muted); font-size: 9px; font-weight: 850; cursor: pointer; }
.guide-current { margin-top: 15px; padding: 15px 0; border-top: 4px solid var(--primary); border-bottom: 1px solid var(--border); }
.guide-current span { color: var(--primary); font-size: 9px; font-weight: 900; }
.guide-current h2 { margin: 6px 0 10px; font-size: 21px; line-height: 1.2; }
.guide-current p { margin: 0; color: var(--muted); font-size: 11px; font-weight: 750; line-height: 1.55; }
.guide-steps { display: grid; gap: 6px; margin-top: auto; }
.guide-step { min-height: 36px; display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 7px; padding: 4px 6px; border-radius: 6px; color: #aaa89f; }
.guide-step b { width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; font-size: 8px; }
.guide-step span { font-size: 10px; font-weight: 800; }
.guide-step.active { color: var(--primary-deep); background: var(--primary-soft); }
.guide-step.active b { color: white; border-color: var(--primary); background: var(--primary); }
.guide-step.done { color: #367a61; }
.guide-followup { display: flex; align-items: center; gap: 6px; margin: 9px 0 0; padding-top: 9px; border-top: 1px solid var(--border); color: var(--muted); font-size: 9px; font-weight: 800; line-height: 1.4; }
.guide-followup i { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--yellow); }
.guide-overlay { z-index: 45; pointer-events: none; position: fixed; inset: 0; }
.guide-shade { position: fixed; background: rgb(34 36 31 / 57%); transition: all .2s; }
.guide-frame { position: fixed; border: 3px solid var(--primary); border-radius: 10px; box-shadow: 0 0 0 4px rgb(56 108 86 / 18%); transition: all .2s; }
.toast { z-index: 100; position: fixed; left: 50%; bottom: 24px; max-width: min(520px, calc(100vw - 32px)); transform: translateX(-50%); padding: 11px 15px; border-radius: 7px; background: #30352f; color: white; box-shadow: 0 10px 26px rgb(35 37 32 / 22%); font-size: 11px; font-weight: 800; text-align: center; }

@media (max-width: 1160px) {
  .app-header { grid-template-columns: 148px minmax(0, 1fr) 64px; padding: 0 13px; }
  .demo-tabs button { min-width: 100px; padding: 0 8px; font-size: 11px; }
  .feature-page { padding: 13px 15px 16px; }
  .game-grid, .build-layout { grid-template-columns: minmax(330px, .85fr) minmax(330px, 1.15fr); }
  .twist-layout, .mine-layout { grid-template-columns: minmax(370px, 1fr) 310px; }
  .joker-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 840px) {
  body { overflow: auto; }
  .app-shell { min-height: 100dvh; height: auto; overflow: visible; }
  .app-header { min-height: 70px; height: auto; grid-template-columns: 130px minmax(0, 1fr); padding: 8px 11px; }
  .lab-status { display: none; }
  .demo-tabs { justify-content: flex-start; }
  .feature-page { min-height: calc(100dvh - 70px); height: auto; overflow: visible; }
  .guided-layout { display: block; }
  .game-grid, .twist-layout, .build-layout, .mine-layout, .config-panel { min-height: 0; grid-template-columns: 1fr; }
  .guide-sidebar { position: fixed; right: 10px; bottom: 10px; left: 10px; max-height: 40vh; overflow-y: auto; }
  .guide-current { padding: 9px 0; }
  .guide-current h2 { margin: 4px 0 5px; font-size: 17px; }
  .guide-steps { display: none; }
  .guide-followup { margin-top: 5px; padding-top: 5px; }
  .match-board, .twist-board, .mine-board { width: min(70vh, 620px, 100%); }
  .config-panel { padding: 19px; }
  .config-options { grid-template-columns: repeat(3, 1fr); }
  .config-card { min-height: 180px; }
}

@media (max-width: 580px) {
  .app-header { grid-template-columns: 102px minmax(0, 1fr); }
  .brand-copy small { display: none; }
  .demo-tabs { gap: 2px; }
  .demo-tabs button { min-width: 77px; height: 42px; padding: 0 6px; font-size: 10px; }
  .feature-page { padding: 11px; }
  .feature-heading { min-height: 0; gap: 8px; }
  .feature-heading h1 { font-size: 21px; }
  .feature-heading p { max-width: 245px; }
  .duel-strip { grid-template-columns: 1fr auto 1fr; gap: 5px; padding: 7px; }
  .fighter { grid-template-columns: auto minmax(0, 1fr); }
  .fighter > strong { display: none; }
  .avatar { width: 29px; height: 29px; }
  .board-panel, .side-panel, .mine-side { padding: 12px; }
  .match-board, .twist-board, .mine-board { gap: 3px; padding: 4px; width: 100%; }
  .tile { border-radius: 5px; border-bottom-width: 3px; }
  .direction-map { grid-template-columns: 1fr 1fr 1fr 1fr; gap: 3px; }
  .direction-map div { padding: 6px 2px; }
  .resource-row { grid-template-columns: 42px minmax(0, 1fr); }
  .attack-preview, .stat-row, .mine-metrics { grid-template-columns: repeat(3, 1fr); }
  .builder-actions, .decision-bar { grid-template-columns: 1fr; display: grid; }
  .builder-actions .action-button, .decision-bar .action-button { width: 100%; }
  .config-options { grid-template-columns: 1fr; }
  .config-card { min-height: 0; }
  .config-card .quota { grid-template-columns: 1fr 1fr; }
  .joker-grid { grid-template-columns: 1fr 1fr; }
  .probability-band { grid-template-columns: 1fr; }
  .mine-toolbar { align-items: flex-start; flex-direction: column; }
  .digit-pad { grid-template-columns: repeat(5, 1fr); }
  .review-grid { grid-template-columns: 1fr; }
}

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