/* LL00Mtube — YouTube Aesthetic Parody */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --yt-red: #ff0000;
    --yt-red-dark: #cc0000;
    --yt-red-light: #ff4444;
    --yt-black: #0f0f0f;
    --yt-dark: #181818;
    --yt-surface: #212121;
    --yt-surface-hover: #3d3d3d;
    --yt-border: #303030;
    --yt-text: #f1f1f1;
    --yt-text-secondary: #aaaaaa;
    --yt-blue: #3ea6ff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    background: var(--yt-black);
    color: var(--yt-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    line-height: 1.6;
    padding-bottom: 260px;
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    width: 100%;
    position: relative;
    padding-top: 20px;
}

/* States */
.state {
    display: none;
    animation: fadeIn 0.3s ease;
}

.state.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* YouTube-style Header/Logo */
h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 2px;
}

h1 .tube {
    background: var(--yt-red);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    margin-left: 2px;
}

h2 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.tagline {
    color: var(--yt-text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    font-weight: 400;
}

.description {
    color: var(--yt-text-secondary);
    font-size: 0.8125rem;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.label {
    color: var(--yt-text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.instruction {
    color: var(--yt-text-secondary);
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* YouTube-style Search Box */
.search-box {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border: 1px solid var(--yt-border);
    border-radius: 40px;
    overflow: hidden;
    background: var(--yt-dark);
}

#song-search {
    flex: 1;
    background: var(--yt-dark);
    border: none;
    padding: 0.75rem 1rem 0.75rem 1.5rem;
    color: var(--yt-text);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 400;
}

#song-search:focus {
    outline: none;
}

#song-search::placeholder {
    color: var(--yt-text-secondary);
}

#search-btn {
    background: var(--yt-surface);
    color: var(--yt-text);
    border: none;
    border-left: 1px solid var(--yt-border);
    border-radius: 0;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

#search-btn:hover {
    background: var(--yt-surface-hover);
    transform: none;
    box-shadow: none;
}

/* YouTube-style Buttons */
button {
    background: var(--yt-red);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0.625rem 1rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover {
    background: var(--yt-red-dark);
    transform: none;
    box-shadow: none;
}

button:active {
    transform: none;
}

/* ===========================================
   PROMPT EDITOR SECTION
   =========================================== */
.prompt-section {
    margin-top: 2rem;
    border-top: 1px solid var(--yt-border);
    padding-top: 1.5rem;
}

.prompt-toggle {
    background: transparent;
    color: var(--yt-text-secondary);
    border: 1px solid var(--yt-border);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
}

.prompt-toggle:hover {
    background: var(--yt-surface);
    color: var(--yt-text);
}

.toggle-icon {
    font-size: 0.625rem;
    transition: transform 0.2s;
}

.prompt-editor {
    margin-top: 1rem;
    animation: slideDown 0.3s ease;
}

.prompt-editor.hidden {
    display: none;
}

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

.prompt-group {
    background: var(--yt-surface);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.prompt-label {
    display: block;
    color: var(--yt-red-light);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.prompt-description {
    color: var(--yt-text-secondary);
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
}

.prompt-textarea {
    width: 100%;
    background: var(--yt-dark);
    border: 1px solid var(--yt-border);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--yt-text);
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    resize: vertical;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--yt-blue);
}

.prompt-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.secondary-btn {
    background: transparent;
    color: var(--yt-text-secondary);
    border: 1px solid var(--yt-border);
    font-size: 0.75rem;
    padding: 0.5rem 1rem;
}

.secondary-btn:hover {
    background: var(--yt-surface);
    color: var(--yt-text);
}

.primary-btn {
    background: var(--yt-red);
    color: white;
    font-size: 0.75rem;
    padding: 0.5rem 1rem;
    margin-left: 0.5rem;
}

.primary-btn:hover {
    background: var(--yt-red-dark);
}

.prompt-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
    gap: 0.5rem;
}

/* Listening State - YouTube Video Page Style */
.now-playing {
    margin-bottom: 1rem;
}

.now-playing .label {
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
}

.now-playing h2 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}

.now-playing p {
    color: var(--yt-text-secondary);
    font-size: 0.875rem;
}

.video-container {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    aspect-ratio: 16/9;
}

#youtube-player {
    width: 100%;
    height: 100%;
}

.vipe-area {
    margin-bottom: 1rem;
    background: var(--yt-surface);
    border-radius: 12px;
    padding: 1rem;
}

.vipe-area .instruction {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
}

#vipe-input {
    width: 100%;
    min-height: 150px;
    background: var(--yt-dark);
    border: 1px solid var(--yt-border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--yt-text);
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
}

#vipe-input:focus {
    outline: none;
    border-color: var(--yt-blue);
}

#vipe-input::placeholder {
    color: var(--yt-text-secondary);
}

.button-row {
    display: flex;
    gap: 0.75rem;
}

.button-row .secondary-btn {
    flex: 0 0 auto;
    padding: 0.75rem 1rem;
}

#done-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
}

/* Reveal State - YouTube Comment/Card Style */
.guess-section {
    background: var(--yt-surface);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.viped-display {
    font-size: 0.875rem;
    color: var(--yt-text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 120px;
    overflow-y: auto;
    background: var(--yt-dark);
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.guess-result {
    background: var(--yt-surface);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

#guess-title {
    color: var(--yt-text);
    font-size: 1.125rem;
    font-weight: 500;
}

#guess-confidence {
    color: var(--yt-text-secondary);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

.reasoning {
    color: var(--yt-text-secondary);
    font-size: 0.75rem;
    font-style: italic;
    margin-top: 0.5rem;
    opacity: 0.8;
}

/* Guessed Video Container */
.guessed-video-container {
    margin-bottom: 1rem;
}

.guessed-video-container.hidden {
    display: none;
}

.guessed-video {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.guessed-video iframe {
    display: block;
    width: 100%;
    border-radius: 12px;
}

/* Memory Section - LLM Memory Extraction */
.memory-section {
    background: linear-gradient(135deg, #0a0a1a, #0a1a2a);
    border: 1px solid var(--yt-blue);
    border-left: 4px solid var(--yt-blue);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.memory-section .label {
    color: var(--yt-blue);
    font-size: 0.6875rem;
}

.memory-content {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--yt-text);
}

#again-btn {
    width: 100%;
    background: transparent;
    border: 1px solid var(--yt-text-secondary);
    color: var(--yt-text);
    padding: 0.75rem 1rem;
}

#again-btn:hover {
    background: var(--yt-surface);
    border-color: var(--yt-text);
}

/* Loading - YouTube Style */
.loading {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 15, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 100;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--yt-surface);
    border-top-color: var(--yt-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-text {
    color: var(--yt-text-secondary);
    font-size: 0.875rem;
}

/* ===========================================
   BLACK DOG EASTER EGG
   =========================================== */
.dog-container {
    position: fixed;
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.5s ease-out, opacity 0.3s;
    /* Ensure dog is visible when active */
    left: 50%;
    top: 50%;
}

.dog-container.active {
    opacity: 1;
    pointer-events: auto;
}

.dog {
    width: 80px;
    height: 60px;
    cursor: pointer;
    position: relative;
}

.dog.flipped {
    transform: scaleX(-1);
}

.dog-body {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Dog head */
.dog-head {
    position: absolute;
    width: 30px;
    height: 25px;
    background: #1a1a1a;
    border-radius: 50% 50% 40% 40%;
    top: 5px;
    left: 45px;
}

.dog-ear {
    position: absolute;
    width: 12px;
    height: 18px;
    background: #1a1a1a;
    border-radius: 50% 50% 30% 30%;
    top: -8px;
}

.dog-ear.left {
    left: 2px;
    transform: rotate(-15deg);
}

.dog-ear.right {
    right: 2px;
    transform: rotate(15deg);
}

.dog-face {
    position: absolute;
    top: 8px;
    left: 5px;
    right: 5px;
}

.dog-eye {
    position: absolute;
    width: 5px;
    height: 5px;
    background: #333;
    border-radius: 50%;
    top: 0;
}

.dog-eye.left {
    left: 3px;
}

.dog-eye.right {
    right: 3px;
}

.dog-eye::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    top: 1px;
    left: 1px;
}

.dog-nose {
    position: absolute;
    width: 6px;
    height: 4px;
    background: #333;
    border-radius: 50%;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
}

.dog-tongue {
    position: absolute;
    width: 6px;
    height: 0;
    background: #ff6b6b;
    border-radius: 0 0 50% 50%;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    transition: height 0.2s;
}

.dog.barking .dog-tongue {
    height: 8px;
    animation: pant 0.2s infinite alternate;
}

@keyframes pant {
    from { height: 6px; }
    to { height: 10px; }
}

/* Dog torso */
.dog-torso {
    position: absolute;
    width: 45px;
    height: 25px;
    background: #1a1a1a;
    border-radius: 40% 30% 40% 40%;
    top: 20px;
    left: 5px;
}

/* Dog tail */
.dog-tail {
    position: absolute;
    width: 8px;
    height: 25px;
    background: #1a1a1a;
    border-radius: 50%;
    top: 10px;
    left: -5px;
    transform-origin: bottom center;
    transform: rotate(30deg);
}

.dog.wagging .dog-tail {
    animation: wag 0.3s ease-in-out infinite alternate;
}

.dog.excited .dog-tail {
    animation: wag 0.15s ease-in-out infinite alternate;
}

@keyframes wag {
    from { transform: rotate(10deg); }
    to { transform: rotate(50deg); }
}

/* Dog legs */
.dog-legs {
    position: absolute;
    bottom: 0;
    left: 8px;
    width: 50px;
}

.dog-leg {
    position: absolute;
    width: 8px;
    height: 15px;
    background: #1a1a1a;
    border-radius: 3px;
    bottom: 0;
}

.dog-leg.front-left { left: 30px; }
.dog-leg.front-right { left: 38px; }
.dog-leg.back-left { left: 5px; }
.dog-leg.back-right { left: 13px; }

/* Dog biting state */
.dog.biting .dog-tongue {
    height: 12px;
    animation: none;
}

.dog.excited {
    animation: dogBounce 0.3s ease-in-out infinite;
}

@keyframes dogBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.dog.excited.flipped {
    animation: dogBounceFlipped 0.3s ease-in-out infinite;
}

@keyframes dogBounceFlipped {
    0%, 100% { transform: scaleX(-1) translateY(0); }
    50% { transform: scaleX(-1) translateY(-5px); }
}

/* ===========================================
   BLUE LEASH
   =========================================== */
.leash-container {
    position: fixed;
    z-index: 150;
    cursor: grab;
    transition: transform 0.1s;
}

.leash-container.hidden {
    display: none;
}

.leash-container.grabbed {
    cursor: grabbing;
}

.leash {
    width: 50px;
    height: 30px;
    position: relative;
}

.leash-handle {
    position: absolute;
    width: 20px;
    height: 12px;
    background: linear-gradient(135deg, #1e90ff, #0066cc);
    border-radius: 6px;
    top: 0;
    left: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.leash-rope {
    position: absolute;
    width: 25px;
    height: 4px;
    background: linear-gradient(90deg, #1e90ff, #4169e1);
    top: 8px;
    left: 15px;
    border-radius: 2px;
    transform: rotate(10deg);
}

.leash-clip {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #c0c0c0;
    border-radius: 50%;
    top: 10px;
    left: 38px;
    border: 1px solid #999;
}

.leash-container:hover .leash-handle {
    background: linear-gradient(135deg, #4169e1, #1e90ff);
}

.leash-container.grabbed .leash {
    transform: scale(1.1);
}

/* ===========================================
   RESEARCH FOOTER
   =========================================== */
.research-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, var(--yt-black) 85%, transparent);
    padding: 2rem 20px 1rem;
    z-index: 50;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 0.75rem;
    color: var(--yt-text-secondary);
    line-height: 1.6;
}

.footer-content h3 {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--yt-text);
    margin-bottom: 0.5rem;
}

.footer-content p {
    margin-bottom: 0.5rem;
}

.footer-content a {
    color: var(--yt-blue);
    text-decoration: none;
}

.footer-content a:hover {
    text-decoration: underline;
}

.data-note {
    font-size: 0.6875rem;
    margin-top: 0.5rem;
    font-style: italic;
}

.data-note .hint {
    color: var(--yt-blue);
    opacity: 0.6;
    cursor: help;
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 600px) {
    h1 {
        font-size: 1.5rem;
    }

    .search-box {
        border-radius: 8px;
    }

    #song-search {
        padding: 0.625rem 1rem;
    }

    #search-btn {
        padding: 0.625rem 1rem;
    }

    .research-footer {
        padding: 1.5rem 15px 0.75rem;
    }

    .footer-content {
        font-size: 0.6875rem;
    }

    body {
        padding-bottom: 300px;
    }

    .prompt-textarea {
        font-size: 0.6875rem;
    }

    .dog {
        transform: scale(0.8);
    }
}
