:root {
    --bg-dark: #0d0c13;
    --bg-card: rgba(26, 24, 38, 0.92);
    --gold: #e5b948;
    --gold-glow: rgba(229, 185, 72, 0.4);
    --gold-hover: #f7d274;
    --parchment-bg: #f8f1de;
    --parchment-border: #8b6d3b;
    --parchment-ink: #2b1f14;
    --purple-fire: #aa26eb;
    --purple-fire-glow: rgba(170, 38, 235, 0.6);
    --black-fire: #120d1e;
    --black-fire-glow: rgba(67, 18, 114, 0.8);
    --poison-green: #2ecc71;
    --wine-red: #9e2a2b;
    --text-light: #ece8e1;
    --text-dim: #a59fa8;
    --font-gothic: 'MedievalSharp', cursive, serif;
    --font-script: 'Caveat', cursive, sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 15% 20%, rgba(138, 43, 226, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(229, 185, 72, 0.08) 0%, transparent 40%),
        url('/static/img/parchment_texture.jpg');
    background-blend-mode: overlay;
    color: var(--text-light);
    font-family: var(--font-gothic);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Site Header */
.site-header {
    background: rgba(13, 12, 19, 0.95);
    border-bottom: 2px solid var(--gold);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--gold);
    font-size: 1.4rem;
    text-shadow: 0 0 10px var(--gold-glow);
    transition: transform 0.2s;
}

.brand-link:hover {
    transform: scale(1.03);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 1rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
    color: var(--gold);
    border-color: var(--gold);
    background: rgba(229, 185, 72, 0.1);
}

/* Control Buttons */
.btn-control {
    background: rgba(255, 255, 255, 0.08);
    color: var(--gold);
    border: 1px solid var(--gold);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}

.btn-control:hover {
    background: var(--gold);
    color: var(--bg-dark);
    box-shadow: 0 0 12px var(--gold-glow);
}

.lang-btn.active {
    background: var(--gold);
    color: var(--bg-dark);
    font-weight: bold;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 1.5rem auto 3rem auto;
    padding: 0 1rem;
    flex: 1;
    width: 100%;
}

/* Parchment Box */
.parchment-scroll {
    background: var(--parchment-bg);
    color: var(--parchment-ink);
    border: 4px double var(--parchment-border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), inset 0 0 40px rgba(139, 109, 59, 0.25);
    position: relative;
    margin-bottom: 2rem;
}

.parchment-title {
    font-size: 2rem;
    text-align: center;
    color: #5c1818;
    margin-bottom: 1rem;
    text-shadow: 1px 1px 0px rgba(255,255,255,0.7);
}

.riddle-poem {
    font-family: var(--font-script);
    font-size: 1.5rem;
    line-height: 1.8;
    text-align: center;
    margin: 1.5rem 0;
    white-space: pre-line;
    font-weight: bold;
}

/* Dungeon Card */
.dungeon-card {
    background: var(--bg-card);
    border: 1px solid rgba(229, 185, 72, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    margin-bottom: 2rem;
}

/* Chamber Overview Grid */
.chamber-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.chamber-card {
    background: rgba(20, 18, 30, 0.9);
    border: 2px solid rgba(229, 185, 72, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

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

.chamber-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(229, 185, 72, 0.2);
    border: 1px solid var(--gold);
    color: var(--gold);
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
}

.chamber-badge.solved {
    background: rgba(46, 204, 113, 0.25);
    border-color: #2ecc71;
    color: #2ecc71;
}

.chamber-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.chamber-title {
    font-size: 1.5rem;
    color: var(--gold);
    margin-bottom: 0.75rem;
    text-align: center;
}

.chamber-desc {
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
    text-align: center;
}

/* Magical Buttons */
.btn-magical {
    display: inline-block;
    background: linear-gradient(135deg, #b8860b, #d4af37, #f7d274);
    color: #1a1505;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    transition: all 0.2s;
    text-shadow: 0 1px 1px rgba(255,255,255,0.4);
}

.btn-magical:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(212, 175, 55, 0.7);
    color: #000;
}

/* Flaming Gates (Bottles Riddle) */
.flame-chamber-arena {
    position: relative;
    background: radial-gradient(circle at center, #191629 0%, #0c0a14 100%);
    border: 2px solid #4a3b63;
    border-radius: 16px;
    padding: 2rem 1.5rem;
    box-shadow: inset 0 0 80px rgba(0,0,0,0.9), 0 10px 40px rgba(0,0,0,0.8);
    overflow: hidden;
}

.flame-wall-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.flame-gate {
    width: 48%;
    padding: 1.5rem 1rem;
    border-radius: 12px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.flame-gate.purple {
    background: rgba(75, 15, 110, 0.35);
    border: 2px solid var(--purple-fire);
    box-shadow: 0 0 35px var(--purple-fire-glow);
}

.flame-gate.black {
    background: rgba(18, 12, 28, 0.8);
    border: 2px solid #5a287a;
    box-shadow: 0 0 35px var(--black-fire-glow);
}

.flame-icon-animated {
    font-size: 3rem;
    animation: flameFlicker 1.5s infinite alternate;
}

@keyframes flameFlicker {
    0% { transform: scale(1) rotate(-2deg); opacity: 0.85; }
    50% { transform: scale(1.1) rotate(3deg); opacity: 1; filter: drop-shadow(0 0 15px currentColor); }
    100% { transform: scale(0.95) rotate(-1deg); opacity: 0.9; }
}

/* 7 Bottles Table */
.bottles-table-wrapper {
    margin: 2rem 0;
    padding: 1.5rem 1rem;
    background: linear-gradient(180deg, #2a201b 0%, #17110e 100%);
    border: 3px solid #6b5338;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.9);
}

.bottles-table {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 1rem 0;
}

.bottle-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 95px;
    cursor: pointer;
    transition: transform 0.2s;
    user-select: none;
}

.bottle-slot:hover {
    transform: translateY(-8px);
}

.bottle-slot.selected {
    transform: translateY(-12px);
    filter: drop-shadow(0 0 15px var(--gold));
}

.bottle-pedestal {
    width: 80px;
    height: 18px;
    background: linear-gradient(180deg, #574635 0%, #2f251c 100%);
    border: 2px solid #856a52;
    border-radius: 6px;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--gold);
    font-weight: bold;
}

/* SVG Bottles */
.bottle-svg {
    filter: drop-shadow(0 8px 12px rgba(0,0,0,0.6));
    transition: filter 0.3s;
}

/* Bottle tags */
.bottle-tag-select {
    margin-top: 0.4rem;
    background: rgba(13, 12, 19, 0.9);
    border: 1px solid var(--gold);
    color: var(--text-light);
    font-family: inherit;
    font-size: 0.75rem;
    padding: 0.2rem;
    border-radius: 4px;
    cursor: pointer;
}

/* Canvas Broom Game */
.canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    border: 3px solid var(--gold);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0,0,0,0.9), 0 0 20px var(--gold-glow);
    background: #000;
}

#broomCanvas {
    display: block;
    width: 100%;
    height: 520px;
    cursor: crosshair;
}

.game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgba(13, 12, 19, 0.9);
    border-bottom: 2px solid var(--gold);
    font-size: 1.1rem;
    color: var(--gold);
}

.mobile-controls {
    display: none;
    margin-top: 1rem;
    justify-content: center;
    gap: 1rem;
}

@media (max-width: 768px) {
    .mobile-controls {
        display: flex;
    }
    .flame-wall-container {
        flex-direction: column;
        gap: 1rem;
    }
    .flame-gate {
        width: 100%;
    }
    #broomCanvas {
        height: 380px;
    }
}

/* Modal Feedback */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    border: 2px solid var(--gold);
    border-radius: 14px;
    max-width: 550px;
    width: 100%;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 0 50px var(--gold-glow);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-backdrop.show .modal-content {
    transform: scale(1);
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.8rem;
    color: var(--gold);
    margin-bottom: 1rem;
}

.modal-text {
    color: var(--text-light);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Footer */
.footer {
    background: rgba(10, 9, 15, 0.95);
    border-top: 1px solid rgba(229, 185, 72, 0.3);
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.footer a {
    color: var(--gold);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Sliding Puzzle (Schieberätsel) */
.sliding-board-container {
    max-width: 440px;
    margin: 1.5rem auto;
    background: #171421;
    border: 3px solid var(--gold);
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: 0 0 30px rgba(0,0,0,0.8), inset 0 0 30px rgba(0,0,0,0.6);
}

.sliding-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 10px;
    width: 100%;
    aspect-ratio: 1 / 1;
}

.sliding-tile {
    background: linear-gradient(145deg, #2b253b, #1b1725);
    border: 2px solid var(--gold);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s, background 0.2s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    padding: 0.5rem;
}

.sliding-tile:hover {
    transform: scale(1.03);
    background: #39324e;
}

.sliding-tile.blank {
    background: transparent;
    border: 2px dashed rgba(229, 185, 72, 0.2);
    box-shadow: none;
    cursor: default;
}

.tile-icon {
    font-size: 2.2rem;
}

.tile-num {
    font-size: 0.85rem;
    color: var(--gold);
    font-weight: bold;
}

.tile-name {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 2px;
}

