.tape-notebook {
    --notebook-panel: #111111;
    --notebook-panel-raised: #181818;
    --notebook-line: #343434;
    --notebook-soft: #c8c8c8;
    width: min(100%, 1180px);
    margin: 0 auto;
}

.tape-notebook button,
.tape-notebook input,
.tape-notebook select,
.tape-notebook textarea {
    font: inherit;
}

.tape-notebook-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(230px, 0.32fr);
    gap: 1.25rem;
    align-items: end;
    margin-bottom: 1rem;
    padding: clamp(1.4rem, 4vw, 3.2rem);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    background:
        radial-gradient(
            circle at 100% 0,
            rgba(255, 74, 84, 0.18),
            transparent 420px
        ),
        var(--surface);
    box-shadow: var(--shadow);
}

.tape-notebook-hero h1 {
    max-width: 850px;
    margin: 0 0 1rem;
    color: var(--accent);
    font-family: "Gobold", Impact, sans-serif;
    font-size: clamp(3rem, 7vw, 6.2rem);
    line-height: 0.94;
    text-transform: uppercase;
    text-wrap: balance;
}

.tape-notebook-intro {
    max-width: 780px;
    margin: 0;
    color: var(--text-soft);
    font-size: clamp(1.02rem, 1.7vw, 1.22rem);
    line-height: 1.6;
}

.tape-notebook-privacy {
    padding: 1rem;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-medium);
    background: rgba(0, 0, 0, 0.25);
}

.tape-notebook-privacy strong,
.tape-notebook-privacy span {
    display: block;
}

.tape-notebook-privacy strong {
    margin-bottom: 0.3rem;
    color: var(--accent-soft);
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tape-notebook-privacy span {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.45;
}

.notebook-manager {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
    background: var(--surface);
}

.notebook-manager-field {
    width: min(100%, 520px);
}

.notebook-manager-field label,
.notebook-field label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.notebook-manager-field select,
.notebook-field input,
.notebook-field select,
.notebook-field textarea {
    width: 100%;
    min-height: 48px;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-small);
    background: #0b0b0b;
    color: #ffffff;
}

.notebook-field textarea {
    min-height: 128px;
    resize: vertical;
    line-height: 1.55;
}

.notebook-manager-field select:focus,
.notebook-field input:focus,
.notebook-field select:focus,
.notebook-field textarea:focus {
    border-color: var(--accent);
}

.notebook-field small {
    display: block;
    margin-top: 0.45rem;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.45;
}

.notebook-manager-actions,
.note-form-actions,
.export-actions,
.video-tool-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.danger-button {
    border-color: #6c2b2f;
    color: #ffb7bb;
}

.danger-button:hover,
.danger-button:focus-visible {
    border-color: var(--accent);
    background: rgba(255, 74, 84, 0.14);
}

.tape-notebook-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(270px, 0.5fr);
    gap: 1rem;
    align-items: start;
}

.tape-notebook-main,
.tape-notebook-sidebar {
    display: grid;
    gap: 1rem;
}

.tape-notebook-sidebar {
    position: sticky;
    top: 84px;
}

.notebook-panel {
    min-width: 0;
    padding: clamp(1rem, 2.5vw, 1.5rem);
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.015),
            transparent 55%
        ),
        var(--notebook-panel);
}

.notebook-panel-header,
.notes-panel-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.notebook-panel-header h2,
.notes-panel-header h2 {
    margin: 0;
    color: #ffffff;
    font-family: "Gobold", Impact, sans-serif;
    font-size: clamp(1.65rem, 3vw, 2.55rem);
    line-height: 1;
    text-transform: uppercase;
    text-wrap: balance;
}

.fight-details-grid,
.note-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.video-source-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(230px, 0.5fr);
    gap: 0.85rem;
    margin-top: 0.85rem;
}

.notebook-input-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
}

.video-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 390px;
    overflow: hidden;
    border: 1px solid var(--notebook-line);
    border-radius: 12px;
    background: #050505;
}

.video-placeholder {
    display: grid;
    max-width: 440px;
    gap: 0.35rem;
    padding: 1.25rem;
    color: var(--muted);
    text-align: center;
}

.video-placeholder strong {
    color: #ffffff;
    font-size: 1.05rem;
}

.youtube-player,
.youtube-player iframe,
.html-video-player {
    width: 100%;
    height: 100%;
    min-height: 390px;
}

.youtube-player iframe,
.html-video-player {
    display: block;
    border: 0;
    background: #000000;
    object-fit: contain;
}

.video-time-display {
    min-width: 90px;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border-bright);
    border-radius: 999px;
    background: #080808;
    color: var(--accent-soft);
    font-family: "Courier New", monospace;
    font-size: 0.9rem;
    text-align: center;
}

.video-tool-row {
    margin-top: 0.8rem;
}

.video-tool-row .primary-button {
    margin-left: auto;
}

.keyboard-hint {
    color: var(--muted);
    font-size: 0.72rem;
}

.note-form-actions {
    margin-top: 0.85rem;
}

.notebook-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    margin: 0;
}

.notebook-stat-grid div {
    min-width: 0;
    padding: 0.8rem;
    border: 1px solid var(--notebook-line);
    border-radius: var(--radius-small);
    background: #0a0a0a;
}

.notebook-stat-grid dt {
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.notebook-stat-grid dd {
    margin: 0.3rem 0 0;
    color: var(--accent);
    font-family: "Gobold", Impact, sans-serif;
    font-size: 1.45rem;
    line-height: 1;
    overflow-wrap: anywhere;
}

.export-actions {
    display: grid;
    grid-template-columns: 1fr;
}

.export-actions .secondary-button {
    width: 100%;
}

.notebook-help ol {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--text-soft);
}

.notebook-help li {
    margin-bottom: 0.6rem;
}

.notebook-help li:last-child {
    margin-bottom: 0;
}

.notes-panel {
    margin-top: 1rem;
}

.note-filters {
    display: grid;
    grid-template-columns:
        minmax(220px, 1.35fr)
        repeat(4, minmax(135px, 0.5fr));
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.notes-empty-state {
    display: grid;
    place-items: center;
    min-height: 180px;
    padding: 1.25rem;
    border: 1px dashed var(--border-bright);
    border-radius: 10px;
    color: var(--muted);
    text-align: center;
}

.notes-empty-state strong,
.notes-empty-state span {
    display: block;
}

.notes-empty-state strong {
    margin-bottom: 0.3rem;
    color: #ffffff;
}

.tape-note-list {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tape-note {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.85rem;
    align-items: start;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}

.tape-note-time {
    display: inline-flex;
    min-width: 76px;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: rgba(255, 74, 84, 0.08);
    color: #ffffff;
    font-family: "Courier New", monospace;
    font-weight: 800;
    cursor: pointer;
}

.tape-note-time:hover,
.tape-note-time:focus-visible {
    background: var(--accent);
    color: #080808;
}

.tape-note-content {
    min-width: 0;
}

.tape-note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.55rem;
}

.tape-note-tag {
    display: inline-flex;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-bright);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tape-note-subject {
    border-color: rgba(255, 74, 84, 0.55);
    color: var(--accent-soft);
}

.tape-note-content p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.6;
    white-space: pre-wrap;
}

.tape-note-actions {
    display: flex;
    gap: 0.4rem;
}

.tape-note-actions button {
    min-height: 40px;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-small);
    background: #0b0b0b;
    color: var(--text-soft);
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
}

.tape-note-actions button:hover,
.tape-note-actions button:focus-visible {
    border-color: var(--accent);
    color: #ffffff;
}

.notebook-status {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 150;
    max-width: min(360px, calc(100% - 2rem));
    margin: 0;
    padding: 0.75rem 0.95rem;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-small);
    background: rgba(10, 10, 10, 0.96);
    color: #ffffff;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition:
        opacity 150ms ease,
        transform 150ms ease;
}

.notebook-status-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1000px) {
    .tape-notebook-layout {
        grid-template-columns: 1fr;
    }

    .tape-notebook-sidebar {
        position: static;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .note-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .tape-notebook-hero {
        grid-template-columns: 1fr;
        padding: 1.1rem;
        border-radius: var(--radius-medium);
    }

    .tape-notebook-hero h1 {
        font-size: clamp(2.15rem, 10vw, 3.2rem);
        line-height: 1.02;
    }

    .notebook-manager {
        align-items: stretch;
        flex-direction: column;
    }

    .notebook-manager-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .notebook-manager-actions button {
        width: 100%;
    }

    .tape-notebook-sidebar {
        grid-template-columns: 1fr;
    }

    .notebook-panel {
        padding: 1rem;
    }

    .notebook-panel-header,
    .notes-panel-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.45rem;
    }

    .notebook-panel-header h2,
    .notes-panel-header h2 {
        font-size: clamp(1.55rem, 7vw, 2.1rem);
    }

    .fight-details-grid,
    .note-meta-grid,
    .video-source-grid,
    .note-filters {
        grid-template-columns: 1fr;
    }

    .notebook-input-action {
        grid-template-columns: 1fr;
    }

    .notebook-input-action .primary-button {
        width: 100%;
    }

    .video-stage,
    .youtube-player,
    .youtube-player iframe,
    .html-video-player {
        min-height: 0;
        aspect-ratio: 16 / 9;
    }

    .video-tool-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .video-tool-row .primary-button {
        grid-column: 1 / -1;
        width: 100%;
        margin-left: 0;
    }

    .keyboard-hint {
        display: none;
    }

    .note-form-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .note-form-actions button {
        width: 100%;
    }

    .notebook-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .notes-panel-header .danger-button {
        width: 100%;
    }

    .tape-note {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .tape-note-time {
        width: fit-content;
    }

    .tape-note-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tape-note-actions button {
        min-height: 44px;
    }

    .notebook-status {
        right: 0.7rem;
        bottom: max(0.7rem, env(safe-area-inset-bottom));
        left: 0.7rem;
        max-width: none;
    }
}

@media (max-width: 420px) {
    .notebook-manager-actions,
    .notebook-stat-grid {
        grid-template-columns: 1fr;
    }
}
