:root {
    --brand: lch(71% 29% 258deg);
    --brand-light: lch(85% 20% 258deg);
    --brand-fallback: #6a7aff;
    --surface: #ffffff;
    --surface-soft: #f5f7ff;
    --surface-strong: #eef3ff;
    --text: #243047;
    --muted: #5f6980;
    --border: #d8def4;
    --shadow: 0 24px 50px rgba(62, 92, 170, 0.12);
    font-size: 18px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: 'Segoe UI', 'Apple SD Gothic Neo', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(137, 164, 255, 0.35), transparent 28%),
        radial-gradient(circle at top right, rgba(196, 214, 255, 0.75), transparent 24%),
        linear-gradient(180deg, #f8fbff 0%, #f4f7ff 42%, #fbfcff 100%);
    user-select: none;
}

input, .time-input {
    user-select: text;
}

a, a:hover, a:visited {
    color: inherit;
    text-decoration: none;
}

.page-shell {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid rgba(216, 222, 244, 0.7);
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}

.hero__glow {
    position: absolute;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    filter: blur(6px);
    opacity: 0.55;
}

.hero__glow--left {
    top: -180px;
    left: -120px;
    background: rgba(118, 145, 255, 0.28);
}

.hero__glow--right {
    right: -100px;
    bottom: -170px;
    background: rgba(175, 195, 255, 0.34);
}

.hero__inner {
    position: relative;
    padding: 28px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.brand__logo {
    width: 104px;
    height: auto;
}

.brand__eyebrow {
    color: var(--muted);
    font-size: 0.9rem;
}

.brand h1 {
    margin: 0;
    color: var(--brand);
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.05;
}

.hero__lead {
    max-width: 760px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.hero__kicker {
    margin: 22px 0 0;
    color: var(--brand);
    font-size: 0.96rem;
    font-weight: 700;
}

.stack {
    display: grid;
    gap: 20px;
}

.card {
    border: 1px solid rgba(216, 222, 244, 0.9);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
}

.panel {
    padding: 24px;
}

.section-title {
    margin: 0;
    font-size: 1.35rem;
}

.dropzone {
    margin-top: 20px;
    border: 3px dashed #aecaef;
    border-radius: 28px;
    padding: 46px 24px;
    background:
        linear-gradient(180deg, rgba(245, 248, 255, 0.96), rgba(238, 244, 255, 0.98)),
        var(--surface-soft);
    text-align: center;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.dropzone.is-dragover {
    border-color: var(--brand);
    background:
        linear-gradient(180deg, rgba(231, 239, 255, 0.98), rgba(224, 234, 255, 0.98)),
        var(--surface-strong);
    transform: translateY(-1px);
}

.dropzone__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 26px;
    border: none;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(91, 115, 216, 0.22);
}

.dropzone__title {
    margin: 0 0 12px;
    color: var(--brand);
    font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.dropzone__copy {
    max-width: 580px;
    margin: 0 auto 16px;
    color: var(--muted);
    line-height: 1.6;
}

.dropzone__hint {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--muted);
}

.editor-container {
    display: none;
    flex-direction: column;
    gap: 20px;
}

.editor-container.is-active {
    display: flex;
}

.video-player-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

#videoPlayer {
    width: 100%;
    height: 100%;
    display: block;
}

.current-time-display {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    pointer-events: none;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.video-actions {
    display: flex;
    gap: 12px;
    margin-top: -4px;
}

.video-actions .btn {
    min-width: 120px;
}

.timeline {
    position: relative;
    height: 40px;
    background: var(--surface-strong);
    border-radius: 8px;
    margin: 10px 0;
    cursor: pointer;
}

.timeline__range {
    position: absolute;
    height: 100%;
    background: rgba(106, 122, 255, 0.3);
    border-left: 2px solid var(--brand);
    border-right: 2px solid var(--brand);
    pointer-events: none;
}

.timeline__handle {
    position: absolute;
    top: -5px;
    bottom: -5px;
    width: 4px;
    background: var(--brand);
    pointer-events: none;
}

.timeline__handle::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: var(--brand);
    border-radius: 50%;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    background: var(--surface-soft);
    padding: 20px;
    border-radius: 16px;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-item label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--muted);
}

.time-input {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    text-align: center;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s;
}

.time-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(106, 122, 255, 0.1);
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn--primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 8px 16px rgba(106, 122, 255, 0.2);
}

.btn--danger {
    background: #d93025;
    box-shadow: 0 8px 16px rgba(217, 48, 37, 0.2);
    color: #fff;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gallery-section {
    margin-top: 24px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.capture-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 16 / 9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.capture-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
}

.capture-item__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-family: monospace;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.capture-item__delete {
    background: none;
    border: none;
    color: #ff5252;
    padding: 2px;
    cursor: pointer;
    font-weight: bold;
}

.status-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 100;
    width: min(720px, calc(100% - 24px));
    transform: translateX(-50%);
    padding: 16px 18px;
    border: 1px solid rgba(106, 122, 255, 0.2);
    border-radius: 20px;
    background: rgba(36, 48, 71, 0.94);
    color: #fff;
    box-shadow: 0 24px 50px rgba(23, 31, 49, 0.28);
    backdrop-filter: blur(16px);
}

.status-toast strong { display: block; font-size: 0.96rem; }
.status-toast span { display: block; margin-top: 6px; color: rgba(255, 255, 255, 0.84); line-height: 1.5; }

.progress-bar {
    margin-top: 12px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    transition: width 0.4s ease;
}

.editor-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.reset-trigger {
    background: none;
    border: none;
    color: #d93025;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 8px;
    text-decoration: underline;
    opacity: 0.8;
}

.reset-trigger:hover {
    opacity: 1;
}

.confirm-dialog {
    border: none;
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
    width: min(400px, calc(100% - 32px));
}

.confirm-dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.confirm-dialog__msg {
    margin: 0 0 20px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    color: var(--text);
}

.confirm-dialog__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

@media (max-width: 640px) {
    .page-shell { width: min(100% - 20px, 1080px); padding-top: 12px; }
    .controls-grid { grid-template-columns: 1fr; }
}
