/* Абсурдия — экраны: подготовка, редактор, игра, сохранения, кабинет, окна */

/* ---------- окно входа и прочие модальные окна ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(8, 5, 16, .72); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; }
.modal { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--ink-1); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); padding: 26px; display: flex; flex-direction: column; gap: 18px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head .x { background: none; border: 0; color: var(--dusk); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.modal form { display: flex; flex-direction: column; gap: 14px; }
.gift { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: rgba(244, 198, 91, .08); border: 1px solid rgba(244, 198, 91, .3); color: var(--gold-2); font-size: 15.5px; }
.gift svg { width: 26px; height: 26px; flex: none; }

/* ---------- выбор картинки ---------- */
.picker { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 14px; align-items: start; }
.picker.is-portrait { grid-template-columns: 120px minmax(0, 1fr); }
.picker-prev { position: relative; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; border: 1px dashed var(--line-2); background: var(--ink-0); display: grid; place-items: center; color: var(--dusk); font-size: 13px; text-align: center; }
.picker.is-portrait .picker-prev { aspect-ratio: 3 / 4; }
.picker-prev img, .picker-prev svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.picker-prev.busy::after { content: 'Рисую…'; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15, 11, 26, .75); color: var(--gold-2); font-weight: 700; }
.picker-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.picker-ai { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.picker-ai input { flex: 1 1 200px; }

/* ---------- подготовка к игре ---------- */
.setup { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.1fr); gap: 36px; align-items: start; }
.showcase { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 16px; }
.showcase .cover { border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 10; border: 1px solid var(--line); box-shadow: var(--shadow); background: #000; }
.showcase .cover img, .showcase .cover svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.showcase .world { font: 400 17px/1.6 var(--f-story); color: var(--mist); margin: 0; }
.setup-form { display: flex; flex-direction: column; gap: 18px; }
.steppers { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--ink-0); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px 9px 14px; }
.stepper span { color: var(--mist); font-size: 15.5px; }
.stepper .ctl { display: flex; align-items: center; gap: 6px; }
.stepper output { font: 700 18px var(--f-mono); min-width: 2.2ch; text-align: center; }
.stepper button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--ink-3); color: var(--moon); cursor: pointer; font-size: 18px; line-height: 1; }
.chal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.chal { text-align: left; background: var(--ink-0); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; color: var(--moon); display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: start; }
.chal .ic { font-size: 24px; grid-row: span 2; line-height: 1.2; }
.chal b { font-size: 16px; }
.chal small { color: var(--mist); font-size: 14px; line-height: 1.35; }
.chal:hover { border-color: var(--line-2); }
.chal[aria-pressed="true"] { border-color: var(--gold); background: rgba(244, 198, 91, .08); box-shadow: inset 0 0 0 1px var(--gold-deep); }
.tiers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tier-opt { text-align: left; background: var(--ink-0); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; color: var(--moon); }
.tier-opt b { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 16.5px; }
.tier-opt small { color: var(--mist); font-size: 14px; }
.tier-opt[aria-pressed="true"] { border-color: var(--gold); background: rgba(244, 198, 91, .08); }

/* ---------- редактор ---------- */
.create-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 30px; align-items: start; }
.create-form { display: flex; flex-direction: column; gap: 18px; }
.aside-sticky { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 14px; }
.ai-fill { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 16px; border: 1px solid rgba(111, 224, 200, .35); background: linear-gradient(180deg, rgba(111, 224, 200, .08), rgba(111, 224, 200, .02)); }
.ai-fill .row { display: flex; gap: 10px; flex-wrap: wrap; }
.ai-fill input { flex: 1 1 280px; }
.rows { display: flex; flex-direction: column; gap: 10px; }
.erow { display: grid; gap: 8px; align-items: center; }
.erow.stat { grid-template-columns: 84px minmax(0, 1fr) 84px 40px; }
.erow.item { grid-template-columns: 64px minmax(0, 1fr) 150px minmax(0, 1.3fr) 40px; }
.erow.lore { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) 40px; }
.erow.char { grid-template-columns: minmax(0, 1fr) 40px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--ink-0); }
.erow.char .char-body { display: flex; flex-direction: column; gap: 10px; }
.erow .x { width: 40px; height: 44px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--ink-3); color: var(--mist); cursor: pointer; font-size: 20px; }
.erow .x:hover { color: var(--ember); border-color: var(--ember); }

/* ---------- игра ---------- */
body.is-play .app { height: 100%; }
body.is-play #view { min-height: 0; overflow: hidden; }
body.is-play .footer { display: none; }
.play { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px minmax(0, 1fr) 380px; }
.sheet, .scene { min-height: 0; overflow: auto; background: rgba(23, 17, 38, .92); padding: 20px; display: flex; flex-direction: column; gap: 22px; }
.sheet { border-right: 1px solid var(--line); }
.scene { border-left: 1px solid var(--line); gap: 18px; }
.sec { display: flex; flex-direction: column; gap: 10px; }
.sec-t { font: 700 12.5px var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--dusk); display: flex; justify-content: space-between; align-items: center; margin: 0; }
.sec-t span { font-family: var(--f-mono); letter-spacing: 0; color: var(--mist); }

.hero-card { display: flex; gap: 14px; align-items: center; }
.portrait { width: 68px; height: 68px; flex: none; border-radius: 14px; overflow: hidden; display: grid; place-items: center; background: linear-gradient(160deg, #3a2e63, #221a3c); border: 2px solid var(--gold-deep); font: 800 26px var(--f-display); color: var(--gold-2); }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.hero-card b { display: block; font: 700 18px/1.2 var(--f-display); }
.hero-card small { display: block; color: var(--dusk); font-size: 14px; margin-top: 4px; line-height: 1.3; }
.vital { display: flex; flex-direction: column; gap: 6px; }
.vital-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; color: var(--mist); }
.vital-top b { font: 700 16px var(--f-mono); color: var(--moon); }
.hpbar { height: 12px; border-radius: 6px; background: #2a1830; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6); }
.hpbar i { display: block; height: 100%; background: linear-gradient(180deg, #ff9a7a, var(--ember) 60%, #c7402f); transition: width .5s; border-radius: 6px; }
.hpbar.low i { background: linear-gradient(180deg, #ff6b57, #b3261e); animation: pulse-hp 1.2s ease-in-out infinite; }
@keyframes pulse-hp { 50% { opacity: .55; } }
.coins { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--ink-0); border: 1px solid var(--line); font-size: 15px; color: var(--mist); }
.coins b { font: 700 16px var(--f-mono); color: var(--gold-2); }
.statuses { display: flex; flex-wrap: wrap; gap: 6px; }
.status { font-size: 13.5px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--mist); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.stat { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hex { width: 40px; height: 44px; flex: none; display: grid; place-items: center; font: 700 15px var(--f-mono); color: var(--gold-2); background: linear-gradient(180deg, #3d3068, #251c45); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.stat span { font-size: 15px; color: var(--mist); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doll { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: ". head ." "weapon body offhand" "hands legs feet"; gap: 8px; }
.slot { position: relative; aspect-ratio: 1; border-radius: 12px; border: 1px dashed var(--line-2); background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px; color: var(--dusk); font-size: 11.5px; text-align: center; min-width: 0; }
.slot .ic { font-size: 26px; line-height: 1; opacity: .25; filter: grayscale(1); }
.slot .nm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.filled { border-style: solid; border-color: var(--line-2); background: linear-gradient(180deg, #221a3a, #181228); color: var(--moon); cursor: pointer; }
.slot.filled .ic { opacity: 1; filter: none; }
.slot.filled:hover, .cell.filled:hover { border-color: var(--gold); }
.slot.locked { opacity: .35; }
.slot.locked::after { content: ''; position: absolute; left: 12%; right: 12%; top: 50%; height: 2px; background: var(--ember); transform: rotate(-35deg); }
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 7px; }
.cell { aspect-ratio: 1; border-radius: 10px; border: 1px dashed var(--line-2); background: transparent; display: grid; place-items: center; font-size: 22px; padding: 0; color: var(--dusk); }
.cell.filled { border-style: solid; background: linear-gradient(180deg, #221a3a, #181228); cursor: pointer; }
.cell .ph { opacity: .18; filter: grayscale(1); font-size: 16px; }
details.chron summary { cursor: pointer; list-style: none; }
details.chron summary::-webkit-details-marker { display: none; }
details.chron summary::after { content: '▾'; margin-left: 6px; }
details.chron ol { margin: 12px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font: 400 15.5px/1.45 var(--f-story); color: var(--mist); }

.story { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.story-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px 10px 24px; border-bottom: 1px solid var(--line); background: rgba(15, 11, 26, .6); flex-wrap: wrap; }
.story-head .t { font: 700 16px var(--f-display); margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.turn { font: 600 13px var(--f-mono); color: var(--dusk); padding: 3px 8px; border: 1px solid var(--line); border-radius: 99px; }
.log { flex: 1; overflow: auto; padding: 34px clamp(16px, 4vw, 56px) 20px; scroll-behavior: smooth; }
.page { max-width: 70ch; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.narr { font: 400 19.5px/1.66 var(--f-story); white-space: pre-wrap; margin: 0; color: #f1e8d6; }
.narr.first::first-letter { float: left; font: 800 3.2em/.86 var(--f-display); color: var(--gold); margin: 6px 12px 0 0; }
.narr.live::after { content: '▍'; color: var(--gold); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.you { align-self: flex-end; max-width: 88%; background: linear-gradient(180deg, #2b2248, #211a39); border: 1px solid var(--line-2); border-radius: 16px 16px 4px 16px; padding: 10px 16px 12px; margin: 0; }
.you small { display: block; font: 700 12px var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-bottom: 3px; }
.you span { white-space: pre-wrap; font-size: 17.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { font: 600 13.5px var(--f-mono); padding: 4px 10px; border-radius: 8px; background: var(--ink-2); color: var(--mist); border: 1px solid var(--line); }
.chip.good { color: var(--leaf); border-color: rgba(157, 219, 138, .35); background: rgba(157, 219, 138, .07); }
.chip.bad { color: var(--ember); border-color: rgba(255, 107, 87, .35); background: rgba(255, 107, 87, .07); }
.chip.item { color: var(--gold-2); border-color: rgba(244, 198, 91, .35); background: rgba(244, 198, 91, .07); }
.chip.info { color: var(--mint); border-color: rgba(111, 224, 200, .35); background: rgba(111, 224, 200, .07); }
.tray { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 16px 18px; border-radius: 16px; border: 1px solid rgba(111, 224, 200, .35); background: radial-gradient(ellipse at 30% 40%, #1e4c47, #10282a 70%); box-shadow: inset 0 2px 14px rgba(0, 0, 0, .55); }
.tray.ok { border-color: rgba(157, 219, 138, .55); }
.tray.fail { border-color: rgba(255, 107, 87, .55); background: radial-gradient(ellipse at 30% 40%, #4a2626, #2a1414 70%); }
.tray.crit-ok { border-color: var(--gold); box-shadow: inset 0 2px 14px rgba(0, 0, 0, .55), 0 0 30px rgba(244, 198, 91, .35); }
.die { position: relative; width: 76px; height: 76px; flex: none; display: grid; place-items: center; color: var(--mint); }
.die svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.die b { position: relative; font: 800 24px var(--f-display); color: var(--moon); text-shadow: 0 2px 6px rgba(0, 0, 0, .6); }
.tray.fail .die { color: var(--ember); }
.tray.crit-ok .die { color: var(--gold); }
.die.rolling svg { animation: tumble .12s linear infinite; }
@keyframes tumble { from { transform: rotate(0) scale(.92); } to { transform: rotate(72deg) scale(1.02); } }
.tray-text { flex: 1 1 220px; display: flex; flex-direction: column; gap: 3px; }
.tray-text b { font: 700 17px var(--f-display); }
.tray-text small { color: var(--mist); font-size: 15px; }
.tray-text .math { font: 600 14.5px var(--f-mono); color: var(--moon); }
.note { font-size: 15.5px; color: var(--mist); border: 1px dashed var(--line-2); border-radius: 12px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.note.bad { color: var(--ember); border-color: rgba(255, 107, 87, .5); }
.thinking { display: flex; align-items: center; gap: 10px; color: var(--dusk); font: italic 400 18px var(--f-story); }
.thinking i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: dots 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: .2s; }
.thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes dots { 0%, 100% { opacity: .2; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }
.tomb { text-align: center; padding: 26px; border-radius: 18px; border: 1px solid rgba(255, 107, 87, .5); background: radial-gradient(ellipse at top, rgba(255, 107, 87, .12), transparent 70%); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.tomb .h2 { color: var(--ember); }
.composer { border-top: 1px solid var(--line); background: rgba(23, 17, 38, .95); padding: 14px clamp(16px, 4vw, 56px) 16px; }
.composer form { max-width: 70ch; margin: 0 auto; display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 54px; max-height: 180px; font-size: 17.5px; border-radius: 14px; }
.composer .btn { height: 54px; border-radius: 14px; }
.composer .hint { max-width: 70ch; margin: 8px auto 0; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.frame { position: relative; padding: 9px; border-radius: 6px; background: linear-gradient(135deg, #6b4e1c, #e2b85c 22%, #7a5a22 48%, #f0cd7a 74%, #6b4e1c); box-shadow: 0 14px 34px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(0, 0, 0, .45); }
.canvas { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #000; box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .55); }
.canvas > img, .canvas > svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.canvas .who { position: absolute; right: 8px; bottom: 8px; width: 34%; aspect-ratio: 3 / 4; object-fit: cover; border: 3px solid #e2b85c; border-radius: 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, .6); }
.canvas .subj { animation: bob 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.plaque { align-self: center; margin-top: -4px; max-width: 92%; text-align: center; padding: 5px 16px; border-radius: 3px; font: italic 500 15.5px/1.3 var(--f-story); color: #2b1d02; background: linear-gradient(180deg, #f0d28a, #c99a3c); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 3px 8px rgba(0, 0, 0, .45); }
.ideas { display: flex; flex-direction: column; gap: 9px; }
.idea { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 2px 10px; align-items: center; text-align: left; background: var(--ink-0); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--moon); cursor: pointer; font-size: 16px; line-height: 1.3; }
.idea .i { grid-row: span 2; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; background: color-mix(in srgb, var(--k) 16%, transparent); border: 1px solid color-mix(in srgb, var(--k) 45%, transparent); }
.idea small { font: 700 11.5px var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--k); }
.idea:hover { border-color: var(--k); background: var(--ink-2); }
.idea:disabled { opacity: .5; cursor: not-allowed; }

.pop { position: fixed; z-index: 30; width: 270px; background: var(--ink-2); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- сохранения ---------- */
.saves { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 16px; }
.save { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; background: var(--ink-1); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.save .thumb { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 11; background: #000; }
.save .thumb img, .save .thumb svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.save-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.save-body b { font: 700 17px var(--f-display); }
.save-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--mist); font-size: 15px; }
.pill { font: 700 12px var(--f-ui); letter-spacing: .08em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--leaf); }
.pill.dead { color: var(--ember); border-color: rgba(255, 107, 87, .5); }
.save .hpbar { height: 7px; }
.save-acts { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- кабинет ---------- */
.acct { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 24px; align-items: start; }
.balance { display: flex; align-items: center; gap: 14px; }
.balance svg { width: 46px; height: 46px; }
.balance b { font: 800 46px/1 var(--f-display); color: var(--gold-2); font-variant-numeric: tabular-nums; }
.prices { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.prices li { display: flex; justify-content: space-between; gap: 10px; color: var(--mist); font-size: 15.5px; border-bottom: 1px dashed var(--line); padding-bottom: 7px; }
.prices li b { color: var(--moon); font-family: var(--f-mono); }
.packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pack { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 22px 14px 16px; border-radius: 16px; background: var(--ink-0); border: 1px solid var(--line); }
.pack .art { font-size: 40px; line-height: 1; }
.pack b { font: 700 16px var(--f-display); }
.pack .qty { font: 800 22px var(--f-mono); color: var(--gold-2); }
.pack .bonus { position: absolute; top: -10px; right: 12px; font: 700 12px var(--f-ui); padding: 3px 9px; border-radius: 99px; background: var(--rose); color: #2a0a1a; }
.pack .btn { width: 100%; margin-top: 4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font: 700 12px var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--dusk); padding: 0 8px 8px 0; }
.tbl td { padding: 8px 8px 8px 0; border-top: 1px solid var(--line); color: var(--mist); vertical-align: top; }
.tbl td.num { font-family: var(--f-mono); color: var(--moon); white-space: nowrap; }
.tbl td.plus { color: var(--leaf); }
.tbl td.minus { color: var(--ember); }
.tbl-wrap { overflow-x: auto; }

/* ---------- адаптивность ---------- */
@media (max-width: 1240px) { .play { grid-template-columns: 280px minmax(0, 1fr) 330px; } }
@media (max-width: 980px) {
  body.is-play .app { height: auto; }
  body.is-play #view { overflow: visible; }
  .play { display: flex; flex-direction: column; }
  .scene { order: 1; border-left: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .scene .frame { max-width: 560px; width: 100%; align-self: center; }
  .story { order: 2; }
  .sheet { order: 3; border-right: 0; border-top: 1px solid var(--line); overflow: visible; }
  .log { overflow: visible; }
  .composer { position: sticky; bottom: 0; z-index: 5; }
  .setup, .create-grid, .acct { grid-template-columns: 1fr; }
  .showcase, .aside-sticky { position: static; }
  .saves { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .packs { grid-template-columns: 1fr; }
  .save { grid-template-columns: 1fr; }
  .picker, .picker.is-portrait { grid-template-columns: 1fr; }
  .picker-prev { max-width: 260px; }
  .erow.stat { grid-template-columns: 70px minmax(0, 1fr) 70px 40px; }
  .erow.item { grid-template-columns: 56px minmax(0, 1fr) 40px; }
  .erow.item .slot-sel, .erow.item .desc { grid-column: 1 / -1; }
  .erow.lore { grid-template-columns: minmax(0, 1fr) 40px; }
  .erow.lore textarea { grid-column: 1 / -1; grid-row: 2; }
  .tiers { grid-template-columns: 1fr; }
}

/* ---------- карточка «Поделиться» ---------- */
.share-prev { border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); background: var(--ink-0); min-height: 120px; display: grid; place-items: center; }
.share-prev img { display: block; width: 100%; height: auto; }
a.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* ---------- админка ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 720px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--ink-1); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.tile .lbl { color: var(--dusk); }
.tile b { font: 800 30px/1.1 var(--f-display); color: var(--moon); font-variant-numeric: tabular-nums; }
.tile b.gold { color: var(--gold-2); }
.tile small { color: var(--mist); font-size: 14px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
@media (max-width: 980px) { .admin-grid { grid-template-columns: 1fr; } }

/* ---------- пиксельная сцена ---------- */
.canvas .pix { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.toggles { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.toggles .check-row { font-size: 15px; color: var(--mist); }

/* ---------- главная: лента миров и приглашение ---------- */
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 330px); gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 14px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.rail:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; border-radius: 12px; }
.rail-card { scroll-snap-align: start; display: flex; min-width: 0; }
.rail-card > .card { flex: 1; }
.rail-card.skeleton { min-height: 360px; }
.rail-nav { display: flex; gap: 8px; }
.rail-nav .btn { width: 44px; height: 40px; font-size: 18px; padding: 0; }
.joinbox { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 14px; background: rgba(23, 17, 38, .7); border: 1px solid var(--line); max-width: 520px; }
.joinbox .row { display: flex; gap: 8px; flex-wrap: wrap; }
.joinbox input { flex: 1 1 200px; text-transform: uppercase; letter-spacing: .12em; font-family: var(--f-mono); }
.feed-end { min-height: 40px; display: flex; justify-content: center; }

/* ---------- предметы: стопки, бонусы, окошко «использовать» ---------- */
.cell { position: relative; }
.cell .qty { position: absolute; right: 2px; bottom: 1px; font: 700 11px var(--f-mono); color: var(--gold-2); text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.cell .gem-dot { position: absolute; left: 4px; top: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 4px var(--mint); }
.slot .tagline { font: 600 10px var(--f-mono); color: var(--mint); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hex.boosted { background: linear-gradient(180deg, #5a4a1e, #3a2e12); color: var(--gold-2); }
.composer { position: relative; }
.usebox { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: min(560px, calc(100% - 24px)); z-index: 12; background: var(--ink-2); border: 1px solid var(--gold-deep); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.usebox b { font: 700 16px var(--f-display); }
.usebox .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.use-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.use-row .seg button { padding: 5px 12px; font-size: 14px; }
.story { position: relative; }
.to-bottom { position: absolute; left: 50%; transform: translateX(-50%); bottom: 118px; z-index: 6; box-shadow: var(--shadow); }
.item-stats { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 2px 0 6px; }
.item-stats label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--mist); }
.item-stats input[type="number"] { width: 70px; padding: 6px 8px; font-size: 15px; }
.item-stats select { width: auto; padding: 6px 8px; font-size: 14px; }
.erow.item { padding-bottom: 8px; border-bottom: 1px dashed var(--line); }

/* ---------- совместная игра ---------- */
.party { display: flex; flex-direction: column; gap: 8px; }
.party-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--ink-0); border: 1px solid var(--line); }
.party-row.me { border-color: var(--gold-deep); }
.party-row.off { opacity: .55; }
.party-row b { font-size: 15px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.party-row small { color: var(--dusk); font-size: 13px; }
.mini-av { flex: none; border-radius: 9px; overflow: hidden; display: inline-grid; place-items: center; background: linear-gradient(160deg, #3a2e63, #221a3c); border: 1px solid var(--gold-deep); font: 800 13px var(--f-display); color: var(--gold-2); vertical-align: middle; }
.mini-av img { width: 100%; height: 100%; object-fit: cover; }
.pstat { flex: none; font: 700 11.5px var(--f-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--dusk); }
.pstat.ok { color: var(--leaf); }
.pstat.wait { color: var(--gold); }
.pstat.dead { color: var(--ember); }
.invite { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border-radius: 12px; background: var(--ink-0); border: 1px dashed var(--gold-deep); }
.invite .code { display: block; font: 800 32px/1.1 var(--f-mono); letter-spacing: .18em; color: var(--gold-2); }
.ready-box { max-width: 70ch; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.ready-box p { font: italic 400 17px var(--f-story); color: var(--moon); }
.ready-box .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.you.them { align-self: flex-start; border-radius: 16px 16px 16px 4px; background: linear-gradient(180deg, #232042, #1b1833); }
.you.them small { color: var(--mint); }
.you small .mini-av { margin-right: 4px; }

/* ---------- кнопка «бросить кубик на это действие» ---------- */
.btn.force { width: 54px; height: 54px; padding: 0; border-radius: 14px; color: var(--mint); flex: none; }
.btn.force[aria-pressed="true"] { background: rgba(111, 224, 200, .16); border-color: var(--mint); box-shadow: 0 0 0 3px rgba(111, 224, 200, .15), 0 0 18px rgba(111, 224, 200, .25); }
.btn.force svg { width: 26px; height: 26px; }
.tiers.dice3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .tiers.dice3 { grid-template-columns: 1fr; } }
