/* ============================================================
   WhatTimeDoesMyKidRun — Bold Dark theme
   Bebas Neue headings + Inter body, dark bg, cyan/gold accents, color-coded pills
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg:             #0f1117;
    --bg-card:        #1a1d27;
    --bg-card-alt:    #151821;
    --bg-card-inner:  #252836;
    --border:         #2a2d3a;
    --cyan:           #00e5ff;
    --cyan-dark:      #00b8d4;
    --cyan-shadow:    #008fa1;
    --gold:           #fbbf24;
    --gold-dim:       #f59e0b;
    --mint:           #10b981;
    --mint-dark:      #059669;
    --text:           #e2e8f0;
    --text-light:     #94a3b8;
    --text-muted:     #64748b;
    --text-dim:       #475569;
    --white:          #ffffff;
    --error:          #f87171;
    --radius:         10px;
    --radius-lg:      16px;
    --radius-xl:      20px;
    --radius-pill:    24px;
    --shadow-press:   0 4px 0;
    --shadow-press-sm:0 3px 0;
}

/* ============================================================
   Reset / Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    color: var(--text);
    background: var(--bg);
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1 { font-family: 'Bebas Neue', sans-serif; font-size: 2rem; font-weight: 400; margin: 0 0 4px; line-height: 1.05; color: var(--white); letter-spacing: 0.03em; text-transform: uppercase; }
h2 { font-family: 'Bebas Neue', sans-serif; font-size: 1.3rem; font-weight: 400; margin: 20px 0 10px; color: var(--white); letter-spacing: 0.04em; text-transform: uppercase; }
p  { margin: 0 0 16px; color: var(--text-muted); font-weight: 600; }

.hidden { display: none !important; }
.error  {
    color: #fecaca;
    font-size: 0.88rem;
    margin: 12px 0;
    font-weight: 600;
    background: rgba(239,68,68,0.12);
    border: 2px solid rgba(239,68,68,0.25);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    line-height: 1.5;
    text-align: left;
}

/* ============================================================
   Inputs
   ============================================================ */
input[type="url"], input[type="text"], input[type="time"], input[type="number"] {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    padding: 14px 16px;
    border: 3px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    font-weight: 600;
    transition: border-color 0.2s;
}
input::placeholder { color: var(--text-dim); }
input:focus { border-color: var(--cyan); }

/* ============================================================
   Buttons
   ============================================================ */
button {
    font-family: 'Inter', sans-serif;
    min-height: 44px;
    touch-action: manipulation;
    cursor: pointer;
    font-size: 16px;
    border-radius: var(--radius);
    border: none;
    padding: 0 20px;
    font-weight: 900;
    transition: all 0.1s;
}

#btn-load, #btn-manual-go, #btn-build {
    width: 100%;
    background: linear-gradient(135deg, var(--cyan), var(--cyan-dark));
    color: var(--bg);
    margin-top: 0;
    font-size: 1.1rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    box-shadow: var(--shadow-press) var(--cyan-shadow);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
#btn-load:active, #btn-manual-go:active, #btn-build:active {
    box-shadow: 0 2px 0 var(--cyan-shadow);
    transform: translateY(2px);
}

.link-button {
    background: none;
    border: none;
    color: var(--cyan);
    text-decoration: none;
    padding: 0;
    min-height: 44px;
    font-size: 0.9rem;
    font-weight: 700;
    display: block;
    text-align: center;
    width: 100%;
    cursor: pointer;
    margin-top: 8px;
}
.link-button:hover { text-decoration: underline; }

/* ============================================================
   Entry View
   ============================================================ */
#view-entry { text-align: center; padding-top: 20px; }

#view-entry h1 {
    font-size: 2.8rem;
    line-height: 1.0;
    margin-bottom: 10px;
}
.accent { color: var(--cyan); }
#view-entry h1 .accent { color: var(--cyan); }
#view-entry .subtitle { font-size: 0.95rem; margin-bottom: 24px; }

/* How-to card */
.how-to {
    text-align: left;
    background: var(--bg-card);
    border: 3px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 18px 20px;
    margin-bottom: 20px;
}
.how-to h2 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cyan);
    margin: 0 0 8px;
}
.how-to ol { padding-left: 20px; font-size: 0.9rem; color: var(--text-light); font-weight: 600; }
.how-to li { margin-bottom: 5px; }
.how-to a { color: var(--cyan); font-weight: 800; text-decoration: none; border-bottom: 2px solid rgba(0,229,255,0.3); }
.how-to a:hover { border-color: var(--cyan); }
.how-to strong { color: var(--text); }
.how-to-note { font-size: 0.78rem; color: var(--text-dim); margin: 8px 0 0; font-weight: 600; }

/* URL input joined to button */
.url-input-group { margin-bottom: 4px; }
.url-input-group input { border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: none; }
.url-input-group #btn-load { margin-top: 0; }

/* ============================================================
   Toggle Group
   ============================================================ */
.toggle-group { display: flex; width: 100%; }
.toggle {
    flex: 1;
    background: var(--bg-card);
    color: var(--text-light);
    border: 3px solid var(--border);
    font-weight: 700;
    min-height: 44px;
}
.toggle:first-child { border-radius: var(--radius) 0 0 var(--radius); border-right: none; }
.toggle:last-child  { border-radius: 0 var(--radius) var(--radius) 0; }
.toggle.active { background: var(--cyan-dark); color: var(--bg); border-color: var(--cyan-dark); }

/* ============================================================
   Editor View
   ============================================================ */
#view-editor { padding-top: 8px; }
#view-editor h1 { font-size: 1.4rem; }

.form-group { margin-bottom: 14px; }
.form-group label, .hint {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
    display: block;
}
.hint { font-weight: 600; text-transform: none; letter-spacing: normal; font-size: 0.85rem; margin-bottom: 8px; }

#manual-entry {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 3px solid var(--border);
}
.manual-field { margin-bottom: 14px; }
.manual-field label {
    font-size: 0.78rem; font-weight: 800; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; display: block;
}
.manual-event-row {
    display: grid;
    grid-template-columns: 1fr 64px;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.manual-event-row label { font-size: 0.9rem; font-weight: 700; }
.manual-event-row input { padding: 8px; text-align: center; }

/* ============================================================
   Schedule Header
   ============================================================ */
.schedule-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.schedule-header > div:first-child { flex: 1; }
.schedule-header h1 { margin-bottom: 2px; }
.schedule-header p  { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

.meet-ext-link {
    display: inline-block;
    color: var(--cyan);
    font-weight: 700;
    font-size: 0.82rem;
    margin-top: 4px;
    text-decoration: none;
    border-bottom: 2px solid rgba(0,229,255,0.3);
}
.meet-ext-link:hover { border-color: var(--cyan); }

#btn-edit {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 2px solid var(--border);
    white-space: nowrap;
    flex-shrink: 0;
    flex-grow: 0;
    width: auto;
    font-weight: 700;
    font-size: 0.78rem;
    border-radius: 8px;
    padding: 6px 14px;
    min-height: unset;
    height: auto;
    line-height: 1;
}
#btn-edit:hover { border-color: var(--text-muted); color: var(--text); }

/* Start time */
.start-time-group {
    display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.start-time-group label { white-space: nowrap; font-weight: 800; font-size: 0.9rem; }
.start-time-group input { width: 150px; flex-shrink: 0; }

/* Settings */
#settings-panel {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    margin-bottom: 14px;
}
#settings-panel summary {
    cursor: pointer; font-weight: 800; font-size: 0.8rem;
    color: var(--text-muted); user-select: none; list-style: none;
    text-transform: uppercase; letter-spacing: 0.06em;
}
#settings-panel summary::before { content: "+ "; }
#settings-panel[open] summary::before { content: "\2212  "; }
.settings-content { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.setting-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.setting-row label { font-size: 0.9rem; font-weight: 700; }
.setting-row input { width: 80px; padding: 8px; }

/* ============================================================
   Event Picker
   ============================================================ */
#event-picker { margin-bottom: 8px; }
#event-checkboxes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.event-check {
    display: flex; align-items: center; gap: 8px;
    min-height: 42px; padding: 8px 10px;
    border: 2px solid var(--border); border-radius: var(--radius);
    cursor: pointer; font-size: 0.82rem; font-weight: 700;
    background: var(--bg-card); color: var(--text-light);
    transition: all 0.15s; user-select: none;
}
.event-check:hover { border-color: var(--text-muted); }
.event-check input[type="checkbox"] {
    width: 18px; height: 18px; flex-shrink: 0;
    cursor: pointer; accent-color: var(--cyan);
}
.event-check.checked {
    background: rgba(0,229,255,0.1);
    border-color: var(--cyan);
    color: var(--cyan);
    font-weight: 800;
}

/* ============================================================
   Kid Summary Card
   ============================================================ */
#kid-summary {
    margin: 20px 0;
    padding: 22px;
    background: var(--bg-card);
    border: 3px solid var(--border);
    border-radius: var(--radius-pill);
    box-shadow: 0 8px 0 #0a0c12;
}

#kid-summary h2 {
    margin: 0 0 14px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--cyan);
}

.kid-event-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card-inner);
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    border: 2px solid var(--border);
}
.kid-event-card:last-child { margin-bottom: 0; }
.kid-event-card.done { opacity: 0.35; }
.kid-event-card.current { border-color: var(--mint); background: rgba(16,185,129,0.1); }

.kid-event-name { flex: 1; font-weight: 800; font-size: 0.95rem; color: var(--white); }
.kid-event-time { text-align: right; flex-shrink: 0; }
.kid-time-value {
    display: block; font-size: 1.6rem; font-weight: 900;
    color: var(--gold); line-height: 1.1; font-variant-numeric: tabular-nums;
}
.kid-time-range { display: block; font-size: 0.68rem; color: var(--text-muted); font-weight: 600; }
.kid-event-card .done-text { font-size: 1rem; color: var(--text-dim); font-weight: 800; }
.kid-event-card .btn-now { flex-shrink: 0; }

/* Now explainer */
.now-explain {
    display: flex; align-items: center; gap: 12px;
    background: rgba(16,185,129,0.08);
    border: 3px solid rgba(16,185,129,0.2);
    border-radius: var(--radius-lg);
    padding: 14px 18px; margin-top: 16px;
    font-size: 0.85rem; color: #34d399; font-weight: 700;
}

#full-schedule-heading {
    margin-top: 28px; margin-bottom: 8px;
    font-size: 0.8rem; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800;
}

/* ============================================================
   Schedule Timeline — pill-based layout
   ============================================================ */
#schedule-timeline { margin-top: 4px; }

.schedule-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 4px;
    font-size: 0.85rem;
    background: var(--bg-card);
    border: 2px solid transparent;
}

.schedule-row.header {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    background: transparent;
    border: none;
    padding-bottom: 4px;
    margin-bottom: 0;
}

.schedule-row:not(.header):nth-child(odd) { background: var(--bg-card); }
.schedule-row:not(.header):nth-child(even) { background: var(--bg-card-alt); }

.schedule-row.mine {
    background: rgba(0,229,255,0.06);
    border-color: rgba(0,229,255,0.3);
}

.schedule-row.done { opacity: 0.3; }
.schedule-row.done .event-name { text-decoration: line-through; }

.schedule-row.current {
    border-color: var(--mint);
    background: rgba(16,185,129,0.08);
}

/* Event info */
.event-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.event-name {
    font-weight: 800; font-size: 0.85rem; color: var(--text);
    line-height: 1.25;
}
.mine .event-name { color: var(--white); }
.event-heats { font-size: 0.68rem; color: var(--text-dim); font-weight: 700; line-height: 1.3; }

.btn-3200-toggle {
    display: inline;
    background: none;
    border: none;
    color: var(--cyan);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0;
    min-height: unset;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(0,229,255,0.3);
}
.btn-3200-toggle:hover { text-decoration-color: var(--cyan); }

/* On small screens, stack pills below event name */
@media (max-width: 480px) {
    .schedule-row:not(.header) {
        flex-wrap: wrap;
    }
    .event-info { flex: 1 1 100%; }
    .time-pills { margin-top: 4px; }
    .time-pill { font-size: 0.74rem; padding: 4px 6px; min-width: 42px; }
    .btn-now { margin-top: 4px; }
}

/* Time pills */
.time-pills { display: flex; gap: 4px; flex-shrink: 0; }

.time-pill {
    display: inline-block;
    padding: 5px 7px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    min-width: 46px;
    text-align: center;
}

.time-pill.early  { background: rgba(16,185,129,0.15); color: #34d399; }
.time-pill.likely { background: rgba(0,229,255,0.12); color: var(--cyan); }
.time-pill.late   { background: rgba(251,191,36,0.15); color: var(--gold); }

.mine .time-pill.early  { background: var(--mint); color: var(--white); }
.mine .time-pill.likely { background: var(--cyan-dark); color: var(--white); }
.mine .time-pill.late   { background: var(--gold-dim); color: var(--bg); }

/* Adjusted time (tracking mode) */
.time-pill.adjusted { background: rgba(0,229,255,0.12); color: var(--cyan); font-size: 0.85rem; }
.mine .time-pill.adjusted { background: var(--cyan-dark); color: var(--white); }
.time-pill.done-pill { background: transparent; color: var(--text-dim); }

/* Pill header labels */
.pill-header { display: flex; gap: 4px; flex-shrink: 0; }
.pill-label {
    display: inline-block; padding: 4px 7px; border-radius: 8px;
    font-size: 0.68rem; font-weight: 800; min-width: 46px; text-align: center;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.pill-label.early  { background: rgba(16,185,129,0.15); color: #34d399; }
.pill-label.likely { background: rgba(0,229,255,0.12); color: var(--cyan); }
.pill-label.late   { background: rgba(251,191,36,0.15); color: var(--gold); }

/* ============================================================
   "Now" button
   ============================================================ */
.btn-now {
    background: var(--mint);
    color: var(--white);
    font-size: 0.72rem;
    font-weight: 900;
    padding: 8px 14px;
    min-height: unset;
    height: auto;
    border-radius: var(--radius);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    box-shadow: var(--shadow-press-sm) var(--mint-dark);
    flex-shrink: 0;
}
.btn-now:active { box-shadow: 0 1px 0 var(--mint-dark); transform: translateY(2px); }

/* ============================================================
   Share
   ============================================================ */
#btn-share {
    width: 100%;
    background: var(--bg-card);
    color: var(--cyan);
    border: 3px solid var(--border);
    margin-top: 20px;
    border-radius: var(--radius-lg);
}
#btn-share:hover { border-color: var(--cyan); }

/* ============================================================
   Start Time Modal
   ============================================================ */
#start-time-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-card {
    background: var(--bg-card);
    border: 3px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px 24px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: slideUp 0.3s ease-out;
}

.modal-card h2 {
    margin: 0 0 8px;
    font-size: 1.4rem;
}

.modal-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-weight: 600;
}

.modal-card input[type="time"] {
    width: 100%;
    font-size: 1.2rem;
    padding: 14px;
    text-align: center;
    margin-bottom: 12px;
}

#modal-start-go {
    width: 100%;
    background: linear-gradient(135deg, var(--cyan), var(--cyan-dark));
    color: var(--bg);
    font-size: 1.05rem;
    padding: 14px;
    border-radius: var(--radius);
    box-shadow: 0 3px 0 var(--cyan-shadow);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
#modal-start-go:active { box-shadow: 0 1px 0 var(--cyan-shadow); transform: translateY(2px); }
#modal-start-go:disabled { opacity: 0.4; cursor: not-allowed; }

.modal-check-link {
    display: inline-block;
    color: var(--cyan);
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 14px;
    text-decoration: none;
    border-bottom: 2px solid rgba(0,229,255,0.3);
}
.modal-check-link:hover { border-color: var(--cyan); }

/* ============================================================
   Loading
   ============================================================ */
#loading {
    text-align: center;
    color: var(--text-muted);
    padding: 24px 0;
    font-weight: 700;
    font-size: 0.95rem;
}

/* ============================================================
   Story blurb on entry page
   ============================================================ */
.story {
    text-align: left;
    color: var(--text-light);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.65;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--cyan);
}
.story em { color: var(--gold); font-style: italic; }
.story strong { color: var(--cyan); }

/* ============================================================
   Footer — Buy Me a Coffee
   ============================================================ */
#site-footer {
    text-align: center;
    padding: 40px 16px 32px;
    margin-top: 48px;
    border-top: 1px solid var(--border);
}

.footer-tagline {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.bmc-btn {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #ffdd00 0%, #ffca28 100%);
    color: #1a1a2e;
    padding: 14px 28px;
    border-radius: 16px;
    text-decoration: none;
    box-shadow: 0 4px 0 #b89a00, 0 6px 20px rgba(255,221,0,0.2);
    transition: all 0.1s;
}
.bmc-btn:hover {
    box-shadow: 0 4px 0 #b89a00, 0 8px 28px rgba(255,221,0,0.3);
    transform: translateY(-1px);
}
.bmc-btn:active { box-shadow: 0 2px 0 #b89a00; transform: translateY(2px); }

.bmc-btn-emoji {
    font-size: 1.6rem;
    line-height: 1;
}

.bmc-btn-text { text-align: left; }

.bmc-btn-label {
    display: block;
    font-weight: 800;
    font-size: 1rem;
    line-height: 1.2;
}

.bmc-btn-sub {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #5c4d00;
    line-height: 1.2;
}

.footer-note {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 14px;
    font-weight: 600;
}

/* ============================================================
   BMC Popup (soft ask after 3 uses)
   ============================================================ */
#bmc-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.bmc-popup-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.4);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.bmc-popup-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.4rem;
    min-height: unset;
    padding: 0;
    cursor: pointer;
    line-height: 1;
}

.bmc-popup-text {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 16px;
}

.bmc-popup-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffdd00;
    color: #000;
    font-weight: 900;
    font-size: 1rem;
    padding: 12px 28px;
    border-radius: 14px;
    text-decoration: none;
    box-shadow: 0 3px 0 #ccb100;
    font-family: 'Inter', sans-serif;
    margin-bottom: 12px;
}
.bmc-popup-btn:active { box-shadow: 0 1px 0 #ccb100; transform: translateY(2px); }

.bmc-popup-dismiss {
    display: block;
    margin: 0 auto;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    min-height: unset;
    padding: 4px;
}
.bmc-popup-dismiss:hover { color: var(--text-light); }
