:root {
    /* Alapszínek - Mélyéj-kék paletta (Holdfény) */
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --accent-purple: #7c3aed;
    --accent-gold: #fcd34d;
    --accent-blue: #38bdf8;
    --accent-pink: #ec4899;

    /* Szöveg színek */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* Glassmorphism tokenek */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(12px);

    /* Gombok */
    --btn-primary: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    --btn-secondary: rgba(255, 255, 255, 0.1);
    --btn-accent: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);

    /* Egyéb */
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Lexend', sans-serif;
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

/* VARÁZSLATOS LILA TÉMA (Kaland mód) */
.theme-magic {
    --bg-dark: #1e1b4b;
    --bg-darker: #0f0b3c;
    --accent-purple: #d946ef;
    --accent-blue: #a855f7;
    --glass-bg: rgba(217, 70, 239, 0.08);
    --glass-border: rgba(217, 70, 239, 0.2);
    --btn-primary: linear-gradient(135deg, #d946ef 0%, #7c3aed 100%);
}

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

body {
    background-color: var(--bg-darker);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* AURORA HÁTTÉR EFFEKT */
.aurora-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 20% 30%, rgba(124, 58, 237, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(56, 189, 248, 0.15) 0%, transparent 40%);
    transition: background 0.8s ease;
}

.theme-magic .aurora-bg {
    background: radial-gradient(circle at 20% 30%, rgba(217, 70, 239, 0.2) 0%, transparent 45%),
        radial-gradient(circle at 80% 70%, rgba(124, 58, 237, 0.2) 0%, transparent 45%);
}

.aurora-bg::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://www.transparenttextures.com/patterns/stardust.png');
    opacity: 0.1;
    pointer-events: none;
}

/* APP CONTAINER */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
}

/* OLDALSÁVOK (Vizuális finomítás) */
.ads-sidebar {
    width: 180px;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    padding-top: 120px;
    border-left: 1px solid var(--glass-border);
    border-right: 1px solid var(--glass-border);
}

.ad-placeholder {
    width: 140px;
    height: 600px;
    background: var(--glass-bg);
    border: 1px dashed var(--text-muted);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* HEADER & NAVBAR */
.header {
    margin-bottom: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    background: linear-gradient(to right, var(--accent-gold), #fff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
    font-weight: 600;
}

.main-nav {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* GOMBOK (Premium Style) */
.btn {
    padding: 14px 28px;
    border-radius: var(--border-radius-md);
    border: none;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
    filter: grayscale(0.5);
    pointer-events: none;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: var(--btn-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--btn-secondary);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-accent {
    background: var(--btn-accent);
    color: #000;
    box-shadow: 0 4px 15px rgba(252, 211, 77, 0.3);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(252, 211, 77, 0.5);
}

/* GLASS CARD UTILITY */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-soft);
}

/* TARTALMI TERÜLET */
.content-area {
    width: 100%;
    animation: fadeIn 0.8s ease-out;
}

.welcome-screen {
    text-align: center;
}

.welcome-screen h2 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* MESE KÁRTYÁK GRID */
.quick-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 50px;
}

.category-card {
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(124, 58, 237, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

.category-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-purple);
}

.category-card:hover::before {
    opacity: 1;
}

.category-card .icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

.category-card h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--accent-gold);
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* LÁBLÉC */
.footer {
    margin-top: auto;
    padding: 60px 0 30px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* STORY LISTA (Modernizálva) */
.story-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.story-item {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.3s;
}

.story-item:hover {
    background: rgba(124, 58, 237, 0.1);
    border-color: var(--accent-purple);
    transform: translateX(5px);
}

/* OLVASÓ FELÜLET */
.story-reader {
    max-width: 800px;
    margin: 0 auto;
}

.story-text {
    font-size: 1.25rem;
    line-height: 1.9;
    color: #e2e8f0;
    background: rgba(0, 0, 0, 0.3);
    padding: 40px;
    border-radius: var(--border-radius-lg);
    margin: 30px 0;
    white-space: pre-wrap;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* AUDIO PLAYER */
.audio-player {
    margin: 30px 0;
    padding: 20px;
    border-radius: 100px;
    background: linear-gradient(to right, rgba(124, 58, 237, 0.1), rgba(56, 189, 248, 0.1));
    border: 1px solid var(--glass-border);
}

audio {
    width: 100%;
    filter: invert(100%) hue-rotate(180deg) brightness(1.5);
    /* Sötét módhoz igazítás */
}

/* ANIMÁCIÓK */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* RESPONSIVE */
@media (max-width: 1200px) {
    .ads-sidebar {
        display: none;
    }

    .main-content {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .logo h1 {
        font-size: 2rem;
    }

    .main-content {
        padding: 15px;
    }

    .btn {
        width: 100%;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
    }

    .story-text {
        padding: 25px;
        font-size: 1.15rem;
    }
}

/* SZEREPLŐ KÉPEK */
.char-image-wrap {
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
    border-radius: 50%;
    border: 4px solid var(--accent-purple);
    overflow: hidden;
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.4);
    background: var(--bg-dark);
}

.char-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.category-card:hover .char-image-wrap img {
    transform: scale(1.1);
}

.mini-char {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    border: 2px solid transparent;
}

.mini-char:hover {
    transform: translateY(-5px) scale(1.05) rotate(2deg);
    border-color: var(--accent-gold);
    box-shadow: 0 0 20px rgba(252, 211, 77, 0.3);
}

.magic-text {
    background: linear-gradient(135deg, var(--accent-gold) 0%, #fff 50%, var(--accent-blue) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* LOADER & ERROR POPUP */
.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(252, 211, 77, 0.1);
    border-top: 5px solid var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.42, 0, 0.58, 1) infinite;
    margin-bottom: 24px;
    box-shadow: 0 0 20px rgba(252, 211, 77, 0.2);
}

.error-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 420px;
    padding: 40px;
    text-align: center;
    z-index: 10000;
    border: 1px solid rgba(239, 68, 68, 0.3);
    animation: fadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.error-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    display: block;
}

.loader-text {
    font-family: var(--font-heading);
    color: var(--accent-gold);
    font-size: 1.2rem;
    letter-spacing: 1px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ============================================================
   WP1 - Frontend visual and UX refinements
   ============================================================ */
:root {
    --font-main: 'Quicksand', 'Trebuchet MS', sans-serif;
    --focus-ring: 0 0 0 3px rgba(56, 189, 248, 0.45);
    --focus-outline: #7dd3fc;
}

body {
    background:
        radial-gradient(circle at 8% 12%, rgba(56, 189, 248, 0.14), transparent 35%),
        radial-gradient(circle at 85% 10%, rgba(252, 211, 77, 0.12), transparent 40%),
        linear-gradient(180deg, #020617 0%, #0b1324 48%, #070f1d 100%);
}

.app-container {
    align-items: flex-start;
}

.main-content {
    width: 100%;
    max-width: 1180px;
    padding: 20px 32px 32px;
}

.hero-header {
    margin-top: 16px;
    margin-bottom: 42px;
    padding: 38px 34px;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    box-shadow: 0 12px 30px rgba(2, 6, 23, 0.38);
}

.main-nav {
    gap: 18px;
}

.nav-links {
    row-gap: 10px;
}

.btn {
    min-height: 46px;
    border: 1px solid transparent;
}

.btn-auth {
    margin-left: 10px;
}

button,
input,
a {
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

button:focus-visible,
.btn:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-color: var(--focus-outline);
}

.content-area {
    position: relative;
}

.welcome-screen {
    max-width: 960px;
    margin: 0 auto;
}

.welcome-screen>* {
    animation: riseIn 0.55s ease-out both;
}

.welcome-screen>*:nth-child(2) {
    animation-delay: 0.08s;
}

.welcome-screen>*:nth-child(3) {
    animation-delay: 0.14s;
}

.welcome-screen>*:nth-child(4) {
    animation-delay: 0.2s;
}

.welcome-screen p {
    max-width: 720px;
    margin: 0 auto;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.quick-categories {
    margin-top: 44px;
    gap: 22px;
}

.category-card {
    min-height: 330px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.category-card p {
    max-width: 34ch;
    margin: 0 auto;
}

.character-section {
    margin-top: 56px;
}

.character-grid {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 22px;
}

.mini-char {
    width: 104px;
    min-height: 132px;
    text-align: center;
    padding: 10px;
}

.mini-char img {
    width: 100%;
    border-radius: 10px;
    display: block;
}

.mini-char span {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.8rem;
}

.handwriting-sticker {
    margin-top: 36px;
    opacity: 0.88;
    transform: rotate(-2deg);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.handwriting-sticker img {
    width: 200px;
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
}

.handwriting-caption {
    margin-top: 10px;
    color: var(--accent-gold);
    font-size: 0.9rem;
}

.auth-modal-card {
    position: relative;
    width: 90%;
    max-width: 420px;
    padding: 36px;
    text-align: center;
}

.modal-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: 0;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.4rem;
}

.auth-modal-title {
    margin-bottom: 18px;
}

.auth-modal-help {
    margin-bottom: 22px;
    font-size: 0.92rem;
    color: var(--text-secondary);
}

.auth-input {
    width: 100%;
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-family: inherit;
}

.auth-divider {
    margin: 24px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.auth-divider hr {
    flex: 1;
    border: 0.5px solid var(--glass-border);
}

.btn-google-auth {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ad-placeholder::before {
    content: 'Reklám helye';
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .hero-header {
        padding: 28px 22px;
    }

    .btn-auth {
        margin-left: 0;
    }

    .quick-categories {
        grid-template-columns: 1fr;
    }

    .category-card {
        min-height: 0;
    }
}

@media (max-width: 600px) {
    .main-content {
        padding: 12px 14px 24px;
    }

    .hero-header {
        padding: 24px 16px;
        margin-bottom: 28px;
    }

    .welcome-screen h2 {
        font-size: 1.8rem;
        line-height: 1.2;
    }

    .welcome-screen p {
        font-size: 0.98rem;
    }

    .character-grid {
        gap: 10px;
    }

    .mini-char {
        width: 90px;
        min-height: 118px;
        padding: 8px;
    }

    .handwriting-sticker img {
        width: 170px;
    }

    .auth-modal-card {
        width: 94%;
        padding: 30px 18px;
    }
}

/* COOKIE BANNER */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    padding: 20px 25px;
    z-index: 10001;
    display: flex;
    justify-content: center;
    animation: slideUp 0.5s ease-out;
}

.cookie-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
}

.cookie-content p {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 40px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@media (max-width: 600px) {
    .cookie-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .btn-sm {
        width: 100%;
    }
}