/* ==========================================================================
   Tango Logic Puzzle - Modern Responsive Mobile Stylesheet
   ========================================================================== */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.85);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-sun: #fbbf24;
    --accent-sun-bg: rgba(251, 191, 36, 0.18);
    --accent-moon: #38bdf8;
    --accent-moon-bg: rgba(56, 189, 248, 0.18);
    --accent-equal: #10b981;
    --accent-opposite: #ef4444;
    --cell-bg: #1e293b;
    --cell-border: #334155;
    --cell-locked-bg: #090e1a;
    --cell-hover: #334155;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Theme: AMOLED Black */
body.theme-amoled {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-card: rgba(18, 18, 18, 0.95);
    --border-color: rgba(255, 255, 255, 0.12);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent-sun: #facc15;
    --accent-sun-bg: rgba(250, 204, 21, 0.18);
    --accent-moon: #38bdf8;
    --accent-moon-bg: rgba(56, 189, 248, 0.18);
    --accent-equal: #10b981;
    --accent-opposite: #ef4444;
    --cell-bg: #111113;
    --cell-border: #242428;
    --cell-locked-bg: #000000;
    --cell-hover: #1f1f23;
    --shadow-color: rgba(0, 0, 0, 0.8);
}

/* Theme: Clean Light */
body.theme-light {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.95);
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-sun: #d97706;
    --accent-moon: #0284c7;
    --cell-bg: #ffffff;
    --cell-border: #cbd5e1;
    --cell-locked-bg: #cbd5e1;
    --cell-hover: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.08);
}

/* Theme: Warm Wood */
body.theme-wood {
    --bg-primary: #291811;
    --bg-secondary: #452418;
    --bg-card: rgba(69, 36, 24, 0.92);
    --border-color: rgba(217, 119, 6, 0.25);
    --text-primary: #fef3c7;
    --text-secondary: #f59e0b;
    --accent-sun: #fbbf24;
    --accent-sun-bg: rgba(251, 191, 36, 0.2);
    --accent-moon: #60a5fa;
    --accent-moon-bg: rgba(96, 165, 250, 0.2);
    --accent-equal: #34d399;
    --accent-opposite: #f87171;
    --cell-bg: #3e2217;
    --cell-border: #5e3223;
    --cell-locked-bg: #180a05;
    --cell-hover: #4e2b1e;
    --shadow-color: rgba(20, 10, 5, 0.6);
}

/* Theme: Cyberpunk Neon */
body.theme-cyberpunk {
    --bg-primary: #090914;
    --bg-secondary: #16162d;
    --bg-card: rgba(22, 22, 45, 0.95);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #00f0ff;
    --text-secondary: #f472b6;
    --accent-sun: #ffe600;
    --accent-moon: #00f0ff;
    --accent-equal: #00ff66;
    --accent-opposite: #ff0055;
    --cell-bg: #16162d;
    --cell-border: rgba(255, 255, 255, 0.1);
    --cell-locked-bg: #0a0a16;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

#appRoot {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    max-width: 540px;
    margin: 0 auto;
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Confetti Canvas */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.header-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.header-btn:active {
    background: var(--cell-hover);
}

.header-title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
    margin-top: 2px;
}

/* Tutorial Banner */
.tutorial-banner {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin: 8px 12px 0 12px;
    padding: 10px 14px;
    box-shadow: 0 4px 12px var(--shadow-color);
    animation: slideDown 0.3s ease;
    max-height: 220px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tutorial-banner h3 {
    font-size: 1.05rem;
    color: var(--accent-sun);
    margin-bottom: 4px;
}

.tutorial-banner .tut-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tutorial-banner .tut-desc {
    font-size: 0.88rem;
    line-height: 1.4;
    color: var(--text-primary);
}

/* Game Board Area */
.game-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    position: relative;
    width: 100%;
    min-height: 300px;
}

.board-container {
    width: min(92vw, 55vh);
    height: min(92vw, 55vh);
    max-width: 440px;
    max-height: 440px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
    box-sizing: border-box;
}

.tango-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    gap: 6px;
    background: var(--bg-secondary);
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px var(--shadow-color);
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}

.grid-row {
    display: flex;
    flex: 1;
    gap: 6px;
    width: 100%;
}

.grid-cell {
    flex: 1;
    aspect-ratio: 1 / 1;
    background: var(--cell-bg);
    border: 2px solid var(--cell-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.1rem, 4vw, 2.2rem);
    position: relative;
    cursor: pointer;
    box-sizing: border-box;
    transition: transform 0.1s ease, border-color 0.2s, background-color 0.2s;
}

.grid-cell:active:not(.locked) {
    transform: scale(0.94);
}

.grid-cell.locked {
    background: var(--cell-locked-bg);
    border-color: var(--border-color);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
    cursor: default;
}

body.theme-light .grid-cell.locked {
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.12);
}

.grid-cell.selected {
    border-color: var(--accent-sun);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.grid-cell.conflict {
    border-color: var(--accent-opposite) !important;
    background: rgba(239, 68, 68, 0.15) !important;
    animation: cellShake 0.4s ease;
}

.grid-cell.hint-highlight {
    border-color: var(--accent-sun) !important;
    animation: hintPulse 1.2s infinite ease-in-out;
}

.grid-cell.hint-shimmer {
    position: relative;
    border-color: var(--accent-sun) !important;
    animation: hintCellShimmer 2s infinite ease-in-out;
    overflow: hidden;
}

.grid-cell.hint-shimmer::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        60deg,
        rgba(255, 255, 255, 0) 20%,
        rgba(251, 191, 36, 0.28) 45%,
        rgba(255, 255, 255, 0.55) 50%,
        rgba(251, 191, 36, 0.28) 55%,
        rgba(255, 255, 255, 0) 80%
    );
    transform: rotate(25deg) translateY(-120%);
    animation: hintLightSweep 2.6s infinite cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 2;
}

.grid-cell.hint-highlight.error-highlight {
    border-color: var(--accent-opposite) !important;
    background: rgba(239, 68, 68, 0.22) !important;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.55);
}

.grid-cell.tutorial-target {
    border-color: var(--accent-sun) !important;
    animation: hintPulse 1.5s infinite ease-in-out;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
}

/* ==================== REVEALED SOLUTION & MISTAKE STYLES ==================== */
.grid-cell.cell-revealed-error {
    border-color: #ef4444 !important;
    background: radial-gradient(circle at center, rgba(239, 68, 68, 0.28) 0%, var(--cell-bg) 85%) !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5) !important;
    position: relative;
}

.grid-cell.cell-revealed-error .wrong-marker-cross {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.75rem;
    font-weight: 900;
    color: #ef4444;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 3;
}

.grid-cell.cell-revealed-error .icon-sun,
.grid-cell.cell-revealed-error .icon-moon {
    opacity: 0.5;
    filter: grayscale(0.6) contrast(1.2);
}

.grid-cell.cell-revealed-error .revealed-correct-sub {
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 4;
}

.grid-cell.cell-revealed-error .revealed-correct-sub .mini-badge {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--accent-sun);
    border-radius: 4px;
    padding: 1px 4px;
    font-size: 0.65rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.grid-cell.cell-revealed-error .revealed-correct-sub .mini-badge.badge-moon {
    border-color: var(--accent-moon);
}

.grid-cell.cell-revealed-correct {
    border-color: rgba(34, 197, 94, 0.55) !important;
    box-shadow: inset 0 0 8px rgba(34, 197, 94, 0.15);
}

.grid-cell.cell-revealed-solution {
    background: var(--cell-bg);
}

.grid-cell .revealed-ghost {
    opacity: 0.75;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 68%;
    height: 68%;
    pointer-events: none;
    animation: symbolPop 0.25s ease-out;
}

.grid-cell .revealed-ghost .tango-symbol {
    width: 100%;
    height: 100%;
}

.grid-cell .revealed-ghost.ghost-sun {
    color: var(--accent-sun);
    filter: drop-shadow(0 0 5px rgba(251, 191, 36, 0.85));
}

.grid-cell .revealed-ghost.ghost-moon {
    color: var(--accent-moon);
    filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.85));
}

/* ==================== TANGO VECTOR SYMBOLS ==================== */
.tango-symbol {
    display: inline-block;
    vertical-align: middle;
    width: 1em;
    height: 1em;
    pointer-events: none;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tango-sun {
    color: var(--accent-sun);
    filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.95)) drop-shadow(0 0 10px rgba(245, 158, 11, 0.6));
}

.tango-moon {
    color: var(--accent-moon);
    filter: drop-shadow(0 0 3px rgba(56, 189, 248, 0.95)) drop-shadow(0 0 10px rgba(2, 132, 199, 0.65));
}

.grid-cell .icon-sun,
.grid-cell .icon-moon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    pointer-events: none;
    animation: symbolPop 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.grid-cell .icon-sun .tango-sun,
.grid-cell .icon-moon .tango-moon {
    width: 72%;
    height: 72%;
}

.grid-cell.tutorial-target .target-ghost {
    opacity: 0.48;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 65%;
    height: 65%;
    pointer-events: none;
}

.grid-cell.tutorial-target .target-ghost .tango-symbol {
    width: 100%;
    height: 100%;
}

.grid-cell.tutorial-target .target-ghost.ghost-sun {
    color: var(--accent-sun);
    filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.6));
}

.grid-cell.tutorial-target .target-ghost.ghost-moon {
    color: var(--accent-moon);
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
}

.grid-cell.val-sun {
    color: var(--accent-sun);
    background: radial-gradient(circle at center, rgba(251, 191, 36, 0.2) 0%, var(--cell-bg) 75%);
    border-color: rgba(251, 191, 36, 0.48);
    box-shadow: inset 0 0 14px rgba(251, 191, 36, 0.14);
}

.grid-cell.val-moon {
    color: var(--accent-moon);
    background: radial-gradient(circle at center, rgba(56, 189, 248, 0.22) 0%, var(--cell-bg) 75%);
    border-color: rgba(56, 189, 248, 0.48);
    box-shadow: inset 0 0 14px rgba(56, 189, 248, 0.14);
}

.grid-cell.val-sun.locked,
.grid-cell.locked.val-sun {
    background: var(--cell-locked-bg) !important;
    border-color: rgba(251, 191, 36, 0.25) !important;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.55) !important;
}

.grid-cell.val-moon.locked,
.grid-cell.locked.val-moon {
    background: var(--cell-locked-bg) !important;
    border-color: rgba(56, 189, 248, 0.25) !important;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.55) !important;
}

body.theme-light .grid-cell.val-sun.locked,
body.theme-light .grid-cell.locked.val-sun {
    background: var(--cell-locked-bg) !important;
    border-color: rgba(217, 119, 6, 0.35) !important;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.18) !important;
}

body.theme-light .grid-cell.val-moon.locked,
body.theme-light .grid-cell.locked.val-moon {
    background: var(--cell-locked-bg) !important;
    border-color: rgba(2, 132, 199, 0.35) !important;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.18) !important;
}

/* Notizen in Zelle */
.cell-notes {
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    display: flex;
    gap: 2px;
    justify-content: space-between;
    font-size: 0.65rem;
    pointer-events: none;
    opacity: 0.9;
}

.cell-notes .mini-sun,
.cell-notes .mini-moon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44%;
    height: 44%;
    max-width: 16px;
    max-height: 16px;
}

.cell-notes .mini-sun .tango-sun {
    width: 100%;
    height: 100%;
    color: var(--accent-sun);
    filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.95));
}

.cell-notes .mini-moon .tango-moon {
    width: 100%;
    height: 100%;
    color: var(--accent-moon);
    filter: drop-shadow(0 0 3px rgba(56, 189, 248, 0.95));
}

.keypad-btn .tango-symbol {
    width: 32px;
    height: 32px;
}

/* Edge Markers (= und ×) */
.edge-marker {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 900;
    z-index: 10;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    box-shadow: 0 2px 5px var(--shadow-color);
    pointer-events: none;
}

.edge-marker.edge-h {
    right: -13px;
    top: 50%;
    transform: translateY(-50%);
}

.edge-marker.edge-v {
    bottom: -13px;
    left: 50%;
    transform: translateX(-50%);
}

.edge-marker.edge-equal {
    color: var(--accent-equal);
    border-color: var(--accent-equal);
}

.edge-marker.edge-opposite {
    color: var(--accent-opposite);
    border-color: var(--accent-opposite);
}

/* Dynamic Proportional Scaling per Grid Size (4x4, 6x6, 8x8, 10x10) */
.tango-grid.size-4 { gap: 6px; padding: 8px; }
.tango-grid.size-4 .grid-row { gap: 6px; }
.tango-grid.size-4 .grid-cell { font-size: clamp(1.4rem, 5.5vw, 2.2rem); border-width: 2px; }
.tango-grid.size-4 .edge-marker { width: 22px; height: 22px; font-size: 0.85rem; }
.tango-grid.size-4 .edge-marker.edge-h { right: -14px; }
.tango-grid.size-4 .edge-marker.edge-v { bottom: -14px; }

.tango-grid.size-6 { gap: 4px; padding: 6px; }
.tango-grid.size-6 .grid-row { gap: 4px; }
.tango-grid.size-6 .grid-cell { font-size: clamp(1.1rem, 4.2vw, 1.7rem); border-width: 2px; }
.tango-grid.size-6 .edge-marker { width: 17px; height: 17px; font-size: 0.7rem; }
.tango-grid.size-6 .edge-marker.edge-h { right: -10px; }
.tango-grid.size-6 .edge-marker.edge-v { bottom: -10px; }

.tango-grid.size-8 { gap: 3px; padding: 5px; }
.tango-grid.size-8 .grid-row { gap: 3px; }
.tango-grid.size-8 .grid-cell { font-size: clamp(0.85rem, 3.2vw, 1.3rem); border-width: 1.5px; border-radius: 6px; }
.tango-grid.size-8 .edge-marker { width: 13px; height: 13px; font-size: 0.55rem; border-width: 1px; }
.tango-grid.size-8 .edge-marker.edge-h { right: -8px; }
.tango-grid.size-8 .edge-marker.edge-v { bottom: -8px; }

.tango-grid.size-10 { gap: 2px; padding: 4px; }
.tango-grid.size-10 .grid-row { gap: 2px; }
.tango-grid.size-10 .grid-cell { font-size: clamp(0.68rem, 2.5vw, 1.05rem); border-width: 1px; border-radius: 4px; }
.tango-grid.size-10 .edge-marker { width: 10px; height: 10px; font-size: 0.42rem; border-width: 1px; }
.tango-grid.size-10 .edge-marker.edge-h { right: -6px; }
.tango-grid.size-10 .edge-marker.edge-v { bottom: -6px; }

/* Keypad Selector Bar */
.game-keypad {
    display: none;
    justify-content: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.keypad-btn {
    flex: 1;
    max-width: 90px;
    height: 52px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--cell-bg);
    color: var(--text-primary);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
}

.keypad-btn:active {
    transform: scale(0.92);
}

/* Bottom Action Bar */
.action-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 8px 16px 8px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    gap: 4px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    gap: 3px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 4px;
    border-radius: var(--radius-md);
    transition: color 0.2s, transform 0.1s;
    font-size: 0.72rem;
    white-space: nowrap;
}

.action-btn .btn-icon {
    font-size: 1.25rem;
    color: var(--text-primary);
    line-height: 1;
}

.action-btn:active {
    transform: scale(0.9);
}

.action-btn.active {
    color: var(--accent-sun);
}
.action-btn.active .btn-icon {
    color: var(--accent-sun);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    box-sizing: border-box;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    max-height: 88vh;
    max-height: 88dvh;
    padding: 20px;
    box-shadow: 0 16px 36px var(--shadow-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    box-sizing: border-box;
    animation: scaleUp 0.25s ease;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding-bottom: 2px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.modal-close-btn:active {
    background: var(--cell-hover);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--text-primary);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-right: 2px;
    flex: 1;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.primary-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--accent-sun), #d97706);
    color: #ffffff;
    border: none;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    transition: transform 0.1s;
}

.primary-btn:active {
    transform: scale(0.96);
}

.secondary-btn {
    flex: 1;
    background: var(--cell-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

/* Level Select Modal & Chapter Tabs */
.level-modal-card {
    max-width: 440px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.chapter-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.25);
    padding: 3px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.chapter-tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 2px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
    overflow: hidden;
}

.chapter-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.chapter-tab-btn.active {
    background: var(--cell-bg);
    border-color: var(--accent-sun);
    color: var(--accent-sun);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.chapter-tab-btn .chapter-title {
    font-size: clamp(0.68rem, 2.3vw, 0.78rem);
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 100%;
}

.chapter-tab-btn .chapter-range {
    font-size: clamp(0.58rem, 1.9vw, 0.68rem);
    opacity: 0.8;
    margin-top: 2px;
    white-space: nowrap;
}

/* Level Select Grid */
.level-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    max-height: 340px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px;
    width: 100%;
    box-sizing: border-box;
}

.level-item-btn {
    aspect-ratio: 1;
    background: var(--cell-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: clamp(0.9rem, 3.2vw, 1.1rem);
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s;
    min-width: 0;
    box-sizing: border-box;
}

.level-item-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.level-item-btn.completed {
    border-color: var(--accent-sun);
    background: var(--accent-sun-bg);
}

.level-item-btn .lvl-star {
    font-size: 0.75rem;
    margin-top: 2px;
}

/* Settings Controls */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    min-height: 40px;
    width: 100%;
    box-sizing: border-box;
}

.setting-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    line-height: 1.25;
    word-break: break-word;
}

.setting-select {
    background: var(--cell-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    max-width: 48%;
    flex-shrink: 0;
    outline: none;
    cursor: pointer;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
}

.danger-btn {
    width: 100%;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.danger-btn:active {
    background: rgba(239, 68, 68, 0.25);
    transform: scale(0.98);
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--cell-border);
    transition: 0.3s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-sun);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleUp {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

@keyframes cellShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

@keyframes hintPulse {
    0%, 100% { box-shadow: 0 0 6px var(--accent-sun); }
    50% { box-shadow: 0 0 16px var(--accent-sun); }
}

@keyframes hintCellShimmer {
    0%, 100% {
        box-shadow: 0 0 6px var(--accent-sun-bg, rgba(251, 191, 36, 0.3)), inset 0 0 6px var(--accent-sun-bg, rgba(251, 191, 36, 0.15));
        border-color: rgba(251, 191, 36, 0.7);
    }
    50% {
        box-shadow: 0 0 16px var(--accent-sun, #fbbf24), inset 0 0 12px var(--accent-sun-bg, rgba(251, 191, 36, 0.35));
        border-color: var(--accent-sun, #fbbf24);
    }
}

@keyframes hintLightSweep {
    0% {
        transform: rotate(25deg) translateY(-120%);
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    55% {
        transform: rotate(25deg) translateY(120%);
        opacity: 1;
    }
    75%, 100% {
        transform: rotate(25deg) translateY(120%);
        opacity: 0;
    }
}

@keyframes symbolPop {
    0% {
        transform: scale(0.4);
        opacity: 0;
    }
    70% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==================== SYNC & QR CODE MODAL ==================== */
.sync-tabs {
    display: flex;
    gap: 8px;
    background: var(--cell-bg);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
}

.sync-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sync-tab-btn.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.sync-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sync-desc {
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.qr-canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    margin: 4px auto;
    width: fit-content;
}

#syncQrCanvas {
    display: block;
    width: 190px;
    height: 190px;
    image-rendering: pixelated;
}

.sync-code-box {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sync-input-code {
    flex: 1;
    background: var(--cell-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.82rem;
    outline: none;
    text-overflow: ellipsis;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sync-textarea {
    width: 100%;
    height: 85px;
    background: var(--cell-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px;
    border-radius: var(--radius-md);
    font-family: monospace;
    font-size: 0.82rem;
    resize: none;
    outline: none;
    box-sizing: border-box;
}

.sync-textarea:focus {
    border-color: var(--accent-moon);
}

.sync-import-actions {
    display: flex;
    gap: 8px;
}

.sync-import-actions .secondary-btn,
.sync-import-actions .file-upload-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    box-sizing: border-box;
}

.sync-feedback {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.4;
    animation: fadeIn 0.2s ease;
}

.sync-feedback.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--accent-equal);
    color: var(--text-primary);
}

.sync-feedback.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--accent-opposite);
    color: #fca5a5;
}

/* ==================== TÄGLICHE ERINNERUNG & BADGES ==================== */
.daily-reminder-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(56, 189, 248, 0.15));
    border: 1px solid var(--accent-sun);
    border-radius: var(--radius-md);
    margin: 8px 12px 0 12px;
    padding: 8px 12px;
    box-shadow: 0 4px 12px var(--shadow-color);
    animation: slideDown 0.3s ease;
}

.reminder-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.reminder-icon {
    font-size: 1.4rem;
}

.reminder-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.reminder-text strong {
    font-size: 0.88rem;
    color: var(--accent-sun);
}

.reminder-text span {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.reminder-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-xs {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.reminder-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
}

.nav-badge {
    display: inline-block;
    background: var(--accent-sun);
    color: #111827;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
    margin-left: 6px;
    vertical-align: middle;
}

.setting-time-input {
    background: var(--cell-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    color-scheme: dark;
    max-width: 48%;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* ==================== TABBED MENU HUB ==================== */
.menu-hub-card {
    max-width: 440px;
    width: 100%;
    box-sizing: border-box;
    padding: 16px;
    gap: 10px;
    overflow-x: hidden;
}

.menu-hub-title-box {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-shrink: 0;
}

.menu-hub-icon {
    font-size: 1.4rem;
}

.menu-hub-tabs {
    display: flex;
    gap: 4px;
    background: var(--cell-bg);
    padding: 3px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.menu-hub-tab {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 2px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    overflow: hidden;
}

.menu-hub-tab .tab-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.menu-hub-tab .tab-label {
    font-size: clamp(0.66rem, 2.1vw, 0.76rem);
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 100%;
}

.menu-hub-tab.active {
    background: var(--bg-secondary);
    color: var(--accent-sun);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.menu-hub-body {
    max-height: 60vh;
    max-height: 60dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-right: 2px;
    width: 100%;
    box-sizing: border-box;
}

.menu-hub-sec {
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeIn 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Modes Cards Grid */
.menu-modes-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-mode-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--cell-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
    transition: all 0.15s ease;
    width: 100%;
    box-sizing: border-box;
}

.menu-mode-card:hover {
    border-color: var(--accent-moon);
    background: var(--cell-hover);
}

.menu-mode-card:active {
    transform: scale(0.98);
}

.menu-mode-card.primary-mode {
    border-color: var(--accent-sun);
    background: var(--accent-sun-bg);
}

.mode-icon-box {
    font-size: 1.8rem;
    line-height: 1;
    flex-shrink: 0;
}

.mode-text-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.mode-text-box strong {
    font-size: 0.95rem;
    font-weight: 700;
}

.mode-text-box span {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.menu-sub-row {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    width: 100%;
}

.menu-sub-row .secondary-btn,
.menu-sub-row .tut-nav-btn {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    min-height: 56px;
    text-align: center;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    border-radius: var(--radius-md);
    background: var(--cell-bg);
    border: 1px solid var(--border-color);
    transition: all 0.15s ease;
    cursor: pointer;
}

.menu-sub-row .secondary-btn:hover,
.menu-sub-row .tut-nav-btn:hover {
    border-color: var(--accent-moon);
    background: var(--cell-hover);
}

.menu-sub-row .secondary-btn:active,
.menu-sub-row .tut-nav-btn:active {
    transform: scale(0.96);
}

.tut-btn-icon {
    font-size: 1.25rem;
    line-height: 1;
    display: block;
    pointer-events: none;
}

.tut-btn-text {
    font-size: clamp(0.72rem, 2.2vw, 0.82rem);
    font-weight: 600;
    line-height: 1.18;
    display: block;
    text-align: center;
    color: var(--text-primary);
    word-break: break-word;
    pointer-events: none;
}

/* Rules Section */
.rules-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rule-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--cell-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}

.rule-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-sun);
    color: #111827;
    font-weight: 700;
    font-size: 0.82rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.rule-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.rule-content strong {
    font-size: 0.88rem;
    color: var(--text-primary);
}

.rule-content p {
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--text-secondary);
    margin: 0;
}

/* Stats Section */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stats-section-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.3px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 10px;
    background: var(--cell-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    gap: 4px;
}

.stat-val {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--accent-sun);
}

.stat-lbl {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

/* Settings Time Picker & Actions */
.time-picker-box {
    display: flex;
    align-items: center;
    gap: 6px;
}

.setting-hub-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

/* ==================== CUSTOM CONFIRM MODAL ==================== */
.confirm-modal-card {
    max-width: 360px;
    padding: 24px 20px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 16px 36px var(--shadow-color);
    animation: modalPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

@keyframes modalPopIn {
    0% {
        transform: scale(0.92);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.confirm-icon-box {
    font-size: 2.6rem;
    line-height: 1;
    margin-bottom: 2px;
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.4));
}

.confirm-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.confirm-message {
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--text-secondary);
    margin: 0 0 6px 0;
    text-align: center;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
}

.confirm-actions button {
    flex: 1;
    padding: 11px 14px;
    font-size: 0.92rem;
    font-weight: 700;
}

/* ============================================================
   CUSTOM THEMED SELECT & TIME PICKER BUTTONS & MODALS
   ============================================================ */

/* Trigger Buttons im Settings-Bereich */
.custom-select-btn, .custom-time-btn {
    background: var(--cell-bg);
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    min-width: 140px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.custom-select-btn:hover, .custom-time-btn:hover {
    border-color: var(--accent-sun);
    background: rgba(255, 255, 255, 0.04);
}

.custom-select-btn:active, .custom-time-btn:active {
    transform: scale(0.97);
    border-color: var(--accent-sun);
}

.custom-select-btn .select-btn-label, .custom-time-btn .time-btn-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.custom-select-btn .select-btn-chevron {
    font-size: 0.8rem;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.custom-time-btn .time-btn-icon {
    font-size: 1rem;
    opacity: 0.9;
}

/* Custom Select Modal (Themed Options List) */
.custom-picker-card {
    max-width: 360px;
    width: 92%;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.custom-select-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 14px 0 6px 0;
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 4px;
}

.custom-select-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--cell-bg);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.custom-select-item:hover {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.custom-select-item:active {
    transform: scale(0.98);
}

.custom-select-item.selected {
    border-color: var(--accent-sun);
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-sun);
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.2);
}

.select-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

.select-item-title {
    font-size: 0.96rem;
    font-weight: 700;
}

.select-item-subtitle {
    font-size: 0.78rem;
    opacity: 0.7;
    color: var(--text-secondary);
}

.select-item-radio {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 12px;
    transition: all 0.2s ease;
}

.custom-select-item.selected .select-item-radio {
    border-color: var(--accent-sun);
    background: var(--accent-sun);
}

.select-item-radio .radio-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0f172a;
    display: none;
}

.custom-select-item.selected .select-item-radio .radio-dot {
    display: block;
}

/* Custom Time Picker Modal */
.custom-time-card {
    max-width: 340px;
    width: 92%;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.time-picker-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 12px 0 16px 0;
}

.time-spinner-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.time-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.time-step-btn {
    background: var(--cell-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 54px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.time-step-btn:hover {
    border-color: var(--accent-sun);
    background: rgba(255, 255, 255, 0.08);
}

.time-step-btn:active {
    transform: scale(0.92);
    background: var(--accent-sun);
    color: #0f172a;
}

.time-digit-display {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: 'Courier New', Courier, monospace, system-ui;
    color: var(--accent-sun);
    background: var(--cell-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    min-width: 60px;
    text-align: center;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
    letter-spacing: 2px;
}

.time-col-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.time-colon {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--accent-sun);
    margin-bottom: 22px;
    animation: pulseColon 1.5s infinite ease-in-out;
}

@keyframes pulseColon {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.95); }
}

.time-presets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
}

.time-preset-btn {
    background: var(--cell-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.time-preset-btn:hover {
    border-color: var(--accent-sun);
    background: rgba(255, 255, 255, 0.05);
}

.time-preset-btn.active, .time-preset-btn:active {
    border-color: var(--accent-sun);
    color: var(--accent-sun);
    background: rgba(245, 158, 11, 0.15);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

/* Solution Revealed In-Game Banner */
.solution-revealed-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(245, 158, 11, 0.18));
    border: 1px solid rgba(239, 68, 68, 0.45);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin: 8px 12px 10px 12px;
    animation: fadeIn 0.3s ease-out;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    z-index: 20;
    backdrop-filter: blur(8px);
}

.revealed-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.revealed-banner-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.revealed-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.revealed-banner-text strong {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--accent-sun);
    line-height: 1.2;
}

.revealed-banner-text span {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

/* ==================== CORTEX MULTI-PUZZLE SYSTEM ==================== */
.puzzle-picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.15s ease;
}

.puzzle-picker-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-sun);
}

.puzzle-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    width: 100%;
    margin: 12px 0;
}

.puzzle-select-card {
    background: var(--cell-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.puzzle-select-card:hover, .puzzle-select-card.active {
    border-color: var(--accent-sun);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(251, 191, 36, 0.2);
}

.puzzle-select-card .puzzle-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.puzzle-select-card .puzzle-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
}

.puzzle-select-card .puzzle-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

.puzzle-select-card .puzzle-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--accent-sun-bg);
    color: var(--accent-sun);
    border: 1px solid var(--accent-sun);
}

.puzzle-select-card .puzzle-card-trophy {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1.15rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
    user-select: none;
    pointer-events: none;
}

.puzzle-select-card.coming-soon {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Stats Multi-Tabs */
.stats-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    background: var(--bg-primary);
    padding: 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
}

.stats-filter-btn {
    flex: 1 1 calc(20% - 6px);
    min-width: fit-content;
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
}

.stats-filter-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.stats-filter-btn.active {
    background: var(--bg-card);
    color: var(--accent-sun);
    border-color: var(--border-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   ANDROID AUTO & COCKPIT LANDSCAPE LAYOUT
   Optimiert für Fahrzeug-Infotainmentsysteme (16:9, 21:9 & Breitbild-Displays)
   ========================================================================== */
@media (orientation: landscape) and (min-width: 640px) {
    body {
        overflow: hidden;
    }

    #appRoot {
        max-width: 100vw;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        overflow: hidden;
        display: grid;
        grid-template-columns: 1fr minmax(280px, 340px);
        grid-template-rows: auto auto 1fr auto;
        grid-template-areas:
            "game header"
            "game banner"
            "game keypad"
            "game action";
        padding-top: 0;
        padding-bottom: 0;
        margin: 0;
        background-color: var(--bg-primary);
    }

    .game-area {
        grid-area: game;
        height: 100%;
        max-height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 12px 18px;
        min-height: 0;
        box-sizing: border-box;
        overflow: hidden;
    }

    .board-container,
    .slitherlink-board-wrapper,
    .sudoku-board-wrapper,
    .tango-board-wrapper,
    .akari-board-wrapper,
    .nonogram-board-wrapper,
    .minesweeper-board-wrapper {
        width: min(calc(100vh - 28px), calc(100vw - 360px)) !important;
        height: min(calc(100vh - 28px), calc(100vw - 360px)) !important;
        max-width: min(calc(100vh - 28px), calc(100vw - 360px)) !important;
        max-height: min(calc(100vh - 28px), calc(100vw - 360px)) !important;
        margin: auto;
    }

    .app-header {
        grid-area: header;
        border-bottom: 1px solid var(--border-color);
        border-left: 1px solid var(--border-color);
        background: var(--bg-secondary);
        padding: 10px 16px;
        z-index: 10;
    }

    .daily-reminder-banner,
    .solution-revealed-banner,
    .tutorial-banner {
        grid-area: banner;
        border-left: 1px solid var(--border-color);
        margin: 8px 12px;
        max-height: 140px;
        overflow-y: auto;
    }

    .game-keypad {
        grid-area: keypad;
        border-left: 1px solid var(--border-color);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        padding: 8px 12px;
        background: var(--bg-secondary);
        gap: 8px;
        overflow-y: auto;
    }

    .action-bar {
        grid-area: action;
        border-left: 1px solid var(--border-color);
        border-top: 1px solid var(--border-color);
        padding: 10px 12px;
        background: var(--bg-secondary);
        display: flex;
        justify-content: space-around;
        gap: 6px;
    }

    .action-btn {
        padding: 8px 6px;
        min-width: 0;
        flex: 1;
    }

    .action-btn .btn-label {
        font-size: 0.72rem;
    }

    /* Modals im Querformat anpassen (z. B. auf Autodisplays) */
    .modal-overlay {
        padding: 12px;
    }

    .modal-card {
        max-width: min(90vw, 640px);
        max-height: 92vh;
        max-height: 92dvh;
    }

    .menu-hub-content {
        max-height: calc(90vh - 160px);
    }
}

