/* Niby — teatrzyk na papierze: kurtyna, światło sceny, didaskalia. */
:root {
  --paper: #f5ede1;
  --paper-2: #ece2d3;
  --card: #fffaf3;
  --ink: #2b1d2e;
  --ink-soft: #77657a;
  --line: rgba(43, 29, 46, .09);
  --curtain: #c63f2f;
  --curtain-deep: #8e2620;
  --curtain-tint: #f7dcd4;
  --gold: #e3a93f;
  --gold-tint: #f8e7bf;
  --plum: #4f3470;
  --plum-tint: #e7def2;
  --sage: #3f8a62;
  --sage-tint: #dcece2;
  --mine-bg: #2b1d2e;
  --mine-ink: #fbf3e8;
  --on-curtain: #fff4e6;
  --shadow-1: 0 1px 2px rgba(43, 29, 46, .05), 0 6px 18px -6px rgba(43, 29, 46, .12);
  --shadow-2: 0 2px 4px rgba(43, 29, 46, .05), 0 18px 40px -12px rgba(43, 29, 46, .25);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a1419;
    --paper-2: #261d25;
    --card: #231b22;
    --ink: #f4eadd;
    --ink-soft: #ad9cab;
    --line: rgba(244, 234, 221, .09);
    --curtain: #e0574a;
    --curtain-deep: #9d2f27;
    --curtain-tint: #43221f;
    --gold: #eab65a;
    --gold-tint: #3d3018;
    --plum: #a68ad0;
    --plum-tint: #2f2540;
    --sage: #74c095;
    --sage-tint: #1f3329;
    --mine-bg: #f1e5d3;
    --mine-ink: #1f171e;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px -6px rgba(0, 0, 0, .5);
    --shadow-2: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 40px -12px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
/* ziarno papieru */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .07; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { body::before { mix-blend-mode: screen; opacity: .04; } }
#app { position: relative; z-index: 1; max-width: 600px; margin: 0 auto; padding: 20px 16px 32px; min-height: 100vh; }

/* ---------- ekrany ---------- */
.screen { display: none; }
.screen.active { display: block; animation: enter .45s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0 0 8px; font-variation-settings: "SOFT" 100; }
.logo {
  font-family: var(--serif); font-style: italic; font-weight: 800; font-size: 76px; line-height: 1; letter-spacing: -.04em;
  color: var(--curtain); margin: 40px 0 6px; text-align: center; font-variation-settings: "SOFT" 100, "WONK" 1;
}
.logo.small { font-size: 34px; margin: 0; text-align: left; }
.tagline { text-align: center; font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--ink-soft); margin: 0 0 20px; }
.pitch { text-align: center; font-size: 14.5px; line-height: 1.5; color: var(--ink-soft); max-width: 360px; margin: -10px auto 20px; }
.pitch b { color: var(--curtain); }
.hint { color: var(--ink-soft); font-size: 14px; }

/* ---------- formularze ---------- */
.card { background: var(--card); border-radius: 24px; padding: 20px; margin: 14px 0; box-shadow: var(--shadow-1); }
label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 500; color: var(--ink-soft); }
input, textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--paper-2); border: 1.5px solid transparent; border-radius: 14px; outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); background: var(--card); box-shadow: 0 0 0 4px var(--gold-tint); }
textarea { resize: vertical; }
.row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 12px; align-items: flex-start; color: var(--ink); font-size: 15px; font-weight: 500; flex-wrap: wrap; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--curtain); flex: none; }
.check small { flex-basis: 100%; padding-left: 32px; margin-top: -8px; color: var(--ink-soft); font-weight: 400; }
.field > span { font-size: 13px; font-weight: 500; color: var(--ink-soft); }

.avatars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin: 8px 0 16px; }
.avatars button {
  aspect-ratio: 1; font-size: 24px; padding: 0; border-radius: 50%; background: var(--paper-2);
  transition: transform .25s var(--spring), box-shadow .2s, background .2s;
}
.avatars button:hover { transform: scale(1.08); }
.avatars button.on { background: var(--card); box-shadow: 0 0 0 2.5px var(--curtain), var(--shadow-1); transform: scale(1.1); }

.limits { margin: 4px 0 16px; padding: 14px 16px; background: var(--paper-2); border-radius: 16px; }
.limits summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.limits summary::-webkit-details-marker { display: none; }
.limits summary::after { content: "+"; font-size: 20px; color: var(--ink-soft); transition: transform .25s var(--ease); }
.limits[open] summary::after { transform: rotate(45deg); }
.limits .hint { margin: 12px 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  font-size: 14px; padding: 7px 14px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line);
  transition: background .2s, color .2s, transform .15s;
}
.chips button.off { background: var(--curtain-tint); color: var(--curtain); text-decoration: line-through; box-shadow: none; }
.chips button.off::before { content: "✕ "; text-decoration: none; display: inline-block; margin-right: 2px; font-size: 11px; }

/* ---------- przyciski ---------- */
button {
  font: inherit; cursor: pointer; border: 0; border-radius: 999px; padding: 11px 20px; background: none; color: var(--ink);
  transition: transform .15s var(--ease), box-shadow .2s, background .2s, color .2s, opacity .2s;
}
button:active:not(:disabled) { transform: scale(.96); }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible { outline: 2.5px solid var(--gold); outline-offset: 2px; }
.primary {
  background: var(--curtain); color: var(--on-curtain); font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 6px 16px -6px var(--curtain);
}
.primary:hover:not(:disabled) { background: var(--curtain-deep); }
#profile-form .primary { width: 100%; padding: 14px; font-size: 17px; margin-top: 6px; }
.ghost { background: var(--card); box-shadow: var(--shadow-1); }
.ghost:hover:not(:disabled) { box-shadow: var(--shadow-2); }
.ghost.on { background: var(--sage-tint); color: var(--sage); box-shadow: inset 0 0 0 1.5px var(--sage); }
.link { color: var(--ink-soft); padding: 8px 10px; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.link:hover { color: var(--ink); text-decoration-color: currentColor; }
.danger { color: var(--curtain); }
#profile-form .link { display: block; margin: 8px auto 0; }
.actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.actions.column { flex-direction: column; align-items: stretch; }

/* ---------- ekran główny ---------- */
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.me { display: flex; align-items: center; gap: 8px; background: var(--card); box-shadow: var(--shadow-1); padding: 6px 16px 6px 6px; font-weight: 500; font-size: 15px; }
.me .av { width: 32px; height: 32px; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; font-size: 18px; }

/* scena z kurtyną i światłem */
.hero {
  position: relative; overflow: hidden; text-align: center; color: var(--on-curtain);
  padding: 58px 24px 30px; border-radius: 30px; box-shadow: var(--shadow-2);
  background:
    radial-gradient(ellipse 60% 55% at 50% 38%, rgba(255, 222, 160, .38), transparent 70%),
    linear-gradient(180deg, rgba(0, 0, 0, .25), transparent 30%, transparent 70%, rgba(0, 0, 0, .3)),
    repeating-linear-gradient(90deg, var(--curtain-deep) 0, #b5372a 9px, #cf4636 18px, #b5372a 27px, var(--curtain-deep) 36px);
}
.hero::before { /* lambrekin */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 28px;
  background: radial-gradient(circle at 18px -6px, #7a1f1a 22px, transparent 23px) 0 0 / 36px 28px repeat-x;
}
.hero .lead { font-family: var(--serif); font-style: italic; font-size: 24px; line-height: 1.25; margin: 0 0 22px; text-shadow: 0 2px 12px rgba(0, 0, 0, .25); font-variation-settings: "SOFT" 100; }
.primary.big {
  font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 30px; padding: 16px 58px; letter-spacing: -.01em;
  background: var(--on-curtain); color: var(--curtain-deep);
  box-shadow: 0 0 0 6px rgba(255, 244, 230, .18), 0 12px 30px -8px rgba(0, 0, 0, .5);
  font-variation-settings: "SOFT" 100;
}
.primary.big:hover:not(:disabled) { background: #fff; transform: translateY(-2px); }
.primary.big:disabled { opacity: 1; background: rgba(255, 244, 230, .16); color: rgba(255, 244, 230, .75); box-shadow: inset 0 0 0 1.5px rgba(255, 244, 230, .35); }
.hero .hint { color: rgba(255, 244, 230, .85); margin: 18px auto 0; max-width: 380px; }
.hero .hint .link { color: inherit; padding: 0 4px; text-decoration-color: rgba(255, 244, 230, .5); }

.section { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 22px; margin: 30px 4px 12px; }
.threads { list-style: none; padding: 0; margin: 0; }
.thread-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 10px;
  background: var(--card); border-radius: 22px; box-shadow: var(--shadow-1); cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.thread-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.thread-item .av { width: 48px; height: 48px; flex: none; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; font-size: 26px; }
.thread-item .body { flex: 1; min-width: 0; }
.thread-item .line1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 3px; min-width: 0; }
.thread-item .line1 b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-item .line2 { color: var(--ink-soft); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-item.unread .line2 { color: var(--ink); font-weight: 600; }
.thread-item .badge { background: var(--curtain); color: var(--on-curtain); border-radius: 999px; font-size: 12px; font-weight: 700; min-width: 24px; height: 24px; display: grid; place-items: center; padding: 0 7px; }
.phase { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.phase[data-phase="pending"] { background: var(--gold-tint); color: #8a5d0c; }
.phase[data-phase="scene"] { background: var(--curtain-tint); color: var(--curtain); }
.phase[data-phase="talk"] { background: var(--plum-tint); color: var(--plum); }
.phase[data-phase="friends"] { background: var(--sage-tint); color: var(--sage); }
@media (prefers-color-scheme: dark) { .phase[data-phase="pending"] { color: var(--gold); } }
#no-live, #no-friends { padding: 0 4px; }
.notif { margin-top: 28px; text-align: center; }
.notif .link { padding: 0; color: var(--curtain); }

/* ---------- wątek ---------- */
.thread.active { display: flex; flex-direction: column; height: calc(100vh - 52px); }
.room-top {
  display: flex; align-items: center; gap: 10px; padding-bottom: 10px;
  position: sticky; top: 0; z-index: 2;
}
#back { width: 42px; height: 42px; padding: 0; font-size: 20px; }
.partner { display: flex; align-items: center; gap: 10px; background: var(--card); box-shadow: var(--shadow-1); padding: 5px 16px 5px 5px; font-weight: 600; }
.partner .av { width: 32px; height: 32px; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; font-size: 18px; }
.clock-box { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 0; }
.clock { white-space: nowrap; }
.clock:empty, .clock-note:empty { display: none; }
.clock-note { font-size: 11px; line-height: 1.25; color: var(--ink-soft); text-align: right; max-width: 170px; }

/* rola jak strona scenariusza */
.scene { position: relative; margin: 4px 0 10px; padding: 16px 18px; border-radius: 22px; transition: padding .3s var(--ease); }
.scene h3 { font-size: 21px; margin: 2px 0 6px; }
.scene p { margin: 6px 0; }
.scene .full > p:first-child { font-family: var(--serif); font-style: italic; color: var(--ink-soft); font-size: 16px; }
.scene .toggle { position: absolute; top: 12px; right: 12px; font-size: 13px; padding: 5px 12px; box-shadow: none; background: var(--paper-2); }
.scene.collapsed { padding-top: 12px; padding-bottom: 10px; }
.scene.collapsed .full { display: none; }
.scene.collapsed h3 { font-size: 17px; margin: 0; }
.scene.collapsed .cat { display: none; }
.cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--curtain); }
/* Rola to najważniejsza rzecz na karcie: osobny panel z akcentem kurtyny. */
.role { margin-top: 14px; padding: 12px 16px 14px; border-radius: 16px; background: var(--curtain-tint); box-shadow: inset 4px 0 0 var(--curtain); }
.role > .label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--curtain); }
.role > .role-name { display: block; font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1.2; margin: 2px 0 4px; }
.role > p { margin: 4px 0 0; }
.secret {
  position: relative; margin-top: 10px; padding: 12px 14px 12px 40px; border-radius: 14px;
  background: var(--gold-tint); font-size: 15px;
}
.secret::before { content: "🤫"; position: absolute; left: 12px; top: 11px; }
.secret .label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #8a5d0c; margin-bottom: 2px; }
@media (prefers-color-scheme: dark) { .secret .label { color: var(--gold); } }

.chat {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 14px 2px 8px;
  -webkit-mask-image: linear-gradient(transparent, #000 12px); mask-image: linear-gradient(transparent, #000 12px);
}
.chat > * { flex-shrink: 0; }
.bubble {
  max-width: 78%; padding: 10px 15px; border-radius: 22px; border-bottom-left-radius: 8px;
  background: var(--card); box-shadow: var(--shadow-1); align-self: flex-start;
  white-space: pre-wrap; overflow-wrap: anywhere;
  transform-origin: bottom left;
}
.bubble.mine { background: var(--mine-bg); color: var(--mine-ink); align-self: flex-end; border-radius: 22px; border-bottom-right-radius: 8px; transform-origin: bottom right; box-shadow: none; }
.bubble:not(.mine) + .bubble.mine, .bubble.mine + .bubble:not(.mine), .sys + .bubble { margin-top: 8px; }
.bubble.ooc { background: var(--sage-tint); color: var(--ink); box-shadow: none; }
.bubble.ooc::before { content: "poza rolą"; display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--sage); margin-bottom: 2px; }
html[lang="en"] .bubble.ooc::before { content: "out of character"; }
/* Animacje tylko dla wiadomości, które przyszły na żywo (.new) — otwarcie historii jest spokojne. */
.bubble.new { animation: bubble-in .45s var(--spring) both; }
.bubble.mine.new { animation-name: bubble-send; }
@keyframes bubble-in { 0% { opacity: 0; transform: translate(-8px, 10px) scale(.55); } 60% { opacity: 1; transform: scale(1.05); } }
@keyframes bubble-send { 0% { opacity: 0; transform: translate(10px, 26px) scale(.6); } 60% { opacity: 1; transform: translateY(-3px) scale(1.03); } }

.sys { align-self: center; text-align: center; max-width: 88%; margin: 12px 0; }
.sys.new { animation: enter .5s var(--ease) both; }
.sys.twist {
  background: var(--plum); color: #f6f0ff; border-radius: 22px; padding: 14px 20px 16px;
  font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1.4;
  box-shadow: 0 14px 30px -12px var(--plum);
}
@media (prefers-color-scheme: dark) { .sys.twist { background: #3b2a58; color: #f3ecff; box-shadow: 0 14px 30px -12px #000; } }
.sys.twist::before {
  content: "Zwrot akcji"; display: block; font-family: var(--sans); font-style: normal; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .16em; color: var(--gold); margin-bottom: 4px;
}
html[lang="en"] .sys.twist::before { content: "Plot twist"; }
.sys.twist.new { animation: twist .7s var(--spring) both; }
@keyframes twist { 0% { opacity: 0; transform: scale(.7) rotate(-3deg); } 60% { transform: scale(1.03) rotate(1deg); } }
.sys.act { font-family: var(--serif); font-style: italic; color: var(--ink-soft); font-size: 15px; padding: 0 12px; }
.sys.act::before, .sys.act::after { content: "✦"; display: block; color: var(--gold); font-style: normal; font-size: 12px; margin: 4px 0; }
.sys.prompt { background: var(--sage-tint); border-radius: 18px; padding: 10px 16px; font-size: 15px; }
.sys.prompt::before { content: "Na rozruszanie"; display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--sage); margin-bottom: 2px; }
html[lang="en"] .sys.prompt::before { content: "Icebreaker"; }
/* Przycisk wysyłania „odbija” po wysłaniu. */
.composer .primary.sent { animation: send-pop .35s var(--spring); }
@keyframes send-pop { 40% { transform: scale(.82) rotate(-12deg); } }
@media (prefers-reduced-motion: reduce) { .new, .composer .primary.sent { animation: none !important; } }

.typing { height: 20px; font-size: 13px; color: var(--ink-soft); padding-left: 6px; font-style: italic; }
.typing:not(:empty)::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 4px 0 10px; }
.bar:empty { display: none; }
.bar .hint { margin: 0; flex-basis: 100%; line-height: 1.45; }
.bar .hint .link { padding: 0 2px; color: var(--curtain); }
.bar .ghost { font-size: 14px; font-weight: 500; padding: 9px 16px; }

.composer {
  display: flex; gap: 6px; align-items: center; padding: 6px; background: var(--card); border-radius: 999px; box-shadow: var(--shadow-2);
}
.composer input { margin: 0; flex: 1; background: transparent; border: 0; padding: 10px 6px; box-shadow: none; }
.composer input:focus { box-shadow: none; background: transparent; }
.composer .primary { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; flex: none; }
.composer .primary svg { width: 20px; height: 20px; }
#ooc { width: 44px; height: 44px; padding: 0; font-size: 20px; background: var(--paper-2); flex: none; filter: grayscale(.6); }
#ooc.on { background: var(--sage-tint); box-shadow: inset 0 0 0 1.5px var(--sage); filter: none; }

/* ---------- okna dialogowe ---------- */
dialog {
  border: 0; border-radius: 28px; background: var(--card); color: var(--ink); padding: 24px;
  max-width: 420px; width: calc(100% - 32px); box-shadow: var(--shadow-2);
}
dialog[open] { animation: pop .4s var(--spring); }
dialog::backdrop { background: rgba(26, 18, 26, .45); backdrop-filter: blur(4px); }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(12px); } }
#profile-body { text-align: center; }
#profile-body h2 { font-size: 26px; }
.options { display: grid; gap: 10px; margin: 14px 0 4px; }
.option {
  position: relative; text-align: left; border-radius: 20px; background: var(--paper-2); padding: 14px 16px; line-height: 1.4;
  transition: box-shadow .25s, transform .25s var(--spring), background .2s;
}
.option h3 { font-size: 18px; margin: 4px 0; }
.option div:last-of-type { font-size: 14px; color: var(--ink-soft); }
.option .badge {
  position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: var(--on-curtain); background: var(--curtain); transform: rotate(-8deg);
  animation: twist .45s var(--spring);
}
.option.p2 { background: var(--card); box-shadow: inset 0 0 0 2px var(--curtain), var(--shadow-1); transform: scale(1.01); }
.option.p1 { background: var(--card); box-shadow: inset 0 0 0 2px var(--gold); }
.option.p1 .badge { background: var(--gold); color: #3a2706; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 10;
  background: var(--ink); color: var(--paper); padding: 12px 20px; border-radius: 999px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .3s var(--ease), transform .3s var(--spring);
  max-width: calc(100% - 32px); box-shadow: var(--shadow-2); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
[hidden] { display: none !important; }

@media (max-width: 480px) {
  .logo { font-size: 64px; margin-top: 24px; }
  .row { grid-template-columns: 1fr 1fr; }
  .row label:first-child { grid-column: span 2; }
  .avatars { grid-template-columns: repeat(8, 1fr); gap: 5px; }
  .avatars button { font-size: 20px; }
  .hero { padding: 52px 18px 26px; }
  .primary.big { font-size: 26px; padding: 14px 46px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.field + .field { margin-top: -4px; }
.field .chips { margin: 8px 0 16px; }
.chips.pick button.on { background: var(--ink); color: var(--paper); box-shadow: none; }
.thread-item.muted { opacity: .55; }
.thread-item.muted:hover { opacity: .8; }
.hint.center { text-align: center; margin: 4px 8px 8px; font-size: 13px; }

/* ---------- konta, zasady, ankieta ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--paper-2); border-radius: 999px; max-width: 340px; margin: 0 auto; }
.tab { flex: 1; padding: 9px 12px; font-weight: 600; color: var(--ink-soft); }
.tab.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }
.hint.small { font-size: 13px; margin: -8px 0 14px; }
#register-form .primary, #login-form .primary { width: 100%; padding: 14px; font-size: 17px; margin-top: 6px; }
.consents { margin: 6px 0 10px; padding: 14px 16px 2px; background: var(--paper-2); border-radius: 16px; }
.consents .check { font-size: 14px; font-weight: 400; line-height: 1.45; }
.consents a, .rules-short + .hint a, .account-links a { color: var(--curtain); }
.account-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
.account-links .link { margin: 0 !important; display: inline !important; padding: 6px 4px; }
.rules-short { list-style: none; padding: 0; margin: 12px 0; }
.rules-short li { padding: 8px 0; line-height: 1.45; border-bottom: 1px solid var(--line); }
.rules-short li:last-child { border-bottom: 0; }
.survey-q p { margin: 14px 0 6px; font-weight: 600; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale button { aspect-ratio: 1; padding: 0; font-size: 22px; background: var(--paper-2); border-radius: 16px; transition: transform .2s var(--spring), background .2s; }
.scale button:hover { transform: scale(1.06); }
.scale button.on { background: var(--gold-tint); box-shadow: inset 0 0 0 2px var(--gold); transform: scale(1.08); }
#survey-dialog label { margin-top: 14px; }
.consents .check { flex-wrap: nowrap; }
.consents .check span small { display: block; padding: 0; margin: 6px 0 0; font-size: 13px; }

/* Język: przełącznik na ekranie logowania i wybór w profilu */
.lang-switch { display: flex; justify-content: flex-end; gap: 2px; margin-bottom: -18px; }
.lang-switch button { padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--ink-soft); }
.lang-switch button.on { background: var(--paper-2); color: var(--ink); }
.field .lang-hint { margin: -10px 0 16px; }

/* Znak z logo (dwa dymki) obok napisu Niby */
.logo .mark { height: .82em; width: auto; vertical-align: -.1em; margin-right: .14em; }

/* Pulsowanie: „tu kliknij” (nowa rola, głosowanie na scenkę) */
.pulse { animation: pulse 1s var(--ease) 4; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200, 62, 46, 0); }
  50% { box-shadow: 0 0 0 7px rgba(200, 62, 46, .28); background: var(--curtain-tint); color: var(--curtain); transform: scale(1.06); }
}

/* Obecność: druga osoba ma tę rozmowę otwartą */
.here-dot { width: 9px; height: 9px; border-radius: 50%; background: #3fbf6b; box-shadow: 0 0 0 3px var(--card); margin-left: -4px; }

/* ---------- minigierki ---------- */
.sys.game { background: var(--gold-tint); border-radius: 18px; padding: 8px 16px; font-weight: 600; font-size: 15px; }
#game-offer:empty { display: none; }
.game-offer { margin: 6px 0 8px; padding: 12px 16px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow-1); border: 2px solid var(--gold); }
.game-offer.new { animation: twist .7s var(--spring) both; }
.game-offer .kicker { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #8a5d0c; }
@media (prefers-color-scheme: dark) { .game-offer .kicker { color: var(--gold); } }
.game-offer h4 { font-family: var(--serif); font-size: 19px; margin: 2px 0 2px; }
.game-offer p { margin: 2px 0 8px; font-size: 14px; color: var(--ink-soft); }
.game-offer .row-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.game-offer.quiet { border: none; padding: 8px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.game-offer .close { padding: 2px 8px; font-size: 16px; }

#game-dialog { width: min(420px, calc(100vw - 32px)); }
.game-head .cat { margin-bottom: 2px; }
.game-head h2 { margin: 0 0 4px; }
.game-status { font-weight: 600; margin: 6px 0 12px; min-height: 1.4em; }
.game-status.win { color: var(--sage); }
.game-status.lose { color: var(--curtain); }

.ttt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(300px, 100%); margin: 0 auto 8px; }
.ttt .cell { aspect-ratio: 1; border-radius: 16px; background: var(--paper-2); font-family: var(--serif); font-size: 44px; font-weight: 800; box-shadow: none; padding: 0; }
.ttt .cell.x { color: var(--curtain); }
.ttt .cell.o { color: var(--plum); }
.ttt .cell:not(:disabled):hover { background: var(--gold-tint); }
.ttt .cell:disabled { opacity: 1; }
.ttt .cell.fresh { animation: bubble-in .35s var(--spring) both; }

.rps-score { font-family: var(--serif); font-size: 22px; font-weight: 700; text-align: center; margin: 4px 0 10px; }
.rps-picks { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; }
.rps-picks button { font-size: 40px; width: 84px; height: 84px; border-radius: 22px; background: var(--paper-2); box-shadow: none; padding: 0; }
.rps-picks button.on { background: var(--gold-tint); box-shadow: 0 0 0 3px var(--gold); }
.rps-picks button:disabled:not(.on) { opacity: .35; }
.rps-history { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; font-size: 14px; }
.rps-history span { background: var(--paper-2); border-radius: 999px; padding: 3px 10px; }
.rps-history .win { background: var(--sage-tint); }
.rps-history .lose { background: var(--curtain-tint); }

.wordle { display: grid; gap: 6px; margin: 0 auto 10px; width: min(300px, 100%); }
.wordle .row { display: grid; grid-template-columns: 20px repeat(5, 1fr); gap: 5px; align-items: center; }
.wordle .who { font-size: 12px; color: var(--ink-soft); text-align: center; }
.wordle .tile { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; background: var(--paper-2); font-weight: 700; font-size: 22px; text-transform: uppercase; }
.wordle .tile.hit { background: #3f9a5c; color: #fff; }
.wordle .tile.near { background: #d9a520; color: #fff; }
.wordle .tile.miss { background: #8b7f8a; color: #fff; }
.wordle .row.fresh .tile { animation: flip .5s var(--ease) both; }
.wordle .row.fresh .tile:nth-child(3) { animation-delay: .08s; } .wordle .row.fresh .tile:nth-child(4) { animation-delay: .16s; }
.wordle .row.fresh .tile:nth-child(5) { animation-delay: .24s; } .wordle .row.fresh .tile:nth-child(6) { animation-delay: .32s; }
@keyframes flip { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
.keys { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-bottom: 10px; }
.keys span { min-width: 22px; padding: 3px 4px; border-radius: 6px; background: var(--paper-2); font-size: 13px; font-weight: 600; text-align: center; text-transform: uppercase; }
.keys .hit { background: #3f9a5c; color: #fff; } .keys .near { background: #d9a520; color: #fff; } .keys .miss { opacity: .3; }
.guess-form { display: flex; gap: 8px; }
.guess-form input { flex: 1; text-transform: uppercase; letter-spacing: .2em; font-weight: 700; }
#game-pick-list .option { text-align: left; }
@media (prefers-reduced-motion: reduce) { .pulse, .game-offer.new, .ttt .cell.fresh, .wordle .row.fresh .tile { animation: none !important; } }

/* Twist: role płciowe rozdane na odwrót */
.swap-note { margin-top: 12px; padding: 10px 14px; border-radius: 14px; background: var(--plum-tint); color: var(--plum); font-weight: 600; font-size: 14px; }
@media (prefers-color-scheme: dark) { .swap-note { color: #e4d6ff; } }

/* Propozycje scenek */
.suggest-line { margin-top: 18px; }
#suggest-dialog { width: min(560px, calc(100vw - 32px)); }
#suggest-dialog select { width: 100%; }
.sg-role { border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px 2px; margin: 0 0 14px; }
.sg-role legend { font-weight: 700; padding: 0 6px; }
.sg-mine { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; font-size: 14px; }
.sg-mine li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.sg-status { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--gold-tint); color: #8a5d0c; }
.sg-status.accepted { background: var(--sage-tint); color: var(--sage); }
.sg-status.rejected { background: var(--curtain-tint); color: var(--curtain); }
.scene .credit { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }

.scene .icebreaker { font-style: italic; }

/* Zdjęcia */
.av { overflow: hidden; }
.av.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin: 8px 0 6px; }
.ph { position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--paper-2); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.ph-add { display: grid; place-items: center; font-weight: 600; color: var(--ink-soft); border: 2px dashed var(--line); box-shadow: none; padding: 0; }
.ph-del, .ph-main { position: absolute; top: 5px; width: 26px; height: 26px; padding: 0; border-radius: 50%; font-size: 13px; background: rgba(28, 20, 24, .65); color: #fff; box-shadow: none; }
.ph-del { right: 5px; }
.ph-main { left: 5px; }
.ph-badge { position: absolute; left: 5px; bottom: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--gold); color: #2a1d10; }
.photos-hint { margin-top: 0; }
.gallery { display: flex; gap: 8px; overflow-x: auto; margin: 10px 0; scroll-snap-type: x mandatory; }
.gallery img { height: 180px; border-radius: 16px; object-fit: cover; scroll-snap-align: start; cursor: zoom-in; flex: none; max-width: 85%; }
.locked-photos { background: var(--paper-2); border-radius: 14px; padding: 10px 14px; font-weight: 600; text-align: center; }
.photo-view { padding: 0; background: transparent; box-shadow: none; max-width: 96vw; max-height: 92vh; }
.photo-view img { display: block; max-width: 96vw; max-height: 92vh; border-radius: 18px; }
.photo-view::backdrop { background: rgba(10, 6, 9, .85); }

/* Reakcje */
.bubble { position: relative; }
.bubble[data-id]:not(.mine) { cursor: pointer; }
.bubble .react { position: absolute; bottom: -12px; right: 10px; font-size: 15px; line-height: 1; padding: 3px 5px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow-1); }
.bubble.mine .react { right: auto; left: 10px; }
.bubble:has(.react) { margin-bottom: 12px; }
.react.pop { animation: bubble-in .4s var(--spring) both; }
.react-bar { align-self: flex-start; display: flex; gap: 2px; padding: 4px 6px; margin: 2px 0 6px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow-1); animation: bubble-in .3s var(--spring) both; }
.react-bar button { font-size: 20px; padding: 4px 6px; border-radius: 999px; box-shadow: none; background: transparent; }
.react-bar button.on { background: var(--gold-tint); }
/* Oscary */
.sys.game.award { background: var(--gold-tint); }
.award-chip { display: inline-block; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--gold-tint); color: #6b4a0a; }
@media (prefers-color-scheme: dark) { .award-chip { color: var(--gold); } }
/* Zainteresowania i odpowiedzi */
.interest-group small { display: block; margin: 10px 0 4px; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.interest-group .chips button { font-size: 13px; padding: 6px 11px; }
.sub-label { margin-top: 10px; }
.prompt-edit { margin: 8px 0; padding: 10px 12px; border-radius: 16px; background: var(--paper-2); }
.prompt-edit select { width: auto; flex: 1; min-width: 0; margin: 0; padding: 8px 10px; }
.prompt-head .link { flex: none; padding: 6px 8px; }
.prompt-edit textarea { background: var(--card); }
.prompt-head { display: flex; gap: 6px; align-items: center; }
.interest-view, .awards-view { justify-content: center; margin: 10px 0; }
.interest-view .chip { font-size: 13px; padding: 5px 11px; border-radius: 999px; background: var(--paper-2); }
.interest-view .chip.shared { background: var(--sage-tint); color: var(--sage); font-weight: 700; }
.interest-view .chip.shared::before { content: "✓ "; }
.prompt-card { text-align: left; margin: 8px 0; padding: 10px 14px; border-radius: 16px; background: var(--paper-2); }
.prompt-card small { color: var(--ink-soft); font-weight: 600; }
.prompt-card p { margin: 2px 0 0; font-family: var(--serif); font-size: 17px; }
.shared-teaser { font-weight: 600; color: var(--sage); }
.push-row { display: block; font-size: 13px; color: var(--ink-soft); }
/* Zwijane grupy zainteresowań */
details.interest-group { border-bottom: 1px solid var(--line); padding: 2px 0; }
details.interest-group summary { cursor: pointer; padding: 9px 0; font-size: 14px; font-weight: 600; color: var(--ink); list-style: none; display: flex; align-items: center; gap: 4px; }
details.interest-group summary::-webkit-details-marker { display: none; }
details.interest-group summary::after { content: "+"; margin-left: auto; color: var(--ink-soft); font-size: 18px; }
details.interest-group[open] summary::after { content: "–"; }
details.interest-group summary .count { color: var(--curtain); }
details.interest-group .chips { padding-bottom: 10px; }

/* Przypomnienie o bezpieczeństwie w czacie */
.sys.safety { background: var(--paper-2); border-radius: 18px; padding: 10px 16px; font-size: 14px; color: var(--ink); }
.sys.safety::before { content: "🛡️ Bezpieczeństwo"; display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-soft); margin-bottom: 2px; }
html[lang="en"] .sys.safety::before { content: "🛡️ Safety"; }

/* Zdjęcia w czacie */
.composer .ooc + .ooc { margin-left: -4px; }
.bubble.image { padding: 4px; position: relative; overflow: hidden; max-width: 72%; }
.bubble.image img { display: block; max-width: 100%; max-height: 320px; border-radius: 18px; cursor: zoom-in; }
.bubble.image.veiled img { filter: blur(28px) saturate(.6); transform: scale(1.08); cursor: default; }
.bubble.image .veil-btn { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); white-space: nowrap; font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 999px; background: rgba(28, 20, 24, .7); color: #fff; box-shadow: none; }
.bubble.image .img-del { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; padding: 0; border-radius: 50%; background: rgba(28, 20, 24, .6); color: #fff; font-size: 14px; box-shadow: none; }
.bubble.image-gone { font-style: italic; color: var(--ink-soft); background: transparent; box-shadow: none; border: 1px dashed var(--line); }
/* Zwinięta karta: długi tytuł nie wchodzi pod przycisk „pokaż rolę” */
.scene.collapsed h3 { padding-right: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Kasztany */
.chestnut-btn img { width: 26px; height: auto; display: block; margin: 0 auto; }
.chestnut-msg { align-self: flex-start; display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.chestnut-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.chestnut-msg img { width: 46px; height: auto; filter: drop-shadow(0 4px 6px rgba(60, 25, 10, .25)); transform: rotate(-12deg); }
.chestnut-msg.new img { animation: bubble-in .5s var(--spring) both; }
.chestnut-fly { position: fixed; left: 0; top: 0; width: 48px; height: auto; z-index: 1000; pointer-events: none; filter: drop-shadow(0 6px 8px rgba(60, 25, 10, .35)); }
.chestnut-pac { position: fixed; z-index: 1000; pointer-events: none; font-weight: 800; font-size: 18px; color: var(--curtain); animation: pac .7s var(--ease) both; }
@keyframes pac { 0% { opacity: 0; transform: scale(.5); } 30% { opacity: 1; transform: scale(1.2); } 100% { opacity: 0; transform: translateY(-20px) scale(1); } }
.chestnut-layer { position: fixed; inset: 0; z-index: 1000; pointer-events: none; display: grid; place-items: center; overflow: hidden; }
.chestnut-big { width: min(46vw, 200px); height: auto; filter: drop-shadow(0 18px 24px rgba(60, 25, 10, .4)); grid-area: 1 / 1; }
.chestnut-bonk { grid-area: 1 / 1; font-family: var(--serif); font-weight: 800; font-size: clamp(44px, 14vw, 88px); color: var(--curtain);
  text-shadow: 0 4px 0 var(--card), 0 8px 24px rgba(0, 0, 0, .25); opacity: 0; transform: translateY(-90px) rotate(-8deg) scale(.4); }
.chestnut-bonk.show { animation: bonk .9s var(--spring) both; }
@keyframes bonk { 0% { opacity: 0; transform: translateY(-90px) rotate(-8deg) scale(.4); } 25% { opacity: 1; transform: translateY(-110px) rotate(-8deg) scale(1.15); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-130px) rotate(-8deg) scale(1); } }
.chestnut-star { position: absolute; left: 50%; top: 50%; font-size: 26px; }
#app.shake { animation: shake .5s linear; }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px) rotate(-.5deg); } 40%, 60% { transform: translateX(8px) rotate(.5deg); } }

/* ---------- profil: przyklejony pasek „Wróć / Zapisz” ---------- */
.edit-bar {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin: 0 -4px 6px; padding: 10px 4px; background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.edit-bar .primary { padding-inline: 26px; }
.gallery-title { font-weight: 700; margin: 14px 0 -4px; }
.dating { margin: 4px 0 18px; padding: 16px 16px 4px; border-radius: 20px; background: var(--curtain-tint); }
.dating h3 { margin: 0 0 4px; font: 600 19px/1.25 var(--serif); }
.dating .hint.small { margin: 0 0 12px; }
.dating-card { margin: 10px 0; }
