:root,
[data-theme="dark"] {
    --bg: #07070a;
    --surface: #141418;
    --surface-2: #1d1d24;
    --line: #2c2c36;
    --text: #f6f6f8;
    --muted: #9a9aa8;
    --accent: #ccff00;
    --accent-ink: #11140a;
    --coral: #ff5a3c;
    --mint: #00f5c8;
    --pink: #ff2e88;
    --danger: #ff5a3c;
    --ok: #ccff00;
    --focus: #ccff00;
    --radius: 1.1rem;
    --pad: 0.85rem;
    --scheme: dark;
}

[data-theme="light"] {
    --bg: #f3f4ee;
    --surface: #ffffff;
    --surface-2: #eceee4;
    --line: #d4d7c8;
    --text: #14150f;
    --muted: #5c5f52;
    --accent: #6b8f00;
    --accent-ink: #11140a;
    --coral: #d6452a;
    --mint: #008f75;
    --pink: #c41d6a;
    --danger: #d6452a;
    --ok: #6b8f00;
    --focus: #6b8f00;
    --scheme: light;
}

html {
    color-scheme: var(--scheme);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background:
        radial-gradient(80% 50% at 100% -10%, rgba(204, 255, 0, 0.16), transparent 50%),
        radial-gradient(70% 40% at 0% 0%, rgba(255, 46, 136, 0.18), transparent 46%),
        var(--bg);
    color: var(--text);
    line-height: 1.35;
}

a {
    color: var(--accent);
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.7rem var(--pad);
}

.app-nav {
    display: flex;
    gap: 0.2rem;
    background: var(--surface);
    border-radius: 999px;
    padding: 0.15rem;
    order: 3;
    width: 100%;
    justify-content: center;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--text);
    font-size: 0.92rem;
}

.illu-mark {
    width: 1.7rem;
    height: 1.7rem;
    color: var(--accent);
}

.app-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 2.2rem;
    padding: 0 0.55rem;
    color: var(--muted);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.82rem;
    border-radius: 999px;
}

.app-nav a[aria-current="page"] {
    color: var(--accent-ink);
    background: var(--accent);
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-email {
    display: none;
    color: var(--muted);
    font-size: 0.8rem;
}

.text-link {
    appearance: none;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    padding: 0.4rem 0;
    min-height: 2.4rem;
    cursor: pointer;
    text-decoration: none;
}

.page {
    padding: 0.15rem var(--pad) 5.5rem;
    max-width: 40rem;
    margin: 0 auto;
}

.stack,
.stack.compact {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

[hidden] {
    display: none !important;
}

.hero {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.hero-illu,
.auth-illu,
.empty-illu {
    width: 5.5rem;
    height: 4.2rem;
    flex: 0 0 auto;
}

.auth-illu {
    width: 7rem;
    height: 5.2rem;
    display: block;
    margin: 0 auto 0.4rem;
}

h1,
h2,
legend {
    margin: 0 0 0.25rem;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

h2,
legend {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.lede,
.hint,
.count,
.empty {
    color: var(--muted);
    margin: 0;
}

.lede {
    font-size: 0.92rem;
}

.hint,
.count {
    font-size: 0.8rem;
}

.card,
.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.85rem;
}

.auth-card {
    margin-top: 1rem;
}

.section-head.row {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.flash {
    padding: 0.65rem 0.8rem;
    border-radius: 0.75rem;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
}

.flash-ok {
    background: rgba(204, 255, 0, 0.12);
    color: var(--accent);
}

.flash-error {
    background: rgba(255, 90, 60, 0.14);
    color: var(--coral);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.55rem;
}

.field.grow {
    flex: 1;
    margin-bottom: 0;
}

.compact-set {
    margin-bottom: 0.35rem;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

label,
legend {
    font-weight: 700;
    font-size: 0.82rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
select {
    width: 100%;
    min-height: 2.5rem;
    border-radius: 0.8rem;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    padding: 0.5rem 0.7rem;
    font: inherit;
}

input[type="range"] {
    width: 100%;
    min-height: 1.7rem;
    accent-color: var(--accent);
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.field-error {
    margin: 0;
    color: var(--danger);
    font-size: 0.85rem;
}

.choice,
.check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.4rem;
    padding: 0.1rem 0;
}

.choice input,
.check input {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
    accent-color: var(--accent);
}

.type-pick legend {
    margin-bottom: 0.55rem;
}

.type-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.voice-grid {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 0.45rem;
}

.type-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-height: 2.75rem;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: var(--surface-2);
    cursor: pointer;
}

.type-card input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.type-card strong {
    font-size: 1.05rem;
}

.type-card span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
}

.type-card:has(input:checked) {
    border-color: var(--accent);
    background: rgba(204, 255, 0, 0.12);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.type-random .js-reorder {
    display: none;
}

.type-custom #random-rules {
    display: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.55rem 0.9rem;
    border: 0;
    border-radius: 0.9rem;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.btn-primary,
.btn-add {
    background: var(--accent);
    color: var(--accent-ink);
}

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

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

.btn-xl {
    width: 100%;
}

.btn-stop {
    width: 100%;
    background: var(--coral);
    color: #1a0705;
}

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

.auth-switch {
    margin: 0.8rem 0 0;
    color: var(--muted);
}

.oauth-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.oauth-or {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0.15rem 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.oauth-or::before,
.oauth-or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.btn-google {
    width: 100%;
    gap: 0.55rem;
    border: 1px solid var(--line);
    background: #fff;
    color: #1f1f1f;
}

.btn-google-logo {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
}

.locale-switch {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}

.locale-row {
    display: flex;
    gap: 0.75rem;
}

.text-link.is-active,
.text-link[aria-current="page"] {
    color: var(--text);
    font-weight: 800;
}

.duration-chip {
    margin: 0.2rem 0 0;
    padding: 0.55rem 0.7rem;
    border-radius: 0.8rem;
    background: linear-gradient(90deg, rgba(204, 255, 0, 0.16), rgba(0, 245, 200, 0.12));
    color: var(--text);
    font-weight: 800;
    font-size: 0.92rem;
}

.sequence-list,
.cue-list,
.training-list {
    list-style: none;
    margin: 0 0 0.65rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.sequence-step,
.cue-item {
    background: var(--surface-2);
    border-radius: 0.8rem;
    padding: 0.55rem 0.65rem;
}

.sequence-step .split .field {
    margin-bottom: 0;
}

.sequence-head,
.cue-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.sequence-head strong,
.cue-name {
    flex: 1;
    min-width: 4rem;
    margin: 0;
    font-weight: 750;
}

.sequence-index {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 0.72rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sequence-head .icon-btn,
.icon-btn {
    appearance: none;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.7rem;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
}

.icon-btn.danger {
    color: var(--coral);
}

.training-item {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.7rem 0.75rem 0.7rem 0.85rem;
    border-left: 4px solid var(--accent);
}

.training-item.accent-coral { border-left-color: var(--coral); }
.training-item.accent-mint { border-left-color: var(--mint); }
.training-item.accent-pink { border-left-color: var(--pink); }
.training-item.accent-volt { border-left-color: var(--accent); }

.training-item h2 {
    margin: 0;
    text-transform: none;
    letter-spacing: -0.03em;
    font-size: 1.05rem;
}

.training-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.training-actions .btn-xl {
    width: 100%;
}

.training-actions-secondary {
    display: flex;
    gap: 0.4rem;
}

.training-actions-secondary .btn,
.training-actions-secondary .inline-form {
    flex: 1;
}

.training-actions-secondary .btn {
    width: 100%;
}

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

.empty-card.nested {
    padding: 0.5rem 0;
    background: none;
    border: 0;
}

.add-row {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.btn-add {
    width: 100%;
    font-size: 1.4rem;
    line-height: 1;
}

.inline-form {
    display: inline;
    margin: 0;
}

.user-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.user-item {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.85rem 0;
    border-top: 1px solid var(--line);
}

.user-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.user-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}

.user-email {
    margin: 0;
    font-weight: 800;
    word-break: break-word;
}

.role-pill {
    display: inline-flex;
    align-items: center;
    min-height: 1.6rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.role-pill.role-admin {
    background: rgba(204, 255, 0, 0.16);
    color: var(--accent);
}

.role-pill.role-user {
    background: var(--surface-2);
    color: var(--muted);
}

.role-pill.role-paused {
    background: rgba(255, 90, 60, 0.16);
    color: var(--danger);
}

.danger-card {
    border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.page-foot {
    max-width: 40rem;
    margin: -4.2rem auto 0;
    padding: 0 var(--pad) 1.2rem;
}

.page-foot a {
    color: var(--muted);
    font-size: 0.8rem;
}

.user-item .split {
    grid-template-columns: 1fr;
}

fieldset {
    border: 0;
    padding: 0;
    margin: 0;
}

.play-cues {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.play-cues li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.4rem;
}

.play-cues strong {
    flex: 1;
}

.start-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    width: 100%;
    max-width: 40rem;
    margin: 0 auto;
    padding: 0.7rem var(--pad) calc(0.7rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(transparent, var(--bg) 36%);
}

.start-bar .btn {
    width: 100%;
    text-decoration: none;
}

.start-bar.dual {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 0.45rem;
}

.session {
    position: fixed;
    inset: 0;
    background: #050507;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem 1rem 1.2rem;
    z-index: 10;
}

.save-sheet {
    justify-content: flex-end;
    background: rgba(5, 5, 7, 0.72);
    padding: 1rem;
}

.save-card {
    width: 100%;
    max-width: 40rem;
    margin: 0 auto;
}

.photo-preview {
    display: block;
    width: 100%;
    max-height: 12rem;
    object-fit: cover;
    border-radius: 0.8rem;
}

.photo-preview[hidden] {
    display: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.camera-sheet {
    background: #050507;
    padding: 0;
    justify-content: flex-end;
    z-index: 11;
}

.camera-sheet video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.camera-sheet .field-error {
    position: relative;
    z-index: 1;
    margin: 1rem;
    text-align: center;
}

.camera-bar {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 0.5rem;
    padding: 1rem;
    background: linear-gradient(transparent, rgba(5, 5, 7, 0.85));
}

.history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.history-item {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.55rem;
    min-height: 10.5rem;
    padding: 0.9rem;
    border-radius: var(--radius);
    background-color: var(--surface);
    background-size: cover;
    background-position: center;
    overflow: hidden;
    isolation: isolate;
}

.history-item::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(7, 7, 10, 0.15), rgba(7, 7, 10, 0.82));
    z-index: 0;
}

.history-copy,
.history-delete {
    position: relative;
    z-index: 1;
}

.history-item h2 {
    color: #fff;
    text-transform: none;
    letter-spacing: -0.03em;
    font-size: 1.2rem;
}

.history-item .hint {
    color: rgba(246, 246, 248, 0.86);
}

.history-delete .btn {
    width: 100%;
    background: rgba(20, 20, 24, 0.55);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.session[hidden] {
    display: none;
}

.session-pulse {
    width: 100%;
    height: 3rem;
}

.session-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    color: var(--muted);
    margin: 0;
    font-size: 0.9rem;
}

.session-countdown {
    margin: 0.2rem 0 0;
    color: var(--accent);
    font-size: 1.05rem;
    font-weight: 800;
    text-align: center;
}

.session-queue {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    flex: 1;
    min-height: 0;
}

.session-queue li {
    margin: 0;
    max-width: 100%;
    text-align: center;
    line-height: 1.15;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-queue li.is-past {
    color: #6f6f7c;
    font-size: clamp(0.85rem, 3.4vw, 1.05rem);
    opacity: 0.55;
}

.session-queue li.is-next {
    color: #c8c8d2;
    font-size: clamp(0.95rem, 3.8vw, 1.2rem);
    opacity: 0.72;
}

.session-queue li.is-current {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    width: min(100%, 22rem);
    color: #fff;
    font-size: clamp(2rem, 11vw, 3.8rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    white-space: normal;
    overflow: visible;
}

.session-cue-name {
    display: block;
    text-align: center;
}

.session-cue-bar {
    display: block;
    width: 100%;
    height: 0.28rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    overflow: hidden;
}

.session-cue-bar-fill {
    display: block;
    height: 100%;
    width: 100%;
    border-radius: inherit;
    background: var(--accent);
    transform: scaleX(1);
    transform-origin: left center;
    transition: transform 0.2s linear;
}

@media (min-width: 640px) {
    .app-nav {
        order: 0;
        width: auto;
    }

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

    .top-nav {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

    .top-email {
        display: block;
    }

    .user-item .split {
        grid-template-columns: 1fr 1fr;
    }

    .add-row {
        flex-direction: row;
        align-items: flex-end;
    }

    .btn-add {
        width: 3rem;
        min-height: 3rem;
        flex: 0 0 3rem;
    }

    .training-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }

    .training-actions {
        flex: 0 0 13.5rem;
    }
}

.help-root {
    position: fixed;
    inset: 0;
    z-index: 40;
    padding: 1rem;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
}

.help-root[hidden] {
    display: none;
}

.help-root.is-top {
    align-items: flex-start;
}

.help-catcher {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 7, 0.72);
    pointer-events: auto;
}

.help-card {
    position: relative;
    width: 100%;
    max-width: 40rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.9rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    pointer-events: auto;
}

.help-illu {
    display: block;
    margin: 0 auto 0.4rem;
}

.help-card h2 {
    text-transform: none;
    letter-spacing: -0.03em;
    font-size: 1.2rem;
}

.help-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    margin-top: 0.75rem;
}

.help-actions .text-link {
    margin-right: auto;
}

.help-actions .btn-primary {
    flex: 1;
    min-width: 6.5rem;
}

.help-spot {
    position: relative;
    z-index: 45;
    box-shadow: 0 0 0 3px var(--accent);
    border-radius: 0.9rem;
}

body.help-open .top:has(.help-spot),
body.help-open .page:has(.help-spot) {
    position: relative;
    z-index: 45;
}

body.help-open {
    overflow: hidden;
}
