:root {
    --bg-1: #f9f6ef;
    --bg-2: #eaf3f0;
    --surface: rgba(255, 255, 255, 0.78);
    --surface-strong: #ffffff;
    --text-main: #122025;
    --text-subtle: #4f646d;
    --stroke: rgba(18, 32, 37, 0.12);
    --accent: #0a7f62;
    --accent-soft: #d6f6ec;
    --warn: #d4571b;
    --shadow: 0 24px 52px rgba(10, 46, 38, 0.14);
}

* {
    box-sizing: border-box;
}

.portability-tools {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 8px 10px;
    background: #ffffff;
    min-width: 210px;
}

.portability-actions {
    display: inline-flex;
    gap: 6px;
}

.player-dock {
    margin-top: 14px;
    border: 1px solid rgba(18, 32, 37, 0.12);
    border-radius: 16px;
    background: #f8fffc;
    padding: 10px;
}

.player-card.large {
    width: min(1320px, calc(100vw - 12px));
    max-height: calc(100vh - 12px);
}

.player-card.large .player-frame-wrap {
    padding-top: min(64vh, 56.25%);
}

.player-card.docked {
    width: 100%;
    box-shadow: none;
    border: 1px solid rgba(18, 32, 37, 0.1);
}

.player-card.docked .close-player-btn {
    display: none;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    color: var(--text-main);
    background: radial-gradient(circle at 10% 10%, #fff6d5 0%, transparent 35%),
        radial-gradient(circle at 80% 90%, #c9efdf 0%, transparent 35%),
        linear-gradient(145deg, var(--bg-1), var(--bg-2));
    padding: 28px 16px 60px;
}
.aurora {
    display: none;
}

.aurora-one {
    width: 280px;
    height: 280px;
    top: 12px;
    left: 12px;
    background: #f5b189;
    animation: driftOne 9s ease-in-out infinite alternate;
}

.aurora-two {
    width: 380px;
    height: 380px;
    bottom: 10px;
    right: 5%;
    background: #7bd7b4;
    animation: driftTwo 10s ease-in-out infinite alternate;
}

.app-shell {
    position: relative;
    z-index: 2;
    width: min(1080px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 18px;
}

.hero-card,
.dashboard {
    background: var(--surface);
    border: 1px solid var(--stroke);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 26px;
    animation: riseIn 0.55s ease both;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

h1 {
    margin: 0;
    font-family: "Sora", "Segoe UI", sans-serif;
    font-size: clamp(1.75rem, 3.4vw, 2.6rem);
    line-height: 1.14;
}

.hero-subtitle {
    margin: 12px 0 0;
    color: var(--text-subtle);
    max-width: 70ch;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-subtle);
}

.field span {
    font-weight: 600;
}

.label-with-help {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.help-icon-btn {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid rgba(10, 127, 98, 0.35);
    background: #eefaf5;
    color: #0a6e55;
    font-weight: 800;
    cursor: pointer;
    line-height: 1;
}

.field-hint {
    color: #56707a;
    font-size: 0.8rem;
}

input,
select {
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--surface-strong);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.98rem;
}

input:focus,
select:focus,
button:focus-visible {
    outline: 2px solid #6fcbb0;
    outline-offset: 1px;
}

.action-row {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    border: 0;
    border-radius: 999px;
    padding: 11px 18px;
    font-family: "Sora", sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.btn-primary {
    background: linear-gradient(90deg, #0a7f62, #0c9170);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(12, 145, 112, 0.26);
}

.btn-subtle {
    background: #fff5ef;
    color: var(--warn);
    border: 1px solid rgba(212, 87, 27, 0.2);
}

.status-text {
    margin: 0;
    color: var(--text-subtle);
    font-size: 0.93rem;
}

.dashboard {
    padding: 20px;
    animation: riseIn 0.7s ease both;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.stat-card {
    background: var(--surface-strong);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    padding: 14px;
}

.stat-card p {
    margin: 0;
    color: var(--text-subtle);
    font-weight: 600;
    font-size: 0.9rem;
}

.stat-card h2 {
    margin: 8px 0 0;
    font-family: "Sora", sans-serif;
    font-size: clamp(1.15rem, 2.8vw, 1.62rem);
}

.stat-accent {
    background: var(--accent-soft);
    border-color: rgba(10, 127, 98, 0.28);
}

.motivation {
    margin-top: 14px;
    background: #f0fbf7;
    border: 1px dashed rgba(10, 127, 98, 0.35);
    color: #1e5a48;
    border-radius: 14px;
    padding: 12px 14px;
    min-height: 48px;
}

.plan-controls {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 10px;
}

.plan-finish-card {
    min-width: 170px;
    padding: 10px 12px;
}

.plan-finish-card h2 {
    font-size: 1.35rem;
}

.inline-setting {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--text-subtle);
    font-size: 0.84rem;
    font-weight: 700;
}

#bufferMinutes {
    width: 145px;
}

#startTime {
    width: 170px;
}

.time-input-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mini-action-btn {
    border: 1px solid rgba(10, 127, 98, 0.3);
    background: #f3fbf8;
    color: #176350;
    border-radius: 8px;
    height: 40px;
    padding: 0 10px;
    cursor: pointer;
    font-weight: 700;
}

.plan-hint {
    margin: 8px 0 0;
    color: #45666f;
    font-size: 0.82rem;
}

.controls-wrap {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.tabs {
    display: inline-flex;
    background: #edf7f3;
    border-radius: 999px;
    padding: 4px;
    border: 1px solid rgba(10, 127, 98, 0.2);
}

.tab {
    border: 0;
    border-radius: 999px;
    padding: 9px 13px;
    background: transparent;
    color: var(--text-subtle);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.tab.active {
    background: #ffffff;
    color: #154e3f;
    box-shadow: 0 5px 14px rgba(10, 127, 98, 0.15);
}

.chip {
    background: #e1f7ee;
    color: #0a7f62;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

.sequence-picker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-subtle);
    font-weight: 700;
}

.video-list {
    margin-top: 16px;
    display: grid;
    gap: 10px;
}

.video-item {
    display: grid;
    grid-template-columns: auto auto 128px 1fr auto;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--stroke);
    border-radius: 14px;
    padding: 11px 12px;
    background: #ffffff;
    transition: transform 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.video-item:hover {
    transform: translateY(-1px);
    border-color: rgba(10, 127, 98, 0.3);
}

.video-item.completed {
    opacity: 0.58;
    filter: grayscale(0.4);
    background: #f6f6f6;
}

.video-item.dragging {
    opacity: 0.35;
}

.video-item.drag-over {
    border-color: #0a7f62;
    box-shadow: 0 0 0 2px rgba(10, 127, 98, 0.16) inset;
}

.video-check {
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.drag-handle {
    width: 22px;
    height: 28px;
    border-radius: 8px;
    border: 1px dashed rgba(18, 32, 37, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #678088;
    user-select: none;
    visibility: hidden;
}

.video-item.drag-ready .drag-handle {
    visibility: visible;
    cursor: grab;
}

.video-item.dragging .drag-handle {
    cursor: grabbing;
}

.video-meta {
    min-width: 0;
}

.video-thumb {
    width: 128px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
    background: #e5ece9;
    border: 1px solid rgba(18, 32, 37, 0.08);
}

.video-title {
    margin: 0;
    font-weight: 700;
    font-size: 0.98rem;
    color: #1d2a2f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-link {
    margin: 4px 0 0;
    font-size: 0.84rem;
    color: #367565;
}

.video-upload {
    margin: 3px 0 0;
    font-size: 0.8rem;
    color: #5b7078;
}

.video-side {
    display: flex;
    align-items: center;
    gap: 8px;
}

.watch-btn {
    border: 1px solid rgba(10, 127, 98, 0.35);
    border-radius: 8px;
    background: #eefaf5;
    color: #0a6e55;
    padding: 5px 9px;
    font-weight: 700;
    cursor: pointer;
}

.duration {
    color: var(--text-subtle);
    font-weight: 700;
    min-width: 60px;
    text-align: right;
}

.manual-actions {
    display: inline-flex;
    gap: 4px;
}

.mini-btn {
    border: 1px solid rgba(10, 127, 98, 0.28);
    background: #f2fbf8;
    color: #145a48;
    border-radius: 8px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-weight: 700;
}

.empty-state {
    background: #ffffff;
    border: 1px dashed var(--stroke);
    border-radius: 14px;
    text-align: center;
    padding: 28px 16px;
}

.empty-state h3 {
    margin: 0;
    font-family: "Sora", sans-serif;
}

.empty-state p {
    margin: 8px 0 0;
    color: var(--text-subtle);
}

.hidden {
    display: none;
}

.player-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
}

.player-modal.hidden {
    display: none;
}

.player-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 16, 20, 0.62);
    backdrop-filter: blur(4px);
}

.player-card {
    position: relative;
    z-index: 2;
    width: min(1120px, calc(100% - 20px));
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(18, 32, 37, 0.14);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
    padding: 14px;
    animation: riseIn 0.25s ease both;
}

.player-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 10px;
}

.player-kicker {
    margin: 0;
    color: #578074;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.player-mini {
    margin: 4px 0 0;
    color: #4b6f77;
    font-size: 0.8rem;
    font-weight: 700;
}

#playerTitle {
    margin: 6px 0 0;
    font-family: "Sora", sans-serif;
    font-size: 1.05rem;
}

.close-player-btn {
    border: 0;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    background: #fff2ea;
    color: #9e471e;
    font-weight: 800;
}

.player-frame-wrap {
    margin-top: 10px;
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: 12px;
    overflow: hidden;
    background: #0a1513;
}

.player-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.player-controls {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.quick-modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
}

.quick-modal.hidden {
    display: none;
}

.quick-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 16, 18, 0.55);
}

.quick-card {
    position: relative;
    z-index: 1;
    width: min(620px, calc(100% - 24px));
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid var(--stroke);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
    padding: 18px;
}

.quick-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 8px;
}

.quick-head h3 {
    margin: 0;
    font-family: "Sora", sans-serif;
}

.help-steps {
    margin: 12px 0 0;
    padding-left: 20px;
    color: #344f57;
}

.help-steps li {
    margin-bottom: 6px;
}

.help-note {
    margin: 8px 0 0;
    color: #4f6971;
    font-size: 0.9rem;
}

.merge-actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.export-option {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #344f57;
    font-weight: 700;
}

.completion-card {
    text-align: center;
}

.big-tick {
    width: 90px;
    height: 90px;
    margin: 0 auto 10px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 3rem;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(135deg, #0ea376, #0a7f62);
}

.completion-card h3 {
    margin: 0;
    font-family: "Sora", sans-serif;
}

.completion-card p {
    color: #456169;
}

.app-footer {
    position: relative;
    z-index: 2;
    width: min(1080px, 100%);
    margin: 14px auto 0;
    color: #55757d;
    font-size: 0.86rem;
}

.app-footer p {
    margin: 0;
}

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

@keyframes driftOne {
    from {
        transform: translate(0, 0);
    }
    to {
        transform: translate(24px, -12px);
    }
}

@keyframes driftTwo {
    from {
        transform: translate(0, 0);
    }
    to {
        transform: translate(-28px, 14px);
    }
}

@media (max-width: 880px) {
    .input-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .video-item {
        grid-template-columns: auto auto 1fr;
    }

    .video-thumb {
        grid-column: 3;
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .video-side {
        grid-column: 3;
        justify-content: space-between;
    }

    .player-controls {
        justify-content: stretch;
    }

    .plan-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 560px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}