/* One calm look for every page: violet-blue tones, thin lines, soft cards, the bottom tab bar. */
:root {
    --bg1: #f4f1ff;
    --text: #1b2236;
    --muted: #5d6784;
    --card: rgba(255, 255, 255, .8);
    --solid: #ffffff;
    --line: rgba(109, 93, 246, .25);
    --accent: #6d5df6;
    --accent-2: #d946ef;
    --alert: #d6336c;
    --field: #f7f5ff;
    --c-logic: #6d5df6;
    --c-memory: #2f6fed;
    --c-letters: #0d9488;
    --c-creative: #c026d3;
    --shadow: 0 10px 28px rgba(109, 93, 246, .14);
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg1: #151228;
        --text: #eceaff;
        --muted: #a49fc4;
        --card: rgba(30, 26, 52, .8);
        --solid: #1c1836;
        --line: rgba(139, 92, 246, .4);
        --accent: #8b7cff;
        --alert: #ff6b9a;
        --field: #241f44;
        --c-logic: #8b7cff;
        --c-memory: #5b93ff;
        --c-letters: #2dd4bf;
        --c-creative: #e879f9;
        --shadow: 0 10px 28px rgba(0, 0, 0, .35);
    }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg1); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: radial-gradient(circle, rgba(109, 93, 246, .14) 1.2px, transparent 1.6px) 0 0 / 22px 22px var(--bg1);
    font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
    touch-action: manipulation;
    overscroll-behavior: none;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
a { color: var(--accent); }

button, select {
    font: inherit; font-weight: 600; color: var(--text); background: var(--solid); border: 1px solid var(--line);
    border-radius: 12px; height: 44px; padding: 0 16px; cursor: pointer;
}
button:disabled { opacity: .45; cursor: default; }
button.big, button.primary {
    background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff;
}
button.soft, button.tab { color: var(--accent); }
button.tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--alert); border-color: var(--alert); }
button.big.danger { background: var(--alert); color: #fff; }
button.danger.ask { background: var(--alert); color: #fff; }

.page { max-width: 760px; margin: 0 auto; padding: env(safe-area-inset-top) 16px 24px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; }
.home { display: inline-flex; align-items: center; min-height: 44px; font-weight: 800; font-size: 1.35rem; color: var(--accent); text-decoration: none; letter-spacing: .02em; }
.title { margin: 8px 0 14px; font-size: 1.5rem; }
.panel {
    background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
    backdrop-filter: blur(6px);
}
.foot { display: flex; gap: 16px; justify-content: center; margin-top: 32px; font-size: .85rem; }
.foot a { color: var(--muted); }

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 4px;
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); background: var(--solid); border-top: 1px solid var(--line);
}
.tab-item {
    flex: 1; max-width: 170px; display: flex; flex-direction: column; align-items: center; gap: 2px; height: auto;
    padding: 6px 4px; border: 0; border-radius: 12px; background: none; color: var(--muted); text-decoration: none;
    font-size: .72rem; font-weight: 600; line-height: 1.2;
}
.tab-item .ico { display: flex; align-items: center; justify-content: center; height: 26px; font-size: 22px; }
.tab-item svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab-item.on { color: var(--accent); }
.tab-item .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sheet-back { position: fixed; inset: 0; z-index: 30; background: rgba(12, 10, 24, .45); }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-width: 520px; margin: 0 auto;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); background: var(--solid);
    border: 1px solid var(--line); border-radius: 18px 18px 0 0;
}
.sheet h2 { margin: 0 0 12px; font-size: 1.05rem; }
.sheet-langs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-langs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sheet[hidden], .sheet-back[hidden] { display: none; }
