@import url("/css/chronicler-shared.css");
  /* ====================================================
     TOKENS — identyczne z chronicler-shared.css
  ==================================================== */
  :root {
    --ink:        #0a0804;
    --ink-panel:  #111009;
    --gold:       #c4922a;
    --gold-light: #e8b94a;
    --gold-dim:   rgba(196, 146, 42, 0.25);
    --gold-line:  rgba(196, 146, 42, 0.18);
    --cream:      #f0e6d0;
    --muted:      #6a5c4e;
    --muted-mid:  #8a7a6a;
  }

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html { font-size: 16px; }

  /* ====================================================
     APP SHELL — full viewport, locked scroll
  ==================================================== */
  body {
    background: var(--ink);
    color: var(--cream);
    font-family: 'Courier Prime', monospace;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  /* Boot veil — hide hub→live flash until RTDB is ready, then fade in. */
  .boot-veil {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.1rem;
    background: var(--ink);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.55s ease, visibility 0.55s ease;
  }
  .boot-veil-label {
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold);
    text-align: center;
    animation: boot-pulse 1.4s ease-in-out infinite;
  }
  .boot-veil-rule {
    width: min(42vw, 160px);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold) 30%, var(--gold) 70%, transparent);
    opacity: 0.55;
  }
  @keyframes boot-pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
  }
  body.is-booting .app-nav,
  body.is-booting .layout-root {
    opacity: 0;
    pointer-events: none;
  }
  body.boot-revealed .app-nav,
  body.boot-revealed .layout-root {
    opacity: 1;
    transition: opacity 0.5s ease;
  }
  body:not(.is-booting) .boot-veil {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  body.is-booting .ballot-submit-bar {
    opacity: 0.35;
    pointer-events: none;
  }
  .boot-skeleton { padding: 0.35rem 0; }

  /* film grain */
  body::after {
    content: '';
    position: fixed; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
    z-index: 9999;
  }

  /* ====================================================
     DEV RIBBON
  ==================================================== */
  .dev-ribbon {
    flex-shrink: 0;
    background: rgba(160, 50, 30, 0.9);
    color: #fff;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: center;
    padding: 0.3rem 1rem;
    z-index: 200;
  }

  /* ====================================================
     TOP NAV BAR
  ==================================================== */
  .app-nav {
    flex-shrink: 0;
    height: 46px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid var(--gold-line);
    gap: 0.75rem;
  }

  .nav-left {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
  }

  .nav-chapters-btn {
    display: none;
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--gold-dim);
    color: var(--gold-light);
    font-family: inherit;
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.2rem 0.45rem;
    cursor: pointer;
  }
  .nav-chapters-btn:hover {
    border-color: var(--gold);
    color: var(--cream);
  }
  .nav-chapters-icon {
    display: none;
    font-size: 1.05rem;
    line-height: 1;
    letter-spacing: 0;
  }

  .nav-back {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    color: var(--gold-light);
    text-decoration: none;
    border-bottom: 1px solid var(--gold-dim);
    white-space: nowrap;
    width: fit-content;
  }
  .nav-back:hover { color: var(--cream); }

  .nav-title {
    text-align: center;
    font-family: 'Playfair Display', serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--cream);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .nav-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: flex-end;
    min-width: 0;
  }

  .nav-timer {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--gold-light);
    background: var(--ink-panel);
    border: 1px solid var(--gold-dim);
    padding: 0.2rem 0.55rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    min-width: 4rem;
    max-width: 9.5rem;
    text-align: center;
    white-space: nowrap;
    transition: border-color 0.3s, color 0.3s;
  }
  .nav-timer.ending {
    color: var(--cream);
    border-color: var(--gold);
    animation: pulse-border 0.6s ease infinite alternate;
  }
  .nav-timer.is-idle {
    display: none;
  }

  .lang-btn {
    background: none;
    border: 1px solid var(--gold-dim);
    color: var(--muted-mid);
    font-family: inherit;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    padding: 0.22rem 0.55rem;
    cursor: pointer;
    text-transform: uppercase;
    transition: color 0.15s, border-color 0.15s;
  }
  .lang-btn.active, .lang-btn:hover {
    color: var(--gold);
    border-color: var(--gold);
  }

  .nav-right .bgm-btn {
    font-size: 0.62rem;
    padding: 0.22rem 0.4rem;
    letter-spacing: 0.06em;
  }

  /* ====================================================
     LAYOUT ROOT — setup (fullscreen vote) vs story (3-col)
  ==================================================== */
  .layout-root {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.layout-setup .layout-root {
    overflow: hidden;
    flex: 1;
    min-height: 0;
  }

  .setup-hero {
    display: none;
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
    padding: 0.5rem 1.25rem 0;
    flex-shrink: 0;
  }

  body.layout-setup .setup-hero {
    display: block;
  }

  .setup-eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted-mid);
    margin-bottom: 0.35rem;
  }

  .setup-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.45rem, 4.5vw, 1.9rem);
    font-weight: 700;
    color: var(--cream);
    margin-bottom: 0.3rem;
    line-height: 1.15;
  }

  .setup-subtitle {
    color: var(--muted-mid);
    font-size: 0.9rem;
    line-height: 1.45;
    max-width: 28rem;
    margin: 0 auto 0.55rem;
  }

  body.layout-setup .setup-subtitle br {
    display: none;
  }

  .setup-rule {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
    margin-bottom: 0.45rem;
  }

  .setup-novel-context {
    border: 1px solid var(--gold-line);
    background: rgba(196, 146, 42, 0.07);
    padding: 0.65rem 0.9rem 0.7rem;
    margin-bottom: 0.35rem;
    text-align: center;
  }

  .setup-context-eyebrow {
    font-size: 0.6rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 0.35rem;
  }

  .setup-context-title {
    display: block;
    font-family: 'Playfair Display', serif;
    font-size: clamp(0.95rem, 3.2vw, 1.15rem);
    font-weight: 700;
    color: var(--cream);
    line-height: 1.3;
    margin-bottom: 0.2rem;
  }

  .setup-context-hook {
    display: block;
    font-size: 0.76rem;
    line-height: 1.4;
    color: var(--muted-mid);
    max-width: 34rem;
    margin: 0 auto;
  }

  body.layout-setup .nav-title {
    display: none;
  }

  /* Setup already has ballot countdown — don't duplicate in the nav chip */
  body.layout-setup .nav-timer {
    display: none;
  }

  body.layout-setup .app-nav {
    height: 40px;
  }

  body.layout-setup .app-body {
    grid-template-columns: 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body.layout-setup .col-left,
  body.layout-setup .col-center {
    display: none !important;
  }

  body.layout-setup .col-right {
    border-left: none;
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  body.layout-setup .ballot-scroll {
    border: 1px solid var(--gold-line);
    background: rgba(17, 16, 9, 0.65);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.75rem 1rem 0.85rem;
    margin: 0 1rem 0.65rem;
    overflow: hidden;
  }

  body.layout-setup .ballot-heading {
    font-size: 0.72rem;
    letter-spacing: 0.24em;
    opacity: 0.75;
  }

  body.layout-setup .ballot-round-meta {
    font-size: 0.92rem;
    line-height: 1.4;
  }

  body.layout-setup .ballot-meta-hint {
    font-size: 0.88rem;
  }

  body.layout-setup .round-type-badge {
    font-size: 0.85rem;
  }

  body.layout-setup .ballot-timer {
    padding: 0.25rem 0 0.35rem;
  }

  body.layout-setup .ballot-timer-label {
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
  }

  body.layout-setup .ballot-timer-digits {
    font-size: clamp(1.85rem, 6vw, 2.15rem);
  }

  body.layout-setup .ballot-options {
    gap: 0.45rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  body.layout-setup .ballot-opt {
    padding: 0.7rem 0.85rem;
  }

  body.layout-setup .opt-title {
    font-size: 1.08rem;
    line-height: 1.35;
    margin-bottom: 0.2rem;
  }

  body.layout-setup .opt-hook {
    font-size: 0.9rem;
    line-height: 1.4;
  }

  body.layout-setup .verdict-italic {
    font-size: 0.98rem;
    line-height: 1.5;
  }

  body.layout-setup .verdict-msg {
    padding: 0.65rem 0.75rem;
    flex-shrink: 0;
  }

  body.layout-setup .ballot-gate-notice {
    font-size: 0.78rem;
    padding: 0.35rem 0.2rem;
  }

  /* Setup — floating submit bar (theme / title fullscreen) */
  body.layout-setup {
    --setup-submit-bar-space: calc(4.75rem + env(safe-area-inset-bottom, 0px));
  }

  body.layout-setup .col-right {
    padding-bottom: var(--setup-submit-bar-space);
  }

  body.layout-setup .col-right.submit-bar-hidden {
    padding-bottom: 0.65rem;
  }

  .ballot-submit-bar.submit-bar-hidden,
  body.layout-story .ballot-submit-bar.submit-bar-hidden {
    display: none;
  }

  body.layout-setup .ballot-scroll {
    margin-bottom: 0;
    padding-bottom: 0.5rem;
  }

  .ballot-submit-bar {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.55rem 1rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--gold-line);
    background: rgba(10, 8, 4, 0.97);
  }

  body.layout-setup .ballot-submit-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    margin: 0 auto;
    max-width: 640px;
    padding: 0.45rem 1rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--gold-line);
    background: linear-gradient(180deg, rgba(10, 8, 4, 0) 0%, rgba(10, 8, 4, 0.92) 28%, var(--ink) 55%);
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.45);
    pointer-events: none;
  }

  body.layout-setup .ballot-submit-bar > * {
    pointer-events: auto;
  }

  body.layout-setup .ballot-submit-bar.submit-bar-hidden {
    display: none;
  }

  body.layout-setup .ballot-submit-bar .ballot-status {
    font-size: clamp(0.68rem, 2.2vw, 0.78rem);
    min-height: 0;
    line-height: 1.35;
    margin: 0;
  }

  body.layout-setup .ballot-submit-bar .ballot-submit {
    width: 100%;
    padding: 0.62rem 0.85rem;
    font-size: clamp(0.64rem, 2.4vw, 0.72rem);
    letter-spacing: 0.14em;
  }

  /* ====================================================
     3-COLUMN BODY
  ==================================================== */
  .app-body {
    flex: 1;
    display: grid;
    /* Compact side rails; center owns the read. Caps stop ultra-wide sidebar sprawl. */
    grid-template-columns: clamp(240px, 14vw, 300px) minmax(0, 1fr) clamp(320px, 20vw, 400px);
    min-height: 0;            /* important: allow flex child to shrink */
    overflow: hidden;
  }

  /* ====================================================
     LEFT COLUMN — novel meta + chapter list
  ==================================================== */
  .col-left {
    border-right: 1px solid var(--gold-line);
    overflow-y: auto;
    min-height: 0;
    padding: 1.25rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
  }

  .sidebar-label {
    font-size: 0.68rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.65;
    margin-bottom: 0.5rem;
  }

  .novel-title-sidebar {
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cream);
    line-height: 1.3;
  }
  .novel-edition-sidebar {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted-mid);
    margin-top: 0.25rem;
  }

  .sidebar-rule { height: 1px; background: var(--gold-line); }

  .chapter-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.45rem 0.5rem 0.55rem;
    border-left: 2px solid transparent;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--muted-mid);
    line-height: 1.45;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
  }
  .chapter-item:hover { border-left-color: var(--gold-dim); background: rgba(196,146,42,.04); color: var(--cream); }
  .chapter-item.active { border-left-color: var(--gold); background: rgba(196,146,42,.06); color: var(--cream); }
  .chapter-item.writing { color: var(--gold-light); }
  .ch-num { font-size: 0.68rem; color: var(--gold); opacity: 0.55; flex-shrink: 0; padding-top: 0.12rem; }

  .sidebar-stat { font-size: 0.85rem; color: var(--muted); line-height: 1.55; }
  .sidebar-stat strong { color: var(--gold); font-weight: 700; }

  .sidebar-exit {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--gold-line);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
  }
  .sidebar-exit-link {
    display: block;
    text-align: center;
    text-decoration: none;
    font-family: 'Courier Prime', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
    background: var(--gold);
    border: 1px solid var(--gold);
    padding: 0.85rem 0.75rem;
    line-height: 1.3;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }
  .sidebar-exit-link:hover {
    background: var(--gold-light);
    border-color: var(--gold-light);
    color: var(--ink);
  }
  .sidebar-exit-link-secondary {
    background: transparent;
    color: var(--gold);
    border-color: rgba(196, 146, 42, 0.55);
  }
  .sidebar-exit-link-secondary:hover {
    background: rgba(196, 146, 42, 0.12);
    border-color: var(--gold);
    color: var(--gold-light);
  }
  /* Mobile chapters drawer only — closes drawer back to prose */
  .sidebar-back-novel {
    display: none;
    width: 100%;
    text-align: center;
    font-family: 'Courier Prime', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
    background: var(--gold);
    border: 1px solid var(--gold);
    padding: 0.85rem 0.75rem;
    line-height: 1.3;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }
  .sidebar-back-novel:hover {
    background: var(--gold-light);
    border-color: var(--gold-light);
    color: var(--ink);
  }

  /* ====================================================
     CENTER COLUMN — novel prose
  ==================================================== */
  .col-center {
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* ponytail: no scroll-behavior:smooth — programmatic pins (lang switch) must not animate top→bottom */
  }

  .center-inner {
    max-width: min(58rem, 90%);
    margin: 0 auto;
    padding: 2.25rem clamp(1.5rem, 3.5vw, 2.75rem) 5rem;
  }

  .read-empty,
  .center-empty-hint {
    color: var(--muted-mid);
    font-size: 1.05rem;
    line-height: 1.65;
    text-align: center;
    padding: 2rem 0;
  }

  .ch-eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.6;
    margin-bottom: 0.55rem;
  }
  .ch-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.65rem, 2.2vw, 2.05rem);
    font-weight: 700;
    color: var(--gold-light);
    line-height: 1.22;
    margin-bottom: 1.1rem;
  }
  .fill-direction {
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--muted-mid);
    margin: 0 0 1.5rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--gold-line);
  }
  .ch-prose {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.2rem, 1.45vw, 1.42rem);
    line-height: 1.78;
    color: var(--cream);
  }
  .ch-prose p + p { margin-top: 1.2rem; }

  /* Sealed chapters: chrome quieter, prose stays full cream for reading */
  .ch-block.ch-settled {
    opacity: 1;
  }
  .ch-block.ch-settled .ch-eyebrow {
    color: var(--muted-mid);
    opacity: 0.75;
  }
  .ch-block.ch-settled .ch-title {
    color: var(--gold-light);
    opacity: 0.88;
  }
  .ch-block.ch-settled .fill-direction {
    opacity: 0.72;
  }
  .ch-block.ch-settled .ch-prose {
    color: var(--cream);
    opacity: 1;
  }

  /* Current chapter strip — same ink as settled prose (no wash while typing) */
  .ch-block.ch-writing-now,
  .running-prose-block.ch-writing-now {
    opacity: 1;
    margin-top: 0.25rem;
    padding: 1.15rem 0 1.35rem;
    border-left: none;
    background: transparent;
  }
  /* Live status lives in .typewriter-live-bar under prose */
  .ch-block.ch-writing-now .ch-eyebrow,
  .running-prose-block.ch-writing-now .ch-eyebrow {
    color: var(--gold);
    opacity: 0.75;
  }
  .ch-block.ch-writing-now.is-typing .ch-eyebrow,
  .running-prose-block.ch-writing-now.is-typing .ch-eyebrow {
    color: var(--gold-light);
    opacity: 1;
  }
  .ch-writing-now .ch-prose,
  .ch-writing-now .running-draft {
    color: var(--cream);
    opacity: 1;
  }

  .running-prose-block {
    margin-bottom: 0.5rem;
  }
  .running-draft {
    font-style: normal;
    color: var(--cream);
    opacity: 1;
    white-space: pre-wrap;
  }
  .running-draft p {
    white-space: normal;
  }
  .running-draft p + p { margin-top: 1.2rem; }

  .ch-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
    margin: 2.5rem 0;
  }

  /* After sealed chapters, before live writing — slightly stronger rule */
  .ch-divider + .ch-writing-now {
    margin-top: 0.35rem;
  }

  /* ====================================================
     TYPING BLOCK — new text materialises here (no extra rules)
  ==================================================== */
  .typing-section { margin-top: 1.25rem; }

  .typing-prose {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.2rem, 1.45vw, 1.42rem);
    line-height: 1.78;
    color: var(--cream);
  }
  .typing-prose p + p { margin-top: 1.2rem; }

  /* Live status + skip — one bar under the typing prose */
  .typewriter-live-bar {
    display: none;
    margin-top: 1.35rem;
    padding-top: 1.05rem;
    border-top: 1px solid var(--gold-line);
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    flex-wrap: wrap;
    opacity: 1;
    transition: opacity 0.42s ease, border-top-color 0.42s ease;
  }
  .is-typing .typewriter-live-bar,
  .typing-section .typewriter-live-bar {
    display: flex;
  }
  .typewriter-live-bar.is-fading-out {
    display: flex;
    opacity: 0;
    border-top-color: transparent;
    pointer-events: none;
  }
  @media (prefers-reduced-motion: reduce) {
    .typewriter-live-bar {
      transition: none;
    }
  }
  .typewriter-live-status {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: clamp(0.98rem, 1.25vw, 1.12rem);
    line-height: 1.35;
    color: var(--gold-light);
    letter-spacing: 0.02em;
  }
  .typewriter-skip {
    margin: 0;
    padding: 0.55rem 1rem;
    border: 1px solid var(--gold);
    background: transparent;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
  .typewriter-skip:hover,
  .typewriter-skip:focus-visible {
    background: rgba(196, 146, 42, 0.14);
    color: var(--gold-light);
    border-color: var(--gold-light);
    outline: none;
  }

  /* Typing caret — hidden (gold bar read as stray yellow strip on mobile) */
  .tw-cursor {
    display: none;
  }

  /* ====================================================
     RIGHT COLUMN — ballot
  ==================================================== */
  .col-right {
    border-left: 1px solid var(--gold-line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }

  .ballot-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
  }

  .ballot-heading {
    font-size: 0.72rem;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--gold);
    text-align: center;
    opacity: 0.75;
  }

  .ballot-round-meta {
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted-mid);
    line-height: 1.5;
  }
  .ballot-meta-hint {
    font-size: 0.82rem;
    color: var(--muted-mid);
  }
  .round-type-badge {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gold);
  }

  /* TIMER */
  .ballot-timer { text-align: center; padding: 0.5rem 0; }
  .ballot-timer-label {
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.35rem;
  }
  .ballot-timer-digits {
    font-weight: 700;
    font-size: 2.2rem;
    color: var(--gold-light);
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s;
  }
  .ballot-timer-digits.ending { color: var(--cream); animation: pulse-border 0.5s ease infinite alternate; }

  /* OPTIONS */
  .ballot-options { display: flex; flex-direction: column; gap: 0.45rem; }

  .ballot-opt {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--gold-dim);
    background: var(--ink-panel);
    color: var(--cream);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, opacity 0.4s;
  }
  .ballot-opt:hover:not(:disabled) { border-color: var(--gold); background: rgba(196,146,42,.08); }
  .ballot-opt.selected {
    border-color: var(--gold);
    background: rgba(196,146,42,.16);
    box-shadow: inset 3px 0 0 var(--gold), 0 0 0 1px rgba(196,146,42,.4);
  }
  .ballot-opt.is-voted {
    border-color: var(--gold-light);
    background: rgba(196,146,42,.2);
    box-shadow: inset 3px 0 0 var(--gold-light), 0 0 0 1px rgba(196,146,42,.45);
  }
  .ballot-opt.is-voted::after {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold-light);
    content: 'Twój głos';
  }
  body.lang-en .ballot-opt.is-voted::after { content: 'Your vote'; }
  .ballot-opt.winner  { border-color: var(--gold-light); background: rgba(196,146,42,.17); box-shadow: inset 3px 0 0 var(--gold-light); }
  .ballot-opt:disabled { cursor: default; }
  /* Losers / frozen — readable, not washed-out spam */
  .ballot-opt.dim {
    opacity: 0.62;
    pointer-events: none;
    filter: none;
  }
  .ballot-opt.dim .opt-title { color: var(--cream); }
  .ballot-opt.winner.dim,
  .ballot-opt.winner {
    opacity: 1;
  }

  .opt-title {
    font-family: 'Playfair Display', serif;
    font-size: 0.95rem;
    line-height: 1.38;
    color: var(--cream);
    margin-bottom: 0.25rem;
  }
  .ballot-opt.winner .opt-title { color: var(--gold-light); }

  .opt-hook {
    font-size: 0.84rem;
    line-height: 1.45;
    color: var(--muted-mid);
    font-style: italic;
  }
  .opt-hook::before {
    content: '— ';
    font-style: normal;
    opacity: 0.75;
  }

  /* bar that appears after vote closes */
  .opt-bar-row {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.6rem;
  }
  .opt-bar-row.show { display: flex; }
  .opt-bar-bg {
    flex: 1;
    height: 3px;
    background: rgba(196,146,42,.12);
    overflow: hidden;
  }
  .opt-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold));
    width: 0;
    transition: width 1.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .ballot-opt.winner .opt-bar-fill { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
  .opt-pct {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gold);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    min-width: 2.5rem;
    text-align: right;
  }

  /* VERDICT message */
  .verdict-msg {
    display: none;
    border: 1px solid var(--gold-dim);
    background: rgba(196,146,42,.06);
    padding: 0.9rem 0.85rem;
    text-align: center;
  }
  .verdict-msg.show { display: block; }
  .verdict-italic {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--cream);
  }

  /* WRITING NOTICE — removed; status is .typewriter-live-bar under story prose */

  /* SUBMIT */
  .ballot-submit {
    width: 100%;
    background: var(--gold);
    border: none;
    color: var(--ink);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.76rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    padding: 0.8rem 1rem;
    cursor: pointer;
    transition: background 0.15s, opacity 0.3s;
  }
  .ballot-submit:hover:not(:disabled) { background: var(--gold-light); }
  .ballot-submit:disabled { opacity: 0.35; cursor: default; }

  .ballot-status {
    min-height: 1.1rem;
    font-size: 0.85rem;
    text-align: center;
    color: var(--muted-mid);
  }
  .ballot-status.ok  { color: var(--gold-light); }
  .ballot-status.err { color: #d47; }

  .ballot-gate-notice {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--muted-mid);
    text-align: center;
    padding: 0.5rem 0.25rem;
  }

  /* ====================================================
     LANG SYSTEM
  ==================================================== */
  body.lang-en [data-lang="pl"] { display: none !important; }
  body:not(.lang-en) [data-lang="en"] { display: none !important; }

  /* ====================================================
     SCROLLBAR
  ==================================================== */
  ::-webkit-scrollbar { width: 3px; }
  ::-webkit-scrollbar-track { background: var(--ink); }
  ::-webkit-scrollbar-thumb { background: var(--gold-dim); }
  ::-webkit-scrollbar-thumb:hover { background: var(--gold); }

  /* ====================================================
     ANIMATIONS
  ==================================================== */
  @keyframes blink { 50% { opacity: 0; } }
  @keyframes pulse-border { from { opacity: 0.7; } to { opacity: 1; } }
  @keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

  /* Mobile chrome — hidden on desktop; wired in ≤600px */
  .mobile-read-peek,
  .mobile-status-strip,
  .mobile-ballot-backdrop,
  .mobile-chapters-backdrop,
  .mobile-sheet-close {
    display: none;
  }

  /* ====================================================
     RESPONSIVE
  ==================================================== */
  @media (max-width: 1100px) {
    .app-body { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
    .col-left  { display: none; }
  }
  @media (max-width: 920px) {
    .app-body { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); }
  }
  @media (max-width: 600px) {
    .ch-block.ch-writing-now,
    .running-prose-block.ch-writing-now {
      padding: 0.85rem 0 1rem;
      margin-left: 0;
    }
    .typewriter-live-bar {
      flex-direction: column;
      align-items: stretch;
      gap: 0.65rem;
    }
    .typewriter-skip {
      width: 100%;
      text-align: center;
    }
    /* Kill 50/50 split — one primary pane per phase.
       Both cols share cell 1/1 so fixed ballot sheet cannot open an
       implicit second track (full-height vertical strip on the right). */
    body.layout-story .app-body {
      grid-template-columns: minmax(0, 1fr);
      grid-template-rows: minmax(0, 1fr);
      grid-auto-columns: 0;
      grid-auto-rows: 0;
      position: relative;
    }
    body.layout-story .col-center,
    body.layout-story .col-right {
      grid-column: 1;
      grid-row: 1;
      min-width: 0;
    }

    .app-nav {
      height: 44px;
      grid-template-columns: auto minmax(0, 1fr) auto;
      padding: 0 0.55rem;
      gap: 0.4rem;
    }
    .nav-title {
      font-size: 0.8rem;
      line-height: 1.2;
    }
    /* Top bar stays chapters-only on mobile story; hub/TLW exit lives in chapters drawer (UX). */
    body.layout-story .nav-left .nav-back {
      display: none;
    }
    body.layout-story .nav-chapters-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 2.4rem;
      min-height: 2rem;
      padding: 0.25rem 0.4rem;
    }
    body.layout-story .nav-chapters-btn[hidden] {
      display: none;
    }
    body.layout-story .nav-chapters-icon {
      display: block;
    }
    body.layout-story .nav-chapters-label {
      display: none;
    }
    .nav-right {
      gap: 0.28rem;
    }
    .lang-btn {
      padding: 0.2rem 0.4rem;
      font-size: 0.64rem;
    }
    .nav-timer {
      min-width: 3.4rem;
      max-width: 6.5rem;
      font-size: 0.7rem;
      padding: 0.18rem 0.35rem;
    }

    /* —— Vote pane: full ballot, story off —— */
    body.layout-story.mobile-pane-vote .col-center {
      display: none !important;
    }
    body.layout-story.mobile-pane-vote .col-right {
      border-left: none;
      border-top: none;
      max-height: none;
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      padding-bottom: 0;
    }
    body.layout-story.mobile-pane-vote .ballot-scroll {
      margin: 0 0.65rem 0;
      padding: 0.6rem 0.75rem 0.4rem;
      border: 1px solid var(--gold-line);
      background: rgba(17, 16, 9, 0.65);
    }
    body.layout-story.mobile-pane-vote .mobile-read-peek {
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      position: static;
      width: calc(100% - 1.3rem);
      box-sizing: border-box;
      margin: 0.35rem 0.65rem 0.15rem;
      background: transparent;
      border: 1px solid var(--gold-dim);
      color: var(--gold-light);
      font-family: inherit;
      font-size: 0.7rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      padding: 0.55rem 0.75rem;
      cursor: pointer;
      text-align: center;
      z-index: auto;
      left: auto;
      right: auto;
      bottom: auto;
    }
    body.layout-story.mobile-pane-vote .mobile-read-peek:hover {
      border-color: var(--gold);
      color: var(--cream);
    }
    body.layout-story.mobile-pane-vote .mobile-read-peek[hidden] {
      display: none;
    }

    /* —— Read pane: full story; ballot as bottom sheet —— */
    body.layout-story.mobile-pane-read {
      /* strip + cookie FAB clearance (~52px) + safe area */
      --mobile-strip-space: calc(5.75rem + env(safe-area-inset-bottom, 0px));
      --mobile-cookie-gutter: 3.6rem;
    }
    body.layout-story.mobile-pane-read .col-center {
      max-height: none;
      padding-bottom: var(--mobile-strip-space);
    }
    body.layout-story.mobile-pane-read .col-right {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      width: 100%;
      z-index: 140;
      max-height: min(88dvh, 640px);
      border-left: none;
      border-top: 1px solid var(--gold-line);
      background: var(--ink);
      transform: translateY(105%);
      transition: transform 0.28s ease;
      box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55);
      display: flex;
      flex-direction: column;
      /* Out of flow for paint; grid-area already shared with .col-center */
      pointer-events: none;
    }
    body.layout-story.mobile-pane-read.mobile-ballot-sheet-open .col-right {
      pointer-events: auto;
    }
    body.layout-story.mobile-pane-read.mobile-ballot-sheet-open .col-right {
      transform: translateY(0);
    }
    body.layout-story.mobile-pane-read .mobile-sheet-close {
      display: block;
      flex-shrink: 0;
      width: 100%;
      background: transparent;
      border: none;
      border-bottom: 1px solid var(--gold-line);
      color: var(--muted-mid);
      font-family: inherit;
      font-size: 0.78rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      padding: 0.7rem 1rem;
      cursor: pointer;
      text-align: center;
    }
    body.layout-story.mobile-pane-read .mobile-sheet-close[hidden] {
      display: none;
    }
    body.layout-story.mobile-pane-read .mobile-status-strip {
      display: block;
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 125;
      padding: 0 0.65rem calc(0.55rem + env(safe-area-inset-bottom, 0px)) var(--mobile-cookie-gutter);
      background: linear-gradient(180deg, rgba(10, 8, 4, 0) 0%, rgba(10, 8, 4, 0.92) 28%, var(--ink) 65%);
      pointer-events: none;
    }
    body.layout-story.mobile-pane-read .mobile-status-strip[hidden] {
      display: none;
    }
    body.layout-story.mobile-pane-read .mobile-status-strip-btn {
      pointer-events: auto;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      width: 100%;
      min-height: 3.15rem;
      background: var(--ink-panel);
      border: 1px solid var(--gold);
      color: var(--cream);
      font-family: inherit;
      padding: 0.75rem 2.1rem;
      cursor: pointer;
      text-align: center;
    }
    /* Noir desk lamp — warm filament pulse when ballot awaits a first tap */
    body.layout-story.mobile-pane-read .mobile-status-strip-btn.is-vote-nudge {
      border-color: var(--gold-light);
      animation: noir-lamp-glow 2.4s ease-in-out infinite;
    }
    @keyframes noir-lamp-glow {
      0%, 100% {
        border-color: rgba(196, 146, 42, 0.45);
        box-shadow:
          0 0 0.35rem rgba(196, 146, 42, 0.2),
          0 0 1.1rem rgba(232, 185, 74, 0.06),
          inset 0 0 0.55rem rgba(196, 146, 42, 0.05);
      }
      40% {
        border-color: var(--gold-light);
        box-shadow:
          0 0 0.75rem rgba(232, 185, 74, 0.42),
          0 0 1.8rem rgba(196, 146, 42, 0.22),
          inset 0 0 0.85rem rgba(232, 185, 74, 0.1);
      }
      55% {
        border-color: rgba(232, 185, 74, 0.7);
        box-shadow:
          0 0 0.55rem rgba(232, 185, 74, 0.28),
          0 0 1.35rem rgba(196, 146, 42, 0.14),
          inset 0 0 0.65rem rgba(196, 146, 42, 0.07);
      }
      70% {
        border-color: var(--gold-light);
        box-shadow:
          0 0 0.9rem rgba(232, 185, 74, 0.48),
          0 0 2rem rgba(196, 146, 42, 0.26),
          inset 0 0 0.95rem rgba(232, 185, 74, 0.12);
      }
    }
    @media (prefers-reduced-motion: reduce) {
      body.layout-story.mobile-pane-read .mobile-status-strip-btn.is-vote-nudge {
        animation: none;
        border-color: var(--gold-light);
        box-shadow:
          0 0 0.7rem rgba(232, 185, 74, 0.35),
          0 0 1.4rem rgba(196, 146, 42, 0.18);
      }
    }
    body.layout-story.mobile-pane-read .mobile-status-strip-label {
      font-family: 'Playfair Display', serif;
      font-size: 1.05rem;
      font-weight: 700;
      font-style: normal;
      letter-spacing: 0.02em;
      color: var(--cream);
      min-width: 0;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      text-align: center;
    }
    body.layout-story.mobile-pane-read .mobile-status-strip-label.is-writing {
      font-style: italic;
      font-weight: 500;
    }
    body.layout-story.mobile-pane-read .mobile-status-strip-chevron {
      position: absolute;
      right: 0.95rem;
      top: 50%;
      transform: translateY(-50%);
      font-size: 1.35rem;
      line-height: 1;
      color: var(--gold-light);
      font-family: 'Playfair Display', serif;
      pointer-events: none;
    }
    body.layout-story.mobile-pane-read.mobile-ballot-sheet-open .mobile-status-strip {
      display: none;
    }

    body.layout-story.mobile-pane-read .mobile-ballot-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 135;
      background: rgba(0, 0, 0, 0.55);
      border: none;
      padding: 0;
      cursor: pointer;
    }
    body.layout-story.mobile-pane-read.mobile-ballot-sheet-open .mobile-ballot-backdrop {
      display: block;
    }
    body.layout-story.mobile-pane-read .mobile-ballot-backdrop[hidden] {
      display: none;
    }

    /* Chapters drawer — reuse #col-left */
    body.layout-story .mobile-chapters-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 150;
      background: rgba(0, 0, 0, 0.55);
      border: none;
      padding: 0;
      cursor: pointer;
    }
    body.layout-story.mobile-chapters-open .mobile-chapters-backdrop {
      display: block;
    }
    body.layout-story .mobile-chapters-backdrop[hidden] {
      display: none;
    }
    body.layout-story.mobile-chapters-open .col-left {
      display: flex;
      position: fixed;
      top: 0;
      left: 0;
      bottom: 0;
      z-index: 160;
      width: min(86vw, 300px);
      background: var(--ink);
      border-right: 1px solid var(--gold-line);
      box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
      transform: translateX(0);
      padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    }
    body.layout-story.mobile-chapters-open .sidebar-exit-link {
      font-size: 0.82rem;
      padding: 1rem 0.85rem;
    }
    body.layout-story.mobile-chapters-open .sidebar-back-novel {
      display: block;
      font-size: 0.82rem;
      padding: 1rem 0.85rem;
    }

    /* Setup on phone — keep existing full-vote polish */
    body.layout-setup .app-body { grid-template-rows: 1fr; }
    body.layout-setup .col-right { max-height: none; border-top: none; flex: 1; }
    body.layout-setup .ballot-scroll { margin: 0 0.65rem 0; padding: 0.6rem 0.75rem 0.4rem; }
    body.layout-setup .ballot-submit-bar { max-width: none; padding-left: 0.75rem; padding-right: 0.75rem; }
    body.layout-setup .setup-hero { padding: 0.35rem 0.85rem 0; max-height: 24vh; }
    body.layout-setup .setup-title { font-size: clamp(1.25rem, 5.5vw, 1.55rem); }
    body.layout-setup .setup-subtitle { font-size: 0.85rem; margin-bottom: 0.4rem; }
    body.layout-setup .ballot-timer-digits { font-size: clamp(1.65rem, 8vw, 1.95rem); }
    body.layout-setup .opt-title { font-size: 1.02rem; }
    body.layout-setup .opt-hook { font-size: 0.88rem; }
    body.layout-setup { --setup-submit-bar-space: calc(4.35rem + env(safe-area-inset-bottom, 0px)); }
  }

  @media (max-height: 700px) {
    body.layout-setup .dev-ribbon { padding: 0.2rem 0.65rem; font-size: 0.58rem; }
    body.layout-setup .app-nav { height: 36px; }
    body.layout-setup .setup-hero { padding-top: 0.25rem; max-height: 22vh; }
    body.layout-setup .setup-eyebrow { margin-bottom: 0.2rem; font-size: 0.68rem; }
    body.layout-setup .setup-title { font-size: clamp(1.2rem, 4.5vw, 1.5rem); }
    body.layout-setup .setup-subtitle { font-size: 0.82rem; margin-bottom: 0.35rem; }
    body.layout-setup .setup-rule { margin-bottom: 0.3rem; }
    body.layout-setup .ballot-timer-label { font-size: 0.72rem; }
    body.layout-setup .ballot-timer-digits { font-size: 1.7rem; }
    body.layout-setup .ballot-opt { padding: 0.6rem 0.75rem; }
    body.layout-setup .opt-title { font-size: 1rem; }
    body.layout-setup .opt-hook { font-size: 0.86rem; }
    body.layout-setup { --setup-submit-bar-space: calc(4.15rem + env(safe-area-inset-bottom, 0px)); }
  }
  @media (prefers-reduced-motion: reduce) {
    .tw-cursor, .writing-cursor { animation: none; opacity: 1; }
    .boot-veil-label { animation: none; opacity: 1; }
    .boot-veil,
    body.boot-revealed .app-nav,
    body.boot-revealed .layout-root {
      transition: none !important;
    }
    * { transition: none !important; animation: none !important; }
  }

.ballot-options.fade-in{animation:fade-in .55s ease both}@keyframes fade-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}.skeleton-line{height:.85rem;margin:.45rem 0;background:linear-gradient(90deg,rgba(196,146,42,.08),rgba(196,146,42,.22),rgba(196,146,42,.08));background-size:200% 100%;animation:sk 1.2s ease infinite}@keyframes sk{0%{background-position:100% 0}100%{background-position:-100% 0}}@media (prefers-reduced-motion:reduce){.ballot-options.fade-in,.skeleton-line,.boot-veil-label{animation:none}}
