:root {
    --bg: #111315;
    --panel: #1d2024;
    --panel-soft: #25292e;
    --line: #373d45;
    --text: #f5f1e8;
    --muted: #b8b0a3;
    --accent: #ff4f64;
    --accent-strong: #ffbe3d;
    --green: #5bd39a;
    --ink: #131313;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
            linear-gradient(120deg, rgba(255, 79, 100, 0.18), transparent 34%),
            linear-gradient(250deg, rgba(91, 211, 154, 0.14), transparent 34%),
            var(--bg);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
            linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(to bottom, black, transparent 76%);
}

a,
button,
input,
textarea,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px clamp(16px, 4vw, 48px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(17, 19, 21, 0.86);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
    text-decoration: none;
    font-weight: 900;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    color: var(--ink);
    background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

.header-actions,
.hero-actions,
.form-actions,
.share-actions,
.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.app-shell {
    position: relative;
    z-index: 1;
    width: min(1160px, calc(100% - 32px));
    margin: 0 auto;
    padding: 42px 0 72px;
}

.primary-button,
.ghost-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    text-decoration: none;
    font-weight: 900;
    cursor: pointer;
}

.primary-button {
    color: var(--ink);
    background: linear-gradient(135deg, var(--accent-strong), var(--accent));
    box-shadow: 0 18px 40px rgba(255, 79, 100, 0.18);
}

.ghost-button {
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--line);
}

.danger-button {
    color: #ffdce0;
    background: rgba(255, 79, 100, 0.12);
    border-color: rgba(255, 79, 100, 0.35);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    align-items: center;
    gap: 34px;
    min-height: calc(100vh - 170px);
    padding-bottom: 36px;
}

.hero-copy h1,
.editor-sidebar h1,
.share-copy h1,
.play-screen h1 {
    margin: 0;
    line-height: 1;
    letter-spacing: 0;
}

.hero-copy h1 {
    max-width: 790px;
    font-size: clamp(40px, 6vw, 78px);
}

.hero-copy p,
.editor-sidebar p,
.share-copy p {
    max-width: 660px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.55;
}

.storage-label {
    width: fit-content;
    margin-top: 16px;
    padding: 10px 12px;
    border: 1px solid rgba(91, 211, 154, 0.3);
    border-radius: 8px;
    color: #caf8dd;
    background: rgba(91, 211, 154, 0.08);
    font-size: 14px;
    font-weight: 900;
}

.eyebrow {
    display: inline-flex;
    width: fit-content;
    margin: 0 0 14px;
    padding: 8px 11px;
    border: 1px solid rgba(255, 190, 61, 0.34);
    border-radius: 999px;
    color: #ffe8b2;
    background: rgba(255, 190, 61, 0.1);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.compact {
    margin-bottom: 8px;
}

.hero-preview {
    display: grid;
    place-items: center;
}

.phone {
    width: min(100%, 330px);
    min-height: 560px;
    padding: 18px;
    border: 10px solid #0a0b0c;
    border-radius: 34px;
    background:
            linear-gradient(160deg, rgba(255, 190, 61, 0.18), transparent 40%),
            #171a1d;
    box-shadow: 0 32px 70px rgba(0, 0, 0, 0.34);
}

.phone-top {
    width: 90px;
    height: 8px;
    margin: 0 auto 92px;
    border-radius: 999px;
    background: #050607;
}

.quest-card,
.empty-state,
.editor-panel,
.editor-sidebar,
.party-card,
.qr-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(29, 32, 36, 0.92);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}

.quest-card {
    padding: clamp(22px, 5vw, 34px);
}

.quest-card.mini {
    min-height: 280px;
}

.quest-card h1,
.quest-card h2 {
    margin: 14px 0 12px;
    font-size: clamp(30px, 6vw, 52px);
    line-height: 1.04;
}

.quest-card p {
    color: var(--muted);
    line-height: 1.55;
}

.quest-card button {
    width: 100%;
    margin-top: 18px;
}

.step-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    color: var(--ink);
    background: var(--green);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    margin: 8px 0 16px;
}

.section-head h2 {
    margin: 0;
    font-size: clamp(28px, 4vw, 44px);
}

.party-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.party-card {
    padding: 18px;
}

.party-card h3 {
    margin: 0 0 8px;
    font-size: 24px;
}

.party-card p {
    min-height: 48px;
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.45;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--muted);
}

.empty-state {
    padding: 28px;
    text-align: center;
}

.empty-state h3 {
    margin: 0 0 10px;
    font-size: 28px;
}

.empty-state p {
    max-width: 520px;
    margin: 0 auto 20px;
    color: var(--muted);
}

.editor-layout,
.share-layout {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.editor-sidebar,
.editor-panel,
.qr-panel {
    padding: 22px;
}

.editor-sidebar {
    position: sticky;
    top: 92px;
}

.editor-sidebar h1,
.share-copy h1 {
    font-size: clamp(34px, 5vw, 56px);
}

.setup-progress {
    display: flex;
    gap: 10px;
    margin-top: 28px;
}

.setup-progress span {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    color: var(--muted);
    font-weight: 900;
}

.setup-progress span.active {
    color: var(--ink);
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

.form-step {
    display: grid;
    gap: 16px;
    padding: 0 0 26px;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.form-step:last-of-type {
    border-bottom: 0;
    margin-bottom: 0;
}

.step-heading h2 {
    margin: 10px 0 0;
    font-size: 28px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
    background: #111315;
    color: var(--text);
    font-size: 16px;
}

input,
select {
    min-height: 48px;
    padding: 0 13px;
}

textarea {
    resize: vertical;
    min-height: 96px;
    padding: 13px;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-strong);
}

.page-editor-list {
    display: grid;
    gap: 12px;
}

.page-editor {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.page-editor.disabled {
    opacity: 0.58;
}

.page-editor-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.page-editor-top strong {
    font-size: 18px;
}

.switch-label {
    display: inline-flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    color: var(--text);
    text-transform: none;
}

.switch-label input {
    width: 20px;
    min-height: 20px;
    accent-color: var(--accent-strong);
}

.add-page {
    width: fit-content;
}

.share-layout {
    min-height: calc(100vh - 180px);
    align-items: center;
}

.qr-panel {
    display: grid;
    justify-items: center;
    gap: 16px;
}

.qr-panel img {
    width: min(100%, 330px);
    aspect-ratio: 1;
    border-radius: 8px;
    background: white;
    padding: 12px;
}

.qr-panel p {
    width: 100%;
    margin: 0;
    padding: 12px;
    border-radius: 8px;
    color: var(--muted);
    background: rgba(0, 0, 0, 0.22);
    overflow-wrap: anywhere;
    font-size: 13px;
}

.play-screen {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 180px);
}

.play-screen .quest-card {
    width: min(620px, 100%);
}

.challenge-box {
    display: none;
    margin-top: 18px;
    padding: 16px;
    border: 1px dashed rgba(255, 190, 61, 0.55);
    border-radius: 8px;
    color: #ffe8b2;
    background: rgba(255, 190, 61, 0.08);
    line-height: 1.5;
}

.challenge-box.visible {
    display: block;
}

.profile-fields,
.config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.config-grid {
    padding: 14px;
    border: 1px solid rgba(255, 190, 61, 0.22);
    border-radius: 8px;
    background: rgba(255, 190, 61, 0.06);
}

.challenge-hint {
    margin: 14px 0 0;
    color: #ffe8b2;
    font-weight: 900;
}

.quiz-box {
    display: grid;
    gap: 14px;
}

.quiz-question {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.quiz-question legend {
    padding: 0 6px;
    color: var(--text);
    font-weight: 900;
}

.quiz-option {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 9px;
    color: var(--text);
    text-transform: none;
}

.quiz-option input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--accent-strong);
}

.dodge-arena {
    position: relative;
    height: 260px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
            linear-gradient(135deg, rgba(255, 79, 100, 0.12), transparent),
            rgba(0, 0, 0, 0.16);
    overflow: hidden;
}

.dodge-button {
    position: absolute;
    width: auto;
    min-width: 130px;
    margin: 0;
    transition: left 0.18s ease, top 0.18s ease;
}

.gift-code {
    display: block;
    margin-top: 18px;
    padding: 18px;
    border-radius: 8px;
    color: var(--ink);
    background: linear-gradient(135deg, var(--accent-strong), var(--green));
    font-size: clamp(28px, 7vw, 54px);
    font-weight: 900;
    text-align: center;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .hero,
    .editor-layout,
    .share-layout {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: 0;
    }

    .editor-sidebar {
        position: static;
    }

    .party-list {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 620px) {
    .app-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-actions,
    .hero-actions,
    .form-actions,
    .share-actions,
    .card-actions {
        width: 100%;
    }

    .primary-button,
    .ghost-button,
    .danger-button {
        flex: 1;
    }

    .party-list {
        grid-template-columns: 1fr;
    }

    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .phone {
        min-height: 440px;
    }

    .phone-top {
        margin-bottom: 44px;
    }

    .profile-fields,
    .config-grid {
        grid-template-columns: 1fr;
    }
}