:root { 
    --bg: #F8F9FA; --text: #002A5C; --primary: #0033A0; --primary-dark: #002266;
    --accent: #FFCC00; --card: #FFFFFF; --border: #D1D8E0;
    --success: #10B981; --danger: #EF4444; --grey: #9CA3AF;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; touch-action: manipulation; }
body { background: var(--bg); color: var(--text); padding: 1rem; padding-top: 3.5rem; padding-bottom: 5.5rem; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; }
h1, h2, h3 { margin-bottom: 0.8rem; color: var(--primary); }
p { margin-bottom: 0.8rem; line-height: 1.5; }

/* STATUS BAR */
#statusBar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1001;
    background: var(--primary-dark); color: white;
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 12px; font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
#roleIndicator { font-weight: bold; font-size: 0.8rem; }
#albaDisplay { font-weight: bold; color: var(--accent); font-size: 0.85rem; }
#miniGameClock { font-family: monospace; font-weight: bold; font-size: 1.1rem; color: var(--accent); background: rgba(255,255,255,0.1); padding: 2px 8px; border-radius: 4px; }

button { 
    background: var(--primary); color: white; border: none; padding: 0.9rem; 
    border-radius: 8px; font-weight: bold; width: 100%; margin-bottom: 0.8rem; 
    cursor: pointer; text-transform: uppercase; letter-spacing: 0.5px; 
    transition: transform 0.1s, box-shadow 0.2s; box-shadow: 0 3px 6px rgba(0,51,160,0.2); 
    min-height: 44px; font-size: 0.85rem;
}
button:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
button:active { transform: scale(0.98); }
button.accent { background: var(--accent); color: var(--primary-dark); box-shadow: 0 3px 6px rgba(255,204,0,0.3); }
button.outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); box-shadow: none; }
button.danger { background: var(--danger); box-shadow: 0 3px 6px rgba(239,68,68,0.2); }
button.success { background: var(--success); box-shadow: 0 3px 6px rgba(16,185,129,0.2); }
button.debug-btn { background: #333; color: #0f0; border: 1px solid #0f0; margin-bottom: 0.3rem; box-shadow: none; padding: 0.4rem; text-transform: none; min-height: auto; font-size: 0.8rem; }

input, select { 
    width: 100%; padding: 0.9rem; margin-bottom: 0.8rem; border: 2px solid var(--border); 
    border-radius: 8px; font-size: 1rem; background: var(--card); color: var(--text); min-height: 44px; 
}
input:focus, select:focus { border-color: var(--primary); outline: none; }

.view { display: none; animation: fadeIn 0.25s ease-out; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.card { background: var(--card); padding: 1.2rem; border-radius: 12px; margin-bottom: 0.8rem; border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }

/* NAV */
.nav-bottom { position: fixed; bottom: 0; left: 0; right: 0; background: var(--primary); display: flex; padding: 0; z-index: 1000; box-shadow: 0 -3px 12px rgba(0,0,0,0.15); border-top: 3px solid var(--accent); padding-bottom: env(safe-area-inset-bottom); }
.nav-bottom button { margin: 0; border-radius: 0; background: transparent; border-right: 1px solid rgba(255,255,255,0.1); text-transform: none; font-size: 0.8rem; color: rgba(255,255,255,0.7); padding: 0.7rem 0; box-shadow: none; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; min-height: auto; }
.nav-bottom button:last-child { border-right: none; }
.nav-bottom button.active-nav { background: var(--primary-dark); color: var(--accent); font-weight: bold; }

/* NAV BADGES */
.nav-badge { position: absolute; top: 4px; right: calc(50% - 28px); background: var(--danger); color: white; font-size: 0.6rem; font-weight: bold; min-width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 50%; display: none; }

/* MAP */
#map { height: 50vh; width: 100%; border-radius: 8px; margin-bottom: 0.5rem; z-index: 1; border: 2px solid var(--border); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.emoji-icon { background: none !important; border: none !important; margin: 0; padding: 0; font-size: 28px; line-height: 1; text-align: center; filter: drop-shadow(0px 2px 2px rgba(0,0,0,0.4)); }
.avatar-icon { background: none !important; border: none !important; margin: 0; padding: 0; }

/* LOG */
.log-entry { font-size: 0.9rem; border-left: 4px solid var(--accent); padding: 0.6rem 0.8rem; margin-bottom: 0.4rem; background: #F8F9FA; border-radius: 0 8px 8px 0; word-break: break-word; }
.log-img { max-width: 100%; border-radius: 4px; margin-top: 0.5rem; border: 1px solid var(--border); }

.status-badge { display: inline-block; padding: 0.3rem 0.8rem; border-radius: 20px; font-size: 0.8rem; font-weight: bold; background: var(--border); color: var(--text); }
.status-badge.ready { background: var(--success); color: white; }

.clock-display { font-size: 3rem; font-weight: 800; font-family: monospace; color: var(--primary-dark); text-align: center; background: var(--accent); padding: 1rem; border-radius: 12px; margin-bottom: 1rem; box-shadow: inset 0 2px 5px rgba(0,0,0,0.1); border: 2px solid #E6B800; }
.endgame-alert { background: var(--danger); color: white; padding: 0.8rem; border-radius: 8px; text-align: center; font-weight: bold; margin-bottom: 0.5rem; animation: pulse 2s infinite; font-size: 0.9rem; }
.relocation-alert { background: var(--accent); color: var(--primary-dark); padding: 0.8rem; border-radius: 8px; text-align: center; font-weight: bold; margin-bottom: 0.5rem; animation: pulse 2s infinite; font-size: 0.9rem; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.01); } }
@keyframes pulse-red { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.7); } 50% { box-shadow: 0 0 0 10px rgba(239,68,68,0); } }
body.endgame-hider { background: #fef2f2 !important; }
body.endgame-hider #statusBar { background: #7f1d1d !important; }
body.endgame-seeker { background: #fff1f2 !important; }
body.endgame-seeker #statusBar { background: #991b1b !important; }

#toast { position: fixed; top: 45px; left: 50%; transform: translateX(-50%); background: var(--primary-dark); color: var(--accent); padding: 0.8rem 1.5rem; border-radius: 25px; z-index: 4000; display: none; font-weight: bold; width: 90%; max-width: 380px; text-align: center; box-shadow: 0 6px 16px rgba(0,0,0,0.2); transition: opacity 0.3s; opacity: 0; font-size: 0.9rem; }
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,34,102,0.85); z-index: 3000; display: none; flex-direction: column; align-items: center; padding: 1rem; backdrop-filter: blur(3px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-box { background: var(--card); color: var(--text); padding: 2rem 1.5rem; border-radius: 16px; width: 100%; max-width: 400px; text-align: center; animation: popIn 0.25s ease-out; box-shadow: 0 10px 30px rgba(0,0,0,0.3); margin: auto; flex-shrink: 0; }
@keyframes popIn { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#loadingScreen { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg); z-index: 5000; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--primary); }
.install-instructions { background:#e8eef5; padding:0.8rem; border-radius:8px; margin-bottom:1rem; border-left:4px solid var(--primary); font-size:0.85rem; text-align:left; }

/* CARDS */
.hand-container { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 0.5rem; }
.playing-card { width: 120px; height: 210px; perspective: 1000px; margin-bottom: 8px; position: relative; }
.card-inner { width: 100%; height: 100%; position: relative; transition: transform 0.5s cubic-bezier(0.4, 0.2, 0.2, 1); transform-style: preserve-3d; -webkit-transform-style: preserve-3d; }
.playing-card.is-flipped .card-inner { transform: rotateY(180deg); -webkit-transform: rotateY(180deg); }
.card-front, .card-back { width: 100%; height: 100%; position: absolute; top: 0; left: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 10px; }
.card-back { background: repeating-linear-gradient(45deg, var(--primary), var(--primary) 10px, var(--primary-dark) 10px, var(--primary-dark) 20px); z-index: 2; transform: rotateY(0deg); border: 3px solid white; box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
.card-front { background: white; z-index: 1; transform: rotateY(180deg); -webkit-transform: rotateY(180deg); display: flex; flex-direction: column; align-items: center; padding: 6px; padding-bottom: 38px; border: 2px solid var(--border); text-align: center; box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
.card-emoji { font-size: 1.6rem; margin-top: 2px; margin-bottom: 2px; }
.card-title { font-size: 0.7rem; font-weight: bold; color: var(--primary-dark); margin-bottom: 3px; line-height: 1.1; }
.card-desc { font-size: 0.6rem; color: #333; line-height: 1.2; overflow-y: auto; text-align: left; width: 100%; }
.card-type-tijd .card-front { border-color: var(--success); border-top-width: 6px; }
.card-type-powerup .card-front { border-color: var(--accent); border-top-width: 6px; }
.card-type-vloek .card-front { border-color: var(--danger); border-top-width: 6px; background: #fff5f5; }
.card-actions { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,0.95); padding: 4px; display: flex; gap: 4px; border-radius: 0 0 8px 8px; border-top: 1px solid var(--border); }
.card-btn { padding: 3px; font-size: 0.65rem; margin: 0; flex: 1; border-radius: 4px; min-height: 22px; }

/* DECK AREA */
.deck-area { background: var(--primary-dark); border-radius: 12px; padding: 1.2rem; color: white; text-align: center; margin-bottom: 0.8rem; }
.deck-stack { width: 70px; height: 110px; background: repeating-linear-gradient(45deg, #0033A0, #0033A0 10px, #002266 10px, #002266 20px); border: 3px solid white; border-radius: 8px; margin: 0 auto 0.8rem; box-shadow: -4px 4px 0 rgba(0,0,0,0.3); position: relative; cursor: pointer; transition: transform 0.1s; }
.deck-stack:active { transform: scale(0.95) translate(2px, -2px); }
.hand-status { font-size: 0.85rem; color: var(--grey); margin-bottom: 0.5rem; text-align: center; }

/* CURSES */
.curse-item { padding: 0.8rem; border-radius: 8px; margin-bottom: 0.4rem; transition: all 0.3s; border: 1px solid var(--border); cursor: pointer; }
.curse-item.active { border-left: 5px solid var(--danger); background: #fff5f5; }
.curse-item.done { opacity: 0.5; background: #e5e7eb; border-left: 5px solid var(--grey); filter: grayscale(100%); }

/* DRAW ANIMATION */
#drawAnimationContainer { position: fixed; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 9999; display: none; justify-content: center; align-items: center; background: rgba(0,0,0,0.7); }
@keyframes drawCardAnim { 0% { transform: translateY(100vh) scale(0.2); opacity: 0; } 20% { transform: translateY(0) scale(1.4); opacity: 1; } 80% { transform: translateY(0) scale(1.4); opacity: 1; } 100% { transform: translateY(-50px) scale(0); opacity: 0; } }
.drawn-card-anim { width: 160px; height: 240px; animation: drawCardAnim 2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes discardAnim { to { transform: translateY(40px) scale(0.8); opacity: 0; } }
.discard-anim { animation: discardAnim 0.25s forwards; pointer-events: none; }

/* QUESTION CATEGORIES */
.q-category { transition: opacity 0.3s; }
.q-category h3 { font-size: 0.95rem; }
.q-input { padding: 0.7rem; font-size: 0.9rem; min-height: 40px; }
.q-input:disabled { opacity: 0.4; background: var(--bg); }
.q-send-btn { padding: 0.7rem; font-size: 0.8rem; min-height: 38px; }
.q-send-btn:disabled { background: var(--grey) !important; box-shadow: none !important; }
.alba-tag { font-size: 0.75rem; color: var(--success); font-weight: bold; background: #d1fae5; padding: 2px 8px; border-radius: 10px; }
.cooldown-bar { margin-bottom: 0.5rem; }

/* UITSLUITINGSZONES ANNOTATIEPANEEL */
#annotationsPanel {
    position: fixed;
    bottom: 60px;       /* boven de nav-bottom */
    left: 0; right: 0;
    background: var(--card);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
    z-index: 2100;
    max-height: 72vh;
    flex-direction: column;
    border-top: 3px solid var(--border);
}
.ann-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1rem 0.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.ann-panel-header h3 { margin: 0; font-size: 1rem; }
.ann-panel-header button {
    width: auto; min-height: 32px; padding: 0.25rem 0.7rem; margin: 0;
    font-size: 0.85rem; background: var(--border); color: var(--text); box-shadow: none;
}
.ann-main-body {
    overflow-y: auto; padding: 0.8rem 1rem; flex: 1;
}
.ann-mode-btns { display: flex; gap: 0.5rem; margin-bottom: 0.8rem; }
.ann-mode-btns button { flex: 1; padding: 0.55rem; margin: 0; font-size: 0.82rem; min-height: 40px; }
.ann-zone-item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.55rem 0.5rem; border-radius: 8px;
    background: #F3F4F6; margin-bottom: 0.4rem;
    border-left: 4px solid #9CA3AF;
}
.ann-zone-icon { font-size: 1.1rem; flex-shrink: 0; }
.ann-zone-info { flex: 1; min-width: 0; }
.ann-zone-name { font-weight: bold; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ann-zone-detail { font-size: 0.72rem; color: var(--grey); margin-top: 1px; }
.ann-zone-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.ann-icon-btn {
    width: 34px !important; height: 34px; padding: 0 !important; margin: 0 !important;
    font-size: 0.85rem !important; background: #E5E7EB !important; color: #374151 !important;
    box-shadow: none !important; border-radius: 6px !important; flex: none !important;
    min-height: 34px !important; display: flex; align-items: center; justify-content: center;
}
.ann-icon-btn-danger { background: #FEE2E2 !important; color: #B91C1C !important; }
.ann-draw-body { padding: 0.75rem 1rem; }
.ann-radius-btn {
    flex: 1; min-width: 55px; padding: 0.45rem 0; margin: 0;
    font-size: 0.75rem; font-weight: bold;
}
.leaflet-tooltip.ann-tooltip {
    background: rgba(0,0,0,0.75); color: white; border: none;
    font-size: 0.78rem; padding: 2px 7px; border-radius: 4px;
}

.location-result-item {
    padding: 0.55rem 0.8rem;
    font-size: 0.83rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    line-height: 1.3;
}
.location-result-item:last-child { border-bottom: none; }
.location-result-item:hover { background: #f0f4ff; }

/* DEBUG */
#debugPanel { display: none; position: fixed; top: 36px; right: 10px; background: rgba(0,0,0,0.92); padding: 0.8rem; border-radius: 8px; z-index: 9999; border: 1px solid #0f0; max-width: 200px; }
#debugPanel h3 { color: #0f0; font-size: 0.9rem; margin-top: 0; }
.debug-trigger { position: fixed; top: 0; right: 0; width: 50px; height: 50px; z-index: 9998; cursor: pointer; }
