* {
    box-sizing: border-box;
}

:root {
    --bg: #0d0f12;
    --bg-soft: #12161b;
    --panel: #171b20;
    --panel-2: #1d2229;
    --panel-3: #232a33;
    --border: #2b323b;
    --border-light: #3a424d;
    --text: #f7f7f7;
    --muted: #a8b0bb;
    --muted-2: #747d89;
    --pink: #ff6cfe;
    --yellow: #fff5ad;
    --green: #1eb980;
    --red: #c21846;
    --card-height: 210px;
    --shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, Arial, Helvetica, sans-serif;
    background: radial-gradient(circle at top left, rgba(255, 108, 254, 0.14), transparent 34rem), radial-gradient(circle at top right, rgba(255, 245, 173, 0.12), transparent 32rem), radial-gradient(circle at 50% 100%, rgba(255, 108, 254, 0.06), transparent 28rem), var(--bg);
    color: var(--text);
}

body {
    min-height: 100vh;
    overflow-x: hidden;
}

button {
    font: inherit;
}

.page {
    min-height: 100vh;
    padding: 18px 40px;
}

.site-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    max-width: 1120px;
    margin: 0 auto 22px;
    padding-bottom: 16px;
}

    .site-header::after {
        content: "";
        position: absolute;
        left: 0;
        right: 86px;
        bottom: 0;
        height: 1px;
        background: rgba(255, 245, 173, 0.13);
    }

.header-credit {
    position: absolute;
    right: 0;
    bottom: -0.55em;
    color: var(--muted-2);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.015em;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55), 0 0 10px rgba(255, 108, 254, 0.08);
}

.brand-row {
    display: flex;
    align-items: flex-end;
    gap: 22px;
}

.logo {
    margin: 0;
    font-size: clamp(3rem, 5vw, 4.35rem);
    line-height: 0.95;
    letter-spacing: -0.08em;
    font-weight: 900;
    color: var(--text);
    text-shadow: 0 0 28px rgba(255, 108, 254, 0.08);
}

    .logo span {
        color: var(--pink);
        text-shadow: 0 0 14px rgba(255, 108, 254, 0.42), 0 0 24px rgba(255, 245, 173, 0.18);
    }

.tagline {
    margin: 0 0 0.42em;
    color: var(--muted);
    font-size: 1rem;
    max-width: 520px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 0;
}

.pill-button {
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid rgba(255, 245, 173, 0.24);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 245, 173, 0.075), rgba(255, 108, 254, 0.045)), rgba(255, 255, 255, 0.025);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 20px rgba(0, 0, 0, 0.12);
}

    .pill-button:hover {
        border-color: rgba(255, 108, 254, 0.78);
        background: linear-gradient(180deg, rgba(255, 245, 173, 0.095), rgba(255, 108, 254, 0.07)), rgba(255, 255, 255, 0.035);
        color: #ffffff;
    }

    .pill-button:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

.pill-icon {
    color: var(--yellow);
    font-size: 1.15rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.main-wrap {
    max-width: 1120px;
    width: 100%;
    margin: 0 auto;
}

.game-panel {
    width: 100%;
    background: linear-gradient(160deg, rgba(255, 108, 254, 0.055), rgba(255, 245, 173, 0.045) 48%, rgba(255, 255, 255, 0.012)), var(--panel);
    border: 1px solid rgba(255, 245, 173, 0.13);
    border-radius: 18px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.game-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 12px;
}

.submit-area {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    min-width: 300px;
}

.instruction-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
    font-size: 1.2rem;
    font-weight: 900;
}

.instruction-icon {
    color: var(--pink);
    text-shadow: 0 0 14px rgba(255, 108, 254, 0.38);
    font-size: 1.15rem;
}

#gameModeLabel {
    color: var(--yellow);
}

.board-section {
    margin-top: 14px;
}

.section-heading {
    margin-bottom: 12px;
    color: var(--yellow);
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bank-area {
    display: flex;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 14px;
    min-height: calc(var(--card-height) + 30px);
    padding: 14px;
    border: 1px solid rgba(255, 245, 173, 0.12);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015)), var(--panel-2);
}

    .bank-area.drag-over {
        border-color: rgba(255, 108, 254, 0.75);
        background: linear-gradient(180deg, rgba(255, 108, 254, 0.08), rgba(255, 245, 173, 0.04)), var(--panel-3);
    }

    .bank-area .video-card {
        flex: 0 0 calc((100% - 56px) / 5);
        min-width: 140px;
    }

.timeline-section {
    margin-top: 16px;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    padding: 0 4px;
    color: var(--muted);
    font-weight: 800;
    font-size: 0.92rem;
}

.timeline-line {
    height: 3px;
    margin-bottom: 15px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--pink) 0%, var(--yellow) 100%);
    box-shadow: 0 0 18px rgba(255, 108, 254, 0.18), 0 0 18px rgba(255, 245, 173, 0.12);
}

.timeline-scroll {
    overflow-x: auto;
    padding-bottom: 2px;
}

.timeline-area {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    gap: 14px;
    width: 100%;
    min-width: 760px;
}

.timeline-slot {
    position: relative;
    height: var(--card-height);
    min-height: var(--card-height);
    border: 2px dashed rgba(255, 245, 173, 0.18);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.008)), var(--panel-2);
    transition: border-color 120ms ease, background 120ms ease;
}

    .timeline-slot.drag-over {
        border-color: rgba(255, 108, 254, 0.75);
        background: linear-gradient(180deg, rgba(255, 108, 254, 0.08), rgba(255, 245, 173, 0.04)), var(--panel-3);
    }

    .timeline-slot.locked-slot {
        border-style: solid;
        border-color: rgba(30, 185, 128, 0.75);
    }

    .timeline-slot.filled {
        border-style: solid;
    }

.video-card {
    display: flex;
    flex-direction: column;
    height: var(--card-height);
    min-height: var(--card-height);
    padding: 9px;
    border: 1px solid rgba(255, 245, 173, 0.11);
    border-radius: 14px;
    background: linear-gradient(90deg, rgba(255, 108, 254, 0.06), rgba(255, 245, 173, 0.035)), var(--panel-2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 245, 173, 0.05);
    cursor: grab;
    user-select: none;
    overflow: hidden;
    transition: border-color 120ms ease, background 120ms ease, opacity 120ms ease, box-shadow 120ms ease;
}

.timeline-slot .video-card {
    height: 100%;
    min-height: 0;
}

.video-card:hover {
    border-color: rgba(255, 108, 254, 0.6);
    background: linear-gradient(90deg, rgba(255, 108, 254, 0.085), rgba(255, 245, 173, 0.055)), #222833;
}

.video-card:active {
    cursor: grabbing;
}

.video-card.dragging {
    opacity: 0.4;
}

.video-card.locked {
    cursor: default;
}

    .video-card.locked:hover {
        border-color: rgba(30, 185, 128, 1);
    }

.video-card.correct {
    border-color: rgba(30, 185, 128, 1);
    background: linear-gradient(180deg, rgba(30, 185, 128, 0.42), rgba(30, 185, 128, 0.15) 45%, transparent 88%), var(--panel-2);
    box-shadow: 0 0 0 2px rgba(30, 185, 128, 0.44), 0 0 24px rgba(30, 185, 128, 0.32), 0 8px 24px rgba(0, 0, 0, 0.22);
}

.video-card.incorrect {
    border-color: rgba(194, 24, 70, 1);
    background: linear-gradient(180deg, rgba(194, 24, 70, 0.5), rgba(194, 24, 70, 0.2) 48%, transparent 88%), var(--panel-2);
    box-shadow: 0 0 0 2px rgba(194, 24, 70, 0.58), 0 0 24px rgba(194, 24, 70, 0.34), 0 8px 24px rgba(0, 0, 0, 0.22);
}

.video-thumb-wrap {
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #111;
    display: block;
    border: 1px solid rgba(255, 245, 173, 0.16);
    margin-bottom: 8px;
}

.video-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.video-card-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.video-title {
    height: calc(1.16em * 3);
    min-height: calc(1.16em * 3);
    max-height: calc(1.16em * 3);
    font-size: 0.88rem;
    line-height: 1.16;
    font-weight: 900;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-date {
    display: block;
    height: 1.1em;
    min-height: 1.1em;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.1;
    font-weight: 700;
    visibility: hidden;
    overflow: hidden;
    white-space: nowrap;
}

    .video-date.show {
        visibility: visible;
    }

.bank-empty {
    display: grid;
    place-items: center;
    min-height: var(--card-height);
    width: 100%;
    border: 1px dashed rgba(255, 245, 173, 0.14);
    border-radius: 12px;
    color: var(--muted);
    font-weight: 700;
}

.primary-button,
.secondary-button,
.solved-random-button {
    min-height: 48px;
    border-radius: 12px;
    padding: 0 36px;
    font-weight: 900;
    cursor: pointer;
    border: 1px solid transparent;
}

.primary-button {
    color: #111;
    background: linear-gradient(135deg, var(--yellow) 0%, var(--pink) 100%);
    box-shadow: 0 10px 28px rgba(255, 108, 254, 0.24), 0 8px 22px rgba(255, 245, 173, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

    .primary-button:hover {
        filter: brightness(1.08);
    }

    .primary-button:disabled {
        opacity: 0.42;
        cursor: not-allowed;
        filter: grayscale(0.35);
        box-shadow: none;
    }

        .primary-button:disabled:hover {
            filter: grayscale(0.35);
        }

.secondary-button,
.solved-random-button {
    color: var(--text);
    background: linear-gradient(180deg, rgba(255, 245, 173, 0.05), rgba(255, 108, 254, 0.035)), rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 245, 173, 0.2);
}

    .secondary-button:hover,
    .solved-random-button:hover {
        border-color: rgba(255, 108, 254, 0.5);
    }

.solved-random-button {
    padding: 0 18px;
    white-space: nowrap;
}

.result-box {
    margin-top: 0;
}

.result-card {
    border: 1px solid rgba(255, 245, 173, 0.13);
    border-radius: 12px;
    background: linear-gradient(160deg, rgba(255, 108, 254, 0.04), rgba(255, 245, 173, 0.035)), rgba(255, 255, 255, 0.025);
    padding: 11px 14px;
    min-height: 48px;
    display: flex;
    align-items: center;
}

.result-score {
    font-size: 1rem;
    font-weight: 900;
    color: var(--yellow);
    margin-bottom: 0;
    white-space: nowrap;
}

.solved-result-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    min-height: 48px;
}

    .solved-result-row .result-card {
        min-width: 150px;
        justify-content: center;
    }

.solved-card {
    border-color: rgba(30, 185, 128, 0.55);
    background: linear-gradient(160deg, rgba(30, 185, 128, 0.18), rgba(255, 245, 173, 0.035)), rgba(255, 255, 255, 0.025);
}

.solved-score {
    color: var(--green);
}

.confetti-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 9999;
}

.confetti-piece {
    position: absolute;
    bottom: -18px;
    left: 50%;
    width: 10px;
    height: 16px;
    border-radius: 3px;
    opacity: 0;
    animation: confetti-rise 1050ms cubic-bezier(0.16, 0.84, 0.38, 1) forwards;
}

    .confetti-piece:nth-child(4n) {
        width: 8px;
        height: 8px;
        border-radius: 999px;
    }

    .confetti-piece:nth-child(4n + 1) {
        background: var(--pink);
    }

    .confetti-piece:nth-child(4n + 2) {
        background: var(--yellow);
    }

    .confetti-piece:nth-child(4n + 3) {
        background: var(--green);
    }

    .confetti-piece:nth-child(4n + 4) {
        background: #ffffff;
    }

@keyframes confetti-rise {
    0% {
        opacity: 0;
        transform: translate3d(0, 0, 0) rotate(0deg) scale(0.8);
    }

    10% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate3d(var(--confetti-x), var(--confetti-y), 0) rotate(var(--confetti-rotate)) scale(1);
    }
}

.warning-card {
    border: 1px solid rgba(255, 245, 173, 0.13);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
    padding: 16px;
    color: var(--muted);
    font-weight: 700;
}

@media (max-width: 900px) {
    .page {
        padding: 18px 16px;
    }

    .site-header {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 18px;
    }

        .site-header::after {
            right: 0;
        }

    .brand-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .tagline {
        margin-bottom: 0;
    }

    .header-actions {
        justify-content: flex-start;
    }

    .header-credit {
        right: auto;
        left: 0;
        padding-right: 14px;
    }

    .game-panel {
        padding: 16px;
    }

    .game-top-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .submit-area {
        width: 100%;
        min-width: 0;
        justify-content: space-between;
    }

    .bank-area .video-card {
        flex: 0 0 150px;
    }

    .timeline-area {
        min-width: 760px;
    }
}

@media (max-width: 560px) {
    :root {
        --card-height: 210px;
    }

    .logo {
        font-size: 3rem;
    }

    .tagline {
        font-size: 0.95rem;
    }

    .pill-button {
        min-height: 40px;
        padding: 0 14px;
        font-size: 0.9rem;
    }

    .header-credit {
        font-size: 0.74rem;
    }

    .instruction-row {
        font-size: 1.05rem;
    }

    .bank-area .video-card {
        flex-basis: 145px;
    }

    .submit-area {
        flex-direction: column;
        align-items: stretch;
    }

    .primary-button {
        width: 100%;
    }

    .solved-result-row {
        width: 100%;
    }

        .solved-result-row .result-card {
            flex: 1;
        }

    .solved-random-button {
        flex: 0 0 auto;
        padding: 0 14px;
    }

    .result-card {
        justify-content: center;
    }

    .video-title {
        font-size: 0.85rem;
    }
}
