:root {
    --bg: #1a1814;
    --bg-alt: #242019;
    --card: #2d2820;
    --card-hover: #353029;
    --primary: #ff9f43;
    --primary-glow: rgba(255, 159, 67, 0.25);
    --teal: #26c9a6;
    --teal-glow: rgba(38, 201, 166, 0.2);
    --impostor: #ff6b9d;
    --impostor-glow: rgba(255, 107, 157, 0.22);
    --text: #faf6f0;
    --text-muted: #a09a8c;
    --border: #3d3630;
    --page-max: 1360px;
    --screen-pad-x: 16px;
    --screen-pad-y: 20px;
    --screen-pad-bottom: 28px;
    --section-pad: 26px;
    --section-gap: 20px;
    --content-gap: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    background:
        radial-gradient(circle at top left, rgba(255, 159, 67, 0.10), transparent 28%),
        radial-gradient(circle at bottom right, rgba(38, 201, 166, 0.08), transparent 24%),
        var(--bg);
}

body {
    min-height: 100vh;
    background: transparent;
    color: var(--text);
    font-family: "Manrope", "Segoe UI", sans-serif;
    line-height: 1.5;
}

.app {
    width: min(100%, var(--page-max));
    margin: 0 auto;
}

.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
    padding: var(--screen-pad-y) var(--screen-pad-x) var(--screen-pad-bottom);
    flex-direction: column;
}

.screen.active {
    display: flex;
    animation: screenIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes screenIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.setup-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    margin-bottom: 28px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-size: 0.78rem;
    font-weight: 800;
}

.hero-shell {
    width: 100%;
    display: grid;
    gap: 18px;
    align-items: stretch;
}

.hero-copy,
.hero-stage-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
        var(--card);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.18);
}

.hero-copy {
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    text-align: left;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-btn {
    text-decoration: none;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-meta span {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.hero-stage {
    display: grid;
    gap: 16px;
}

.hero-stage-card {
    padding: 22px;
}

.hero-stage-card-primary {
    background:
        radial-gradient(circle at top right, rgba(255, 159, 67, 0.12), transparent 36%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
        var(--card);
}

.hero-stage-card-secondary {
    background:
        radial-gradient(circle at bottom left, rgba(38, 201, 166, 0.12), transparent 36%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
        var(--card);
}

.hero-stage-label {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 800;
}

.hero-stage-title {
    font-family: "Sora", "Segoe UI", sans-serif;
    font-size: clamp(1.35rem, 4vw, 2rem);
    line-height: 1.2;
    margin-bottom: 14px;
}

.hero-stage-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-stage-steps span,
.fit-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 700;
    color: var(--text);
}

.hero-stage-line {
    color: var(--text-muted);
    line-height: 1.75;
}

.hero-stage-line strong {
    color: var(--text);
}

.story-grid,
.fit-grid {
    display: grid;
    gap: var(--content-gap);
}

.story-card {
    padding: 20px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-alt);
}

.story-card-title {
    font-family: "Sora", "Segoe UI", sans-serif;
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.story-card-copy {
    color: var(--text-muted);
    line-height: 1.75;
}

.fit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.site-footer {
    text-align: center;
    padding: 10px 0 4px;
}

.site-footer-copy {
    color: var(--text-muted);
    line-height: 1.8;
    max-width: 48rem;
    margin: 0 auto;
}

.ad-banner {
    width: 100%;
    height: 60px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.ad-banner:empty {
    display: none;
}

.logo {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, rgba(255, 159, 67, 0.2), rgba(255, 199, 95, 0.2));
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 30px rgba(255, 159, 67, 0.14);
}

.app-title {
    font-family: "Sora", "Segoe UI", sans-serif;
    font-size: clamp(2.35rem, 8vw, 3.8rem);
    font-weight: 800;
    text-align: left;
    background: linear-gradient(135deg, var(--primary) 0%, #ffeaa7 50%, var(--impostor) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.05;
    text-wrap: balance;
}

.app-tagline {
    color: var(--text-muted);
    text-align: left;
    font-size: clamp(0.98rem, 2.6vw, 1.08rem);
    max-width: 42rem;
    line-height: 1.75;
}

.rules-section {
    overflow: hidden;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--content-gap);
    margin-bottom: var(--content-gap);
}

.rule-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
        var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
}

.rule-card-title {
    font-family: "Sora", "Segoe UI", sans-serif;
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--primary);
}

.rule-card-copy {
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 0.96rem;
}

.rules-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rule-detail {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
}

.rule-detail summary {
    list-style: none;
    cursor: pointer;
    padding: 18px 20px;
    font-weight: 700;
    color: var(--text);
    position: relative;
}

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

.rule-detail summary::after {
    content: "+";
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--teal);
    font-size: 1.2rem;
}

.rule-detail[open] summary::after {
    content: "-";
}

.rule-detail-body {
    padding: 0 20px 18px;
    color: var(--text-muted);
}

.rule-detail-body p {
    line-height: 1.75;
    margin-top: 8px;
}

.rule-detail-body strong {
    color: var(--text);
}

.page-title {
    font-family: "Sora", "Segoe UI", sans-serif;
    text-align: center;
    font-size: clamp(1.75rem, 5vw, 2.2rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.25;
    margin: 24px 0 8px;
}

.page-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.75;
    margin: 0 auto 24px;
    max-width: 34rem;
}

.page-copy {
    line-height: 1.8;
    max-width: 42rem;
}

body[data-page="reveal"] .screen,
body[data-page="vote"] .screen,
body[data-page="result"] .screen {
    justify-content: center;
}

body[data-page="reveal"] .page-title,
body[data-page="vote"] .page-title,
body[data-page="result"] .page-title {
    margin: 0 0 12px;
}

body[data-page="reveal"] .page-subtitle,
body[data-page="vote"] .page-subtitle {
    margin: 0 auto 30px;
}

body[data-page="result"] .page-title {
    margin-bottom: 24px;
}

.section {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent), var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: var(--section-pad);
    margin-bottom: var(--section-gap);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.18);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.player-count {
    font-size: 1rem;
    color: var(--teal);
    font-weight: 600;
}

.player-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 52px;
    margin-bottom: var(--content-gap);
}

.player-chip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 100%;
    background: var(--bg-alt);
    padding: 10px 16px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid var(--border);
}

.player-chip .remove {
    background: none;
    border: none;
    color: var(--impostor);
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
    opacity: 0.6;
}

.player-chip .remove:hover {
    opacity: 1;
}

.player-chip .player-name {
    cursor: pointer;
    flex: 1;
    overflow-wrap: anywhere;
}

.player-chip .player-name:hover {
    color: var(--primary);
}

.add-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
    margin-top: 8px;
}

.input {
    flex: 1;
    min-width: 0;
    background: var(--bg-alt);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 16px 18px;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.input:focus {
    border-color: var(--teal);
    background: var(--card);
}

.input:focus-visible,
.btn:focus-visible,
.option-btn:focus-visible,
.secret-player-btn:focus-visible,
.vote-btn:focus-visible,
.rule-detail summary:focus-visible,
.hold-reveal-card:focus-visible {
    outline: 3px solid rgba(38, 201, 166, 0.35);
    outline-offset: 3px;
}

.input::placeholder {
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #1a1814;
    border: none;
    border-radius: 14px;
    padding: 17px 24px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.3;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--primary-glow);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--teal);
    color: #1a1814;
}

.btn-secondary:hover {
    box-shadow: 0 8px 24px var(--teal-glow);
}

.btn-danger {
    background: var(--impostor);
}

.btn-danger:hover {
    box-shadow: 0 8px 24px var(--impostor-glow);
}

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

.btn-ghost:hover {
    border-color: var(--text-muted);
    box-shadow: none;
}

.settings-row {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.chaos-description {
    width: 100%;
    font-size: 0.85rem;
    color: var(--impostor);
    margin-top: -12px;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: rgba(255, 107, 157, 0.1);
    border-radius: 8px;
}

.custom-words-section .section-header {
    margin-bottom: 12px;
}

.custom-category-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.custom-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-alt);
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.custom-category-item.active {
    border-color: var(--teal);
    background: rgba(38, 201, 166, 0.1);
}

.custom-category-item.locked {
    opacity: 0.8;
}

.custom-category-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.custom-category-item .category-name {
    font-weight: 500;
    color: var(--text);
    overflow-wrap: anywhere;
}

.custom-category-item .word-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.custom-category-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

.toggle-pill {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-pill.active {
    border-color: var(--teal);
    color: var(--teal);
    background: rgba(38, 201, 166, 0.12);
}

.toggle-pill:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.custom-category-item .delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 8px;
}

.custom-category-item .delete-btn:hover {
    color: var(--impostor);
}

.custom-category-form {
    padding: 16px;
    background: var(--bg-alt);
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-top: 14px;
}

.custom-category-form .form-row {
    margin-bottom: 12px;
}

.custom-category-form textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.custom-category-form .form-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.empty-message {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 16px;
    font-style: italic;
}


.settings-label {
    font-size: 1rem;
    color: var(--text-muted);
    min-width: 96px;
    padding-top: 12px;
}

.settings-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.mode-options {
    width: 100%;
}

.mode-options .option-btn {
    flex: 1 1 160px;
}

.option-btn {
    background: var(--bg-alt);
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 13px 18px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.option-btn:hover {
    border-color: var(--text-muted);
}

.option-btn.active {
    border-color: var(--teal);
    background: rgba(20, 184, 166, 0.15);
}

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

.online-section[hidden] {
    display: none;
}

.online-choice-grid {
    display: grid;
    gap: 18px;
}

.online-choice-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px;
}

.online-choice-title {
    font-family: "Sora", "Segoe UI", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.online-choice-copy {
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 14px;
}

.online-name-row,
.online-join-row,
.online-link-row {
    margin-top: 0;
}

.online-action-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.online-action-stack .btn,
.online-link-row .btn {
    width: 100%;
}

.online-lobby-meta {
    display: grid;
    gap: 12px;
    justify-items: center;
    text-align: center;
    margin-bottom: 16px;
}

.online-lobby-badge {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
}

.online-lobby-code {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: clamp(1.8rem, 7vw, 2.8rem);
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--primary);
}

.online-status {
    margin-top: 16px;
    text-align: center;
    color: var(--text-muted);
    line-height: 1.75;
}

.online-status[data-state="error"] {
    color: var(--impostor);
}

.lobby-screen {
    justify-content: flex-start;
}

.lobby-screen .section {
    padding: 32px 30px;
}

.lobby-screen .section-header {
    margin-bottom: 20px;
}

.lobby-hero {
    margin-bottom: 24px;
}

.lobby-hero-card {
    max-width: 760px;
    width: 100%;
    margin: 0 auto 24px;
}

.lobby-grid {
    display: grid;
    gap: 24px;
}

.lobby-screen .player-chips {
    margin-bottom: 20px;
}

.lobby-screen .player-chip .player-name {
    cursor: default;
}

.player-chip.is-ready {
    box-shadow: inset 0 0 0 1px rgba(38, 201, 166, 0.16);
}

.player-chip-tag {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
}

.lobby-screen .settings-row {
    margin-bottom: 22px;
}

.lobby-screen .chaos-description {
    margin-top: -4px;
    margin-bottom: 0;
    padding: 12px 14px;
}

.lobby-screen .custom-category-list,
.lobby-screen #lobby-custom-category-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lobby-screen .custom-category-form {
    margin-top: 16px;
    padding: 18px;
}

.lobby-screen .category-grid {
    gap: 14px;
}

.lobby-screen .online-link-row {
    gap: 14px;
}

.lobby-inline-status {
    margin-top: 12px;
    text-align: left;
}

.lobby-action-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.lobby-action-row .btn {
    flex: 1 1 220px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-height: 360px;
    overflow-y: auto;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    background: var(--bg-alt);
    padding: 16px 18px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

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

.category-item.active {
    background: rgba(20, 184, 166, 0.1);
    border-color: var(--teal);
}

.category-item .check {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 10px;
    background: var(--card);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-item.active .check {
    background: var(--teal);
    border-color: var(--teal);
}

.category-item .check::after {
    content: "✓";
    font-size: 16px;
    color: var(--bg);
    opacity: 0;
}

.category-item.active .check::after {
    opacity: 1;
}

.category-item .check::after {
    content: "\2713";
}

.category-item.locked {
    opacity: 0.7;
    cursor: default;
}

.category-item .label {
    font-size: 1rem;
    font-weight: 500;
    min-width: 0;
    overflow-wrap: anywhere;
}

.start-btn {
    margin-top: auto;
    padding-top: 10px;
}

.start-btn .btn {
    width: 100%;
    padding: 18px;
    font-size: 1.05rem;
    border-radius: 16px;
}

.hold-reveal-card {
    --player-accent: var(--primary);
    --player-accent-soft: var(--primary-glow);
    width: 100%;
    max-width: 520px;
    margin: 24px auto 24px;
    perspective: 1200px;
    cursor: pointer;
    user-select: none;
    touch-action: none;
}

.hold-reveal-card.is-click-reveal {
    touch-action: auto;
}

.hold-reveal-card.is-click-reveal .hold-reveal-front {
    cursor: pointer;
}

.hold-reveal-card.is-click-reveal .pass-icon {
    color: var(--teal);
}

.hold-reveal-inner {
    position: relative;
    width: 100%;
    min-height: 320px;
    transition: transform 0.28s ease;
    transform-style: preserve-3d;
}

.hold-reveal-card.is-revealed .hold-reveal-inner {
    transform: rotateY(180deg);
}

.hold-reveal-face {
    position: absolute;
    inset: 0;
    width: 100%;
    min-height: 320px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.hold-reveal-front,
.hold-reveal-back,
.pass-to-display {
    background: var(--card);
    border-radius: 24px;
    padding: 38px 32px;
    text-align: center;
    border: 2px solid var(--player-accent);
    box-shadow: 0 0 30px var(--player-accent-soft);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hold-reveal-front:active,
.pass-to-display:active {
    transform: scale(0.99);
}

.hold-reveal-front:hover,
.pass-to-display:hover {
    border-color: var(--teal);
    box-shadow: 0 0 40px var(--teal-glow);
}

.hold-reveal-back {
    transform: rotateY(180deg);
    border-color: var(--border);
    box-shadow: 0 0 26px var(--player-accent-soft);
}

.pass-to-label {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    letter-spacing: 0.12em;
}

.pass-to-name {
    font-size: clamp(2rem, 7vw, 3.2rem);
    font-weight: 700;
    color: var(--player-accent);
    word-break: break-word;
    line-height: 1.15;
}

.pass-icon {
    font-size: 1rem;
    margin-top: 18px;
    color: var(--text-muted);
    line-height: 1.7;
}

.word-reveal-card,
.hold-reveal-back {
    background: var(--card);
    border-radius: 24px;
    padding: 48px 32px;
    text-align: center;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 520px;
}

.word-reveal-card.is-impostor,
.hold-reveal-back.is-impostor {
    border-color: var(--impostor);
    box-shadow: 0 0 40px var(--impostor-glow);
}

.role-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.word-reveal-card.is-impostor .role-label,
.hold-reveal-back.is-impostor .role-label {
    color: var(--impostor);
}

.the-word {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 700;
    color: var(--teal);
    word-break: break-word;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.word-reveal-card.is-impostor .the-word,
.hold-reveal-back.is-impostor .the-word {
    color: var(--impostor);
}

.impostor-hint {
    margin-top: 28px;
    color: var(--text-muted);
    line-height: 1.75;
}

.impostor-hint span {
    color: var(--impostor);
    font-weight: 600;
}

.reveal-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 520px;
    margin: 28px auto 0;
}

.reveal-actions .btn {
    width: 100%;
}

.progress-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
}

.progress-dot.done {
    background: var(--teal);
}

.progress-dot.current {
    background: var(--primary);
    transform: scale(1.3);
}

.turn-display {
    text-align: center;
    margin: auto 0 0;
}

.discussion-screen {
    justify-content: center;
}

.discussion-screen .turn-display,
.discussion-screen .timer-panel,
.discussion-screen .turn-info,
.discussion-screen .turn-actions {
    margin-top: 0;
    margin-bottom: 0;
}

.current-turn {
    background: var(--card);
    padding: 34px 28px;
    border-radius: 30px;
    border: 2px solid var(--primary);
    box-shadow: 0 0 30px var(--primary-glow);
    display: block;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}

.turn-label {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.turn-player {
    font-size: clamp(2rem, 7vw, 3rem);
    font-weight: 700;
    color: var(--primary);
    line-height: 1.15;
}

.turn-info {
    text-align: center;
    color: var(--text-muted);
    margin: 24px auto 0;
    font-size: 1.08rem;
    width: 100%;
    max-width: 720px;
    line-height: 1.8;
}

.discussion-secret-section {
    width: 100%;
    max-width: 720px;
    margin: 24px auto 0;
    padding: 32px 30px;
}

.discussion-secret-section .section-header {
    margin-bottom: 14px;
}

.discussion-secret-copy {
    color: var(--text-muted);
    text-align: center;
    line-height: 1.7;
    max-width: 580px;
    margin: 0 auto 22px;
}

.discussion-secret-players {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 22px;
}

.secret-player-btn {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 999px;
    padding: 10px 16px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s, background 0.2s;
}

.secret-player-btn:hover {
    transform: translateY(-1px);
}

.secret-player-btn.active {
    border-color: var(--teal);
    background: rgba(38, 201, 166, 0.12);
}

.discussion-secret-section .hold-reveal-card {
    margin: 0 auto 16px;
}

.discussion-secret-actions {
    margin: 0 auto;
    width: 100%;
    max-width: 560px;
}

.discussion-secret-actions .btn {
    min-height: 56px;
}

.timer-panel {
    width: 100%;
    max-width: 360px;
    margin: 24px auto 0;
    padding: 22px 24px;
    text-align: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--card);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.18);
}

.timer-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.timer-value {
    margin-top: 14px;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: clamp(1.75rem, 6vw, 2.5rem);
    font-weight: 700;
    color: var(--teal);
}

.turn-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 480px;
    margin: 28px auto 0;
}

.discussion-screen .turn-actions {
    margin-top: 36px;
    max-width: 560px;
}

.vote-list {
    display: grid;
    gap: 14px;
    max-width: 620px;
    width: 100%;
    margin: 0 auto 0;
}

.vote-btn {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 22px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}

.vote-btn:hover {
    border-color: var(--primary);
}

.vote-btn.selected {
    border-color: var(--primary);
    background: rgba(249, 115, 22, 0.15);
}

.vote-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 520px;
    margin: 28px auto 0;
}

.result-card {
    background: var(--card);
    border-radius: 28px;
    padding: 48px 40px;
    text-align: center;
    max-width: 620px;
    width: 100%;
    margin: auto;
    animation: resultIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes resultIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-card.impostor-wins {
    border: 1px solid var(--impostor);
    box-shadow: 0 0 50px var(--impostor-glow);
}

.result-card.players-win {
    border: 1px solid var(--teal);
    box-shadow: 0 0 50px var(--teal-glow);
}

.winner-badge {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: clamp(1.15rem, 4vw, 1.5rem);
    font-weight: 700;
    margin-bottom: 24px;
}

.winner-badge.impostor {
    background: var(--impostor);
    color: white;
}

.winner-badge.players {
    background: var(--teal);
    color: var(--bg);
}

.impostors-list {
    margin-bottom: 24px;
    line-height: 1.7;
}

.result-breakdown {
    display: grid;
    gap: 12px;
    margin: 0 0 24px;
    text-align: left;
}

.result-breakdown::before {
    content: "Vote Breakdown";
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.vote-breakdown-row {
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
}

.vote-breakdown-target {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.vote-breakdown-votes {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.vote-breakdown-voters {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.92rem;
}

.result-message {
    font-size: 1.08rem;
    color: var(--text-muted);
    line-height: 1.8;
    max-width: 34rem;
    margin: 0 auto 24px;
}

.impostor-name {
    color: var(--impostor);
    font-weight: 600;
}

.result-detail {
    padding: 20px 0;
    border-top: 1px solid var(--border);
}

.result-detail:first-of-type {
    border-top: none;
}

.result-detail .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.result-detail .value {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: clamp(1.2rem, 4vw, 1.55rem);
    font-weight: 700;
    color: var(--teal);
    word-break: break-word;
}

.result-detail .value.hint {
    color: var(--impostor);
}

.game-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 520px;
    margin: 28px auto 0;
}

.game-actions .btn {
    width: 100%;
}

@media (min-width: 1024px) {
    .screen {
        --screen-pad-x: 36px;
        --screen-pad-y: 34px;
        --screen-pad-bottom: 44px;
    }

    .section {
        --section-pad: 34px;
        --content-gap: 18px;
    }

    .page-title {
        font-size: clamp(2.2rem, 4vw, 3rem);
    }

    .page-subtitle,
    .turn-info,
    .discussion-secret-copy,
    .online-status,
    .result-message {
        font-size: 1.05rem;
    }

    .online-choice-card,
    .story-card,
    .rule-card,
    .lobby-screen .section,
    .discussion-secret-section,
    .result-card {
        border-radius: 26px;
    }

    .online-choice-card {
        min-height: 100%;
        padding: 28px;
    }

    .online-link-row {
        align-items: center;
    }

    .lobby-hero-card {
        max-width: 920px;
    }

    .lobby-grid {
        gap: 28px;
    }

    .lobby-grid .players-section {
        position: sticky;
        top: 24px;
    }

    .category-grid {
        gap: 14px;
    }

    .category-item,
    .vote-btn {
        min-height: 72px;
    }

    .current-turn {
        max-width: 760px;
        padding: 40px 36px;
    }

    .timer-panel {
        max-width: 420px;
        padding: 24px 26px;
    }

    .discussion-secret-section {
        max-width: 920px;
    }

    .hold-reveal-card,
    .word-reveal-card,
    .hold-reveal-back,
    .reveal-actions,
    .vote-actions,
    .game-actions,
    .turn-actions {
        max-width: 860px;
    }

    .vote-list {
        max-width: 980px;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .reveal-actions,
    .vote-actions,
    .game-actions,
    .turn-actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .reveal-actions .btn,
    .vote-actions .btn,
    .game-actions .btn,
    .turn-actions .btn {
        width: auto;
        flex: 1 1 240px;
    }

    .result-card {
        max-width: 920px;
        padding: 56px 48px;
    }
}

@media (max-width: 639px) {
    .hero-actions {
        width: 100%;
        flex-direction: column;
    }

    .hero-actions .btn {
        width: 100%;
    }

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

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

    .add-row {
        flex-direction: column;
    }

    .add-row .btn {
        width: 100%;
    }

    .settings-label {
        min-width: auto;
        width: 100%;
        padding-top: 0;
    }

    .settings-options {
        width: 100%;
    }

    .option-btn {
        flex: 1 1 calc(50% - 6px);
        text-align: center;
        min-height: 44px;
        font-size: 0.95rem;
    }

    .category-grid {
        grid-template-columns: 1fr;
        max-height: none;
    }

    .section {
        padding: 20px;
    }

    .discussion-secret-section {
        padding: 24px 20px;
    }

    .lobby-screen .section {
        padding: 24px 20px;
    }

    .discussion-secret-copy {
        margin-bottom: 18px;
    }

    .discussion-secret-players {
        margin-bottom: 18px;
    }

    .result-card {
        padding: 30px 20px;
    }

    .hold-reveal-card {
        max-width: 100%;
    }

    .online-link-row {
        flex-direction: column;
    }

    .online-choice-grid {
        grid-template-columns: 1fr;
    }

    .custom-category-form {
        padding: 14px;
    }

    .custom-category-form textarea {
        min-height: 100px;
    }

    .hold-reveal-card {
        min-height: 280px;
    }

    .hold-reveal-inner,
    .hold-reveal-face {
        min-height: 280px;
    }

    .vote-btn {
        padding: 16px 12px;
        font-size: 1rem;
        min-height: 56px;
    }

    .game-actions {
        flex-direction: column;
    }

    .game-actions .btn {
        width: 100%;
    }

    .turn-actions {
        flex-direction: column;
        gap: 12px;
    }

    .turn-actions .btn {
        width: 100%;
    }
}

@media (min-width: 640px) {
    .screen {
        --screen-pad-x: 24px;
        --screen-pad-y: 28px;
        --screen-pad-bottom: 36px;
    }

    .section {
        --section-pad: 30px;
    }

    .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .vote-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .story-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .fit-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .online-link-row .btn {
        width: auto;
        min-width: 132px;
    }

}

@media (min-width: 900px) {
    #setup-screen,
    #setup-screen.active {
        display: grid;
        grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
        gap: 24px;
        align-content: start;
    }

    .setup-hero,
    .story-section,
    .fit-section,
    .mode-section,
    .online-section,
    .rules-section,
    .faq-section,
    .players-section,
    .setup-actions,
    .site-footer {
        grid-column: 1 / -1;
    }

    .hero-shell {
        grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
        gap: 20px;
    }

    .hero-stage {
        align-content: center;
    }

    .settings-section,
    .categories-section {
        margin-bottom: 0;
        height: 100%;
    }

    .categories-section .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: 520px;
    }

    .start-btn {
        padding-top: 0;
    }

    .turn-actions,
    .vote-actions,
    .game-actions,
    .reveal-actions {
        max-width: 560px;
    }

    .online-choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lobby-grid {
        grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
        align-items: start;
    }

    .lobby-grid .custom-words-section,
    .lobby-grid .categories-section {
        grid-column: 1 / -1;
    }
}

@media (min-width: 1180px) {
    .screen {
        padding-left: 28px;
        padding-right: 28px;
    }

    .category-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .categories-section .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-copy {
        padding: 34px 32px;
    }

    .hero-stage-card {
        padding: 24px;
    }
}
