/* ============================================================
   FREEBOOT WEB — Premium Mobile-First Design
   ============================================================ */

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

:root {
    --purple: #9146FF;
    --purple-dark: #772ce8;
    --purple-glow: rgba(145, 70, 255, 0.35);
    --green: #00ffa3;
    --green-glow: rgba(0, 255, 163, 0.25);
    --pink: #ff49db;
    --bg-deep: #0a0a0f;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.08);
    --text: #efeff1;
    --text-dim: #8b8b9a;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- Animated Background Blobs --- */
.bg-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.3;
    z-index: 0;
    pointer-events: none;
    animation: blobFloat 20s ease-in-out infinite alternate;
}
.blob-1 {
    width: 350px; height: 350px;
    background: var(--purple);
    top: -80px; left: -100px;
    animation-delay: 0s;
}
.blob-2 {
    width: 280px; height: 280px;
    background: var(--pink);
    top: 40%; right: -80px;
    animation-delay: -7s;
}
.blob-3 {
    width: 300px; height: 300px;
    background: var(--green);
    bottom: -60px; left: 30%;
    animation-delay: -14s;
    opacity: 0.15;
}
@keyframes blobFloat {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(30px, -20px) scale(1.05); }
    66%  { transform: translate(-20px, 15px) scale(0.95); }
    100% { transform: translate(10px, -10px) scale(1.02); }
}

/* --- App Container --- */
#app {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px 100px;
}

/* --- Top Bar --- */
#topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo-icon {
    font-size: 22px;
    animation: logoPulse 2s ease-in-out infinite;
}
@keyframes logoPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
.logo-text {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}
.nav-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
}
.pill-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* --- URL Section --- */
#url-section { margin-bottom: 20px; }
.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
}

.url-bar {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.url-bar:focus-within {
    border-color: var(--purple);
    box-shadow: 0 0 20px var(--purple-glow);
}
.url-icon {
    padding: 0 10px;
    font-size: 18px;
    flex-shrink: 0;
}
.url-bar input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    padding: 10px 4px;
    outline: none;
    min-width: 0;
}
.url-bar input::placeholder { color: var(--text-dim); }

.btn-glow {
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-glow:active {
    transform: scale(0.95);
    box-shadow: 0 0 20px var(--purple-glow);
}

/* --- Player Section --- */
#player-section { margin-bottom: 20px; }
#player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #111;
    border: 1px solid var(--border);
}
#twitch-player { width: 100%; height: 100%; }
#twitch-player iframe { width: 100% !important; height: 100% !important; }
#player-placeholder {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    gap: 8px; color: var(--text-dim);
}
.ph-icon { font-size: 48px; margin-bottom: 4px; opacity: 0.5; }
.ph-text { font-size: 15px; font-weight: 600; }
.ph-sub { font-size: 12px; opacity: 0.5; }

/* --- Timeline Section --- */
#timeline-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}
.timeline-header { margin-bottom: 14px; }
.section-subtitle {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}
.time-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.time-input {
    width: 72px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'Outfit', monospace;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    padding: 8px 4px;
    border-radius: 8px;
    transition: border-color 0.2s;
}
.time-input:focus { outline: none; border-color: var(--purple); }
.start-chip .time-input { border-color: rgba(145, 70, 255, 0.4); }
.end-chip .time-input { border-color: rgba(0, 255, 163, 0.4); }

.pin-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}
.pin-btn:active { transform: scale(0.9); background: rgba(255,255,255,0.15); }

/* --- Slider --- */
.slider-area {
    flex: 1;
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
    touch-action: none;
}
.slider-track {
    position: absolute;
    left: 0; right: 0;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
}
.slider-range {
    position: absolute;
    height: 6px;
    background: linear-gradient(90deg, var(--purple), var(--green));
    border-radius: 3px;
    box-shadow: 0 0 12px var(--purple-glow);
    pointer-events: none;
}
.slider-knob {
    position: absolute;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--purple);
    transform: translateX(-50%);
    z-index: 3;
    touch-action: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    transition: transform 0.1s, box-shadow 0.1s;
}
.slider-knob:active {
    transform: translateX(-50%) scale(1.3);
    box-shadow: 0 0 16px var(--purple-glow);
}
.knob-end {
    border-color: var(--green);
}
.knob-end:active {
    box-shadow: 0 0 16px var(--green-glow);
}

.slider-pos {
    position: absolute;
    top: 2px; bottom: 2px;
    width: 2px;
    background: #fff;
    border-radius: 1px;
    transform: translateX(-50%);
    z-index: 4;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(255,255,255,0.6);
    transition: left 0.15s linear;
}
.pos-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 6px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: rgba(0,0,0,0.7);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color 0.3s;
}
.card:focus-within { border-color: rgba(145, 70, 255, 0.3); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}
.card-chevron {
    font-size: 16px;
    color: var(--text-dim);
    transition: transform 0.3s;
}
.card.collapsed .card-chevron { transform: rotate(-90deg); }
.card-body {
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: cardOpen 0.25s ease-out;
}
.card.collapsed .card-body { display: none; }

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

.fancy-input {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    width: 100%;
    resize: none;
}
.fancy-input:focus {
    outline: none;
    border-color: var(--purple);
    background: rgba(145, 70, 255, 0.04);
    box-shadow: 0 0 12px var(--purple-glow);
}
.fancy-input::placeholder { color: var(--text-dim); }

/* --- Custom Toggle --- */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 4px 0;
}
.toggle-row input[type="checkbox"] {
    display: none;
}
.toggle-slider {
    width: 44px; height: 24px;
    background: rgba(255,255,255,0.1);
    border-radius: 100px;
    position: relative;
    transition: background 0.3s;
    flex-shrink: 0;
}
.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s, background 0.3s;
}
.toggle-row input:checked + .toggle-slider {
    background: var(--purple);
}
.toggle-row input:checked + .toggle-slider::after {
    transform: translateX(20px);
}
.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

/* --- CTA Button --- */
#cta-section {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    padding: 16px;
    z-index: 100;
    background: linear-gradient(to top, var(--bg-deep) 60%, transparent);
}
.cta-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 6px 30px var(--purple-glow);
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: hidden;
}
.cta-button::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: skewX(-20deg);
    animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}
.cta-button:active {
    transform: scale(0.97);
    box-shadow: 0 2px 15px var(--purple-glow);
}
.cta-icon { font-size: 20px; }

/* --- Popup --- */
#popup-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
#popup {
    position: relative;
    background: rgba(20, 20, 28, 0.95);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 30px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}
#popup-glow {
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at center, var(--purple-glow) 0%, transparent 60%);
    opacity: 0.4;
    pointer-events: none;
    animation: popupGlow 4s ease-in-out infinite alternate;
}
@keyframes popupGlow {
    0% { transform: scale(1); opacity: 0.3; }
    100% { transform: scale(1.1); opacity: 0.5; }
}
#popup-icon { font-size: 52px; margin-bottom: 12px; position: relative; z-index: 1; }
#popup-title { font-size: 18px; font-weight: 800; margin-bottom: 16px; position: relative; z-index: 1; }
#popup-pct {
    font-size: 48px; font-weight: 900;
    background: linear-gradient(135deg, var(--purple), var(--green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    position: relative; z-index: 1;
}
#popup-bar-track {
    width: 100%; height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
    position: relative; z-index: 1;
}
#popup-bar-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--purple), var(--green));
    border-radius: 4px;
    transition: width 0.4s ease;
}
#popup-msg {
    font-size: 13px; color: var(--text-dim);
    min-height: 20px;
    position: relative; z-index: 1;
}
#popup-close {
    display: none;
    margin-top: 20px;
    background: linear-gradient(135deg, var(--green), #00cc82);
    color: #000;
    border: none;
    padding: 12px 32px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    position: relative; z-index: 1;
    transition: transform 0.15s;
}
#popup-close:active { transform: scale(0.95); }

/* --- Desktop tweaks --- */
@media (min-width: 768px) {
    #app { padding-top: 20px; }
    #cta-section { padding: 20px; }
}
