/* StoryCards design: dark is the default theme, [data-theme="light"] overrides */
:root {
    --bg: #141416;
    --surface: #1F1F23;
    --soft: #26262B;
    --field: #17171A;
    --ink: #F2EFE9;
    --text2: #D6D1C7;
    --muted: #A8A39A;
    --line: #34343A;
    --line2: #4A4A52;
    --edge: #6A6A72;
    --shadow: #000000;
    --card: #2A2A30;
    --card2: #34343A;
    --card-ink: #F2EFE9;
    --ok-bg: #173A2B;
    --ok-fg: #8FD3B0;
    --neu-bg: #2C2C32;
    --neu-fg: #C9C4BA;
    --link: #F08A5D;
    --row-active: #2E1F18;
    --logo-face: #2A2A30;
    --logo-stroke: #F2EFE9;
    --danger: #F08A8A;
    --accent: #E8622C;
    --accent-ink: #16161A;
    --btn-hover: #D6D1C7;

    --font-display: 'Bricolage Grotesque', sans-serif;
    --font-body: 'IBM Plex Sans', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

[data-theme="light"] {
    --bg: #F5F2EC;
    --surface: #FFFFFF;
    --soft: #FBFAF7;
    --field: #FFFFFF;
    --ink: #16161A;
    --text2: #3D3C3A;
    --muted: #5B5A57;
    --line: #E2DDD4;
    --line2: #D6D0C5;
    --edge: #16161A;
    --shadow: #16161A;
    --card: #FFFFFF;
    --card2: #F1EEE8;
    --card-ink: #16161A;
    --ok-bg: #E7F3EC;
    --ok-fg: #1A6849;
    --neu-bg: #F1EEE8;
    --neu-fg: #3D3C3A;
    --link: #B8461A;
    --row-active: #FDF1EA;
    --logo-face: #FFFFFF;
    --logo-stroke: #16161A;
    --danger: #B3261E;
    --btn-hover: #2c2c33;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--link);
    font-weight: 600;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 1.05;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* Site header (same as the marketing pages, see site.css) */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header .wrap { max-width: 1200px; margin: 0 auto; padding: 16px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.site-header .wrap > .theme-toggle { margin-left: auto; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 22px; flex: 1 1 auto; font-size: 15px; }
.site-nav a { color: var(--ink); text-decoration: none; padding: 10px 0; }
.site-nav a:hover { color: var(--link); }
.btn-dark { text-decoration: none; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 15px; padding: 12px 18px; border-radius: 10px; }
.btn-dark:hover { color: var(--bg); background: var(--btn-hover); }
.logo-face { fill: var(--logo-face); stroke: var(--logo-stroke); }
.logo-accent { fill: var(--accent); stroke: var(--logo-stroke); }
.theme-toggle { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 10px; border: 1.5px solid var(--line2); background: transparent; color: var(--ink); cursor: pointer; }
.theme-toggle:hover { background: var(--surface); border-color: var(--edge); }

/* Page layout */
.page-main {
    max-width: 640px;
    margin: 0 auto;
    padding: 56px 16px 80px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.page-main.narrow {
    max-width: 520px;
    padding-top: 72px;
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.page-title {
    font-size: clamp(36px, 5vw, 52px);
}

.lede {
    font-size: 17px;
    color: var(--text2);
    line-height: 1.55;
}

/* Cards */
.card {
    background: var(--surface);
    border: 2px solid var(--edge);
    border-radius: 20px;
    box-shadow: 8px 8px 0 var(--shadow);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card.success {
    box-shadow: 8px 8px 0 #1F7A55;
}

.card-title {
    font-size: 40px;
}

.hint {
    font-size: 13px;
    color: var(--muted);
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label,
.form-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.form-group label .optional {
    font-weight: 400;
    color: var(--muted);
}

input[type="text"],
textarea {
    width: 100%;
    font: inherit;
    font-size: 16px;
    padding: 13px 14px;
    color: var(--ink);
    background: var(--field);
    border: 1.5px solid var(--edge);
    border-radius: 12px;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

#storiesContainer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.story-input {
    display: flex;
    gap: 8px;
    align-items: center;
}

.story-input .story-title {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    padding: 12px 14px;
    border-color: var(--line2);
}

.btn-remove {
    color: var(--text2);
    background: transparent;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    width: 44px;
    height: 44px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-remove:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-copy {
    font: inherit;
    font-weight: 600;
    font-size: 16px;
    border-radius: 12px;
    padding: 13px 20px;
    min-height: 48px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-ink);
    border: 2px solid var(--accent-ink);
    box-shadow: 3px 3px 0 var(--shadow);
}

[data-theme="light"] .btn-primary,
.btn-primary {
    border-color: #16161A;
}

.btn-primary:hover {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0 var(--shadow);
}

.btn-primary:active {
    transform: translate(3px, 3px);
    box-shadow: none;
}

.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border: 1.5px solid var(--edge);
}

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

.btn-add-story {
    align-self: flex-start;
    background: transparent;
    border: 1.5px dashed var(--line2);
    border-radius: 10px;
    font-size: 15px;
    padding: 10px 14px;
    min-height: 44px;
}

.btn-create {
    width: 100%;
    font-size: 17px;
    padding: 15px;
}

.btn-copy {
    background: var(--ink);
    color: var(--bg);
    border: 0;
    font-size: 15px;
    padding: 13px 18px;
}

.btn-invite,
.btn-report,
.btn-logout {
    font-size: 14px;
    border-radius: 10px;
    padding: 10px 14px;
    min-height: 44px;
}

.btn-invite svg,
.btn-report svg,
.btn-logout svg {
    flex-shrink: 0;
}

/* Link box / success */
.success-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ok-bg);
    border: 2px solid var(--ok-fg);
    color: var(--ok-fg);
    display: grid;
    place-items: center;
}

.link-row {
    display: flex;
    gap: 8px;
}

.link-row input {
    flex: 1;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 14px;
    border-color: var(--line2);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.error-message {
    background: var(--row-active);
    color: var(--danger);
    border: 1.5px solid var(--danger);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
}

.join-footer {
    font-size: 14px;
    color: var(--muted);
    text-align: center;
}

/* Join page */
.join-title {
    font-size: 40px;
}

/* Session header */
.session-title {
    font-size: 28px;
    margin: 0;
    color: var(--ink);
}

.session-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.session-main {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    align-items: flex-start;
}

/* Participants */
.participants-panel {
    flex: 1 1 240px;
    max-width: 100%;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
}

.count {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
}

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

.participant-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    background: var(--soft);
    font-size: 15px;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 600;
    color: #FFFFFF;
    flex: 0 0 auto;
}

.participant-name {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.participant-tag {
    font-size: 12px;
    color: var(--muted);
}

/* Pills */
.pill {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    flex: 0 0 auto;
    background: var(--neu-bg);
    color: var(--neu-fg);
}

.pill.ok {
    background: var(--ok-bg);
    color: var(--ok-fg);
}

.pill.hot {
    background: var(--accent);
    color: var(--accent-ink);
}

/* Voting area */
.voting-area {
    flex: 999 1 560px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.current-story {
    background: var(--surface);
    border: 2px solid var(--edge);
    border-radius: 20px;
    box-shadow: 8px 8px 0 var(--shadow);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.story-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.story-pos {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
}

.story-title-main {
    font-size: 32px;
    margin-top: 6px;
}

.story-description {
    margin-top: 6px;
    font-size: 15px;
    color: var(--text2);
    line-height: 1.5;
}

.story-status {
    font-family: var(--font-mono);
    font-size: 13px;
    text-transform: uppercase;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--neu-bg);
    color: var(--neu-fg);
    border: 1.5px solid var(--line2);
}

.story-status.all-voted {
    background: var(--ok-bg);
    color: var(--ok-fg);
    border-color: var(--ok-fg);
}

.voting-hint {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 14px;
}

.card-deck {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.poker-card {
    font: inherit;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 26px;
    width: 64px;
    height: 92px;
    border-radius: 12px;
    border: 1.5px solid var(--edge);
    background: var(--card);
    color: var(--card-ink);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.15s;
}

.poker-card.card-special {
    background: var(--card2);
}

.poker-card:hover {
    transform: translateY(-4px);
}

.poker-card.selected {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: #16161A;
    transform: translateY(-10px);
    box-shadow: 0 8px 0 var(--shadow);
}

/* Votes */
.votes-display {
    border: 1.5px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
}

.votes-display .panel-title {
    padding: 12px 18px;
    background: var(--soft);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    color: var(--muted);
}

.vote-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
}

.vote-value {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 24px;
    color: var(--link);
}

/* Host controls */
.host-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.confirm-points {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.final-points {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}

#finalPointsInput {
    width: 96px;
    font-size: 18px;
    font-weight: 600;
    padding: 11px 12px;
}

.wait-note {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: var(--text2);
    background: var(--soft);
    border-radius: 12px;
    padding: 14px 16px;
}

.wait-note::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex: 0 0 auto;
}

/* Stories */
.stories-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stories-panel .panel-head .panel-title {
    font-size: 18px;
}

.stories-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.story-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 14px;
    background: var(--surface);
    border: 1.5px solid var(--line);
}

.story-item.active {
    background: var(--row-active);
    border: 2px solid var(--accent);
}

.story-delete {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1.5px solid var(--line2);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.story-delete:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.story-item-title {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.story-item.completed .story-item-title {
    color: var(--muted);
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 12, 0.6);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 140px 16px 16px;
    z-index: 2000;
    overflow-y: auto;
}

.modal-content {
    width: 100%;
    max-width: 520px;
    background: var(--surface);
    border: 2px solid var(--edge);
    border-radius: 20px;
    box-shadow: 8px 8px 0 var(--shadow);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-content h3 {
    font-size: 28px;
}

.modal-message {
    color: var(--text2);
    line-height: 1.6;
}

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

.modal-close {
    color: var(--ink);
    background: transparent;
    border: 0;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
    font-size: 15px;
    border-radius: 10px;
    padding: 12px 18px;
    min-height: 44px;
}

#addStoryForm {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .session-main {
        padding: 16px;
    }

    .current-story {
        padding: 20px;
    }

    .story-title-main {
        font-size: 26px;
    }

    .poker-card {
        width: 56px;
        height: 82px;
        font-size: 22px;
    }

    .modal {
        padding-top: 80px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

.qr-block { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 16px; }
.qr-block img { cursor: pointer; width: 200px; height: 200px; border-radius: 10px; background: #fff; }

/* Participants follow the voting card when stacked; sit to its left on wide screens */
@media (min-width: 769px) {
    .participants-panel { order: -1; }
}
.site-header .session-title { padding-left: 24px; border-left: 1.5px solid var(--line); }
@media (max-width: 768px) {
    .site-header .session-title { padding-left: 0; border-left: 0; flex-basis: 100%; }
}

/* Footer (same as the marketing pages, see site.css); pinned to the bottom on short pages */
.home-page, .join-page, .session-page { display: flex; flex-direction: column; }
.home-page > main, .join-page > main, .session-page > main { width: 100%; }
.site-footer { margin-top: auto; border-top: 1px solid var(--line); background: var(--surface); }
.site-footer .wrap { max-width: 1200px; margin: 0 auto; padding: 40px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; font-size: 15px; }
.site-footer .brandname { font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.site-footer nav { display: flex; flex-direction: column; gap: 8px; }
.site-footer .tag { color: var(--muted); line-height: 1.6; max-width: 320px; margin-top: 8px; }
.site-footer .group { display: flex; flex-direction: column; gap: 8px; }
.site-footer a { color: var(--ink); font-weight: 400; }
.site-footer a:hover { color: var(--link); }
.site-footer .group .cap { font-family: var(--font-mono); font-size: 12px; color: var(--muted); text-transform: uppercase; }
