:root {
    /* All colors are configurable here for quick theming. Keep contrast high. */
    --bg: #0e0f13;
    --panel: #161922;
    --ink: #e3f2ff;
    --guide: #243046;
    --accent: #7ae582;
    --warn: #ffb703;
    --dot: #9fb3c8;
}

html,
body {
    height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    /* Dyslexia-friendly defaults: large x-height, more spacing, stable shapes */
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Atkinson Hyperlegible",
        "OpenDyslexic", Arial, sans-serif;
}

.wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 10px;
    padding: 20px;
    box-sizing: border-box;
}

header {
    display: none;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    background: var(--panel);
    padding: 12px 14px;
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .04);
}

header .title {
    font-weight: 700;
    letter-spacing: .3px;
}

header select,
header button {
    background: #0f1219;
    color: var(--ink);
    border: 1px solid #2a3144;
    border-radius: 12px;
    padding: 8px 10px;
    outline: none;
}

header button {
    cursor: pointer;
    transition: .2s transform ease;
}

header button:active {
    transform: scale(.98)
}

#hud {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-left: auto;
    flex-wrap: wrap;
}

#canvaswrap {
    position: relative;
    flex: 1;
    background: linear-gradient(180deg, #0f131b, #0c0f16);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
}

#canvaswrap canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 16px;
}

.pill {
    background: rgba(22, 25, 34, .7);
    backdrop-filter: blur(6px);
    color: var(--ink);
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .06);
    font-size: 14px;
}

.toast {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 16px;
    background: #0f131b;
    border: 1px solid #273147;
    color: var(--ink);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    opacity: 0;
    transition: .3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1
}

.celebrate {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    pointer-events: none;
    font-size: 32px;
    font-weight: 800;
    color: #c1ffd7;
    text-shadow: 0 6px 24px rgba(0, 0, 0, .6);
}

.celebrate.show {
    display: grid;
}

.legend {
    font-size: 13px;
    opacity: .9
}

.legend mark {
    background: transparent;
    color: var(--accent);
    font-weight: 700
}