* { margin: 0; padding: 0; box-sizing: border-box; }

/* ---------- FARGER ---------- */
:root {
    --bg-a: #0a0e27;
    --bg-b: #1a0033;
    --surface: rgba(20, 24, 55, 0.8);
    --surface-solid: #0a0e27;
    --nav-bg: rgba(10, 14, 39, 0.95);
    --text: #ffffff;
    --muted: #b0b9d9;
    --accent: #00ffff;
    --accent-2: #00ff88;
    --accent-3: #d946ef;
    --hot: #ff006e;
    --on-accent: #0a0e27;
    --accent-soft: rgba(0, 255, 255, 0.1);
    --accent-2-soft: rgba(0, 255, 136, 0.1);
    --accent-glow: rgba(0, 255, 255, 0.5);
    --accent-3-glow: rgba(217, 70, 239, 0.3);
    --contact-glow: rgba(0, 255, 136, 0.3);
    --text-glow: 0 0 20px rgba(0, 255, 255, 0.3);
    --steam: #c7d5e0;
    --overlay: rgba(0, 0, 0, 0.8);
    --overlay-strong: rgba(0, 0, 0, 0.95);
    color-scheme: dark;
}

[hidden] { display: none !important; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-a) 0%, var(--bg-b) 100%) fixed;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent-2); }
a:hover { text-decoration: underline; }

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}
h1:focus, main:focus { outline: none; }

.skip-link {
    position: absolute;
    left: 1rem;
    top: -5rem;
    background: var(--accent);
    color: var(--on-accent);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    z-index: 3000;
}
.skip-link:focus { top: 1rem; }

/* ---------- NAVIGASJON ---------- */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    border-bottom: 3px solid var(--accent);
    padding: 1rem 2rem;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
}
.nav-logo:hover { text-decoration: none; }

.nav-logo img {
    height: 60px;
    width: 60px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    object-fit: cover;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
    flex-wrap: wrap;
}

.nav-menu a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-menu a:hover,
.nav-menu a[aria-current="page"] {
    color: var(--accent);
    text-decoration: none;
    text-shadow: 0 0 10px var(--accent-glow);
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.5rem;
}
.hamburger span {
    width: 25px;
    height: 2px;
    background: var(--accent);
    display: block;
}

@media (max-width: 768px) {
    nav { padding: 0.75rem 1rem; }
    .hamburger { display: flex; }
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--nav-bg);
        padding: 0 1rem;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s;
        border-bottom: 3px solid transparent;
    }
    .nav-menu:not(.active) { visibility: hidden; }
    .nav-menu.active { max-height: 600px; padding: 1rem; border-bottom-color: var(--accent); }
    .nav-menu a { display: block; padding: 0.75rem 0; border-bottom: 1px solid var(--accent-soft); }
}

/* ---------- SIDER ---------- */
.page { display: none; margin-top: 100px; padding: 3rem 2rem; }
.page.active { display: block; }

.container { max-width: 1200px; margin: 0 auto; }

h1 {
    font-size: 3.5rem;
    color: var(--accent);
    margin: 2rem 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: var(--text-glow);
}

h2 {
    font-size: 2.2rem;
    color: var(--accent-2);
    margin: 2rem 0 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

p { color: var(--muted); line-height: 1.8; margin: 1rem 0; }
.center-note { text-align: center; font-size: 1.1rem; }

.hero { text-align: center; padding: 3rem 0; }
.hero-logo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    object-fit: cover;
    margin-bottom: 2rem;
}
.hero-sub { font-size: 1.3rem; }

.about-text { color: var(--muted); font-size: 1.1rem; line-height: 1.9; margin: 1.5rem 0; }

/* ---------- KORT ---------- */
/* Maks 3 per rad. Siste rad sentreres (f.eks. 4 kort = 3 + 1 midtstilt, 5 kort = 3 + 2 midtstilt) */
.grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
}
.grid > * { flex: 0 1 calc((100% - 4rem) / 3); min-width: 240px; }

.card-link { display: block; text-decoration: none; }
.card-link:hover { text-decoration: none; }

.card {
    display: block;
    width: 100%;
    font: inherit;
    color: inherit;
    background: var(--surface);
    border: 2px solid var(--accent);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.card:hover {
    background: var(--accent-soft);
    transform: translateY(-8px);
    box-shadow: 0 0 20px var(--accent-glow);
}

.card-icon {
    margin: 1rem 0;
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}
.card-title { color: var(--accent); font-weight: bold; text-transform: uppercase; margin: 1rem 0; display: block; }
.card-text { color: var(--muted); display: block; }

/* ---------- LOGOER ---------- */
.brand-logo { width: 3.5rem; height: 3.5rem; display: block; margin: 0 auto; }
.brand-logo.wide { width: 5rem; height: 2.5rem; }
.contact-icon .brand-logo { width: 3rem; height: 3rem; }
.contact-icon .brand-logo.wide { width: 4.5rem; height: 2.25rem; }
.item-logo { width: 1.5rem; height: 1.5rem; flex-shrink: 0; margin: 0; }
.item-logo.wide { width: 2.4rem; height: 1.2rem; }

/* ---------- BILDER I FAVORITT-LISTENE ---------- */
.item-thumb {
    width: 96px;
    height: 45px;
    object-fit: cover;
    object-position: center 25%;
    border-radius: 6px;
    border: 1px solid var(--accent-2);
    flex-shrink: 0;
}

.thumb-ph {
    width: 96px;
    height: 45px;
    border-radius: 6px;
    border: 1px solid var(--accent-2);
    background: var(--accent-2-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

/* ---------- KNAPPER ---------- */
.btn {
    background: var(--accent);
    color: var(--on-accent);
    border: 2px solid var(--accent);
    padding: 0.7rem 1.5rem;
    border-radius: 20px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    transition: all 0.3s;
}
.btn:hover { transform: scale(1.04); }
.btn-ghost { background: transparent; color: var(--accent); }

/* ---------- LIVE ---------- */
.live-section { margin: 2rem 0; }
.live-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 1.6rem;
    margin: 0 0 1rem;
}
.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #e91916;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 0.15rem 0.55rem;
    border-radius: 6px;
    text-transform: uppercase;
    vertical-align: middle;
    text-shadow: none;
}
.live-pill::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #fff;
    animation: livepulse 1.4s infinite;
}
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
/* LIVE-merke på Twitch-kortene vises bare når du er live */
.live-badge { display: none; }
body[data-live="true"] .live-badge { display: inline-flex; margin-left: 0.5rem; }

.live-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 1rem;
    align-items: stretch;
}
.live-frame,
.live-chat {
    position: relative;
    border: 2px solid var(--accent);
    border-radius: 15px;
    overflow: hidden;
    background: var(--surface-solid);
}
.live-frame { aspect-ratio: 16 / 9; }
.live-chat { min-height: 360px; }
.live-frame iframe,
.live-chat iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.live-note { text-align: right; margin: 0.5rem 0 0; font-size: 0.9rem; }
.live-fallback { text-align: center; }
a.btn { display: inline-block; text-decoration: none; }
a.btn:hover { text-decoration: none; }

@media (max-width: 900px) {
    .live-layout { grid-template-columns: 1fr; }
    .live-chat { min-height: 420px; }
}

/* ---------- VITSER ---------- */
.joke-tabs {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
    justify-content: center;
}

.joke-tab {
    background: var(--surface);
    border: 2px solid var(--accent-3);
    color: var(--text);
    padding: 0.8rem 1.5rem;
    border-radius: 20px;
    cursor: pointer;
    font: inherit;
    font-weight: bold;
    transition: all 0.3s;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.joke-tab:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 15px var(--accent-3-glow);
}

.joke-tab.active {
    background: var(--accent-3);
    color: #fff;
    box-shadow: 0 0 20px var(--accent-3-glow);
}

.badge-18 {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.05rem 0.4rem;
    border-radius: 6px;
    background: var(--hot);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.joke-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.joke-card {
    background: var(--surface);
    border: 2px solid var(--accent-3);
    border-radius: 15px;
    padding: 2rem;
    transition: all 0.3s;
}

.joke-card:hover {
    background: rgba(217, 70, 239, 0.1);
    transform: translateY(-5px);
    box-shadow: 0 0 20px var(--accent-3-glow);
}

.joke-text { color: var(--text); font-size: 1.1rem; margin: 1rem 0; line-height: 1.7; }
.joke-punch { color: var(--accent-2); }

.joke-button {
    background: var(--accent-3);
    color: #fff;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 20px;
    cursor: pointer;
    font: inherit;
    font-weight: bold;
    transition: all 0.3s;
    width: 100%;
    margin-top: 1rem;
}

.joke-button:hover {
    transform: scale(1.05);
    background: var(--hot);
}

/* ---------- KONTAKT ---------- */
.contact-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin: 3rem 0;
}
.contact-grid > * { flex: 0 1 calc((100% - 4rem) / 3); min-width: 260px; }

.contact-card {
    background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft));
    border: 2px solid var(--accent-2);
    border-radius: 15px;
    padding: 2.5rem;
    text-align: center;
    transition: all 0.3s;
}

.contact-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--contact-glow);
    border-color: var(--accent);
}

.contact-icon {
    margin-bottom: 1rem;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}
.contact-label { color: var(--accent-2); font-weight: bold; text-transform: uppercase; font-size: 0.9rem; letter-spacing: 1px; }
.contact-value { color: var(--text); font-size: 1.2rem; margin-top: 0.5rem; font-weight: 600; }
.contact-link { color: var(--accent); text-decoration: none; }
.contact-link:hover { text-decoration: underline; }

/* ---------- GALLERI ---------- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.gallery-item {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    font: inherit;
    color: inherit;
    overflow: hidden;
    border-radius: 15px;
    border: 2px solid var(--accent);
    height: 250px;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--surface-solid);
}

.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--accent-glow);
}

.gallery-img { display: block; width: 100%; height: 100%; object-fit: cover; }

.gallery-label {
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    padding: 1rem;
    color: var(--accent);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

/* ---------- LIGHTBOX ---------- */
.lightbox-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-strong);
    z-index: 2000;
    overflow-y: auto;
}

.lightbox-modal.show { display: flex; align-items: center; justify-content: center; }

.lightbox-content {
    position: relative;
    background: var(--surface-solid);
    border: 3px solid var(--accent);
    border-radius: 15px;
    padding: 2rem;
    max-width: 800px;
    width: 90%;
    margin: auto;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s;
}
.lightbox-close:hover { color: var(--hot); transform: rotate(90deg); }

.lightbox-img {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: 2px solid var(--accent-2);
}

.lightbox-title {
    color: var(--accent);
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lightbox-description {
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    background: var(--accent-soft);
    padding: 1.5rem;
    border-left: 3px solid var(--accent-2);
    border-radius: 8px;
}
.lightbox-description p { margin: 0.25rem 0; }

.lightbox-credit {
    color: var(--accent-2);
    font-size: 1rem;
    font-weight: bold;
    background: var(--accent-2-soft);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border: 2px solid var(--accent-2);
}
.lightbox-credit-label { color: var(--muted); font-size: 0.9rem; }

.lightbox-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    gap: 1rem;
}

.lightbox-nav-btn {
    background: var(--accent-3);
    color: #fff;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 20px;
    cursor: pointer;
    font: inherit;
    font-weight: bold;
    transition: all 0.3s;
}
.lightbox-nav-btn:hover { transform: scale(1.05); background: var(--hot); }

.lightbox-counter { color: var(--accent); font-weight: bold; font-size: 1.1rem; }

/* ---------- FAVORITT-BOKS (RULLBAR) ---------- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 2000;
}

.modal.show { display: flex; align-items: center; justify-content: center; }

.modal-content {
    background: var(--surface-solid);
    border: 3px solid var(--accent);
    border-radius: 15px;
    padding: 2.5rem 2rem 2rem 2.5rem;
    max-width: 560px;
    width: 90%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.modal-title {
    color: var(--accent);
    font-size: 1.8rem;
    margin: 0 0 1.25rem;
    text-transform: uppercase;
    flex-shrink: 0;
    padding-right: 2rem;
}

.modal-tools {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin: 0 0.75rem 0.5rem 0;
    flex-shrink: 0;
}

.modal-search {
    flex: 1 1 auto;
    min-width: 0;
    background: var(--surface-solid);
    color: var(--text);
    border: 2px solid var(--accent);
    border-radius: 20px;
    padding: 0.55rem 1rem;
    font: inherit;
    font-size: 0.95rem;
}
.modal-search::placeholder { color: var(--muted); }

.tool-btn {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.tool-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.modal-count { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.75rem; flex-shrink: 0; min-height: 1.2rem; }

.modal-list {
    list-style: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--accent-soft);
}
.modal-list::-webkit-scrollbar { width: 8px; }
.modal-list::-webkit-scrollbar-track { background: var(--accent-soft); border-radius: 4px; }
.modal-list::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

.modal-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem;
    background: var(--accent-soft);
    border-left: 3px solid var(--accent-2);
    margin-bottom: 0.75rem;
    border-radius: 8px;
    color: var(--text);
}

.modal-item a { color: var(--accent-2); text-decoration: none; font-weight: bold; }
.modal-item a:hover { text-decoration: underline; }

.modal-empty { color: var(--muted); padding: 1rem; }

/* Rader i favoritt-listen er knapper som åpner detaljvisning */
button.modal-item {
    width: 100%;
    font: inherit;
    text-align: left;
    cursor: pointer;
    border: none;
    border-left: 3px solid var(--accent-2);
    transition: background 0.2s, transform 0.2s;
}
button.modal-item:hover { background: var(--accent-2-soft); transform: translateX(3px); }
.item-name { flex: 1; min-width: 0; color: var(--accent-2); font-weight: bold; }
.item-go { color: var(--accent); font-size: 1.6rem; line-height: 1; }

/* ---------- DETALJVISNING ---------- */
.detail-modal { z-index: 2100; }
.detail-img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: min(42vh, 420px);
    margin: 0 auto 1.5rem;
    background: var(--surface-solid);
}
.detail-meta { color: var(--accent); font-weight: 600; margin: -0.5rem 0 1rem; }
.detail-loading { opacity: 0.7; }
.detail-source { font-size: 0.8rem; margin-top: 0.75rem !important; }
.detail-link .btn { margin-top: 0.6rem; }

/* 18+ */
.age-content { max-width: 460px; padding: 2.5rem; }
.age-content p { margin: 0 0 1.5rem; }
.age-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ---------- FOOTER ---------- */
footer {
    background: var(--nav-bg);
    border-top: 3px solid var(--accent);
    padding: 2rem;
    text-align: center;
    color: var(--muted);
    margin-top: 4rem;
}
footer p { margin: 0; }
.credit { font-size: 0.8rem; margin-top: 0.75rem; }

/* ---------- MINISPILL ---------- */
.game-frame {
    border: 3px solid var(--accent);
    border-radius: 15px;
    overflow: hidden;
    background: #0b1230;
    height: min(78vh, 820px);
    min-height: 520px;
    margin: 1.5rem 0 0.5rem;
    box-shadow: 0 0 20px var(--accent-glow);
}
.game-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.game-note { text-align: center; font-size: 0.95rem; }
@media (max-width: 768px) { .game-frame { height: 70vh; min-height: 460px; } }

@media (max-width: 600px) {
    .grid > *, .contact-grid > * { flex-basis: 100%; min-width: 0; }
}

@media (max-width: 768px) {
    .page { padding: 2rem 1.25rem; }
    h1 { font-size: 2.5rem; }
    h2 { font-size: 1.8rem; }
    .nav-logo { font-size: 1.4rem; }
    .nav-logo img { height: 44px; width: 44px; }
    .lightbox-content { padding: 1.5rem; }
    .lightbox-img { max-height: 300px; }
    .modal-content { padding: 2rem 1.25rem 1.25rem 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
    .card:hover, .joke-card:hover, .contact-card:hover, .gallery-item:hover, .joke-tab:hover, .btn:hover { transform: none; }
}
