:root {
    color-scheme: dark;
    --background: #0a0a0a;
    --surface: #1c1c20;
    --surface-soft: rgba(255, 255, 255, 0.025);
    --surface-hover: rgba(255, 255, 255, 0.05);
    --foreground: #ffffff;
    --muted: rgba(245, 245, 247, 0.7);
    --ink-dim: rgba(245, 245, 247, 0.42);
    --divider: rgba(255, 255, 255, 0.1);
    --accent: #ff5a4f;
    --accent-strong: #ff453a;
    --accent-muted: rgba(255, 90, 79, 0.18);
    --note-blue: #2563eb;
    --note-blue-soft: #a8c5ff;
    --note-blue-tint: rgba(147, 184, 255, 0.12);
    --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.32), 0 1px 0 rgba(255, 255, 255, 0.03) inset;
    --serif-display: "Inter Tight", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

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

body {
    font-family: var(--serif-display);
    background-color: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.loading,
.error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 24px;
}

.loading p {
    color: var(--muted);
    font-size: 14px;
}

.loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--divider);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

.error h2 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    color: var(--foreground);
}

.error p {
    color: var(--muted);
    font-size: 14px;
}

.error a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.error a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

.header {
    margin-bottom: 20px;
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--foreground);
    margin-bottom: 4px;
    line-height: 1.3;
}

.header .meta {
    font-size: 13px;
    color: var(--ink-dim);
    font-family: var(--mono);
    letter-spacing: 0.02em;
}

.main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--divider);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.annotation-overlay {
    position: absolute;
    object-fit: fill;
    pointer-events: none;
    z-index: 2;
}

.annotation-hide-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    padding: 7px 11px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    background: rgba(18, 18, 18, 0.84);
    color: #ffffff;
    font: 600 12px/1.2 var(--sans);
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.annotation-hide-button:hover {
    background: rgba(18, 18, 18, 0.96);
}

.notes-panel {
    background: var(--surface-soft);
    border-radius: 14px;
    border: 1px solid var(--divider);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card);
}

.notes-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--divider);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notes-header h2 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.notes-header .count {
    font-size: 12px;
    color: var(--ink-dim);
    font-family: var(--mono);
}

.notes-list {
    list-style: none;
    overflow-y: auto;
    max-height: 500px;
    padding: 8px 0;
}

.note-item {
    display: flex;
    gap: 14px;
    padding: 14px 18px;
    cursor: pointer;
    transition: background-color 150ms ease;
    align-items: flex-start;
    border-bottom: 1px solid var(--divider);
}

.note-item:last-child {
    border-bottom: none;
}

.note-item:hover {
    background: var(--surface-hover);
}

.note-item.active {
    background: var(--accent-muted);
}

.note-item.highlight {
    animation: highlight-fade 1.2s ease-out;
}

@keyframes highlight-fade {
    0% { background: var(--accent-muted); }
    100% { background: transparent; }
}

.note-timestamp {
    flex-shrink: 0;
    background: var(--note-blue-tint);
    color: var(--note-blue-soft);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: var(--mono);
    min-width: 56px;
    text-align: center;
    border: none;
    cursor: pointer;
    line-height: 1.4;
    letter-spacing: 0.02em;
    transition: background-color 150ms ease, transform 150ms ease;
}

.note-timestamp:hover {
    background: rgba(147, 184, 255, 0.22);
    transform: translateY(-1px);
}

.note-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--muted);
    white-space: pre-line;
    word-break: break-word;
}

.note-annotation-badge {
    flex-shrink: 0;
    margin-left: auto;
    align-self: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    color: var(--accent, #93b8ff);
    background: rgba(147, 184, 255, 0.14);
    border: 1px solid rgba(147, 184, 255, 0.3);
    border-radius: 999px;
    padding: 4px 8px;
}

.notes-empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--ink-dim);
    font-size: 14px;
    line-height: 1.6;
}

.notes-empty .empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.notes-empty p {
    margin-bottom: 4px;
}

.footer {
    text-align: center;
    padding: 40px 16px;
    font-size: 13px;
    color: var(--ink-dim);
}

.footer .footer-tagline {
    margin-bottom: 16px;
    font-family: var(--mono);
    letter-spacing: 0.02em;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

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

.footer .cta-button {
    display: inline-block;
    background: var(--accent);
    color: #ffffff;
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
    letter-spacing: -0.005em;
}

.footer .cta-button:hover {
    background: var(--accent-strong);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-muted);
}

@media (min-width: 900px) {
    .container {
        padding: 32px 40px;
    }

    .main {
        flex-direction: row;
        align-items: flex-start;
    }

    .video-wrapper {
        flex: 3;
        min-width: 0;
    }

    .notes-panel {
        flex: 1;
        min-width: 320px;
        max-width: 400px;
        flex-shrink: 0;
    }

    .notes-list {
        max-height: calc(100vh - 200px);
    }
}

@media (min-width: 1400px) {
    .container {
        padding: 40px 60px;
    }

    .notes-panel {
        max-width: 440px;
    }

    .header h1 {
        font-size: 26px;
    }
}
