:root {
    color-scheme: dark;
    --font-ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
    --page: #101923;
    --panel: #172431;
    --panel-light: #203341;
    --line: #3c5360;
    --text: #edf7f7;
    --text-soft: #d7e8e8;
    --muted: #a8bdc5;
    --accent: #91e1cc;
    --accent-deep: #397f79;
    --accent-ink: #10252a;
    --warm: #f5c57d;
    --danger: #fa897f;
    --page-glow-a: #274451;
    --page-glow-b: #24404a;
    --page-a: #101923;
    --page-b: #111d27;
    --page-c: #12212a;
    --hairline: #ffffff19;
    --divider: #ffffff25;
    --panel-border: #78919a35;
    --panel-border-strong: #78919a45;
    --panel-bg: #172631e8;
    --panel-translucent: #172631cc;
    --surface: #20313d;
    --surface-hover: #2d4651;
    --surface-border: #68808a66;
    --surface-border-strong: #68808a88;
    --surface-hover-border: #a1bfc5;
    --active-bg: #28554f;
    --active-soft: #d8f6eb;
    --frame-a: #20333e;
    --frame-b: #15242f;
    --board-bg: #15232e;
    --clue-bg: #223642;
    --marked-clue: color-mix(in srgb, var(--muted) 80%, var(--clue-bg));
    --cell-bg: #162632;
    --cell-hover: #31505a;
    --filled-bg: #b9e7d9;
    --filled-inset: #effff5aa;
    --cross-text: #b3c8ca;
    --cross-bg: #1c303b;
    --auto-text: #728d94;
    --auto-bg: #1b2d37;
    --mistake-text: #ff9b91;
    --mistake-bg: #4b2b32;
    --grid-line: #4b6570;
    --grid-strong: #a9c7c6;
    --board-border: #8aa4a8;
    --toolbar-bg: #12212aee;
    --toast-bg: #263b47;
    --guide-bg: #19303bef;
    --guide-text: #d2e3e5;
    --modal-bg: #1c2e39;
    --modal-text: #bfd2d5;
    --modal-backdrop: #061016bb;
    --rule-bg: #14252f;
    --shadow: #06111888;
    --shadow-soft: #06111855;
    --scroll-thumb: #66838a;
    --scroll-track: #1b2c36;
    --cell-size: 34px;
    font-family: var(--font-ui);
}
.training-list { display:flex; flex-direction:column; gap:10px; }
.training-list button { min-height:44px; text-align:left; }
.training-line { display:grid; gap:2px; width:100%; margin-bottom:14px; }
.training-line span { aspect-ratio:1; background:var(--cell-bg); border:1px solid var(--line); display:grid; place-items:center; font-size:14px; }
.training-line .filled { background:var(--filled-bg); }
.training-line .certain { outline:2px solid var(--accent); outline-offset:-2px; }

:root[data-theme="aurora"] {
    --page: #171329; --panel: #251d3a; --panel-light: #32284c; --line: #66577d;
    --text: #f7f1ff; --text-soft: #e9ddf5; --muted: #c2b4d0;
    --accent: #d6a6ff; --accent-deep: #7957a1; --accent-ink: #27153a;
    --warm: #ffd078; --danger: #ff8fa3;
    --page-glow-a: #4a306b; --page-glow-b: #243a68; --page-a: #171329; --page-b: #1d1731; --page-c: #171d35;
    --panel-bg: #251d3aeb; --panel-translucent: #251d3ad6; --panel-border: #a68cbd3d; --panel-border-strong: #a68cbd55;
    --surface: #32284c; --surface-hover: #493964; --surface-border: #aa8fc466; --surface-border-strong: #aa8fc499; --surface-hover-border: #d8c1ed;
    --active-bg: #5f4778; --active-soft: #f0ddff; --frame-a: #302747; --frame-b: #1d192e;
    --board-bg: #1d192e; --clue-bg: #342b4b; --cell-bg: #211c34; --cell-hover: #4b3d63;
    --filled-bg: #d7b9f0; --filled-inset: #fff5ffaa; --cross-text: #cfbfdb; --cross-bg: #2b243e;
    --auto-text: #8f7da0; --auto-bg: #272137; --mistake-text: #ffabb9; --mistake-bg: #512b42;
    --grid-line: #66577d; --grid-strong: #bea9d0; --board-border: #aa96bc; --toolbar-bg: #1b162deF;
    --toast-bg: #3c3054; --guide-bg: #2b2242f2; --guide-text: #eadff3; --modal-bg: #2a223f; --modal-text: #ddd0e8;
    --modal-backdrop: #0d0919c7; --rule-bg: #1e1830; --shadow: #09061299; --shadow-soft: #09061266;
    --scroll-thumb: #826b9c; --scroll-track: #221b34;
}

:root[data-theme="forest"] {
    --page: #101b17; --panel: #192a22; --panel-light: #263b30; --line: #526b5d;
    --text: #f2f7ed; --text-soft: #dce9d5; --muted: #adbea9;
    --accent: #b9dd83; --accent-deep: #66883d; --accent-ink: #1b2b12;
    --warm: #e7b86b; --danger: #f28d78;
    --page-glow-a: #294b38; --page-glow-b: #4a4026; --page-a: #101b17; --page-b: #14221c; --page-c: #19251c;
    --panel-bg: #192a22eb; --panel-translucent: #192a22d6; --panel-border: #81967f3d; --panel-border-strong: #81967f55;
    --surface: #263b30; --surface-hover: #365345; --surface-border: #78907866; --surface-border-strong: #78907899; --surface-hover-border: #c3d2bd;
    --active-bg: #486a38; --active-soft: #e3f2cf; --frame-a: #263c31; --frame-b: #16261e;
    --board-bg: #16261e; --clue-bg: #2a4035; --cell-bg: #182a21; --cell-hover: #3c5a49;
    --filled-bg: #c9e8a5; --filled-inset: #f6ffe9aa; --cross-text: #becbb8; --cross-bg: #21362b;
    --auto-text: #82917d; --auto-bg: #1e3127; --mistake-text: #f4a08e; --mistake-bg: #4a302b;
    --grid-line: #587062; --grid-strong: #b1c6b4; --board-border: #91a995; --toolbar-bg: #12241aeF;
    --toast-bg: #30483a; --guide-bg: #203a2cf2; --guide-text: #dce9d7; --modal-bg: #22372c; --modal-text: #d0dfcf;
    --modal-backdrop: #07110bc7; --rule-bg: #15271e; --shadow: #050e0999; --shadow-soft: #050e0966;
    --scroll-thumb: #708b77; --scroll-track: #182a20;
}

:root[data-theme="paper"] {
    color-scheme: light;
    --page: #f5efe4; --panel: #fffaf1; --panel-light: #eee4d4; --line: #9aaba5;
    --text: #26332f; --text-soft: #34443f; --muted: #64736e;
    --accent: #5db19c; --accent-deep: #287a68; --accent-ink: #102c26;
    --warm: #a96017; --danger: #b6413b;
    --page-glow-a: #d8eadf; --page-glow-b: #ead7b8; --page-a: #f8f3e9; --page-b: #f2eadc; --page-c: #e9e2d5;
    --hairline: #34443f22; --divider: #34443f2e; --panel-bg: #fffaf1ed; --panel-translucent: #fffaf1e8;
    --panel-border: #62766d42; --panel-border-strong: #62766d66; --surface: #eee4d4; --surface-hover: #e1d4c0;
    --surface-border: #65776f66; --surface-border-strong: #65776f99; --surface-hover-border: #52655d;
    --active-bg: #b9dfd3; --active-soft: #173f35; --frame-a: #eee6da; --frame-b: #ddd7cc;
    --board-bg: #f7f3eb; --clue-bg: #e5ddcf; --cell-bg: #fffdf8; --cell-hover: #d9e9e2;
    --filled-bg: #397e6d; --filled-inset: #153d33aa; --cross-text: #50605b; --cross-bg: #eee9df;
    --auto-text: #87938f; --auto-bg: #f1ece3; --mistake-text: #9d302e; --mistake-bg: #f2d3ce;
    --grid-line: #a4b0aa; --grid-strong: #596a65; --board-border: #687a74; --toolbar-bg: #fffaf1f2;
    --toast-bg: #fffaf1; --guide-bg: #fffaf1f5; --guide-text: #3f514b; --modal-bg: #fffaf1; --modal-text: #465751;
    --modal-backdrop: #4b554f55; --rule-bg: #eee6da; --shadow: #48534d3d; --shadow-soft: #48534d26;
    --scroll-thumb: #8b9c95; --scroll-track: #e4ddd1;
}

:root[data-theme="led"] {
    --page: #000000; --panel: #050509; --panel-light: #0c1018; --line: #334b5b;
    --text: #f5fbff; --text-soft: #dcecf6; --muted: #8ea8b8;
    --accent: #87ceeb; --accent-deep: #3a789f; --accent-ink: #071923;
    --warm: #ffe600; --danger: #ff3b72;
    --page-glow-a: #0b1a26; --page-glow-b: #190015; --page-a: #000000; --page-b: #000000; --page-c: #000000;
    --hairline: #87ceeb24; --divider: #ff2bd633; --panel-bg: #030407f2; --panel-translucent: #030407e6;
    --panel-border: #87ceeb38; --panel-border-strong: #87ceeb66; --surface: #0a1016; --surface-hover: #142431;
    --surface-border: #87ceeb55; --surface-border-strong: #87ceeb88; --surface-hover-border: #87ceeb;
    --active-bg: #173548; --active-soft: #d8f1fb; --frame-a: #0a151d; --frame-b: #000000;
    --board-bg: #000000; --clue-bg: #0a151d; --cell-bg: #020407; --cell-hover: #122b3a;
    --filled-bg: #87ceeb; --filled-inset: #eaf8ffcc; --cross-text: #ff2bd6; --cross-bg: #160014;
    --auto-text: #52666a; --auto-bg: #05090b; --mistake-text: #ff5c86; --mistake-bg: #26000e;
    --grid-line: #28485c; --grid-strong: #87ceeb; --board-border: #5d9bc3; --toolbar-bg: #020405f5;
    --toast-bg: #0c1720; --guide-bg: #03070afa; --guide-text: #dcecf6; --modal-bg: #05080d; --modal-text: #c9dfe9;
    --modal-backdrop: #000000dd; --rule-bg: #02070a; --shadow: #000000cc; --shadow-soft: #00000099;
    --scroll-thumb: #4f8aaf; --scroll-track: #020608;
}

/* Complete palettes: light backgrounds use ink fills, dark backgrounds use soft light fills. */
:root[data-theme="sakura"] {
    color-scheme: light;
    --page: #fcf1f4;
    --panel: #fffafb;
    --panel-light: #f2dde5;
    --line: #ac8a9a;
    --text: #462d3c;
    --text-soft: #462d3c;
    --muted: #755565;
    --accent: #a53767;
    --accent-deep: #a53767;
    --accent-ink: #462d3c;
    --warm: #86551e;
    --danger: #aa3541;
    --page-glow-a: #f2dde5;
    --page-glow-b: #f2dde5;
    --page-a: #fcf1f4;
    --page-b: #fcf1f4;
    --page-c: #fcf1f4;
    --hairline: #ac8a9a40;
    --divider: #ac8a9a55;
    --panel-border: #ac8a9a60;
    --panel-border-strong: #ac8a9a99;
    --panel-bg: #fffafb;
    --panel-translucent: #fffafbee;
    --surface: #f2dde5;
    --surface-hover: #f5bdd3;
    --surface-border: #ac8a9a99;
    --surface-border-strong: #ac8a9a;
    --surface-hover-border: #a53767;
    --active-bg: #f2dde5;
    --active-soft: #462d3c;
    --frame-a: #f2dde5;
    --frame-b: #fcf1f4;
    --board-bg: #fffdfd;
    --clue-bg: #f2dde5;
    --cell-bg: #fffdfd;
    --cell-hover: #f2dde5;
    --filled-bg: #8f315b;
    --filled-inset: #8f315b;
    --cross-text: #755565;
    --cross-bg: #fffafb;
    --auto-text: #755565;
    --auto-bg: #fffafb;
    --mistake-text: #a32940;
    --mistake-bg: #f7dce2;
    --grid-line: #ac8a9a;
    --grid-strong: #755565;
    --board-border: #755565;
    --toolbar-bg: #fffafbf5;
    --toast-bg: #fffafb;
    --guide-bg: #fffafb;
    --guide-text: #462d3c;
    --modal-bg: #fffafb;
    --modal-text: #462d3c;
    --modal-backdrop: #fcf1f4bb;
    --rule-bg: #f2dde5;
    --shadow: #fcf1f466;
    --shadow-soft: #fcf1f433;
    --scroll-thumb: #ac8a9a;
    --scroll-track: #f2dde5;
}
:root[data-theme="sakura"] :is(.tool-button.active, .help-footer button.primary, .modal-actions button.primary, #stroke-count, .library-tabs .active) { background: #f5bdd3; border-color: #a53767; }
:root[data-theme="lagoon"] {
    color-scheme: light;
    --page: #edf8f5;
    --panel: #f8fdfa;
    --panel-light: #d9ece5;
    --line: #82a69b;
    --text: #193d38;
    --text-soft: #193d38;
    --muted: #4b6c64;
    --accent: #146b59;
    --accent-deep: #146b59;
    --accent-ink: #193d38;
    --warm: #86551e;
    --danger: #aa3541;
    --page-glow-a: #d9ece5;
    --page-glow-b: #d9ece5;
    --page-a: #edf8f5;
    --page-b: #edf8f5;
    --page-c: #edf8f5;
    --hairline: #82a69b40;
    --divider: #82a69b55;
    --panel-border: #82a69b60;
    --panel-border-strong: #82a69b99;
    --panel-bg: #f8fdfa;
    --panel-translucent: #f8fdfaee;
    --surface: #d9ece5;
    --surface-hover: #a5ddca;
    --surface-border: #82a69b99;
    --surface-border-strong: #82a69b;
    --surface-hover-border: #146b59;
    --active-bg: #d9ece5;
    --active-soft: #193d38;
    --frame-a: #d9ece5;
    --frame-b: #edf8f5;
    --board-bg: #ffffff;
    --clue-bg: #d9ece5;
    --cell-bg: #ffffff;
    --cell-hover: #d9ece5;
    --filled-bg: #216e5d;
    --filled-inset: #216e5d;
    --cross-text: #4b6c64;
    --cross-bg: #f8fdfa;
    --auto-text: #4b6c64;
    --auto-bg: #f8fdfa;
    --mistake-text: #a32940;
    --mistake-bg: #f7dce2;
    --grid-line: #82a69b;
    --grid-strong: #4b6c64;
    --board-border: #4b6c64;
    --toolbar-bg: #f8fdfaf5;
    --toast-bg: #f8fdfa;
    --guide-bg: #f8fdfa;
    --guide-text: #193d38;
    --modal-bg: #f8fdfa;
    --modal-text: #193d38;
    --modal-backdrop: #edf8f5bb;
    --rule-bg: #d9ece5;
    --shadow: #edf8f566;
    --shadow-soft: #edf8f533;
    --scroll-thumb: #82a69b;
    --scroll-track: #d9ece5;
}
:root[data-theme="lagoon"] :is(.tool-button.active, .help-footer button.primary, .modal-actions button.primary, #stroke-count, .library-tabs .active) { background: #a5ddca; border-color: #146b59; }
:root[data-theme="lavender"] {
    color-scheme: light;
    --page: #f2f0fb;
    --panel: #fcfaff;
    --panel-light: #e5dff3;
    --line: #9e93b7;
    --text: #38304e;
    --text-soft: #38304e;
    --muted: #696078;
    --accent: #645098;
    --accent-deep: #645098;
    --accent-ink: #38304e;
    --warm: #86551e;
    --danger: #aa3541;
    --page-glow-a: #e5dff3;
    --page-glow-b: #e5dff3;
    --page-a: #f2f0fb;
    --page-b: #f2f0fb;
    --page-c: #f2f0fb;
    --hairline: #9e93b740;
    --divider: #9e93b755;
    --panel-border: #9e93b760;
    --panel-border-strong: #9e93b799;
    --panel-bg: #fcfaff;
    --panel-translucent: #fcfaffee;
    --surface: #e5dff3;
    --surface-hover: #cfc0ed;
    --surface-border: #9e93b799;
    --surface-border-strong: #9e93b7;
    --surface-hover-border: #645098;
    --active-bg: #e5dff3;
    --active-soft: #38304e;
    --frame-a: #e5dff3;
    --frame-b: #f2f0fb;
    --board-bg: #ffffff;
    --clue-bg: #e5dff3;
    --cell-bg: #ffffff;
    --cell-hover: #e5dff3;
    --filled-bg: #65508e;
    --filled-inset: #65508e;
    --cross-text: #696078;
    --cross-bg: #fcfaff;
    --auto-text: #696078;
    --auto-bg: #fcfaff;
    --mistake-text: #a32940;
    --mistake-bg: #f7dce2;
    --grid-line: #9e93b7;
    --grid-strong: #696078;
    --board-border: #696078;
    --toolbar-bg: #fcfafff5;
    --toast-bg: #fcfaff;
    --guide-bg: #fcfaff;
    --guide-text: #38304e;
    --modal-bg: #fcfaff;
    --modal-text: #38304e;
    --modal-backdrop: #f2f0fbbb;
    --rule-bg: #e5dff3;
    --shadow: #f2f0fb66;
    --shadow-soft: #f2f0fb33;
    --scroll-thumb: #9e93b7;
    --scroll-track: #e5dff3;
}
:root[data-theme="lavender"] :is(.tool-button.active, .help-footer button.primary, .modal-actions button.primary, #stroke-count, .library-tabs .active) { background: #cfc0ed; border-color: #645098; }
:root[data-theme="arctic"] {
    color-scheme: light;
    --page: #eef4fb;
    --panel: #fbfdff;
    --panel-light: #dce7f4;
    --line: #90a5bf;
    --text: #263950;
    --text-soft: #263950;
    --muted: #50647b;
    --accent: #285b9c;
    --accent-deep: #285b9c;
    --accent-ink: #263950;
    --warm: #86551e;
    --danger: #aa3541;
    --page-glow-a: #dce7f4;
    --page-glow-b: #dce7f4;
    --page-a: #eef4fb;
    --page-b: #eef4fb;
    --page-c: #eef4fb;
    --hairline: #90a5bf40;
    --divider: #90a5bf55;
    --panel-border: #90a5bf60;
    --panel-border-strong: #90a5bf99;
    --panel-bg: #fbfdff;
    --panel-translucent: #fbfdffee;
    --surface: #dce7f4;
    --surface-hover: #b6d4f7;
    --surface-border: #90a5bf99;
    --surface-border-strong: #90a5bf;
    --surface-hover-border: #285b9c;
    --active-bg: #dce7f4;
    --active-soft: #263950;
    --frame-a: #dce7f4;
    --frame-b: #eef4fb;
    --board-bg: #ffffff;
    --clue-bg: #dce7f4;
    --cell-bg: #ffffff;
    --cell-hover: #dce7f4;
    --filled-bg: #32659b;
    --filled-inset: #32659b;
    --cross-text: #50647b;
    --cross-bg: #fbfdff;
    --auto-text: #50647b;
    --auto-bg: #fbfdff;
    --mistake-text: #a32940;
    --mistake-bg: #f7dce2;
    --grid-line: #90a5bf;
    --grid-strong: #50647b;
    --board-border: #50647b;
    --toolbar-bg: #fbfdfff5;
    --toast-bg: #fbfdff;
    --guide-bg: #fbfdff;
    --guide-text: #263950;
    --modal-bg: #fbfdff;
    --modal-text: #263950;
    --modal-backdrop: #eef4fbbb;
    --rule-bg: #dce7f4;
    --shadow: #eef4fb66;
    --shadow-soft: #eef4fb33;
    --scroll-thumb: #90a5bf;
    --scroll-track: #dce7f4;
}
:root[data-theme="arctic"] :is(.tool-button.active, .help-footer button.primary, .modal-actions button.primary, #stroke-count, .library-tabs .active) { background: #b6d4f7; border-color: #285b9c; }
:root[data-theme="ember"] {
    color-scheme: dark;
    --page: #211b20;
    --panel: #2c252b;
    --panel-light: #3c3038;
    --line: #79616c;
    --text: #fff2eb;
    --text-soft: #fff2eb;
    --muted: #cfb8ba;
    --accent: #f2a185;
    --accent-deep: #f2a185;
    --accent-ink: #211b20;
    --warm: #f1cf91;
    --danger: #ff9da6;
    --page-glow-a: #3c3038;
    --page-glow-b: #3c3038;
    --page-a: #211b20;
    --page-b: #211b20;
    --page-c: #211b20;
    --hairline: #79616c40;
    --divider: #79616c55;
    --panel-border: #79616c60;
    --panel-border-strong: #79616c99;
    --panel-bg: #2c252b;
    --panel-translucent: #2c252bee;
    --surface: #3c3038;
    --surface-hover: #79616c;
    --surface-border: #79616c99;
    --surface-border-strong: #79616c;
    --surface-hover-border: #f2a185;
    --active-bg: #3c3038;
    --active-soft: #fff2eb;
    --frame-a: #3c3038;
    --frame-b: #211b20;
    --board-bg: #241d23;
    --clue-bg: #3c3038;
    --cell-bg: #241d23;
    --cell-hover: #3c3038;
    --filled-bg: #efb195;
    --filled-inset: #efb195;
    --cross-text: #cfb8ba;
    --cross-bg: #2c252b;
    --auto-text: #cfb8ba;
    --auto-bg: #2c252b;
    --mistake-text: #ffb1bd;
    --mistake-bg: #532f3d;
    --grid-line: #79616c;
    --grid-strong: #cfb8ba;
    --board-border: #cfb8ba;
    --toolbar-bg: #2c252bf5;
    --toast-bg: #2c252b;
    --guide-bg: #2c252b;
    --guide-text: #fff2eb;
    --modal-bg: #2c252b;
    --modal-text: #fff2eb;
    --modal-backdrop: #211b20bb;
    --rule-bg: #3c3038;
    --shadow: #211b2066;
    --shadow-soft: #211b2033;
    --scroll-thumb: #79616c;
    --scroll-track: #3c3038;
}
:root[data-theme="espresso"] {
    color-scheme: dark;
    --page: #211c19;
    --panel: #2e2722;
    --panel-light: #3e342b;
    --line: #7d6b57;
    --text: #fbf1de;
    --text-soft: #fbf1de;
    --muted: #cdbca7;
    --accent: #e7bf7a;
    --accent-deep: #e7bf7a;
    --accent-ink: #211c19;
    --warm: #f1cf91;
    --danger: #ff9da6;
    --page-glow-a: #3e342b;
    --page-glow-b: #3e342b;
    --page-a: #211c19;
    --page-b: #211c19;
    --page-c: #211c19;
    --hairline: #7d6b5740;
    --divider: #7d6b5755;
    --panel-border: #7d6b5760;
    --panel-border-strong: #7d6b5799;
    --panel-bg: #2e2722;
    --panel-translucent: #2e2722ee;
    --surface: #3e342b;
    --surface-hover: #7d6b57;
    --surface-border: #7d6b5799;
    --surface-border-strong: #7d6b57;
    --surface-hover-border: #e7bf7a;
    --active-bg: #3e342b;
    --active-soft: #fbf1de;
    --frame-a: #3e342b;
    --frame-b: #211c19;
    --board-bg: #251f1a;
    --clue-bg: #3e342b;
    --cell-bg: #251f1a;
    --cell-hover: #3e342b;
    --filled-bg: #e8c896;
    --filled-inset: #e8c896;
    --cross-text: #cdbca7;
    --cross-bg: #2e2722;
    --auto-text: #cdbca7;
    --auto-bg: #2e2722;
    --mistake-text: #ffb1bd;
    --mistake-bg: #532f3d;
    --grid-line: #7d6b57;
    --grid-strong: #cdbca7;
    --board-border: #cdbca7;
    --toolbar-bg: #2e2722f5;
    --toast-bg: #2e2722;
    --guide-bg: #2e2722;
    --guide-text: #fbf1de;
    --modal-bg: #2e2722;
    --modal-text: #fbf1de;
    --modal-backdrop: #211c19bb;
    --rule-bg: #3e342b;
    --shadow: #211c1966;
    --shadow-soft: #211c1933;
    --scroll-thumb: #7d6b57;
    --scroll-track: #3e342b;
}
:root[data-theme="midnight"] {
    color-scheme: dark;
    --page: #141b30;
    --panel: #1d2840;
    --panel-light: #2b3857;
    --line: #546687;
    --text: #eef3ff;
    --text-soft: #eef3ff;
    --muted: #b7c5e1;
    --accent: #a5baf8;
    --accent-deep: #a5baf8;
    --accent-ink: #141b30;
    --warm: #f1cf91;
    --danger: #ff9da6;
    --page-glow-a: #2b3857;
    --page-glow-b: #2b3857;
    --page-a: #141b30;
    --page-b: #141b30;
    --page-c: #141b30;
    --hairline: #54668740;
    --divider: #54668755;
    --panel-border: #54668760;
    --panel-border-strong: #54668799;
    --panel-bg: #1d2840;
    --panel-translucent: #1d2840ee;
    --surface: #2b3857;
    --surface-hover: #546687;
    --surface-border: #54668799;
    --surface-border-strong: #546687;
    --surface-hover-border: #a5baf8;
    --active-bg: #2b3857;
    --active-soft: #eef3ff;
    --frame-a: #2b3857;
    --frame-b: #141b30;
    --board-bg: #182139;
    --clue-bg: #2b3857;
    --cell-bg: #182139;
    --cell-hover: #2b3857;
    --filled-bg: #becbfa;
    --filled-inset: #becbfa;
    --cross-text: #b7c5e1;
    --cross-bg: #1d2840;
    --auto-text: #b7c5e1;
    --auto-bg: #1d2840;
    --mistake-text: #ffb1bd;
    --mistake-bg: #532f3d;
    --grid-line: #546687;
    --grid-strong: #b7c5e1;
    --board-border: #b7c5e1;
    --toolbar-bg: #1d2840f5;
    --toast-bg: #1d2840;
    --guide-bg: #1d2840;
    --guide-text: #eef3ff;
    --modal-bg: #1d2840;
    --modal-text: #eef3ff;
    --modal-backdrop: #141b30bb;
    --rule-bg: #2b3857;
    --shadow: #141b3066;
    --shadow-soft: #141b3033;
    --scroll-thumb: #546687;
    --scroll-track: #2b3857;
}
:root[data-theme="rose"] {
    color-scheme: dark;
    --page: #261b2b;
    --panel: #35263b;
    --panel-light: #49344f;
    --line: #815d86;
    --text: #fdf0fb;
    --text-soft: #fdf0fb;
    --muted: #d2b7d3;
    --accent: #efa8ce;
    --accent-deep: #efa8ce;
    --accent-ink: #261b2b;
    --warm: #f1cf91;
    --danger: #ff9da6;
    --page-glow-a: #49344f;
    --page-glow-b: #49344f;
    --page-a: #261b2b;
    --page-b: #261b2b;
    --page-c: #261b2b;
    --hairline: #815d8640;
    --divider: #815d8655;
    --panel-border: #815d8660;
    --panel-border-strong: #815d8699;
    --panel-bg: #35263b;
    --panel-translucent: #35263bee;
    --surface: #49344f;
    --surface-hover: #815d86;
    --surface-border: #815d8699;
    --surface-border-strong: #815d86;
    --surface-hover-border: #efa8ce;
    --active-bg: #49344f;
    --active-soft: #fdf0fb;
    --frame-a: #49344f;
    --frame-b: #261b2b;
    --board-bg: #2b2030;
    --clue-bg: #49344f;
    --cell-bg: #2b2030;
    --cell-hover: #49344f;
    --filled-bg: #f0c0db;
    --filled-inset: #f0c0db;
    --cross-text: #d2b7d3;
    --cross-bg: #35263b;
    --auto-text: #d2b7d3;
    --auto-bg: #35263b;
    --mistake-text: #ffb1bd;
    --mistake-bg: #532f3d;
    --grid-line: #815d86;
    --grid-strong: #d2b7d3;
    --board-border: #d2b7d3;
    --toolbar-bg: #35263bf5;
    --toast-bg: #35263b;
    --guide-bg: #35263b;
    --guide-text: #fdf0fb;
    --modal-bg: #35263b;
    --modal-text: #fdf0fb;
    --modal-backdrop: #261b2bbb;
    --rule-bg: #49344f;
    --shadow: #261b2b66;
    --shadow-soft: #261b2b33;
    --scroll-thumb: #815d86;
    --scroll-track: #49344f;
}

.theme-option::before { content: ""; display: inline-block; vertical-align: middle; width: 30px; height: 20px; margin-right: 10px; border: 1px solid var(--surface-border); border-radius: 5px; background: linear-gradient(90deg, var(--preview-cell) 0 40%, var(--preview-fill) 40% 75%, var(--preview-accent) 75%); }
.theme-option[data-theme-value="ocean"] { --preview-cell: #162632; --preview-fill: #b9e7d9; --preview-accent: #f5c57d; }
.theme-option[data-theme-value="aurora"] { --preview-cell: #211c34; --preview-fill: #d7b9f0; --preview-accent: #ffd078; }
.theme-option[data-theme-value="forest"] { --preview-cell: #182a21; --preview-fill: #c9e8a5; --preview-accent: #e7b86b; }
.theme-option[data-theme-value="paper"] { --preview-cell: #fffdf8; --preview-fill: #397e6d; --preview-accent: #a96017; }
.theme-option[data-theme-value="sakura"] { --preview-cell: #fffdfd; --preview-fill: #8f315b; --preview-accent: #a53767; }
.theme-option[data-theme-value="lagoon"] { --preview-cell: #ffffff; --preview-fill: #216e5d; --preview-accent: #146b59; }
.theme-option[data-theme-value="lavender"] { --preview-cell: #ffffff; --preview-fill: #65508e; --preview-accent: #645098; }
.theme-option[data-theme-value="arctic"] { --preview-cell: #ffffff; --preview-fill: #32659b; --preview-accent: #285b9c; }
.theme-option[data-theme-value="ember"] { --preview-cell: #241d23; --preview-fill: #efb195; --preview-accent: #f2a185; }
.theme-option[data-theme-value="espresso"] { --preview-cell: #251f1a; --preview-fill: #e8c896; --preview-accent: #e7bf7a; }
.theme-option[data-theme-value="midnight"] { --preview-cell: #182139; --preview-fill: #becbfa; --preview-accent: #a5baf8; }
.theme-option[data-theme-value="rose"] { --preview-cell: #2b2030; --preview-fill: #f0c0db; --preview-accent: #efa8ce; }
.theme-option[data-theme-value="led"] { --preview-cell: #000000; --preview-fill: #87ceeb; --preview-accent: #ff2bd6; }

.board-scroll {
    position: relative;
    overflow: auto;
    max-width: 100%;
    overscroll-behavior: contain;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
    scrollbar-width: thin;
}

.nonogram-board {
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    border: 2px solid var(--board-border);
    background: var(--board-bg);
    user-select: none;
}

.nonogram-board th, .nonogram-board td { padding: 0; border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); }
.nonogram-board tr > :last-child { border-right: 0; }
.nonogram-board tbody tr:last-child > * { border-bottom: 0; }
.nonogram-board th { color: var(--text); font-family: var(--font-display); font-size: calc(var(--cell-size) * .41); font-weight: 700; font-variant-numeric: tabular-nums; }
.nonogram-board .corner { position: sticky; z-index: 4; top: 0; left: 0; min-width: calc(var(--cell-size) * 2.5); background: var(--clue-bg); }
.nonogram-board .col-clue { position: sticky; z-index: 3; top: 0; width: var(--cell-size); min-width: var(--cell-size); padding: 7px 0; vertical-align: bottom; background: var(--clue-bg); }
.nonogram-board .col-clue span { display: block; line-height: 1.2; }
.nonogram-board .row-clue { position: sticky; z-index: 2; left: 0; min-width: calc(var(--cell-size) * 2.5); padding: 0 8px; text-align: right; white-space: nowrap; background: var(--clue-bg); }
.nonogram-board .row-clue span + span { margin-left: .32em; }
.nonogram-board .block-right { border-right: 2px solid var(--grid-strong); }
.nonogram-board .block-bottom > * { border-bottom: 2px solid var(--grid-strong); }

.game-cell {
    display: grid;
    place-items: center;
    width: var(--cell-size);
    height: var(--cell-size);
    padding: 0;
    border: 0;
    border-radius: 0;
    color: var(--cross-text);
    background: var(--cell-bg);
    font-size: calc(var(--cell-size) * .75);
    line-height: 1;
    text-align: center;
    touch-action: none;
}
.game-cell:hover { background: var(--cell-hover); }
.game-cell.filled { background: var(--filled-bg); box-shadow: inset 0 0 0 2px var(--filled-inset); }
.game-cell.crossed { color: var(--cross-text); background: var(--cross-bg); }
.game-cell.auto-crossed { color: var(--auto-text); background: var(--auto-bg); }
.game-cell.mistake { color: var(--mistake-text); background: var(--mistake-bg); }
.game-cell:focus-visible { position: relative; z-index: 1; outline: 3px solid var(--warm); outline-offset: -3px; }
.game-cell:disabled { opacity: 1; cursor: default; }

.toast {
    position: fixed;
    z-index: 15;
    left: 50%;
    bottom: 24px;
    max-width: min(90vw, 500px);
    padding: 12px 18px;
    border: 1px solid var(--surface-hover-border);
    border-radius: 12px;
    color: var(--text);
    background: var(--toast-bg);
    box-shadow: 0 12px 35px #0008;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.storage-error { border-color: var(--danger); background: var(--mistake-bg); }

.modal {
    width: min(90vw, 520px);
    max-height: 85vh;
    padding: 0;
    border: 1px solid var(--surface-hover-border);
    border-radius: 22px;
    color: var(--text);
    background: var(--modal-bg);
    box-shadow: 0 24px 90px #000b;
}
.modal::backdrop { background: var(--modal-backdrop); backdrop-filter: blur(5px); }
.modal-content { padding: clamp(24px, 5vw, 38px); }
.modal h2 { margin: 0 0 14px; font-size: clamp(27px, 5vw, 38px); line-height: 1.1; letter-spacing: -.04em; }
#modal-message { color: var(--modal-text); line-height: 1.55; }
#modal-message p { margin: 0 0 12px; }
#modal-message ul { margin: 10px 0; padding-left: 23px; }
#modal-message li { margin: 7px 0; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 26px; }
.modal-actions button { min-height: 44px; padding: 9px 16px; border: 1px solid var(--surface-border-strong); border-radius: 10px; color: var(--text); background: var(--surface); font-weight: 700; }
.modal-actions button.primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.help-dialog { width:min(640px,calc(100vw - 32px)); max-width:none; max-height:calc(100dvh - 32px); padding:0; border:1px solid var(--panel-border-strong); border-radius:20px; color:var(--text); background:var(--modal-bg); box-shadow:0 24px 90px #0009; }
.help-dialog[open] { display:flex; flex-direction:column; }
.help-dialog::backdrop { background:var(--modal-backdrop); backdrop-filter:blur(6px); }
.help-dialog button { min-height:44px; border:1px solid var(--surface-border); border-radius:9px; padding:9px 14px; color:var(--text); background:var(--surface); font:inherit; font-weight:600; }
.help-dialog :focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.help-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 24px 4px; flex-shrink:0; }
.help-header .eyebrow { margin:0; font-size:11px; }
.help-header button { flex-shrink:0; padding:8px; border-color:transparent; background:transparent; color:var(--muted); font-size:13px; }
.help-steps { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; padding:8px 24px 18px; flex-shrink:0; }
.help-steps button { display:flex; align-items:center; justify-content:center; gap:8px; padding:8px 4px; background:transparent; font-size:13px; }
.help-steps button span { display:grid; place-items:center; width:23px; height:23px; border-radius:50%; color:var(--muted); background:var(--surface); font-size:12px; }
.help-steps button[aria-current] { border-color:var(--accent); color:var(--text); background:var(--surface); }
.help-steps button[aria-current] span { color:var(--accent-ink); background:var(--accent); }
.help-body { min-height:0; overflow-y:auto; padding:0 28px 12px; overscroll-behavior:contain; scrollbar-gutter:stable; }
.help-body h2 { margin:0 0 12px; font-size:clamp(25px,4vw,32px); line-height:1.15; letter-spacing:-.035em; }
.help-body h2:focus { outline:none; }
.help-body p { margin:0 0 16px; font-size:14px; line-height:1.6; }
#help-description { color:var(--modal-text); }
.help-directions { display:grid; grid-template-columns:minmax(0,1fr) 86px; gap:20px; align-items:center; padding:20px; margin:20px 0; border-radius:12px; background:var(--rule-bg); }
.help-directions strong { display:block; margin-bottom:12px; font-size:13px; color:var(--muted); }
.help-row-diagram { display:flex; align-items:center; gap:12px; }
.help-row-diagram b, .help-column-diagram b, .help-line b { color:var(--warm); text-align:center; line-height:1.25; font-size:18px; font-variant-numeric:tabular-nums; }
.help-row-diagram b { white-space:nowrap; }
.help-line-cells { display:flex; gap:3px; }
.help-cell { display:grid; place-items:center; min-width:0; aspect-ratio:1; border:1px solid var(--grid-line); background:var(--cell-bg); color:var(--cross-text); font-size:22px; line-height:1; }
.help-line-cells .help-cell { width:clamp(22px,5vw,36px); }
.help-cell.is-filled { background:var(--filled-bg); }
.help-cell.is-crossed { background:var(--cross-bg); }
.help-column-diagram { display:flex; flex-direction:column; align-items:center; gap:8px; }
.help-column-diagram .help-line-cells { flex-direction:column; }
.help-column-diagram .help-cell { width:28px; }
.help-key-rule strong { color:var(--text); }
.help-body .help-note { color:var(--muted); font-size:13px; }
.help-overlap { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin:20px 0; padding:16px; border-radius:12px; background:var(--rule-bg); }
.help-overlap > div > span { display:block; margin-bottom:8px; color:var(--muted); font-size:12px; }
.help-line { display:grid; grid-template-columns:24px repeat(5,minmax(0,1fr)); align-items:center; gap:2px; max-width:330px; }
.help-overlap .help-line .help-cell:nth-child(4) { outline:2px solid var(--warm); outline-offset:-2px; }
.help-practice > strong { display:block; margin-bottom:8px; font-size:13px; }
.help-practice .help-line { max-width:300px; margin:auto; }
.help-practice .help-cell { min-height:44px; padding:0; border-radius:2px; background:var(--cell-bg); }
.help-practice .help-cell.is-filled { background:var(--filled-bg); }
.help-practice .help-cell:hover { border-color:var(--accent); }
.help-body .help-feedback { margin:12px 0 16px; padding:12px; border-radius:10px; background:var(--surface); font-size:13px; }
.help-tools { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin:20px 0; }
.help-tools > div { display:flex; align-items:flex-start; gap:12px; }
.help-tools svg { flex-shrink:0; width:24px; height:24px; margin-top:2px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; color:var(--accent); }
.help-tools strong { display:block; margin-bottom:4px; font-size:14px; }
.help-tools p { font-size:13px; color:var(--muted); margin:0; }
.help-details { border-top:1px solid var(--divider); }
.help-details summary { min-height:44px; padding:12px 0; cursor:pointer; font-size:14px; font-weight:600; }
.help-details p { font-size:13px; color:var(--modal-text); }
.help-lives { width:100%; border-collapse:collapse; margin:0 0 12px; text-align:center; font-size:13px; }
.help-lives caption { margin-bottom:8px; text-align:left; color:var(--muted); }
.help-lives th, .help-lives td { padding:6px; border:1px solid var(--surface-border); }
.help-lives td { color:var(--warm); font-weight:600; }
.help-body .help-return { margin:12px 0 0; }
.help-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 24px; border-top:1px solid var(--divider); flex-shrink:0; }
#help-count { color:var(--muted); font-size:13px; font-variant-numeric:tabular-nums; }
.help-footer > div { display:flex; gap:8px; }
.help-footer button.primary { color:var(--accent-ink); background:var(--accent); border-color:var(--accent); }
@media(max-width:570px) {
    .help-dialog { width:calc(100vw - 16px); max-height:calc(100dvh - 16px); border-radius:14px; }
    .help-header { padding:8px 16px 0; }
    .help-header .eyebrow { max-width:130px; }
    .help-steps { padding:6px 16px 16px; gap:4px; }
    .help-steps button { gap:5px; font-size:12px; }
    .help-steps button span { width:20px; height:20px; }
    .help-body { padding:0 16px 12px; scrollbar-gutter:auto; }
    .help-directions { grid-template-columns:minmax(0,1fr) 58px; gap:12px; padding:12px; }
    .help-row-diagram { flex-direction:column; align-items:flex-start; gap:8px; }
    .help-overlap { grid-template-columns:1fr; gap:12px; padding:12px; margin:12px 0; }
    .help-overlap .help-cell { max-height:34px; }
    .help-tools { grid-template-columns:1fr; gap:12px; }
    .help-footer { padding:12px 16px; }
}

.game-cell.pencil { color: var(--warm); font-size: calc(var(--cell-size) * .9); }
.game-cell.cursor-cell { position: relative; z-index: 1; outline: 3px solid var(--warm); outline-offset: -3px; }
.nonogram-board th.advice-clue { box-shadow: inset 0 0 0 2px var(--warm); }
.game-cell.advice-cell { outline: 2px dashed var(--warm); outline-offset: -3px; }
.picture-view .game-cell { color: transparent; background: var(--cell-bg); }
.picture-view .game-cell.filled { background: var(--filled-bg); }
.picture-view th { opacity: .25; }
.picture-view td { border-color: transparent; }
.picture-view .game-cell { transition: background .35s, color .35s; }
/* Playing-surface UI. Navigation, tools and dialogs each have one visual role. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height:100%; }
body { isolation:isolate; min-width:320px; min-height:100dvh; margin:0; background:var(--page); color:var(--text); font:15px/1.45 var(--font-ui); -webkit-font-smoothing:antialiased; }
body::before, body::after { content:""; position:fixed; z-index:-1; pointer-events:none; width:65vw; height:65vh; border-radius:50%; filter:blur(75px); opacity:.08; background:radial-gradient(ellipse,var(--accent),transparent 68%); animation:ambient-drift 32s ease-in-out infinite alternate; }
body::before { left:-30vw; top:4vh; }
body::after { right:-35vw; bottom:-20vh; opacity:.045; animation-delay:-16s; }
@keyframes ambient-drift { to { transform:translate(7vw,5vh) scale(1.12); } }
html[data-ambient] body::before, html[data-ambient] body::after { display:none; }
#ambient-layer { position:fixed; inset:0; z-index:-1; pointer-events:none; overflow:hidden; contain:strict; }
#ambient-layer[hidden] { display:none; }
#ambient-layer canvas { position:absolute; inset:0; }
.ambient-veil { position:absolute; width:60vw; height:65vh; opacity:var(--ambient-opacity,.05); background:radial-gradient(ellipse,var(--accent),transparent 70%); will-change:transform; }
.ambient-veil:first-of-type { left:-35vw; top:10vh; }
.ambient-veil:last-of-type { right:-35vw; bottom:-15vh; }
[data-effect=fog] .ambient-veil { animation:ambient-mist 55s ease-in-out infinite alternate; }
[data-effect=fog] .ambient-veil:last-of-type { animation-delay:-27s; }
[data-effect=reflections] .ambient-veil { height:28vh; border-radius:50%; transform:rotate(-20deg); animation:ambient-reflection 35s ease-in-out infinite alternate; }
[data-effect=reflections] .ambient-veil:last-of-type { animation-delay:-18s; }
#ambient-layer:not([data-effect=fog]):not([data-effect=reflections]) .ambient-veil { display:none; }
@keyframes ambient-mist { to { transform:translate(14vw,5vh) scale(1.2); } }
@keyframes ambient-reflection { to { transform:translate(5vw,3vh) rotate(-12deg) scale(1.15,.8); opacity:calc(var(--ambient-opacity)*.4); } }
.precision-offer { font-size:.75rem; color:var(--text); padding:4px 8px; border:1px solid var(--panel-border); border-radius:8px; }
.precision-offer[aria-pressed=true] { background:var(--accent); color:var(--accent-ink); }
.board-zoom { flex-wrap:wrap; max-width:calc(100vw - 24px); }
.library-summary { flex-wrap:wrap; }
button, summary { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; font:inherit; }
button:disabled { opacity:.38; cursor:default; }
button, select, summary { outline-offset:4px; }
:focus-visible { outline:2px solid var(--accent-deep); }
svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.topbar { padding:14px 32px 0; display:flex; flex-direction:column; align-items:flex-start; gap:6px; }
.brand { display:flex; flex-direction:column; align-items:flex-start; gap:12px; flex-shrink:0; }
.brand img { width:64px; height:64px; object-fit:contain; }
.brand span { display:block; color:var(--muted); font-size:11px; margin-top:2px; }
.top-actions { display:flex; align-items:center; gap:22px; }
.nav-link, .top-menu summary { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:8px 0; color:var(--muted); background:transparent; border:0; border-radius:0; text-decoration:none; font-size:14px; list-style:none; cursor:pointer; }
.nav-link:hover, .top-menu summary:hover { color:var(--text); }
#language-button { min-width:44px; gap:7px; }
.language-flag { width:22px; height:14px; flex-shrink:0; border-radius:2px; overflow:hidden; fill:none; stroke:none; stroke-linecap:butt; stroke-linejoin:miter; }
.top-menu { position:relative; }
.top-menu:not([open]) .top-menu-popover { display:none; }
.top-menu summary::after { content:"▼"; margin-left:6px; font-size:.7em; line-height:1; align-self:center; }
summary::-webkit-details-marker { display:none; }
.top-menu[open] summary { color:var(--text); box-shadow:inset 0 -2px var(--accent); }
.top-menu-popover { position:absolute; top:calc(100% + 6px); left:0; z-index:30; width:240px; max-height:min(480px,var(--theme-menu-height,calc(100dvh - 200px))); overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; padding:6px; background:var(--modal-bg); border:1px solid var(--panel-border-strong); border-radius:12px; box-shadow:0 12px 32px var(--shadow); }
.theme-option { display:block; position:relative; width:100%; min-height:44px; padding:9px 30px 9px 10px; border:0; border-radius:6px; color:var(--text); background:transparent; font-size:14px; text-align:left; white-space:nowrap; }
.theme-option:hover, .theme-option:focus-visible { background:var(--surface); }
.theme-option[aria-checked=true] { background:var(--surface); font-weight:650; }
.theme-option[aria-checked=true]::after { content:"✓"; position:absolute; right:10px; }
.navigation-menu summary { display:none; }
#navigation-links { display:flex; align-items:center; gap:22px; }
.layout { max-width:1160px; margin:auto; padding:18px 24px 22px; }
.site-footer { position:fixed; z-index:2147483647; left:12px; bottom:calc(1px + env(safe-area-inset-bottom)); min-height:11px; color:var(--muted); font-size:10px; line-height:11px; pointer-events:none; }
.footer-copyright { white-space:nowrap; }
.footer-business-link { display:none; text-align:center; white-space:nowrap; }
.site-footer a { color:inherit; text-underline-offset:2px; pointer-events:auto; }
.site-footer a:hover { color:var(--text); }
.game-area { min-width:0; display:flex; flex-direction:column; align-items:center; }
.game-heading { width:min(100%,max(280px,var(--board-width,680px))); display:flex; align-items:center; justify-content:space-between; gap:18px; margin:0 0 16px; min-height:32px; }
.puzzle-meta { display:flex; align-items:center; flex-wrap:wrap; gap:9px; }
.game-heading h2 { margin:0; font-size:15px; font-weight:650; white-space:nowrap; }
#difficulty-label { font-size:13px; color:var(--muted); }
.heading-metrics { display:flex; gap:14px; align-items:center; flex-shrink:0; }
.metric-card strong { font-weight:500; font-size:13px; font-variant-numeric:tabular-nums; white-space:nowrap; color:var(--muted); }
.lives-card strong { color:var(--text-soft); }
.game-status { width:min(100%,max(280px,var(--board-width,680px))); padding:8px 0; font-size:13px; color:var(--muted); }
.board-stage { display:contents; }
.board-frame { position:relative; max-width:100%; padding:3px; border-radius:3px; background:var(--board-bg); }
.board-scroll { max-height:var(--board-height,calc(100dvh - 270px)); max-width:100%; touch-action:none; }
.nonogram-board { border-width:1px; }
.nonogram-board th { font-weight:600; }
:root:is([data-theme="paper"], [data-theme="sakura"], [data-theme="lagoon"], [data-theme="lavender"], [data-theme="arctic"]) { --marked-clue:color-mix(in srgb, var(--muted) 90%, #000); }
.nonogram-board .clue-done, .nonogram-board .clue-manual { color:var(--marked-clue); font-style:italic; font-weight:400; text-decoration:none; }
.nonogram-board th span[role=button] { cursor:pointer; border-radius:2px; }
.nonogram-board th span[role=button]:hover { background:var(--cell-hover); }
.nonogram-board th span[role=button]:focus-visible { outline:2px solid var(--warm); }
.game-cell.filled { box-shadow:none; }
.game-cell { font-family:var(--font-ui); font-weight:300; }
.game-cell:hover:not(.filled):not(.crossed):not(.auto-crossed):not(.mistake) { background:var(--cell-hover); }
.game-tools { display:contents; }
.controls { order:2; position:relative; margin:6px 0 0; max-width:100%; }
.tool-group { display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:6px; }
.tool-button, .icon-button { display:inline-flex; align-items:center; justify-content:center; gap:6px; width:44px; height:44px; min-height:44px; padding:9px; border:1px solid transparent; border-radius:9px; background:transparent; color:var(--muted); font-size:14px; }
.tool-button:hover, .icon-button:hover { background:var(--surface); color:var(--text); }
.tool-button.active { color:var(--accent-ink); background:var(--accent); border-color:var(--accent-deep); }
.tool-group [data-tool] span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
.tool-group .icon-button span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
.is-finished .controls, .is-lost .controls { display:none; }
.tool-group #undo-button { margin-left:12px; }
#restart-button { color:var(--danger); }
.board-zoom { order:1; width:min(100%,max(340px,var(--board-width,680px))); display:flex; align-items:center; justify-content:flex-end; gap:0; margin-top:8px; }
.board-zoom button { width:32px; min-width:32px; height:32px; min-height:32px; padding:0; color:var(--muted); background:transparent; border:0; font-size:18px; }
.board-zoom #sound-button { margin-right:auto; width:44px; height:44px; min-height:44px; }
#precision-offer { width:auto; flex:1 0 100%; font-size:12px; height:44px; min-height:44px; white-space:normal; }
#sound-button:hover { background:var(--surface); color:var(--text); }
#sound-button .sound-muted, #sound-button[aria-pressed=false] .sound-waves { display:none; }
#sound-button[aria-pressed=false] .sound-muted { display:block; }
.zoom-value { font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; min-width:40px; text-align:center; }
.after-board { order:3; width:min(100%,max(280px,var(--board-width,680px))); }
.completion-panel { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:4px 18px; padding:20px 0; }
.completion-copy, .completion-actions { grid-column:1; }
.completion-panel span { color:var(--muted); font-size:12px; }
.completion-panel h3 { margin:4px 0 0; font-size:21px; font-weight:600; }
.completion-actions, .advice-actions { display:flex; flex-wrap:wrap; gap:12px; }
.completion-actions button, .advice-actions button { background:transparent; color:var(--muted); border:0; padding:8px 0; min-height:44px; font-size:13px; }
#similar-button { grid-column:2; grid-row:1 / span 2; display:inline-flex; align-items:center; justify-content:center; width:64px; height:64px; padding:0; border:1px solid var(--filled-bg); border-radius:50%; background:var(--filled-bg); color:var(--cell-bg); box-shadow:0 5px 18px var(--shadow-soft); }
#similar-button svg { width:32px; height:32px; stroke-width:2.5; }
#similar-button .retry-icon { fill:currentColor; stroke:none; }
#similar-button:hover { box-shadow:0 7px 24px var(--shadow); }
.board-frame > #similar-button { position:absolute; left:var(--next-button-left,calc(100% + 18px)); top:var(--grid-center-y,50%); transform:translateY(-50%); }
.advice-panel { padding:16px; margin-top:18px; border:1px solid var(--panel-border); border-radius:10px; background:var(--panel-bg); }
.advice-panel strong { color:var(--text); font-weight:600; }
.advice-panel p { color:var(--muted); font-size:13px; margin:8px 0; }
.precise-pad { display:flex; gap:16px; justify-content:center; align-items:center; padding:14px 0; }
.direction-pad { display:grid; grid-template-columns:repeat(3,44px); grid-template-rows:repeat(2,44px); gap:4px; }
.direction-pad button { border:1px solid var(--surface-border); border-radius:8px; color:var(--text); background:var(--surface); }
.direction-pad button:first-child { grid-column:2; }
.direction-pad button:nth-child(2) { grid-column:1; grid-row:2; }
.direction-pad button:nth-child(3) { grid-column:3; grid-row:2; }
.direction-pad button:nth-child(4) { grid-column:2; grid-row:2; }
#cursor-position { font-size:12px; color:var(--muted); }
.cursor-lens { position:fixed; z-index:500; pointer-events:none; width:min(230px,calc(100vw - 12px)); padding:10px; border:1px solid var(--accent); border-radius:12px; background:var(--modal-bg); color:var(--text); box-shadow:0 5px 24px #0007; font-size:14px; line-height:1.5; }
.cursor-lens > div { overflow-wrap:anywhere; }
.lens-cells { display:grid; grid-template-columns:repeat(3,24px); justify-content:center; margin-top:6px; }
.lens-cells span { display:grid; place-items:center; height:24px; border:1px solid var(--panel-border); background:var(--cell-bg); }
.lens-cells .filled { background:var(--filled-bg); }
.lens-cells .outside { opacity:0; }
.lens-cells .selected { outline:2px solid var(--accent); outline-offset:-2px; }
.cursor-actions { display:flex; gap:8px; margin-top:8px; }
.cursor-actions button { padding:8px; border:1px solid var(--surface-border); border-radius:8px; background:var(--surface); color:var(--text); min-height:44px; }
#stroke-count { position:fixed; z-index:35; pointer-events:none; transform:translateX(-50%); padding:4px 8px; border-radius:6px; color:var(--accent-ink); background:var(--accent); font-size:12px; }
dialog { overscroll-behavior:contain; }
.library-dialog, .preferences-dialog { width:min(940px,calc(100vw - 40px)); max-height:calc(100dvh - 40px); padding:28px; border:1px solid var(--panel-border-strong); border-radius:16px; color:var(--text); background:var(--modal-bg); }
.preferences-dialog { width:min(520px,calc(100vw - 40px)); }
.library-dialog::backdrop, .preferences-dialog::backdrop { background:var(--modal-backdrop); backdrop-filter:blur(6px); }
.dialog-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:22px; }
.dialog-header h2 { margin:0; font-size:24px; font-weight:600; }
.dialog-header button { border:0; background:transparent; color:var(--muted); min-height:44px; padding:8px; }
.library-tabs { display:flex; gap:24px; border-bottom:1px solid var(--divider); margin-bottom:20px; }
.library-tabs button { padding:10px 0; min-height:44px; border:0; background:transparent; color:var(--muted); font-size:15px; }
.library-tabs .active { color:var(--text); box-shadow:0 2px var(--accent); }
.library-resume { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-bottom:18px; }
.life-summary { padding:10px 0 16px; margin-bottom:12px; border-bottom:1px solid var(--hairline); font-size:13px; }
.life-summary > div { display:flex; flex-wrap:wrap; justify-content:space-between; gap:6px 16px; margin:6px 0; }
.life-summary output { font-weight:600; font-variant-numeric:tabular-nums; }
.life-summary small,.life-summary details { color:var(--muted); font-size:12px; }
.life-summary details { margin-top:6px; }
.life-summary summary { cursor:pointer; padding:8px 0; }
.life-summary p { line-height:1.6; margin:4px 0; max-width:70ch; }
.level-life-average { display:block; line-height:1.5; margin-top:4px; }
#resume-puzzle { border:0; background:var(--surface); color:var(--text); border-radius:8px; padding:10px 14px; min-height:44px; text-align:left; font-size:13px; }
#total-progress { color:var(--muted); font-size:12px; white-space:nowrap; }
#filters-toggle { display:none; }
.catalog-filters { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.catalog-filters label, .setting-field { display:flex; flex-direction:column; gap:6px; font-size:12px; color:var(--muted); }
select { color:var(--text); background:var(--surface); border:1px solid var(--surface-border); border-radius:7px; min-height:42px; padding:8px; font:inherit; width:100%; }
.library-summary { display:flex; justify-content:space-between; align-items:center; margin:18px 0; color:var(--muted); font-size:12px; }
.library-summary button { border:0; background:transparent; color:var(--text); min-height:44px; padding:8px 0; font-size:13px; }
.picture-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(165px,1fr)); gap:14px; }
.puzzle-card { display:flex; flex-direction:column; align-items:flex-start; gap:6px; padding:12px; border:1px solid var(--panel-border); border-radius:10px; background:transparent; color:var(--text); text-align:left; min-width:0; }
.puzzle-card:hover { background:var(--surface); }
.puzzle-card strong { font-weight:600; font-size:14px; }
.puzzle-card small { font-size:12px; color:var(--muted); }
.puzzle-state { color:var(--muted); font-size:12px; }
.picture-preview { display:block; width:100%; aspect-ratio:1; max-height:160px; fill:var(--filled-bg); stroke:none; shape-rendering:crispEdges; }
.picture-preview .preview-bg { fill:var(--cell-bg); }
.puzzle-placeholder { display:grid; place-items:center; width:100%; height:120px; color:var(--muted); background:var(--surface); font-size:22px; }
.puzzle-rows { display:flex; flex-direction:column; gap:0; }
.puzzle-rows .puzzle-card { display:grid; grid-template-columns:46px minmax(90px,.7fr) minmax(150px,1.5fr) auto; align-items:center; min-height:68px; gap:14px; padding:10px 8px; border:0; border-bottom:1px solid var(--hairline); border-radius:0; }
.puzzle-rows .puzzle-card:not(:has(svg))::before { content:""; display:block; width:38px; height:38px; border:1px solid var(--surface-border); border-radius:5px; background:repeating-linear-gradient(90deg,transparent 0 11px,var(--hairline) 11px 12px),repeating-linear-gradient(0deg,transparent 0 11px,var(--hairline) 11px 12px); }
.puzzle-rows .picture-preview { width:38px; height:38px; }
.empty-message { grid-column:1/-1; padding:20px 0; color:var(--muted); }
.mosaic-library p { color:var(--muted); }
.mosaic-scene { display:grid; grid-template-columns:repeat(2,1fr); max-width:560px; margin:20px auto; gap:2px; }
.mosaic-select { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
.mosaic-select button { min-height:44px; white-space:normal; }
.mosaic-select button[aria-pressed="true"] { border-color:var(--accent); }
.mosaic-tile { position:relative; padding:0; border:0; background:var(--cell-bg); }
.mosaic-tile .picture-preview { max-height:none; }
.mosaic-tile span { position:absolute; bottom:4px; left:4px; padding:3px 6px; border-radius:3px; background:var(--toolbar-bg); color:var(--text); font-size:11px; }
.preferences-dialog h3 { margin:26px 0 14px; color:var(--muted); font-size:12px; font-weight:600; letter-spacing:.05em; text-transform:uppercase; }
.setting-check { display:flex; justify-content:space-between; align-items:center; gap:14px; margin:16px 0 8px; font-size:14px; }
.setting-check input { order:2; width:20px; height:20px; accent-color:var(--accent-deep); }
.setting-help { margin:6px 0 16px; font-size:12px; line-height:1.55; color:var(--muted); }
.transfer-actions { display:flex; flex-wrap:wrap; gap:12px; }
.transfer-actions button, .progress-reset button, #install-button { padding:8px 12px; min-height:44px; border:1px solid var(--surface-border); border-radius:8px; color:var(--text); background:var(--surface); font-size:13px; }
.progress-reset { border-top:1px solid var(--divider); padding-top:14px; }
.progress-reset button { color:var(--danger); }
.toast { bottom:22px; border-radius:9px; font-size:13px; }
.picture-view .game-cell { transition:background .3s,color .3s; }
html[data-motion=off] *, html[data-motion=off] *::before, html[data-motion=off] *::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; }
html[data-motion=off] body::before, html[data-motion=off] body::after { display:none; }
:root[data-theme=led] body::before, :root[data-theme=led] body::after { display:none; }
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; } body::before,body::after { display:none; } }
@media(min-width:1300px) { .game-area:has(.advice-panel:not([hidden])) { position:relative; } .advice-panel { position:fixed; right:16px; bottom:24px; width:240px; z-index:8; box-shadow:0 8px 24px var(--shadow); } }
@media(max-width:760px) { .topbar { padding:12px 20px 0; } .top-actions,#navigation-links { gap:16px; } }
@media(min-width:571px) and (max-width:680px) {
    .topbar { padding-inline:16px; }
    .brand { gap:8px; }
    .top-actions, #navigation-links { gap:12px; }
    .nav-link, .top-menu summary { font-size:13px; }
}
@media(min-width:761px) {
    .topbar { position:absolute; top:0; left:0; width:200px; padding:18px 20px 0; gap:18px; align-items:stretch; }
    .brand { align-items:flex-start; gap:10px; }
    .brand img { width:96px; height:96px; }
    .brand div { min-width:0; }
    .top-actions, #navigation-links { flex-direction:column; align-items:stretch; gap:2px; }
    .top-actions .nav-link { justify-content:flex-start; width:100%; text-align:left; }
    .top-menu-popover { top:0; left:calc(100% + 12px); max-height:min(480px,var(--theme-menu-height,calc(100dvh - 280px))); }
    .layout { max-width:1560px; padding:18px 200px 22px; }
    .controls { max-width:100%; }
    .tool-group { justify-content:center; flex-wrap:wrap; }
}
@media(max-width:570px) {
    .topbar { display:grid; grid-template-columns:minmax(0,1fr) max-content; align-items:start; padding:6px 12px 0; gap:8px; }
    .brand { gap:6px; } .brand img { width:44px; height:44px; }
    .top-actions { display:grid; grid-template-columns:repeat(2,max-content); justify-items:start; gap:0 12px; }
    #language-button { gap:4px; white-space:nowrap; }
    .language-flag { width:20px; height:13px; }
    .nav-link, .top-menu summary { justify-content:flex-start; min-width:44px; font-size:13px; white-space:nowrap; }
    .navigation-menu { position:relative; } .navigation-menu summary { display:flex; align-items:center; justify-content:center; width:44px; height:44px; color:var(--muted); list-style:none; cursor:pointer; }
    .navigation-menu:not([open]) #navigation-links { display:none; }
    #navigation-links { position:absolute; z-index:30; right:0; top:calc(100% + 6px); width:180px; display:flex; flex-direction:column; gap:0; align-items:stretch; padding:6px 12px; border:1px solid var(--panel-border-strong); border-radius:10px; background:var(--modal-bg); box-shadow:0 8px 24px var(--shadow); }
    #navigation-links .nav-link { justify-content:flex-start; }
    .top-menu-popover { left:auto; right:0; width:230px; max-height:min(480px,var(--theme-menu-height,calc(100dvh - 166px))); }
    .layout { padding:10px 10px calc(var(--controls-space,132px) + env(safe-area-inset-bottom)); }
    .layout:has(.game-area.is-finished), .layout:has(.game-area.is-lost) { padding-bottom:calc(16px + env(safe-area-inset-bottom)); }
    .game-heading { min-height:42px; gap:8px; margin-bottom:12px; }
    .puzzle-meta { flex-direction:column; align-items:flex-start; gap:2px; }
    .game-heading h2 { font-size:14px; } #difficulty-label { font-size:11px; }
    .heading-metrics { gap:10px; } .metric-card strong { font-size:12px; }
    .controls { position:fixed; z-index:20; bottom:calc(12px + env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%); margin:0; width:min(360px,calc(100vw - 24px)); padding:6px; background:var(--toolbar-bg); border:1px solid var(--panel-border); border-radius:14px; box-shadow:0 8px 30px var(--shadow-soft); backdrop-filter:blur(12px); }
    .tool-group { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:4px; }
    .tool-group #undo-button { margin-left:0; }
    .tool-group .tool-button, .tool-group .icon-button { width:100%; height:44px; min-height:44px; padding:8px; }
    .board-zoom { margin-top:4px; }
    .precise-pad { padding-block:6px; }
    .completion-panel { padding:16px 0; gap:4px 12px; }
    #similar-button { width:56px; height:56px; }
    .toast { bottom:140px; }
    .library-dialog, .preferences-dialog { width:100%; height:100dvh; max-height:100dvh; max-width:100%; margin:0; padding:16px; border:0; border-radius:0; }
    .dialog-header { margin-bottom:14px; }
    .catalog-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
    #filters-toggle { display:inline-flex; }
    .library-dialog:not(.filters-open) .catalog-filters { display:none; }
    .library-resume { padding-bottom:6px; }
    #resume-puzzle { font-size:12px; }
    .library-tabs { gap:22px; }
    .picture-list { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
    .puzzle-rows .puzzle-card { grid-template-columns:38px minmax(0,1fr) auto; gap:4px 10px; padding:12px 0; }
    .puzzle-rows .puzzle-card small { grid-column:2; font-size:11px; }
    .puzzle-rows .puzzle-card .puzzle-state { grid-column:3; grid-row:1 / span 2; font-size:11px; }
    .puzzle-rows .puzzle-card svg,.puzzle-rows .puzzle-card::before { grid-row:1 / span 2; }
    .advice-panel { margin-top:10px; }
}
@media(max-height:500px) and (orientation:landscape) and (pointer:coarse) {
    .topbar { padding-block:4px 0; gap:0; } .brand img { width:40px; height:40px; } .brand div { display:block; } .brand span { font-size:10px; }
    .layout { padding:4px 140px 6px; }
    .controls { position:fixed; left:auto; right:10px; top:85px; bottom:auto; transform:none; width:116px; margin:0; padding:6px; border:1px solid var(--panel-border); border-radius:12px; background:var(--toolbar-bg); z-index:20; }
    .tool-group { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; }
    .tool-group #undo-button { margin:0; }
    .tool-group .tool-button,.tool-group .icon-button { width:100%; height:44px; min-height:44px; padding:8px; }
}
@media(min-width:761px) and (max-height:500px) and (orientation:landscape) and (pointer:coarse) {
    .layout { padding-inline:200px; }
}
@media(min-width:761px) and (pointer:fine), (min-width:761px) and (pointer:none) {
    .site-footer { left:0; right:0; bottom:env(safe-area-inset-bottom); height:22px; min-height:22px; padding-inline:12px; display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:center; background:var(--page); }
    .footer-copyright { grid-column:1; justify-self:start; }
    .footer-business-link { display:block; grid-column:2; }
    .board-stage { display:flex; align-items:center; justify-content:center; width:100%; height:var(--surface-height,auto); }
    .game-tools { --tools-gap:4px; --tools-inset:12px; position:fixed; z-index:20; top:var(--tools-top,var(--tools-inset)); left:var(--tools-left); width:56px; height:max-content; max-height:var(--surface-height,calc(100dvh - var(--tools-inset) * 2)); display:flex; flex-direction:column; align-items:center; gap:var(--tools-gap); overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-gutter:stable both-edges; }
    .game-tools > * { flex-shrink:0; }
    .game-tools .controls { order:0; margin:0; }
    .game-tools .tool-group { flex-direction:column; flex-wrap:nowrap; gap:var(--tools-gap); }
    .game-tools #undo-button, .game-tools #redo-button { order:1; margin:0; }
    .game-tools #pencil-button, .game-tools #advice-button, .game-tools #restart-button, .game-tools #check-button { order:2; }
    .game-tools #undo-button, .game-tools #pencil-button, .game-tools #advice-button { margin-top:calc(var(--tools-gap) * .5); }
    .game-tools .tool-group:has(#pencil-button:not([hidden])) #advice-button { margin-top:0; }
    .game-tools .board-zoom { order:1; flex-direction:column; flex-wrap:nowrap; width:44px; margin:0; gap:var(--tools-gap); }
    .game-tools .board-zoom button { width:44px; height:44px; min-height:44px; padding:9px; border:1px solid transparent; border-radius:9px; }
    .game-tools .board-zoom button:hover { background:var(--surface); color:var(--text); }
    .game-tools .board-zoom #sound-button { margin:0; }
    .game-tools .zoom-value { line-height:20px; }
}
@media(min-width:761px) and (max-height:680px) and (pointer:fine), (min-width:761px) and (max-height:680px) and (pointer:none) {
    .game-tools { --tools-inset:6px; }
    .game-tools .zoom-value { line-height:12px; }
}
@media(min-width:1300px) and (pointer:fine), (min-width:1300px) and (pointer:none) {
    .advice-panel { left:calc(var(--tools-left) + 68px); right:auto; width:min(240px,calc(100vw - var(--tools-left) - 84px)); }
}
