:root {
    color-scheme: light;
    --blue: #2196f3;
    --blue-dark: #0d67b5;
    --red: #f44336;
    --red-dark: #c7251a;
    --green: #4caf50;
    --white: #ffffff;
    --ink: #172126;
    --muted: #66737a;
    --line: rgba(23, 33, 38, 0.14);
    --page: #eef3f7;
    --panel: #ffffff;
    --shadow: 0 18px 40px rgba(23, 33, 38, 0.16);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--page);
    color: var(--ink);
}

button,
textarea,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    width: min(760px, calc(100% - 24px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 16px 0;
}

.play-panel {
    min-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.topbar {
    min-height: 76px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 16px 18px 0;
}

h1 {
    grid-column: 2;
    margin: 0;
    text-align: center;
    font-size: 2rem;
    line-height: 1.05;
    letter-spacing: 0;
}

.topbar .ghost-button {
    grid-column: 3;
    justify-self: end;
}

.question-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 0 18px;
}

.question-number,
.status-text,
.field-hint,
.modal-copy {
    color: var(--muted);
}

.question-number {
    min-height: 22px;
    margin: 0;
    text-align: center;
    font-weight: 800;
}

.option-stack {
    display: grid;
    grid-template-rows: minmax(190px, 1fr) auto minmax(190px, 1fr);
    gap: 10px;
}

.option-card {
    position: relative;
    min-height: 190px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border: 0;
    border-radius: 8px;
    color: var(--white);
    text-align: center;
    box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.14), 0 10px 22px rgba(23, 33, 38, 0.16);
    transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.option-card:not(:disabled):hover {
    transform: translateY(-2px);
    filter: saturate(1.08);
}

.option-card:not(:disabled):active {
    transform: translateY(1px);
}

.option-card:disabled {
    cursor: default;
}

.option-card-blue {
    background: var(--blue);
}

.option-card-red {
    background: var(--red);
}

.option-card.selected {
    box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18), 0 0 0 5px rgba(76, 175, 80, 0.35), 0 14px 26px rgba(23, 33, 38, 0.2);
}

.option-card strong {
    position: relative;
    z-index: 1;
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 2.7rem;
    line-height: 1.06;
    letter-spacing: 0;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}

.or-badge {
    width: 64px;
    min-height: 64px;
    display: grid;
    place-items: center;
    justify-self: center;
    align-self: center;
    border-radius: 999px;
    background: var(--white);
    color: var(--ink);
    border: 5px solid var(--page);
    font-size: 1.2rem;
    font-weight: 900;
    box-shadow: 0 10px 24px rgba(23, 33, 38, 0.18);
    z-index: 2;
}

.result-bar {
    position: absolute;
    inset: auto 0 0 0;
    height: 0;
    background: rgba(255, 255, 255, 0.25);
    transition: height 240ms ease;
}

.result-text {
    position: absolute;
    right: 16px;
    bottom: 14px;
    z-index: 1;
    min-height: 24px;
    font-size: 1rem;
    font-weight: 900;
}

.gender-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.gender-stats[hidden] {
    display: none;
}

.gender-stats span {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 8px;
    background: #f3f7fa;
    color: var(--muted);
    font-weight: 900;
}

.gender-stats strong {
    color: var(--ink);
}

.actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 18px 18px;
}

.status-text {
    margin: 0;
    font-weight: 700;
}

.action-buttons,
.modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.primary-button,
.secondary-button,
.app-store-button,
.ghost-button,
.icon-button,
.gender-grid button {
    min-height: 44px;
    border-radius: 8px;
    border: 0;
    padding: 0 18px;
    font-weight: 900;
    text-decoration: none;
}

.primary-button {
    background: var(--green);
    color: var(--white);
}

.primary-button:disabled {
    background: #aeb8bd;
    cursor: default;
}

.secondary-button {
    background: var(--ink);
    color: var(--white);
}

.app-store-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #000;
    color: var(--white);
    white-space: nowrap;
}

.app-store-button:hover,
.secondary-button:hover {
    filter: brightness(1.08);
}

.ghost-button {
    min-width: 92px;
    background: rgba(23, 33, 38, 0.06);
    color: var(--ink);
}

.icon-button {
    width: 44px;
    padding: 0;
    background: rgba(23, 33, 38, 0.08);
    color: var(--ink);
    font-size: 1.5rem;
    line-height: 1;
}

.modal {
    width: min(520px, calc(100% - 24px));
    max-height: calc(100vh - 40px);
    border: 0;
    border-radius: 8px;
    padding: 0;
    color: var(--ink);
    box-shadow: var(--shadow);
}

.comments-modal {
    width: min(720px, calc(100% - 24px));
}

.modal::backdrop {
    background: rgba(10, 18, 24, 0.54);
}

.modal-body {
    padding: 22px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

h2 {
    margin: 0;
    font-size: 1.65rem;
    line-height: 1.1;
    letter-spacing: 0;
}

.comment-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-top: 18px;
}

textarea,
input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 12px 14px;
    resize: vertical;
}

textarea:disabled {
    background: #eef2f4;
}

.comments-list {
    max-height: min(420px, calc(100vh - 260px));
    overflow: auto;
    display: grid;
    gap: 10px;
    margin-top: 18px;
    padding-right: 4px;
}

.comment-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #f8fafb;
}

.comment-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.9rem;
}

.comment-item p {
    margin: 8px 0 0;
    overflow-wrap: anywhere;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    background: rgba(33, 150, 243, 0.12);
    padding: 0 9px;
    color: var(--blue-dark);
    font-size: 0.76rem;
    font-weight: 900;
}

.gender-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.gender-grid button {
    background: #eef2f4;
    color: var(--ink);
}

.field-hint,
.modal-copy {
    margin: 10px 0 0;
}

.seo-section {
    margin: 18px 0 0;
    padding: 28px 18px 34px;
    color: var(--ink);
}

.seo-section h2 {
    font-size: 1.75rem;
}

.seo-section > p:not(.eyebrow) {
    max-width: 680px;
    margin: 12px 0 0;
    color: var(--muted);
    font-weight: 700;
    line-height: 1.55;
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.seo-grid article {
    min-height: 132px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 16px;
}

.seo-grid h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.25;
}

.seo-grid p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.45;
}

@media (max-width: 680px) {
    .app-shell {
        width: 100%;
        padding: 0;
    }

    .play-panel {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .topbar {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    h1,
    .topbar .ghost-button {
        grid-column: 1;
    }

    .topbar .ghost-button {
        justify-self: center;
    }

    h1 {
        font-size: 1.8rem;
    }

    .question-area {
        padding: 0 12px;
    }

    .option-stack {
        grid-template-rows: minmax(170px, 1fr) auto minmax(170px, 1fr);
    }

    .option-card {
        min-height: 170px;
        padding: 18px;
    }

    .option-card strong {
        font-size: 2rem;
    }

    .actions-row,
    .action-buttons,
    .comment-form,
    .gender-stats,
    .gender-grid {
        flex-direction: column;
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .actions-row {
        padding: 0 12px 14px;
    }

    .primary-button,
    .secondary-button,
    .app-store-button,
    .ghost-button {
        width: 100%;
    }

    .seo-section {
        padding: 24px 14px 30px;
    }

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