.hidden { display: none !important; }

:root {
    /* PUZZLE STYLE TOKENS */
    --bg: #0A0C0F;
    --neon-green: #C6FF00;
    --pale-cyan: #B2EBF2;
    --soft-pink: #FFD1E8;
    --muted-blue: #4FC3F7;
    --text-dark: #111418;
    --text-light: #FFFFFF;
    --radius-xl: 40px;
    --radius-md: 20px;
    --notch: 24px;
    --safe-bottom: 100px;
}

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

body {
    background: #000;
    font-family: 'Inter', sans-serif;
    color: var(--text-light);
    min-height: 100vh;
    overflow: hidden; /* Prevent body scroll, shell handles it */
    display: flex;
    justify-content: center;
}

/* --- Mobile Frame Wrapper for Desktop --- */
.app-shell {
    width: 100%;
    max-width: 480px;
    height: 100vh; /* LOCK TO VIEWPORT HEIGHT */
    background: var(--bg);
    position: relative;
    box-shadow: 0 0 100px rgba(0,0,0,0.8);
    border-left: 1px solid rgba(255,255,255,0.05);
    border-right: 1px solid rgba(255,255,255,0.05);
    overflow: hidden; /* Contain absolute children */
    display: flex;
    flex-direction: column;
}

/* --- SCROLLABLE CONTENT AREA --- */
.main-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding-bottom: var(--safe-bottom);
    scrollbar-width: none; /* Firefox */
}
.main-scroll-area::-webkit-scrollbar { display: none; } /* Chrome/Safari */

/* --- Glitch / Uncomfortable Overlays --- (ACCELERATED) */
.app-shell::before {
    content: ''; position: absolute; inset: 0; z-index: 10000;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0px, transparent 1px, transparent 2px);
    animation: scanlines 4s linear infinite;
    opacity: 0.6;
}

@keyframes scanlines { from { background-position: 0 0; } to { background-position: 0 100%; } }

.hud-background {
    position: absolute; inset: 0; z-index: -2;
    background: radial-gradient(circle at 50% 0%, #1A222C, var(--bg));
}

.grid-overlay {
    position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0.03;
    background-image: radial-gradient(circle, #fff 1px, transparent 1px);
    background-size: 30px 30px;
}

/* --- GLITCH KEYFRAMES --- */
@keyframes glitch-wiggle {
    0% { transform: translate(0); }
    1% { transform: translate(-3px, 2px); }
    2% { transform: translate(3px, -2px); }
    3% { transform: translate(-1px, 3px); }
    4% { transform: translate(1px, -3px); }
    5% { transform: translate(0); }
    100% { transform: translate(0); }
}

@keyframes color-bleed {
    0%, 100% { text-shadow: none; }
    50% { text-shadow: 3px 0 0 rgba(255,0,0,0.5), -3px 0 0 rgba(0,255,255,0.3); }
}

.glitch-active {
    animation: glitch-wiggle 0.2s infinite, color-bleed 0.3s infinite;
}

/* --- Mobile Header --- */
.controller-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex; 
    flex-direction: column;
    padding: 16px 20px; 
    background: rgba(10, 12, 15, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.system-status { 
    display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
    animation: glitch-wiggle 2.5s infinite steps(1); 
}
.brand-title { font-weight: 900; letter-spacing: -0.5px; font-size: 1rem; color: var(--neon-green); }
.bar-sub { font-size: 0.6rem; font-weight: 700; opacity: 0.5; text-transform: uppercase; letter-spacing: 1px; }

/* --- Dashboard Container --- */
.dashboard-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --- Profile Section --- */
.left-pane {
    background: var(--muted-blue); 
    border-radius: var(--radius-md);
    padding: 24px;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: 0.1s;
    position: relative;
    animation: glitch-wiggle 5s infinite steps(1);
    clip-path: polygon(0% 0%, 100% 0%, 100% 90%, 95% 100%, 0% 100%);
}

.left-pane:active { transform: scale(0.98) translate(2px, -2px); }

.identity-info {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.avatar-frame {
    width: 60px; height: 60px; border-radius: 50%; 
    background: #fff; border: 4px solid rgba(255,255,255,0.4);
    position: relative; overflow: hidden;
    flex-shrink: 0;
}

.vector-silhouette { width: 100%; height: 100%; background: linear-gradient(135deg, #eee, #ccc); }
.scanner-sweep {
    position: absolute; top: 0; left: 0; width: 100%; height: 4px;
    background: var(--neon-green); animation: scan 2s linear infinite;
}
@keyframes scan { 0%{top:0%} 100%{top:100%} }

.citizen-name { font-weight: 900; font-size: 1.2rem; letter-spacing: -0.5px; }
.citizen-tag { font-weight: 700; opacity: 0.6; font-size: 0.75rem; }

.public-details { 
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
}

.public-details li {
    list-style: none;
    background: rgba(0,0,0,0.05);
    padding: 12px;
    border-radius: 12px;
    animation: glitch-wiggle 4s infinite steps(1);
    border: 1px solid rgba(0,0,0,0.05);
}

.detail-label { font-size: 0.55rem; font-weight: 800; opacity: 0.6; text-transform: uppercase; margin-bottom: 2px; }
.detail-value { font-size: 1rem; font-weight: 900; letter-spacing: -0.5px; }

/* --- Tabs (FIXED Bottom Navigation) --- */
.tab-bar {
    position: absolute; /* Relative to app-shell (which is 100vh) */
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(20px);
    border-radius: 100px;
    padding: 6px;
    display: flex;
    gap: 6px;
    z-index: 1000;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
}

.tab-btn {
    flex: 1; 
    padding: 14px; 
    background: transparent; 
    border: none; 
    cursor: pointer;
    font-weight: 900; 
    font-size: 0.8rem; 
    color: rgba(255,255,255,0.5); 
    border-radius: 100px; 
    transition: 0.3s;
    text-transform: uppercase;
}

.tab-btn.active { 
    background: var(--neon-green); 
    color: var(--text-dark); 
    animation: glitch-wiggle 1.5s infinite steps(1);
}

/* --- Work Cards --- */
.right-pane { display: flex; flex-direction: column; gap: 20px; }

.work-card, .posted-card {
    border-radius: 20px;
    padding: 24px;
    position: relative;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
    transition: transform 0.05s;
    animation: glitch-wiggle 6s infinite steps(1);
    clip-path: polygon(0 0, 100% 0, 100% 92%, 92% 100%, 0 100%);
}

.work-card:active { transform: rotate(2deg) scale(0.97) translate(3px, -2px); }

.work-card:nth-child(odd) { background: var(--pale-cyan); }
.work-card:nth-child(even) { background: var(--soft-pink); }
.posted-card { background: var(--soft-pink); }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.card-title { font-weight: 900; font-size: 1.4rem; letter-spacing: -0.8px; line-height: 1.1; max-width: 70%; }
.card-timer { 
    background: var(--text-dark); 
    color: #fff; 
    padding: 6px 14px; 
    border-radius: 8px; 
    font-weight: 900; 
    font-size: 0.7rem;
    animation: color-bleed 2s infinite;
}

.card-brief { font-size: 0.85rem; font-weight: 700; line-height: 1.4; opacity: 0.8; }

.progress-row { display: flex; flex-direction: column; gap: 8px; }
.progress-track { height: 12px; background: rgba(0,0,0,0.1); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--text-dark); }
.progress-pct { font-weight: 900; font-size: 0.85rem; align-self: flex-end; }

.card-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* 3 STRIKE EXPRESSION DOTS */
.strike-dots { display: flex; gap: 8px; }
.strike-dot { 
    width: 18px; height: 18px; border-radius: 4px; 
    background: rgba(0,0,0,0.1); border: 2px solid rgba(0,0,0,0.2);
    position: relative; overflow: hidden;
}
.strike-dot::after {
    content: ''; position: absolute; top: 4px; left: 4px; width: 6px; height: 6px;
    background: rgba(0,0,0,0.3); border-radius: 1px;
}
.strike-dot.hit { 
    background: #ff3b30; border-color: #ff3b30; 
    animation: glitch-wiggle 0.5s infinite steps(1);
}
.strike-dot.hit::after { background: #fff; animation: scan 0.5s infinite; }

.card-actions { display: flex; gap: 8px; }
.btn-submit {
    background: var(--text-dark); color: #fff; border: none; padding: 12px 20px;
    border-radius: 8px; font-weight: 900; font-size: 0.75rem; text-transform: uppercase;
}
.btn-extend {
    background: transparent; border: 2px solid var(--text-dark); color: var(--text-dark);
    padding: 10px 18px; border-radius: 8px; font-weight: 900; font-size: 0.75rem; text-transform: uppercase;
}

/* --- Floating Add Button (FIXED) --- */
.add-btn {
    position: absolute;
    bottom: 100px; /* Stay above nav bar */
    right: 20px;
    width: 66px;
    height: 66px;
    background: var(--neon-green);
    color: var(--text-dark);
    border: none;
    clip-path: polygon(20% 0%, 80% 0%, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0% 80%, 0% 20%);
    font-size: 2.5rem;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(198, 255, 0, 0.4);
    z-index: 1100;
}
.add-btn:active { animation: glitch-wiggle 0.05s infinite; transform: scale(0.9) rotate(45deg); }

/* --- Modals --- */
.overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.96);
    backdrop-filter: blur(15px); display: flex; align-items: flex-end; justify-content: center; z-index: 2000;
}

.modal-box {
    background: #fff; border-radius: 32px 32px 0 0; width: 100%; 
    padding: 24px; color: var(--text-dark);
    animation: slide-up 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.2);
    border-top: 8px solid var(--neon-green);
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; font-weight: 900; font-size: 1.6rem; letter-spacing: -1px; text-transform: uppercase; }

.modal-close, .modal-back { 
    width: 44px; height: 44px; background: var(--pale-cyan); border: 2px solid var(--text-dark); 
    font-weight: 900; font-size: 1.2rem; cursor: pointer;
    clip-path: polygon(10% 0, 100% 0, 100% 100%, 0 100%, 0 10%);
}
.modal-back { background: var(--soft-pink); }

.path-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.path-card { 
    background: #f4f5f7; padding: 24px; text-align: left; display: flex; align-items: center; gap: 16px; 
    cursor: pointer; border: 2px solid transparent; transition: 0.2s;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 85% 100%, 0 100%);
}
.path-card:nth-child(1) { background: var(--pale-cyan); }
.path-card:nth-child(2) { background: var(--soft-pink); }
.path-card:hover { border-color: var(--text-dark); transform: translate(4px, -4px); box-shadow: -4px 4px 0 var(--text-dark); }

.path-icon { font-size: 2.5rem; filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.1)); }
.path-title { font-weight: 900; font-size: 1.1rem; text-transform: uppercase; }
.path-desc { font-size: 0.8rem; font-weight: 700; opacity: 0.7; margin-top: 4px; line-height: 1.3; }

.input-group label { font-size: 0.7rem; font-weight: 900; color: var(--text-dark); text-transform: uppercase; margin-bottom: 6px; display: block; letter-spacing: 1px; }
.input-group input, .input-group select, .input-group textarea {
    width: 100%; background: #f0f0f0; border: 2px solid var(--text-dark); padding: 16px; 
    font-family: inherit; font-weight: 800; font-size: 1rem; color: var(--text-dark);
    clip-path: polygon(0 0, 100% 0, 100% 90%, 95% 100%, 0 100%);
}
.input-group input:focus, .input-group textarea:focus { background: #fff; outline: none; border-color: var(--neon-green); }

.execute-btn {
    width: 100%; background: var(--neon-green); color: var(--text-dark); border: 2px solid var(--text-dark); 
    padding: 20px; font-weight: 900; font-size: 1.1rem; cursor: pointer; text-transform: uppercase;
    clip-path: polygon(5% 0, 100% 0, 95% 100%, 0 100%);
    transition: 0.1s;
}
.execute-btn:hover { animation: glitch-wiggle 0.2s infinite; }
.execute-btn:disabled { opacity: 0.5; cursor: not-allowed; background: #ccc; }

.checkbox-row { display: flex; gap: 12px; align-items: flex-start; margin: 20px 0; }
.checkbox-row input[type="checkbox"] {
    width: 28px; height: 28px; appearance: none; background: #f0f0f0; border: 3px solid var(--text-dark);
    clip-path: polygon(20% 0%, 100% 0%, 100% 80%, 80% 100%, 0% 100%, 0% 20%);
    cursor: pointer; position: relative;
}
.checkbox-row input[type="checkbox"]:checked { background: var(--neon-green); }
.checkbox-row input[type="checkbox"]:checked::after {
    content: '✓'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 900;
}

.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; }
.filter-pill {
    flex-shrink: 0; background: rgba(255,255,255,0.1); border-radius: 100px; padding: 10px 20px; 
    font-weight: 800; font-size: 0.75rem; color: #fff; border: none;
}
.filter-pill.active { background: var(--neon-green); color: var(--text-dark); animation: glitch-wiggle 2s infinite steps(1); }
