:root {
    --bg: #12142A;
    --bg-panel: #1B1E3D;
    --card: #232752;
    --card-hover: #2B3062;
    --accent: #F2B84B;
    --accent-dim: rgba(242, 184, 75, 0.16);
    --accent-line: rgba(242, 184, 75, 0.28);
    --danger: #FF6F6F;
    --danger-dim: rgba(255, 111, 111, 0.14);
    --text: #F3F1EA;
    --text-dim: #9AA0C7;
    --border: rgba(255, 255, 255, 0.08);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 9px;
    --font-display: "Space Grotesk", sans-serif;
    --font-body: "Inter", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: radial-gradient(120% 140% at 50% -10%, #1D2148 0%, var(--bg) 55%, #0C0E1F 100%);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.stage {
    max-width: 720px;
    margin: 0 auto;
    padding: 56px 20px 80px;
}

/* ---------- Masthead ---------- */

.masthead {
    text-align: center;
    margin-bottom: 40px;
}

.masthead__eyebrow {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}

.masthead__title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 3.4rem);
    margin: 0;
    letter-spacing: -0.02em;
}

.masthead__sub {
    color: var(--text-dim);
    font-size: 15px;
    margin: 12px auto 0;
    max-width: 420px;
    line-height: 1.5;
}

/* ---------- Login page ---------- */

.stage--login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 30px;
    text-align: center;
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}

.login-card__title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2rem;
    margin: 8px 0 4px;
}

.login-card__sub {
    color: var(--text-dim);
    font-size: 14px;
    margin: 0 0 22px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-error--visible {
    display: block;
    margin-top: 14px;
}

/* ---------- Masthead top row / logout ---------- */

.masthead__top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    position: relative;
}

.logout-link {
    position: absolute;
    right: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 12px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.logout-link:hover {
    color: var(--text);
    border-color: var(--accent-line);
}

@media (max-width: 480px) {
    .logout-link {
        position: static;
        margin-top: 8px;
    }

    .masthead__top {
        flex-direction: column;
    }
}

/* ---------- Reel panel (signature element) ---------- */

.reel-panel {
    background: linear-gradient(160deg, var(--bg-panel), #171A38);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    margin-bottom: 44px;
}

.reel-panel__frame {
    position: relative;
    background: #0B0D1F;
    border-radius: var(--radius-md);
    border: 1px solid rgba(242, 184, 75, 0.18);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), inset 0 20px 40px -20px rgba(0, 0, 0, 0.8);
}

.reel__window {
    height: 108px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(242, 184, 75, 0.035) 0px,
            rgba(242, 184, 75, 0.035) 1px,
            transparent 1px,
            transparent 3px
        );
}

.reel__strip {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.reel__item {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.7rem;
    color: var(--accent);
    text-shadow: 0 0 18px rgba(242, 184, 75, 0.55);
    padding: 6px 20px;
    white-space: nowrap;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reel__item--placeholder {
    color: var(--text-dim);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 1rem;
    text-shadow: none;
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

.reel__item--spinning {
    animation: reel-cycle 0.09s linear infinite;
}

.reel__item--landed {
    animation: reel-settle 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes reel-cycle {
    from { opacity: 0.4; transform: translateY(-6px); }
    to   { opacity: 1;   transform: translateY(0); }
}

@keyframes reel-settle {
    0%   { transform: translateY(14px) scale(0.94); opacity: 0; }
    60%  { transform: translateY(-3px) scale(1.03); opacity: 1; }
    100% { transform: translateY(0) scale(1); }
}

.reel__glass {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%, transparent 60%, rgba(0, 0, 0, 0.25));
    pointer-events: none;
}

.reel-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.reel-controls__label {
    font-size: 13px;
    color: var(--text-dim);
    font-weight: 500;
}

.btn--big {
    flex: 1 1 auto;
    min-width: 180px;
    padding: 14px 22px;
    font-size: 15px;
}

/* ---------- Manage section ---------- */

.manage {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px;
}

.manage-details {
    margin: 0;
}

.manage-details summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.manage-details summary::-webkit-details-marker {
    display: none;
}

.manage__header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.manage__header::after {
    content: "";
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    margin-left: auto;
    border-right: 2px solid var(--text-dim);
    border-bottom: 2px solid var(--text-dim);
    transform: rotate(-45deg);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.manage-details[open] .manage__header::after {
    transform: rotate(45deg);
}

.manage-details:hover .manage__header::after {
    border-color: var(--accent);
}

.manage__body {
    margin-top: 18px;
}

.manage__title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin: 0;
    font-weight: 700;
}

.manage__count {
    font-size: 13px;
    color: var(--text-dim);
}

.add-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.form-error {
    color: var(--danger);
    font-size: 13px;
    margin: 8px 0 0;
}

/* ---------- Form controls ---------- */

.input,
.select {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text);
    background: #171A36;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
    color: #6A709B;
}

.input:focus,
.select:focus {
    border-color: var(--accent-line);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.input--grow {
    flex: 1 1 220px;
}

.select {
    cursor: pointer;
}

/* ---------- Buttons ---------- */

.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    border: none;
    border-radius: var(--radius-sm);
    padding: 11px 18px;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}

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

.btn--primary {
    background: linear-gradient(180deg, #F6C868, var(--accent));
    color: #1A1400;
    box-shadow: 0 10px 24px -10px rgba(242, 184, 75, 0.6);
}

.btn--primary:hover {
    filter: brightness(1.05);
}

.btn--primary:disabled {
    opacity: 0.55;
    cursor: default;
    filter: none;
}

.btn--secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn--secondary:hover {
    background: var(--card-hover);
}

.btn--ghost {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.btn--ghost:hover {
    color: var(--text);
}

.btn--small {
    padding: 8px 14px;
    font-size: 12px;
}

/* ---------- Activity list ---------- */

.activity-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.row {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    transition: background 0.15s ease;
}

.row:hover {
    background: var(--card-hover);
}

.row__view {
    display: flex;
    align-items: center;
    gap: 10px;
}

.row__view[hidden] {
    display: none;
}

.row__name {
    font-weight: 500;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row__category {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-dim);
    border-radius: 999px;
    padding: 4px 10px;
    white-space: nowrap;
}

.row__actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.icon-btn--delete:hover {
    background: var(--danger-dim);
    color: var(--danger);
    border-color: rgba(255, 111, 111, 0.3);
}

.row__edit {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.row__edit[hidden] {
    display: none;
}

.row__edit-name {
    flex: 1 1 160px;
}

.row__edit-category {
    flex: 0 1 140px;
}

.empty-state {
    color: var(--text-dim);
    font-size: 14px;
    text-align: center;
    padding: 24px 0 4px;
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
    .stage {
        padding: 36px 14px 60px;
    }

    .reel__item {
        font-size: 1.3rem;
    }

    .add-form {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .reel__item--spinning,
    .reel__item--landed {
        animation: none;
    }
}
