:root {
    --bg: #0f1117;
    --bg-soft: #151923;
    --text: #f3f4f7;
    --text-muted: #b9bfd0;
    --panel: rgba(25, 30, 41, 0.72);
    --panel-border: rgba(255, 255, 255, 0.09);
    --tile: rgba(255, 255, 255, 0.04);
    --tile-hover: rgba(255, 255, 255, 0.08);
    --accent: #86a8ff;
    --shadow: 0 18px 45px rgba(4, 7, 13, 0.4);
    --focus: 0 0 0 3px rgba(134, 168, 255, 0.4);
}

body.theme-light {
    --bg: #eef1f8;
    --bg-soft: #e2e7f2;
    --text: #151b2b;
    --text-muted: #4f5a77;
    --panel: rgba(255, 255, 255, 0.84);
    --panel-border: rgba(27, 36, 64, 0.14);
    --tile: rgba(19, 28, 48, 0.05);
    --tile-hover: rgba(19, 28, 48, 0.1);
    --accent: #305eea;
    --shadow: 0 16px 38px rgba(32, 46, 86, 0.15);
    --focus: 0 0 0 3px rgba(48, 94, 234, 0.32);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 15% 20%, var(--bg-soft), transparent 45%),
        radial-gradient(circle at 85% 90%, color-mix(in srgb, var(--accent) 12%, var(--bg)), transparent 38%),
        var(--bg);
    display: grid;
    place-items: center;
    padding: 1.25rem;
    transition: background-color 0.3s ease, color 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;
}

.page {
    width: min(100%, 30rem);
    animation: fade-in 420ms ease-out;
}

.card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.card-header {
    text-align: center;
    margin-bottom: 1rem;
}

.brand-logo {
    display: block;
    width: min(9.5rem, 52%);
    height: auto;
    margin: 0 auto 0.85rem;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.28));
}

body.theme-light .brand-logo {
    filter: drop-shadow(0 8px 14px rgba(29, 44, 88, 0.18));
}

h1 {
    margin: 0;
    font-size: clamp(1.75rem, 6vw, 2.3rem);
    letter-spacing: 0.01em;
}

.tagline {
    margin: 0.45rem 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.theme-toggle-corner {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.35rem;
}

.theme-switch {
    position: relative;
    display: inline-flex;
    width: 3rem;
    height: 1.8rem;
}

.theme-switch-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.theme-switch-slider {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: rgba(0, 0, 0, 0.22);
    transition: background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.theme-switch-slider::after {
    content: "☾";
    position: absolute;
    top: 0.19rem;
    left: 0.18rem;
    width: 1.28rem;
    height: 1.28rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26);
    color: #27304a;
    font-size: 0.78rem;
    line-height: 1;
    transition: transform 0.22s ease, color 0.22s ease;
}

.theme-switch-input:hover + .theme-switch-slider {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--panel-border));
}

.theme-switch-input:focus-visible + .theme-switch-slider {
    box-shadow: var(--focus);
}

.theme-switch-input:checked + .theme-switch-slider {
    border-color: color-mix(in srgb, var(--accent) 75%, var(--panel-border));
    background: color-mix(in srgb, var(--accent) 34%, var(--bg));
}

.theme-switch-input:checked + .theme-switch-slider::after {
    content: "☀";
    transform: translateX(1.18rem);
    color: #9a6400;
}

.links-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.link-tile {
    display: block;
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 0.95rem;
    border: 1px solid var(--panel-border);
    background: var(--tile);
    color: var(--text);
    text-decoration: none;
    text-align: center;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.link-title {
    display: block;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.link-description {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.84rem;
    line-height: 1.35;
    color: var(--text-muted);
    font-weight: 500;
}

.link-tile:hover {
    transform: translateY(-2px);
    background: var(--tile-hover);
    border-color: color-mix(in srgb, var(--accent) 60%, var(--panel-border));
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.link-tile:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .card {
        padding: 1.15rem;
        border-radius: 1rem;
    }

    .brand-logo {
        width: min(8.25rem, 56%);
        margin-bottom: 0.75rem;
    }

    .link-tile {
        padding: 0.9rem;
    }

    .link-description {
        font-size: 0.82rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Cookie Consent Banner ── */
.cookie-banner {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(calc(100% - 2rem), 38rem);
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 1rem;
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
    z-index: 1000;
    animation: fade-in 360ms ease-out;
    margin: 0;
    color: var(--text);
}

.cookie-banner-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.cookie-banner-text {
    flex: 1 1 18rem;
}

.cookie-banner-text strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.cookie-banner-text p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.cookie-policy-link {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-policy-link:hover {
    opacity: 0.8;
}

.cookie-banner-actions {
    display: flex;
    gap: 0.55rem;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 0.45rem 1.1rem;
    border-radius: 0.65rem;
    border: 1px solid var(--panel-border);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.cookie-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

.cookie-btn-accept {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

body.theme-light .cookie-btn-accept {
    color: #fff;
}

.cookie-btn-accept:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.cookie-btn-reject {
    background: var(--tile);
    color: var(--text);
}

.cookie-btn-reject:hover {
    background: var(--tile-hover);
    transform: translateY(-1px);
}

/* ── Cookie Policy Modal ── */
.cookie-modal {
    padding: 1.5rem;
    background: var(--bg-soft);
    border: 1px solid var(--panel-border);
    border-radius: 1.1rem;
    max-width: 32rem;
    width: calc(100vw - 2.5rem);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    animation: fade-in 250ms ease-out;
    color: var(--text);
    /* showModal() centers dialog automatically via margin: auto */
}

.cookie-modal::backdrop {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
}

.cookie-modal-box {
    position: relative;
}

.cookie-modal-box h2 {
    margin: 0 0 0.9rem;
    font-size: 1.1rem;
    padding-right: 1.5rem;
}

.cookie-modal-box p,
.cookie-modal-box ul {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0 0 0.7rem;
}

.cookie-modal-box ul {
    padding-left: 1.2rem;
}

.cookie-modal-box strong {
    color: var(--text);
}

.cookie-modal-box code {
    background: var(--tile);
    border-radius: 0.3rem;
    padding: 0.1em 0.35em;
    font-size: 0.85em;
    color: var(--accent);
}

.cookie-modal-box a {
    color: var(--accent);
}

.cookie-modal-close {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 0.4rem;
    transition: color 0.15s ease;
}

.cookie-modal-close:hover {
    color: var(--text);
}

.cookie-modal-close:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}
