:root {
    --bg-1: #f4f1ea;
    --bg-2: #d8e3d2;
    --ink: #192126;
    --muted: #55626c;
    --surface: #fffefc;
    --stroke: #d8d2c9;
    --accent: #0d8f77;
    --accent-strong: #086f5c;
    --card-shadow: 0 16px 40px rgba(15, 25, 31, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: "IBM Plex Sans", sans-serif;
    background: radial-gradient(circle at top right, #f7e6ce 0, transparent 40%), linear-gradient(145deg, var(--bg-1), var(--bg-2));
    min-height: 100vh;
}

.layout {
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 20px 56px;
}

.hero h1 {
    font: 700 2.1rem/1.08 "Space Grotesk", sans-serif;
    margin: 0 0 10px;
}

.hero-kicker {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--accent-strong);
    font-size: 0.78rem;
}

.hero-text {
    margin: 0;
    color: var(--muted);
    max-width: 70ch;
}

.search-box {
    margin-top: 24px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #ffffff;
    backdrop-filter: blur(4px);
    border-radius: 16px;
    padding: 14px;
}

.search-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.tabs {
    display: inline-flex;
    gap: 8px;
    margin-bottom: 10px;
}

.tab-btn {
    border: 1px solid var(--stroke);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: 7px 14px;
    font-weight: 700;
    cursor: pointer;
}

.tab-btn.is-active {
    background: linear-gradient(180deg, #17a98c, var(--accent-strong));
    border-color: transparent;
    color: #fff;
}

.search-row {
    display: flex;
    gap: 10px;
}

#query {
    width: 100%;
    border: 1px solid var(--stroke);
    background: var(--surface);
    border-radius: 11px;
    padding: 12px 14px;
    font-size: 1rem;
}

#query:focus {
    outline: 2px solid rgba(13, 143, 119, 0.35);
    border-color: var(--accent);
}

#search-btn {
    border: none;
    background: linear-gradient(180deg, #17a98c, var(--accent-strong));
    color: white;
    font-weight: 700;
    padding: 0 18px;
    border-radius: 11px;
    cursor: pointer;
    transition: transform 140ms ease;
}

#search-btn:hover {
    transform: translateY(-1px);
}

.status {
    min-height: 22px;
    margin: 10px 0 2px;
    color: var(--muted);
    font-size: 0.95rem;
}

.results {
    margin-top: 16px;
    display: grid;
    gap: 12px;
}

.confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 28, 32, 0.45);
    display: grid;
    place-items: center;
    z-index: 1000;
    padding: 20px;
}

.confirm-backdrop.is-hidden {
    display: none;
}

.confirm-modal {
    width: min(420px, 100%);
    background: #fffefc;
    border: 1px solid var(--stroke);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 20px 40px rgba(10, 20, 25, 0.2);
}

.confirm-modal h3 {
    margin: 0 0 8px;
    font: 700 1.05rem/1.2 "Space Grotesk", sans-serif;
}

.confirm-modal p {
    margin: 0;
    color: var(--muted);
}

.confirm-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.confirm-btn {
    border-radius: 10px;
    border: none;
    font-weight: 700;
    padding: 9px 13px;
    cursor: pointer;
}

.confirm-btn.secondary {
    background: #e9ece8;
    color: #203039;
}

.confirm-btn.primary {
    background: linear-gradient(180deg, #e98a2f, #c86d15);
    color: #fff;
}

.episode-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    background: var(--surface);
    border: 1px solid rgba(25, 33, 38, 0.08);
    border-radius: 14px;
    padding: 12px;
    box-shadow: var(--card-shadow);
    animation: fadeIn 260ms ease both;
}

.episode-header {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    width: 100%;
}

.episode-main {
    min-width: 0;
}

.cover {
    width: 108px;
    height: 108px;
    border-radius: 10px;
    object-fit: cover;
    background: #eef0ee;
}

.show-title {
    margin: 0;
    color: var(--accent-strong);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    font-weight: 700;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.episode-title {
    margin: 2px 0 8px;
    font: 700 1.05rem/1.3 "Space Grotesk", sans-serif;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.meta {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.88rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.favorite-btn {
    border: 1px solid var(--stroke);
    background: #fff;
    color: #19333a;
    border-radius: 999px;
    padding: 6px 11px;
    font-weight: 700;
    cursor: pointer;
}

.favorite-btn.is-favorite {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(180deg, #f59b00, #d17a00);
}

.resume-meta {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}


.episode-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: stretch;
    width: 100%;
}

.notes-pane,
.player-pane {
    border: 1px solid var(--stroke);
    border-radius: 10px;
    background: #f6f4ef;
    padding: 9px 10px;
    min-height: 220px;
    width: 100%;
}

.pane-title {
    margin: 0 0 8px;
    font: 700 0.92rem/1.2 "Space Grotesk", sans-serif;
    color: #2f3b43;
    letter-spacing: 0.02em;
}

.description {
    margin: 0;
    white-space: pre-wrap;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 0.9rem;
    color: #2f3b43;
    height: 175px;
    overflow: auto;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.notes-details {
    margin: 0;
}

.notes-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #2f3b43;
    margin-bottom: 6px;
}

.notes-details:not([open]) .description {
    height: 92px;
    overflow: hidden;
}

.notes-details[open] .description {
    height: 175px;
    overflow: auto;
}

.player-controls-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    height: 175px;
    width: 100%;
}

.skip-btn {
    border: none;
    background: linear-gradient(180deg, #17a98c, var(--accent-strong));
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    border-radius: 9px;
    cursor: pointer;
    width: 52px;
    height: 42px;
    flex: 0 0 auto;
}

.skip-btn:hover {
    filter: brightness(1.03);
}

.media-wrap {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
}

.mount-btn {
    width: 100%;
    border: none;
    background: linear-gradient(180deg, #17a98c, var(--accent-strong));
    color: #fff;
    font-weight: 700;
    border-radius: 10px;
    min-height: 44px;
    cursor: pointer;
}

.mount-btn:hover {
    filter: brightness(1.03);
}

.episode-media {
    width: 100%;
    max-width: 100%;
}

.media-wrap audio,
.media-wrap video {
    width: 100%;
    max-width: 100%;
    border-radius: 8px;
    background: #dfe6e2;
}

.media-wrap video {
    max-height: 280px;
}

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

@media (max-width: 900px) {
    .notes-pane,
    .player-pane {
        min-height: 0;
    }

    .player-controls-inline {
        height: auto;
    }

    .skip-btn {
        width: 52px;
        height: 38px;
    }
}

@media (max-width: 760px) {
    .hero h1 {
        font-size: 1.65rem;
    }

    .search-row {
        flex-direction: column;
    }

    #search-btn {
        height: 44px;
    }

    .episode-card {
        padding: 10px;
    }

    .episode-header {
        grid-template-columns: 86px minmax(0, 1fr);
        gap: 10px;
    }

    .player-pane {
        overflow: hidden;
    }

    .player-controls-inline {
        height: auto;
        align-items: center;
    }

    .skip-btn {
        width: 44px;
        height: 36px;
        font-size: 13px;
        padding: 0;
    }

    .cover {
        width: 86px;
        height: 86px;
    }
}
