:root {
    /* Aligned to the Toon Tone game shell (style.css): warm off-white ground,
       indigo accent, indigo-tinted shadows, corner aurora. Shared by the color
       tools and the creator so all three read as one product. */
    --tool-shell-width: 1280px;
    --shell-surface: #ffffff;
    --shell-surface-muted: #f2f0ea;
    --shell-ink: #0f172a;
    --shell-muted: #5a6172;
    --shell-soft: #838a99;
    --shell-line: #e9e4d9;
    --shell-line-strong: #d8d2c5;
    --shell-accent: #4f46e5;
    --shell-accent-strong: #4338ca;
    --shell-accent-soft: rgba(99, 102, 241, 0.14);
    --shell-shadow: rgba(79, 70, 229, 0.28);
    --shell-focus: #4f46e5;
    --shell-header-bg: color-mix(in oklab, #ffffff 78%, transparent);
    --shell-aurora-1: rgba(252, 199, 138, 0.14);
    --shell-aurora-2: rgba(129, 140, 248, 0.10);
}

:root[data-theme='dark'] {
    --shell-surface: #161d2e;
    --shell-surface-muted: #1e2740;
    --shell-ink: #f9fafb;
    --shell-muted: #aab2c5;
    --shell-soft: #8b93a7;
    --shell-line: #2a3350;
    --shell-line-strong: #3b466a;
    --shell-accent: #818cf8;
    --shell-accent-strong: #a5b4fc;
    --shell-accent-soft: rgba(129, 140, 248, 0.22);
    --shell-shadow: rgba(0, 0, 0, 0.4);
    --shell-focus: #a5b4fc;
    --shell-header-bg: color-mix(in oklab, #161d2e 78%, transparent);
    --shell-aurora-1: rgba(129, 140, 248, 0.26);
    --shell-aurora-2: rgba(244, 114, 182, 0.20);
}

/* Corner aurora shared by every tool/creator page — mirrors the game's
   body::before glow so the tools sit on the same living background. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(38vw 30vh at 4% 4%, var(--shell-aurora-1), transparent 70%),
        radial-gradient(42vw 32vh at 96% 96%, var(--shell-aurora-2), transparent 70%);
}

@media (prefers-reduced-motion: no-preference) {
    body::before { transition: background 0.3s ease; }
}

.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;
}

.tools-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 68px;
    padding: 0.8rem clamp(1rem, 3vw, 3.5rem);
    background: var(--shell-header-bg);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
}

/* Rainbow hairline underline — the game's signature header separator. */
.tools-header::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    opacity: 0.7;
    pointer-events: none;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(244, 114, 182, 0.45) 20%,
        rgba(129, 140, 248, 0.55) 50%,
        rgba(56, 189, 248, 0.45) 80%,
        transparent 100%
    );
}

.tools-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    color: var(--shell-ink);
    font-weight: 800;
    text-decoration: none;
}

.tools-logo:hover {
    color: var(--shell-ink);
    text-decoration: none;
}

.tools-logo-mark {
    width: 36px;
    height: 36px;
    display: block;
    flex: 0 0 auto;
}

.tools-logo-text { white-space: nowrap; }

.tools-nav {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.7rem;
    min-width: 0;
}

.tools-play-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 38px;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    background: var(--shell-accent);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 800;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: 0 10px 24px -14px var(--shell-shadow);
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.tools-play-link:hover {
    background: var(--shell-accent-strong);
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
}

.tools-lang-switch {
    display: inline-flex;
    align-items: center;
    position: relative;
}

.tools-lang-icon {
    position: absolute;
    left: 0.62rem;
    top: 50%;
    z-index: 1;
    color: var(--shell-muted);
    opacity: 0.78;
    pointer-events: none;
    transform: translateY(-50%);
}

.tools-lang-select {
    min-width: 72px;
    height: 32px;
    padding: 0 1.45rem 0 1.78rem;
    border: 1px solid color-mix(in oklab, var(--shell-line) 86%, transparent);
    border-radius: 999px;
    background: linear-gradient(
        180deg,
        color-mix(in oklab, var(--shell-surface) 96%, transparent),
        color-mix(in oklab, var(--shell-surface) 82%, transparent)
    );
    color: var(--shell-muted);
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 8px 24px -18px var(--shell-shadow);
}

.tools-lang-select:focus-visible {
    outline: 2px solid var(--shell-focus);
    outline-offset: 2px;
}

.tools-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 0.9rem;
    color: var(--shell-soft);
    font-size: 0.85rem;
}

.tools-breadcrumbs a {
    color: var(--shell-muted);
    font-weight: 650;
}

.tools-selector-nav {
    width: min(280px, 100%);
    margin: 0 0 1.6rem;
}

.tool-selector {
    position: relative;
    width: 100%;
    color: var(--shell-ink);
}

.tool-selector-trigger {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 42px;
    padding: 0.55rem 0.7rem;
    list-style: none;
    border: 1px solid var(--shell-line);
    border-radius: 12px;
    background: var(--shell-surface);
    color: var(--shell-ink);
    box-shadow: 0 10px 24px -20px var(--shell-shadow);
    font-size: 0.9rem;
    font-weight: 750;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.tool-selector-trigger::-webkit-details-marker { display: none; }
.tool-selector-trigger::marker { content: ''; }
.tool-selector-trigger > span {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
    text-align: left;
}

.tool-selector-icon,
.tool-selector-option svg {
    flex: 0 0 auto;
    color: var(--shell-accent-strong);
}

.tool-selector-caret {
    flex: 0 0 auto;
    color: var(--shell-muted);
    transition: transform 0.15s ease;
}

.tool-selector[open] .tool-selector-caret { transform: rotate(180deg); }

.tool-selector-trigger:hover {
    border-color: var(--shell-line-strong);
    background: var(--shell-surface-muted);
}

.tool-selector-trigger:focus-visible {
    outline: 2px solid var(--shell-focus);
    outline-offset: 2px;
}

.tool-selector-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    z-index: 1000;
    width: 100%;
    max-height: 320px;
    margin: 0;
    padding: 0.3rem;
    overflow-y: auto;
    border: 1px solid var(--shell-line);
    border-radius: 12px;
    background: var(--shell-surface);
    box-shadow: 0 16px 36px -24px var(--shell-shadow);
}

.tool-selector-group + .tool-selector-group {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--shell-line);
}

.tool-selector-group-label {
    margin: 0;
    padding: 0.35rem 0.65rem 0.2rem;
    color: var(--shell-soft);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
}

.tool-selector-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 42px;
    padding: 0.55rem 0.65rem;
    border-radius: 5px;
    color: var(--shell-ink);
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.25;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.tool-selector-option span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.tool-selector-option:hover,
.tool-selector-option[aria-current='page'] {
    background: var(--shell-accent-soft);
    color: var(--shell-ink);
    text-decoration: none;
}

.tool-selector-option:focus-visible {
    outline: 2px solid var(--shell-focus);
    outline-offset: -2px;
}

.tools-hero {
    max-width: 760px;
    margin-bottom: 2.2rem;
}

.tools-eyebrow {
    margin: 0 0 0.45rem;
    color: var(--shell-accent-strong);
    font-size: 0.75rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    line-height: 1.3;
    text-transform: uppercase;
}

.tools-hero h1 {
    max-width: 800px;
    margin: 0;
    color: var(--shell-ink);
    font-size: 3rem;
    line-height: 1.08;
    letter-spacing: 0;
}

.tools-hero p:not(.tools-eyebrow) {
    max-width: 680px;
    margin: 0.9rem 0 0;
    color: var(--shell-muted);
    font-size: 1rem;
}

@media (max-width: 900px) {
    .tools-hero h1 { font-size: 2.6rem; }
}

@media (max-width: 620px) {
    .tools-header {
        min-height: 60px;
        padding: 0.65rem 0.8rem;
        gap: 0.5rem;
    }

    .tools-logo-mark { width: 32px; height: 32px; }
    .tools-logo { gap: 0.45rem; font-size: 0.95rem; }
    .tools-nav { gap: 0.35rem; }
    .tools-play-link { min-height: 34px; padding: 0.3rem 0.55rem; font-size: 0.77rem; }
    .tools-lang-select {
        width: 68px;
        min-width: 68px;
        height: 30px;
        padding: 0 0.45rem 0 1.55rem;
        font-size: 0.72rem;
    }
    .tools-lang-icon { left: 0.5rem; width: 12px; height: 12px; }
    .tools-hero { margin-bottom: 1.6rem; }
    .tools-hero h1 { font-size: 2.1rem; }
    .tools-hero p:not(.tools-eyebrow) { font-size: 0.95rem; }
}

@media (max-width: 420px) {
    .tools-logo-text { display: none; }
}

@media (max-width: 400px) {
    .tools-lang-select {
        width: 56px;
        min-width: 56px;
        padding: 0 0.4rem 0 1.35rem;
    }
    .tools-lang-icon { left: 0.42rem; }
}

@media (max-width: 360px) {
    .tools-header { padding-left: 0.45rem; padding-right: 0.45rem; gap: 0.25rem; }
    .tools-play-link { min-height: 32px; padding: 0.25rem 0.4rem; font-size: 0.7rem; }
    .tools-lang-select { font-size: 0.66rem; }
}
