/* --- Global Core Variables & Design Resets --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Space Grotesk', sans-serif;
}

:root {
    --bg-color: #050505;
    --card-bg: #0d0d0d;
    --border-color: #1a1a1a;
    --text-main: #ffffff;
    --text-muted: #666666;
    --accent-color: #ffffff;
    --btn-secondary-bg: #141414;
    --active-selection: #262626;
    --status-success: #10b981;
    --status-fail: #ef4444;
    
    /* Strict rolling wheel constraint parameter handles */
    --row-height: 80px;
}

.light-mode {
    --bg-color: #fafafa;
    --card-bg: #ffffff;
    --border-color: #e4e4e7;
    --text-main: #09090b;
    --text-muted: #a1a1aa;
    --accent-color: #09090b;
    --btn-secondary-bg: #f4f4f5;
    --active-selection: #e4e4e7;
    --status-success: #059669;
    --status-fail: #dc2626;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: scroll;
    transition: background-color 0.3s ease, color 0.3s ease;
    padding: 60px 20px;
}

.theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    cursor: pointer;
    color: var(--text-main);
    padding: 8px;
    border-radius: 50%;
    z-index: 100;
}

/* --- Main Vertical Layout Pipeline --- */
.app-workspace {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    width: 100%;
    max-width: 850px;
}

/* --- Top Control Area Row Configuration --- */
.upper-control-station {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 32px;
    width: 100%;
}

.control-config-panel {
    flex: 1.2;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* --- Bottom Scroll Area Configuration --- */
.lower-dashboard-station {
    width: 100%;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 32px;
    padding: 36px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.15);
}

.panel-section h3 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* --- Time Config Cards Architecture --- */
.config-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.config-card {
    flex: 1;
    min-width: 75px;
    background-color: var(--btn-secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.config-card:hover {
    border-color: var(--text-muted);
    transform: translateY(-2px);
}

.card-time { font-size: 1.15rem; font-weight: 700; color: var(--text-main); line-height: 1.2; }
.card-unit { font-size: 0.65rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.02em; }

.config-card.active {
    background-color: var(--card-bg);
    border: 2px solid var(--text-main);
}
.config-card.active::after {
    content: ''; position: absolute; bottom: 6px; width: 12px; height: 2px; background-color: var(--text-main); border-radius: 2px;
}

/* --- Task Input Workspace Sheet --- */
.task-space-container {
    margin-bottom: 24px;
    width: 100%;
}

.task-input {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--btn-secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 12px;
    outline: none;
    text-align: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.task-input:focus {
    border-color: var(--text-muted);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.02);
}

.task-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* --- State Indicator Layout Wrapper with Task Insertion --- */
.state-indicator-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 20px;
    flex-wrap: wrap;
}

.state-indicator {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.inline-task-display {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
    opacity: 0.9;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: none; 
}

.inline-task-display::before {
    content: '—';
    margin-right: 8px;
    color: var(--text-muted);
}

/* --- Controls Header Layout and Mini Button Overrides --- */
.card-export-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mini-btn {
    padding: 6px 14px;
    font-size: 0.78rem;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

/* --- The Branded Profile Card Canvas Architecture --- */
.profile-card-canvas-bg {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 40px 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background-image: url('Profile_card_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.6);
    position: relative;
    overflow: hidden;
}

.profile-card-canvas-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 6, 0.35);
    pointer-events: none;
}

.profile-glass-card {
    width: 100%;
    max-width: 440px;
    padding: 32px 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.card-logo {
    font-family: 'Russo One', sans-serif;
    font-size: 1.35rem;
    letter-spacing: 0.06em;
    color: #ffffff;
    margin-bottom: 4px;
}

.card-timeline-label {
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: capitalize;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.card-active-task {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.9;
}

.card-metrics-display {
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: #ffffff;
    line-height: 1.1;
    margin-bottom: 16px;
}

.card-badge-container {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.card-badge-pill {
    display: inline-block;
    padding: 6px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.card-quote-footer {
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

/* --- Real-time Visitor Counter Styling --- */
.visitor-display-box {
    background-color: var(--btn-secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.visitor-metric { display: flex; flex-direction: column; gap: 2px; }
.visitor-count-number { font-size: 1.6rem; font-weight: 700; color: var(--text-main); letter-spacing: -0.02em; }
.visitor-count-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }

.live-pulse-wrapper { display: flex; align-items: center; gap: 8px; }
.pulse-dot {
    width: 8px; height: 8px; background-color: #10b981; border-radius: 50%;
    position: relative; animation: pulseRadar 2s infinite ease-in-out;
}
.pulse-text { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

@keyframes pulseRadar {
    0% { transform: scale(0.9); opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.9); opacity: 0; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.section-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.dropdown-select {
    background-color: var(--btn-secondary-bg); border: 1px solid var(--border-color); color: var(--text-main);
    padding: 6px 14px; border-radius: 8px; font-size: 0.78rem; font-weight: 500; outline: none; cursor: pointer;
}

.chart-wrapper { background-color: var(--btn-secondary-bg); border: 1px solid var(--border-color); border-radius: 14px; padding: 18px 24px; margin-top: 8px; }
.chart-container { display: flex; align-items: flex-end; justify-content: space-between; height: 130px; gap: 16px; }
.chart-bar-column { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart-bar-fill { width: 100%; background-color: var(--text-main); border-radius: 4px 4px 0 0; min-height: 2px; opacity: 0.85; transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.chart-bar-fill.active-bar { opacity: 1; box-shadow: 0 0 12px rgba(255, 255, 255, 0.2); }
.chart-bar-label { font-size: 0.65rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; }

/* --- Tabular Terminal Log Components --- */
.table-scroll-frame { max-height: 200px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: 12px; background-color: var(--btn-secondary-bg); }
.log-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.78rem; }
.log-table th, .log-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); }
.log-table th { background-color: var(--card-bg); color: var(--text-muted); font-weight: 600; position: sticky; top: 0; font-size: 0.72rem; text-transform: uppercase; }
.log-table tr:last-child td { border-bottom: none; }
.log-table td:nth-child(4) { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-row-notice { text-align: center; color: var(--text-muted); }
.status-tag { font-weight: 600; font-size: 0.72rem; text-transform: uppercase; }
.status-tag.complete { color: var(--status-success); }
.status-tag.interrupted { color: var(--status-fail); }

/* --- Trophy Milestone Cabinets --- */
.trophy-cabinet { display: flex; gap: 8px; flex-wrap: wrap; min-height: 48px; align-items: center; background-color: var(--btn-secondary-bg); padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border-color); }
.empty-cabinet-text { font-size: 0.75rem; color: var(--text-muted); }
.trophy-emoji { font-size: 1.4rem; }

/* --- Left Side: Main Core Widget Styling --- */
.widget-container {
    width: 380px; padding: 36px; background-color: var(--card-bg); border: 3px solid var(--text-main); border-radius: 36px; box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3); text-align: center; display: flex; flex-direction: column; justify-content: center; position: relative;
    /* STRICT CLIP BOUNDARY: Eliminates wheel numbers spilling down outside the card box */
    overflow: hidden !important; 
}

/* --- Immersive Pop Trophy Celebration Overlays --- */
.trophy-celebration-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.85); z-index: 50; display: flex; justify-content: center; align-items: center; font-size: 6rem; opacity: 0; pointer-events: none; transform: scale(0.4); transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.light-mode .trophy-celebration-overlay { background-color: rgba(255, 255, 255, 0.92); }
.trophy-celebration-overlay.celebrate-active { opacity: 1; transform: scale(1); pointer-events: auto; }

.widget-header {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 24px;
}

.streak-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
    background-color: var(--btn-secondary-bg);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: 20px;
    
    line-height: 1;
    cursor: default;
}
.streak-flame {
    font-size: 1rem;
    filter: drop-shadow(0 0 2px rgba(255, 165, 0, 0.3));
}
.streak-flame { font-size: 0.95rem; line-height: 1; }
.streak-count { line-height: 1; }

.app-logo { 
    font-family: 'Russo One', sans-serif;
    font-size: 1.4rem; 
    font-weight: 400; 
    letter-spacing: 0.04em; 
    color: var(--text-main); 
}

.icon-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px; display: flex; align-items: center; border-radius: 8px; }
.icon-btn:hover { color: var(--text-main); background: var(--btn-secondary-bg); }

/* --- Mechanical Rolling Wheel System --- */
.timer-display { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    gap: 4px; 
    font-size: 3.2rem; 
    font-weight: 600; 
    letter-spacing: -0.02em; 
    margin-bottom: 32px; 
    color: var(--text-main); 
    height: var(--row-height); 
    
    /* STRICT INNER MASK: Defends against wheel numbers displaying out of bounds */
    overflow: hidden !important; 
}

.time-col { 
    width: 1.35em; 
    height: var(--row-height); 
    position: relative; 
    /* ADDITIONAL FENCE: Enforces column containment cleanly */
    overflow: hidden !important;
}

.digit-wheel { 
    position: absolute; 
    width: 100%; 
    left: 0; 
    top: 0; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: flex-start; /* Aligns strictly from top */
    transition: none; /* Countdown updates instantly, no rolling/sliding animation */
}

.digit-wheel div { 
    height: var(--row-height); 
    width: 100%;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    flex-shrink: 0; 
    line-height: 1; /* Eliminates vertical font-padding cropping issues */
}

.colon { 
    height: var(--row-height); 
    display: flex; 
    align-items: center; 
    padding-bottom: 8px; 
    color: var(--text-main); 
    line-height: 1;
}

/* --- Controls Buttons --- */
.controls { display: flex; gap: 8px; margin-bottom: 24px; }
.btn { flex: 1; padding: 14px 6px; border: none; border-radius: 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.btn-primary { background-color: var(--accent-color); color: var(--bg-color); }
.btn-secondary { background-color: var(--btn-secondary-bg); color: var(--text-main); border: 1px solid var(--border-color); }
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.widget-footer { font-size: 0.68rem; color: var(--text-muted); letter-spacing: 0.02em; }
.widget-footer a { color: var(--text-main); text-decoration: none; font-weight: 600; }
.widget-footer a:hover { text-decoration: underline; }

/* --- PIP VIEW ISOLATION OVERRIDES --- */
body.pip-mode { 
    background-color: var(--bg-color); 
    height: 100vh; 
    width: 100vw; 
    margin: 0; 
    padding: 0; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    --row-height: 60px; 
}
body.pip-mode .widget-container { 
    width: 100vw; 
    height: 100vh; 
    border-radius: 0px; 
    border: none; 
    box-shadow: none; 
    padding: 12px; 
}
body.pip-mode .widget-header { margin-bottom: 14px; }
body.pip-mode .state-indicator-row { margin-bottom: 8px; }
body.pip-mode .timer-display { margin-bottom: 18px; }
body.pip-mode .task-space-container { margin-bottom: 16px; }
body.pip-mode .controls { margin-bottom: 16px; }

/* --- HEIGHT-BASED RESPONSIVE PROGRESSIVE BREAKPOINTS --- */
/* Order of Removal: 1. Logo, 2. Footer, 3. Buttons, 4. Status/Task */

@media (max-height: 290px) {
    .widget-header { display: none !important; } /* Removes Logo & PiP Icon */
}

@media (max-height: 250px) {
    .widget-footer { display: none !important; } /* Removes "Lockd in by @ekddesigns" */
    .widget-container { padding-bottom: 12px; }
}

@media (max-height: 200px) {
    .controls, .task-space-container { display: none !important; } /* Removes Action Buttons & Input Area */
    .timer-display { margin-bottom: 8px; }
}

@media (max-height: 140px) {
    .state-indicator-row { display: none !important; } /* Removes Lockd in - Task Name text */
    .timer-display { margin-bottom: 0px; }
}

/* --- RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 768px) {
    body { padding: 40px 12px 24px 12px; }
    .app-workspace { gap: 20px; }
    .upper-control-station { flex-direction: column; align-items: center; gap: 20px; width: 100%; }
    .widget-container { width: 100%; max-width: 380px; padding: 28px 20px; }
    .control-config-panel { width: 100%; max-width: 380px; padding: 20px; border-radius: 20px; }
    .lower-dashboard-station { padding: 24px 16px; border-radius: 24px; gap: 24px; }
    .config-card { padding: 8px 4px; border-radius: 10px; min-width: 65px; }
    .card-time { font-size: 1rem; }
    .card-unit { font-size: 0.55rem; }
}
@media (max-width: 420px) {
    :root { --row-height: 60px; }
    .timer-display { margin-bottom: 24px; }
}

.is-exporting .profile-glass-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background-color: #121214 !important; 
    border: 1px solid rgba(255, 255, 255, 0.2) !important; 
    box-shadow: none !important;
}

.is-exporting .profile-card-canvas-bg::before {
    background: rgba(0, 0, 0, 0.3) !important;
}

.is-exporting .card-metrics-display, 
.is-exporting .card-logo {
    color: #ffffff !important;
    text-shadow: none !important;
}
