
:root {
  color-scheme: dark;
  --bg: #130b12;
  --panel: rgba(22, 15, 22, .68);
  --panel-strong: rgba(25, 17, 27, .9);
  --line: rgba(228, 194, 142, .24);
  --gold: #e8c07a;
  --wine: #7c1236;
  --rose: #d65476;
  --ivory: #f8efe1;
  --muted: #bbaea2;
  --green: #66d9a7;
  --shadow: 0 22px 70px rgba(0, 0, 0, .48);
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #1f151d; color: var(--ivory); font: 14px/1.35 Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
#app { position: fixed; inset: 0; isolation: isolate; background: radial-gradient(circle at 50% 40%, rgba(255, 207, 144, .22), transparent 36%), radial-gradient(circle at 50% 72%, rgba(157, 31, 72, .18), transparent 48%), #1f151d; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; background: #1f151d; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at center, transparent 56%, rgba(0,0,0,.14)); z-index: 2; }
.hud { position: fixed; z-index: 5; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(18, 13, 18, .76), rgba(6, 4, 8, .62)); backdrop-filter: blur(16px); box-shadow: var(--shadow); }
.topbar { left: 18px; right: 18px; top: 16px; min-height: 76px; border-radius: 8px; display: grid; grid-template-columns: minmax(190px,.8fr) minmax(240px,1.2fr) auto; align-items: center; gap: 18px; padding: 12px 14px; }
.brand, .objective { min-width: 0; }
.brand span, .objective span, .stats span, .action-card span, .panel-head span, label span { display: block; color: var(--gold); text-transform: uppercase; letter-spacing: 0; font-size: .68rem; font-weight: 900; }
.brand strong, .objective strong { display: block; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.05rem; }
.objective strong { font-size: 1.25rem; }
.controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.controls label { display: grid; gap: 3px; min-width: 92px; }
.controls select, .controls button, .panel-head button, .action-dock button, .tab, .profile-box button { border: 1px solid var(--line); border-radius: 7px; background: rgba(8, 6, 10, .78); color: var(--ivory); min-height: 34px; padding: 7px 10px; font-weight: 850; }
.controls select:focus, .controls button:hover, .profile-box button:hover, .action-dock button:hover { outline: none; border-color: rgba(232, 192, 122, .68); }
.journal { right: 18px; top: 104px; width: min(340px, calc(100vw - 36px)); max-height: calc(100vh - 230px); overflow: auto; border-radius: 8px; padding: 14px; }
.journal p { margin: 0 0 12px; color: var(--muted); }
.journal ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.journal li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; border: 1px solid rgba(228,194,142,.16); border-radius: 7px; padding: 8px; background: rgba(0,0,0,.18); }
.journal li.done b { color: var(--green); }
.journal small { color: var(--muted); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.action-card { left: 18px; bottom: 108px; width: min(430px, calc(100vw - 36px)); border-radius: 8px; padding: 15px; }
.action-card h1 { margin: 4px 0 7px; font-size: 1.35rem; line-height: 1.05; }
.action-card p { margin: 0 0 12px; color: var(--muted); }
.choice-row { display: grid; gap: 7px; }
.choice-row button { border: 1px solid rgba(232,192,122,.3); border-radius: 7px; text-align: left; color: var(--ivory); background: rgba(8,6,10,.8); padding: 9px 10px; font-weight: 850; }
.choice-row button.good { background: linear-gradient(135deg, rgba(124,18,54,.86), rgba(168,112,56,.72)); border-color: rgba(232,192,122,.58); }
.stats { right: 18px; bottom: 104px; display: grid; grid-template-columns: repeat(4, minmax(102px, 1fr)); gap: 8px; width: min(560px, calc(100vw - 470px)); border: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
.stats article { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 9px 10px; min-width: 0; }
.stats strong { display: block; margin: 3px 0 7px; font-size: 1rem; }
.stats i { display: block; height: 6px; width: 42%; max-width: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--wine), var(--gold)); box-shadow: 0 0 18px rgba(232,192,122,.22); }
.action-dock { left: 50%; bottom: 18px; transform: translateX(-50%); display: grid; grid-template-columns: repeat(4, minmax(116px, 1fr)); gap: 8px; width: min(650px, calc(100vw - 620px)); min-width: 480px; border-radius: 8px; padding: 8px; }
.action-dock button { min-height: 48px; display: grid; place-items: center; line-height: 1.05; }
.action-dock button span { display: block; margin-top: 4px; color: var(--muted); font-size: .68rem; font-weight: 800; }
.action-dock .danger { border-color: rgba(214,84,118,.56); color: #ffdbe3; background: rgba(124,18,54,.32); }
.toast { left: 50%; top: 104px; transform: translateX(-50%); width: min(420px, calc(100vw - 36px)); border-radius: 999px; padding: 9px 14px; text-align: center; color: #ffe8bd; opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(6px); }
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(0,0,0,.42); }
.profile-box { width: min(720px, calc(100vw - 32px)); max-height: min(86vh, 780px); overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-strong); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 10px; }
.profile-layout { display: grid; grid-template-columns: minmax(180px, .78fr) minmax(320px, 1.35fr); gap: 12px; align-items: start; }
.profile-pane { border: 1px solid rgba(228,194,142,.18); border-radius: 8px; background: rgba(0,0,0,.18); padding: 10px; display: grid; gap: 9px; }
.profile-box input, .profile-box select { width: 100%; border: 1px solid rgba(228,194,142,.24); border-radius: 7px; background: rgba(2,2,4,.62); color: var(--ivory); min-height: 38px; padding: 8px 10px; }
.profile-box input[type="color"] { min-height: 42px; padding: 4px; }
.profile-box input[type="range"] { padding: 0; accent-color: var(--gold); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tab.active { border-color: rgba(232,192,122,.68); background: rgba(124,18,54,.54); }
.profile-state, .auth-message { color: var(--muted); }
.auth-message { min-height: 18px; margin: 0; font-size: .86rem; }
.profile-state strong { color: var(--gold); }
.avatar-preview { min-height: 66px; border: 1px solid rgba(232,192,122,.2); border-radius: 8px; background: linear-gradient(135deg, rgba(124,18,54,.28), rgba(232,192,122,.08)); padding: 10px; }
.avatar-preview strong { display: block; margin: 3px 0; font-size: 1.05rem; color: var(--ivory); }
.avatar-preview small { color: var(--muted); }
.avatar-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.avatar-grid label { min-width: 0; display: grid; gap: 5px; }
.avatar-grid label.wide { grid-column: 1 / -1; }
.slider-label span { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.slider-label b { color: var(--ivory); font-size: .78rem; }
.profile-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#auth-fields[hidden], [hidden] { display: none !important; }
.hud-hidden .topbar, .hud-hidden .action-card, .hud-hidden .stats, .hud-hidden .action-dock { display: none; }
#app[data-intensity="adult"] { --wine: #9b123d; --rose: #ff6d91; --gold: #ffd48a; }
#app[data-quality="low"] .vignette { opacity: .32; }
@media (max-width: 1120px) {
  .topbar { grid-template-columns: 1fr; gap: 8px; align-items: start; }
  .controls { justify-content: start; flex-wrap: wrap; }
  .objective strong { font-size: 1.05rem; }
  .action-card { bottom: 94px; }
  .action-dock { left: 18px; right: 18px; transform: none; width: auto; min-width: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats { right: 18px; bottom: 84px; width: min(520px, calc(100vw - 470px)); }
}
@media (max-width: 760px) {
  .topbar { left: 10px; right: 10px; top: 10px; min-height: 0; padding: 10px; }
  .brand span, .objective span, .controls label span { display: none; }
  .brand strong, .objective strong { white-space: normal; }
  .brand strong, .objective strong { font-size: .95rem; }
  .controls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; }
  .controls label { min-width: 0; }
  .controls select, .controls button { min-height: 34px; width: 100%; padding: 6px 7px; font-size: .8rem; }
  .action-card { left: 10px; right: 10px; bottom: 172px; width: auto; padding: 11px; }
  .action-card h1 { font-size: 1.02rem; }
  .action-card p { font-size: .82rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .choice-row { grid-template-columns: 1fr; }
  .choice-row button { padding: 7px 8px; font-size: .78rem; }
  .stats { left: 10px; right: 10px; bottom: 82px; width: auto; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .stats article { padding: 7px 6px; }
  .stats span { font-size: .5rem; }
  .stats strong { font-size: .72rem; }
  .action-dock { left: 10px; right: 10px; bottom: 8px; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 5px; padding: 6px; }
  .action-dock button { min-height: 54px; font-size: .7rem; padding: 6px 4px; }
  .action-dock button span { font-size: .56rem; }
  .journal { left: 10px; right: 10px; top: 178px; width: auto; max-height: calc(100vh - 280px); }
  .profile-box { width: min(520px, calc(100vw - 20px)); max-height: calc(100vh - 24px); padding: 12px; }
  .profile-layout { grid-template-columns: 1fr; }
  .avatar-grid { grid-template-columns: 1fr; }
  .profile-actions { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-card { bottom: 164px; }
  .stats { bottom: 76px; }
  .action-dock button span { display: none; }
  .action-dock button { min-height: 42px; }
}
