:root {
  color-scheme: light;
  --paper: #f6f4ee;
  --ink: #243c34;
  --muted: #69766e;
  --green: #244b3e;
  --line: #dedfd5;
  --r0: #d6c8e9;
  --r1: #f2c79f;
  --r2: #b8d8c1;
  --r3: #b7d5ea;
  --r4: #ecd98f;
  --r5: #ebaebb;
  --r6: #cbd39b;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  background: var(--paper);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button, a, .cell { touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; min-height: 44px; }
button:disabled { cursor: default; opacity: .4; }
button, a { -webkit-user-select: none; user-select: none; }
button:focus-visible, a:focus-visible { outline: 3px solid #376eae; outline-offset: 4px; }
button:hover:not(:disabled) { filter: brightness(.96); }
svg { width: 24px; height: 24px; display: block; flex-shrink: 0; }
.svg-library { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.page { width: min(1060px, 100%); margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) max(26px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(26px, env(safe-area-inset-left)); }
.header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 760; font-size: 22px; line-height: 1; letter-spacing: -.8px; }
.brand-icon { width: 42px; height: 44px; display: grid; place-items: center; background: var(--green); color: var(--paper); border-radius: 13px; transform: rotate(-5deg); }
.brand-icon svg { width: 28px; height: 28px; }
.brand-sub { display: block; font-size: 9px; letter-spacing: 3px; margin-top: 5px; }
.preferences { display: flex; align-items: center; gap: 7px; }
.small-button { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; font-weight: 650; font-size: 14px; }
.sound-button { font-size: 22px; }
.sound-button[aria-pressed="true"] { color: var(--muted); text-decoration: line-through; }
.intro { text-align: center; padding: 38px 0 30px; }
.eyebrow { font-size: 10px; font-weight: 750; letter-spacing: 2px; color: var(--muted); line-height: 1.6; margin: 0 0 10px; }
h1 { font-size: clamp(32px, 6vw, 48px); letter-spacing: -2px; line-height: 1.1; margin: 0; font-weight: 720; }
.title-dot { color: #c19053; }
.subtitle { font-size: 15px; color: var(--muted); margin: 13px 0 0; }
.game-layout { display: grid; grid-template-columns: minmax(0, 570px) minmax(0, 300px); gap: 36px; align-items: start; justify-content: center; }
.game-card { background: #fffefb; border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: 0 10px 36px #273d3206; min-width: 0; }
.difficulty-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 4px; border-radius: 12px; background: #f1f1ea; gap: 4px; }
.difficulty-picker button { font-size: 13px; font-weight: 650; min-height: 40px; border-radius: 9px; color: var(--muted); transition: background .15s, color .15s; }
.difficulty-picker button[aria-pressed="true"] { color: var(--green); background: #fffefb; box-shadow: 0 2px 5px #243c3410; }
.game-meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 19px 1px 15px; font-size: 12px; color: var(--muted); }
.queen-count, .counters { display: flex; gap: 7px; align-items: center; }
.queen-count svg { width: 18px; height: 18px; color: var(--green); }
.queen-count strong { color: var(--ink); font-weight: 700; }
.counters { gap: 16px; }
.counters strong { font-weight: 500; color: var(--ink); }
.timer { border-left: 1px solid var(--line); padding-left: 15px; color: var(--ink); }
.timer, #moves, .stat-grid strong, .victory-results strong { font-variant-numeric: tabular-nums; }
.board-wrap { position: relative; aspect-ratio: 1; }
.board { height: 100%; width: 100%; display: grid; grid-template-rows: repeat(7, minmax(0, 1fr)); border: 2px solid #3f4b42; border-radius: 10px; overflow: hidden; background: #eaece3; isolation: isolate; }
.board-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-height: 0; }
.cell { position: relative; min-height: 0; min-width: 0; padding: 0; display: grid; place-items: center; background: var(--region); border-right: 1px solid #263e342b; border-bottom: 1px solid #263e342b; color: #263930; cursor: pointer; border-radius: 0; }
.cell.boundary-right { border-right: 2px solid #435246c7; }
.cell.boundary-bottom { border-bottom: 2px solid #435246c7; }
.cell:last-child { border-right: 0; }
.board-row:last-child .cell { border-bottom: 0; }
.cell svg { width: 56%; height: 56%; max-width: 42px; max-height: 42px; pointer-events: none; }
.cell .region-letter { position: absolute; top: 3px; left: 4px; font-size: 9px; font-weight: 700; line-height: 1; color: #334238; opacity: .65; pointer-events: none; }
.cell.mark svg { opacity: .7; width: 48%; height: 48%; }
.cell.affected::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, #a1292814 0 3px, transparent 3px 9px); pointer-events: none; }
.cell.conflict::after { content: ''; position: absolute; inset: 3px; border: 3px solid #a51f39; border-radius: 6px; pointer-events: none; }
.cell.conflict svg { color: #941d31; }
.cell.conflict .region-letter { opacity: 0; }
.cell:focus-visible { outline: 3px solid #163d64; outline-offset: -5px; z-index: 2; }
.cell.pop svg { animation: pop .2s ease-out; }
.board.solved { box-shadow: 0 0 0 4px #7c9c744d; }
.loading { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 18px; padding: 28px; text-align: center; font-size: 14px; background: #f1f0e7f5; border-radius: 9px; line-height: 1.6; }
.spinner { width: 28px; height: 28px; border: 2px solid #cbd4c5; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
.mode-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.mode-picker button { display: flex; justify-content: center; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px; font-weight: 650; min-height: 46px; }
.mode-picker button[aria-pressed="true"] { background: var(--green); color: white; border-color: var(--green); }
.mode-picker svg { width: 19px; height: 19px; }
kbd { font: inherit; font-size: 9px; opacity: .65; border: 1px solid currentColor; border-radius: 3px; padding: 1px 3px; margin-left: auto; }
.interaction-tip { font-size: 11px; text-align: center; line-height: 1.6; color: var(--muted); margin: 11px 0 7px; min-height: 18px; }
.status { text-align: center; font-size: 12px; line-height: 1.45; margin: 0; min-height: 38px; display: grid; align-content: center; padding: 3px 0 9px; }
.status.error { color: #a01f34; }
.status.success { color: #386943; }
.tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); padding-top: 9px; gap: 4px; }
.tools button { font-size: 12px; font-weight: 550; padding: 5px 2px; border-radius: 8px; }
.tools button:hover:not(:disabled) { background: #f2f2ec; }
.side-panel { padding-top: 3px; min-width: 0; }
.note-card { padding: 22px; background: #ebeede; border-radius: 17px; position: relative; }
.note-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 17px; }
.note-heading .eyebrow { margin: 0; font-size: 8px; letter-spacing: 1.4px; }
.tiny-crown { display: grid; place-items: center; border-radius: 50%; background: #dce2c7; padding: 8px; transform: rotate(-10deg); }
.tiny-crown svg { width: 19px; height: 19px; }
.note-card h2 { white-space: pre-line; margin: 0; font-size: 24px; letter-spacing: -.8px; line-height: 1.2; font-weight: 650; }
.note-card > p { color: var(--muted); font-size: 12px; margin: 14px 0 19px; line-height: 1.5; }
.rule-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.rule-list li { display: flex; align-items: center; gap: 11px; font-size: 12px; line-height: 1.5; }
.rule-symbol { width: 26px; height: 26px; display: grid; place-items: center; font-size: 21px; flex-shrink: 0; font-family: sans-serif; }
.region-symbol { color: #8065a0; }
.text-button { font-size: 12px; text-decoration: underline; text-underline-offset: 4px; padding: 7px 0; }
.note-card .text-button { margin-top: 10px; }
.level-note { display: flex; align-items: flex-start; gap: 9px; padding: 19px 3px 17px; }
.level-note p { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 0; }
.level-dot { width: 6px; height: 6px; background: #96a47b; border-radius: 50%; margin-top: 7px; flex-shrink: 0; }
.primary { min-height: 48px; background: var(--green); color: #fffefb; border-radius: 11px; font-size: 13px; font-weight: 600; padding: 12px 18px; }
#new-game { width: 100%; display: flex; justify-content: space-between; align-items: center; }
#new-game > span:last-child { font-size: 22px; line-height: 1; }
.secondary { border: 1px solid var(--green); border-radius: 10px; padding: 8px 18px; }
.stats { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 19px; }
.stats-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stats-heading h2 { font-size: 12px; font-weight: 650; margin: 0; }
.stats-heading > span { color: var(--muted); font-size: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 18px; }
.stat-grid > div { display: flex; flex-direction: column; text-align: center; gap: 7px; border-right: 1px solid var(--line); }
.stat-grid > div:last-child { border: 0; }
.stat-grid strong { font-size: 22px; font-weight: 550; letter-spacing: -.7px; }
.stat-grid span { font-size: 10px; color: var(--muted); }
.save-note { font-size: 10px; color: var(--muted); text-align: center; margin: 18px 0 0; line-height: 1.5; }
footer { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11px; padding: 28px 0 6px; line-height: 1.5; }
.footer-badge { font-size: 10px; }
dialog { border: 1px solid var(--line); color: var(--ink); background: #fffefb; border-radius: 22px; padding: 32px; width: min(500px, calc(100% - 28px)); max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 24px 100px #172c3340; }
dialog::backdrop { background: #243a3266; backdrop-filter: blur(4px); }
dialog .eyebrow { padding-right: 22px; }
dialog h2 { font-size: 30px; line-height: 1.15; letter-spacing: -1px; margin: 14px 0; }
dialog p { font-size: 14px; line-height: 1.6; color: var(--muted); }
.dialog-close { position: absolute; top: 12px; right: 12px; font-size: 22px; width: 36px; min-height: 44px; border: 0; }
.tutorial-demo { width: 120px; height: 120px; display: grid; grid-template-columns: repeat(3, 1fr); border: 2px solid #536047; border-radius: 7px; overflow: hidden; float: right; margin: 5px 0 14px 18px; }
.tutorial-demo span { background: var(--r2); border: .5px solid #263e3433; display: grid; place-items: center; }
.tutorial-demo span:nth-child(3n) { background: var(--r0); }
.tutorial-demo span.forbidden { color: #973048; }
.tutorial-rules { padding-left: 19px; font-size: 13px; line-height: 1.65; }
.tutorial-rules li { margin-bottom: 10px; padding-left: 2px; }
dialog .keyboard-note { font-size: 11px; clear: both; border-top: 1px solid var(--line); padding-top: 12px; }
.full-width { width: 100%; }
#victory { text-align: center; padding-top: 40px; }
#victory .eyebrow { padding: 0; }
.victory-crown { width: 84px; height: 84px; display: grid; place-items: center; background: #ebeede; border-radius: 28px; color: #987134; margin: 0 auto 24px; transform: rotate(-7deg); }
.victory-crown svg { width: 48px; height: 48px; }
.victory-results { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0; }
.victory-results > div { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: #f3f3ec; border-radius: 12px; }
.victory-results strong { font-size: 26px; font-weight: 600; }
.victory-results span { font-size: 12px; color: var(--muted); }
.noscript { padding: 30px; text-align: center; }
@keyframes pop { from { transform: scale(.6); opacity: .5; } to { transform: scale(1); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 780px) {
  .page { max-width: 580px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .game-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .intro { padding: 25px 0; }
  .game-card { padding: 16px; border-radius: 18px; }
  .side-panel { display: flex; flex-direction: column; }
  #new-game { order: -3; }
  .level-note { order: -2; padding-top: 12px; }
  .stats { order: -1; margin: 0 0 21px; }
  .note-card { padding: 22px; }
  .note-card h2 { white-space: normal; font-size: 22px; }
  .note-heading { margin-bottom: 12px; }
  .rule-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .note-card .text-button { margin-top: 12px; }
  footer { flex-direction: column; align-items: center; gap: 7px; padding-top: 22px; }
}
@media (max-width: 380px) {
  .page { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); padding-top: max(12px, env(safe-area-inset-top)); }
  .header { padding: 0 5px 13px; }
  .preferences { gap: 3px; }
  .brand { font-size: 20px; gap: 7px; }
  .game-card { padding: 8px; border-radius: 12px; }
  .game-meta { padding: 13px 2px; font-size: 11px; }
  .counters { gap: 8px; }
  .timer { padding-left: 8px; }
  .mode-picker button { padding: 7px; font-size: 11px; }
  kbd { display: none; }
  .interaction-tip { font-size: 10px; }
  .rule-list { grid-template-columns: 1fr; }
  dialog { padding: 25px 20px; }
  .tutorial-demo { width: 90px; height: 90px; }
}
@media (hover: none) { kbd { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
