/* Anidoku on lexinum.org. Hand-written, shared by every language page.
   Region palettes: copied from lib/features/anidoku/presentation/anidoku_palette.dart
   (made by tools/anidoku/palettes.py). Keep them in step with the app. */

:root {
    --bg: #f6f7f2;
    --bg-raised: #ffffff;
    --line: #d9ddd3;
    --text: #1b2119;
    --muted: #5f6a5a;
    --accent: #3d7b37;
    --accent-soft: #e3f0df;
    --ink: #2b2b2b;
    --grid: rgba(43, 43, 43, 0.18);
    --error: #c62828;
    --plain: #eef0ea;
    --radius: 14px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #10140f;
        --bg-raised: #1a1f19;
        --line: #2f382c;
        --text: #e9eee5;
        --muted: #a9b3a3;
        --accent: #a3d79b;
        --accent-soft: #25502a;
        --ink: #e6e6e6;
        --grid: rgba(230, 230, 230, 0.16);
        --error: #ff8a80;
        --plain: #232a21;
    }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, select { font: inherit; color: inherit; }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* ---- header ---- */
.top { border-bottom: 1px solid var(--line); background: var(--bg-raised); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; }
.brand img { width: 28px; height: 28px; border-radius: 7px; background: #fff; }
.top .app-link { font-size: 0.9rem; font-weight: 600; }

h1 { font-size: 1.9rem; margin: 22px 0 4px; display: flex; align-items: center; gap: 10px; }
h1 img { width: 40px; height: 40px; }
.lead { color: var(--muted); }

/* ---- tabs ---- */
.tabs { display: flex; gap: 6px; margin: 18px 0 12px; border-bottom: 1px solid var(--line); }
.tabs button {
    border: 0; background: none; padding: 10px 14px; cursor: pointer;
    font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

/* ---- status line and tools ---- */
.status { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 6px 0 10px; }
.status .label { font-weight: 700; }
.status .clock { font-variant-numeric: tabular-nums; font-weight: 700; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.btn {
    border: 1px solid var(--line); background: var(--bg-raised); border-radius: 999px;
    padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 0.92rem;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.notice { color: var(--muted); font-size: 0.9rem; margin: 8px 0; min-height: 1.4em; }

/* ---- the board ---- */
.board-box { position: relative; width: 100%; max-width: 560px; margin: 0 auto; }
.board {
    display: grid; width: 100%; aspect-ratio: 1;
    border: 4px solid var(--ink); border-radius: 6px; overflow: hidden;
    touch-action: none; user-select: none; -webkit-user-select: none;
}
.cell {
    position: relative; border: 0; padding: 0; cursor: pointer;
    min-width: 0; min-height: 0; overflow: hidden;
    background: var(--plain);
    box-shadow: inset 0 0 0 0.5px var(--grid);
    display: grid; place-items: center;
}
.ad:not(.plain) .cell { background: var(--fill); }
.cell.bt { border-top: 3px solid var(--ink); }
.cell.bl { border-left: 3px solid var(--ink); }
.cell img { width: 84%; height: 84%; pointer-events: none; }
.cell .x { font-size: min(5.5vw, 30px); line-height: 1; color: var(--ink); opacity: 0.85; pointer-events: none; }
.cell .x.auto { opacity: 0.3; font-size: min(4vw, 22px); }
.cell.conflict::after { content: ''; position: absolute; inset: 0; background: var(--error); opacity: 0.35; }
.cell.mistake { box-shadow: inset 0 0 0 3px var(--error); }
.cell.hinted::before { content: '💡'; position: absolute; right: 2px; bottom: 0; font-size: 0.7em; }
.cell.pointed { animation: point 0.8s ease-in-out 3; }
@keyframes point { 50% { box-shadow: inset 0 0 0 4px var(--accent); } }

.cover {
    position: absolute; inset: 0; display: none; place-items: center; text-align: center;
    background: var(--bg); border-radius: 6px; padding: 16px;
}
.board-box.paused .cover { display: grid; }

/* ---- result ---- */
.result {
    display: none; margin: 16px 0; padding: 18px; border-radius: var(--radius);
    background: var(--accent-soft);
}
.result.show { display: block; }
.result h2 { font-size: 1.3rem; margin-bottom: 6px; }
.result p { margin: 4px 0; }
.result .lesson { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--bg-raised); }
.result .lesson small { display: block; color: var(--muted); font-weight: 600; }
.result .lesson p { font-size: 0.92rem; }
.result .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---- lists ---- */
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; margin: 12px 0; }
.levels button {
    aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-raised);
    font-weight: 700; cursor: pointer; position: relative;
}
.levels button.solved { background: var(--accent-soft); }
.levels button.solved::after { content: '✓'; position: absolute; top: 2px; right: 5px; font-size: 0.7rem; }
.levels button:disabled { opacity: 0.4; cursor: default; }
.archive { list-style: none; margin: 12px 0; }
.archive li button {
    width: 100%; display: flex; justify-content: space-between; text-align: left;
    padding: 10px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer;
}
.archive .done { color: var(--accent); font-weight: 600; }

/* ---- settings, rules, app ---- */
details { margin: 14px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised); padding: 12px 14px; }
summary { cursor: pointer; font-weight: 700; }
.settings label { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.settings select { margin-left: auto; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.rules ol { margin: 8px 0 8px 22px; }
.rules p { color: var(--muted); font-size: 0.93rem; margin-top: 6px; }
.app { margin: 22px 0; padding: 18px; border-radius: var(--radius); background: var(--bg-raised); border: 1px solid var(--line); text-align: center; }
.app p { margin-top: 6px; }
.app .btn { display: inline-block; margin-top: 8px; text-decoration: none; }
.daily-meta { color: var(--muted); font-size: 0.9rem; }
footer { margin: 28px 0 40px; color: var(--muted); font-size: 0.85rem; text-align: center; }
footer a { color: var(--muted); }
[hidden] { display: none !important; }

/* ---- region palettes (light) ---- */
.ad[data-cv="standard"] { --r0: #F6AFB0; --r1: #8DCEB2; --r2: #CEB8EA; --r3: #D2C08D; --r4: #7DCBEB; --r5: #FFD7B7; --r6: #97F1F4; --r7: #FFD1F2; --r8: #D1EBB8; --r9: #C5E4FF; }
.ad[data-cv="red-green"] { --r0: #F0C27E; --r1: #9288D0; --r2: #C8F2FA; --r3: #AB8983; --r4: #DDF1D3; --r5: #B8874A; --r6: #87AFB6; --r7: #AEBFFC; --r8: #CCB59C; --r9: #A7D2C9; }
.ad[data-cv="blue-yellow"] { --r0: #F0C27E; --r1: #7A8DD7; --r2: #5EF8F8; --r3: #DBD6F8; --r4: #8F9557; --r5: #D7737D; --r6: #9ECE8C; --r7: #BB91D3; --r8: #F5EDA5; --r9: #69B8F2; }
.ad[data-cv="mono"] { --r0: #727272; --r1: #AAAAAA; --r2: #E7E7E7; --r3: #8E8E8E; --r4: #C8C8C8; --r5: #808080; --r6: #B9B9B9; --r7: #F6F6F6; --r8: #9C9C9C; --r9: #D7D7D7; }

@media (prefers-color-scheme: dark) {
    .ad[data-cv="standard"] { --r0: #754547; --r1: #2C5B48; --r2: #5A4C6E; --r3: #5D522F; --r4: #17596F; --r5: #88624D; --r6: #307476; --r7: #885E75; --r8: #5E704D; --r9: #546C8F; }
    .ad[data-cv="red-green"] { --r0: #695120; --r1: #3280B0; --r2: #602346; --r3: #2E8872; --r4: #453627; --r5: #1B5A7B; --r6: #7E7C42; --r7: #23674E; --r8: #327477; --r9: #4F3403; }
    .ad[data-cv="blue-yellow"] { --r0: #695120; --r1: #3280B0; --r2: #36355D; --r3: #7D749C; --r4: #B0636D; --r5: #275F3A; --r6: #887850; --r7: #3C3A21; --r8: #66212E; --r9: #65824F; }
    .ad[data-cv="mono"] { --r0: #A0A0A0; --r1: #676767; --r2: #343434; --r3: #838383; --r4: #4D4D4D; --r5: #929292; --r6: #5A5A5A; --r7: #282828; --r8: #757575; --r9: #404040; }
}
