/* SKYLINE — Tokens, layout, stage, chat, login, status panel, shared bits. */
:root {
  --bg: #0b0f16; --panel: #121925; --panel2: #18212f; --line: #263246; --text: #e6edf5;
  --muted: #8a99ad; --accent: #4fc3f7; --warn: #ffb74d; --bad: #ef5350; --good: #66bb6a;
  --head: "Chakra Petch", "Noto Sans Thai", sans-serif;
  --body: "Noto Sans Thai", "Chakra Petch", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--body); }
button, input, select, textarea { font: inherit; color: var(--text); }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: #0f3b57; border-color: var(--accent); font-weight: 600; }
button.on, button.sel { background: #12405e; border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
input, select, textarea { background: #0d131d; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; width: 100%; }
label { display: block; margin: 8px 0; color: var(--muted); }
label input, label select { margin-top: 3px; }
.radio { display: inline-flex; gap: 6px; align-items: center; color: var(--text); margin-right: 14px; }
.radio input { width: auto; }
.row { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.btns { display: flex; flex-wrap: wrap; gap: 5px; margin: 5px 0; }
.muted { color: var(--muted); } .small { font-size: 12px; } .pad { padding: 10px; }
.err { color: var(--bad); min-height: 1em; font-size: 13px; white-space: pre-wrap; }
.hint { color: var(--warn); font-size: 13px; min-height: 1em; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.box { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 8px; background: var(--panel); }
.label { font: 600 12px var(--head); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }

/* overlays */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50;
  background: radial-gradient(ellipse at top, #16304f, #05070c 70%); }
.card { width: min(380px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.card.wide { width: min(640px, 94vw); max-height: 92vh; overflow: auto; }
h1, h2, h3, .brand { font-family: var(--head); margin: 0 0 6px; }
h1 span, .brand span { color: var(--accent); font-weight: 400; }
.attrs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.skills { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.skill { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.skill.sel { border-color: var(--accent); background: #10314a; }
.skill b { display: block; } .skill span { color: var(--muted); font-size: 12px; }

/* layout */
#app { display: grid; grid-template-rows: 44px 1fr; height: 100vh; }
header { display: flex; align-items: center; gap: 16px; padding: 0 14px; border-bottom: 1px solid var(--line); background: #0d131d; }
#hd-status { font-family: var(--head); color: var(--warn); }
#hd-timer { font-family: var(--head); font-variant-numeric: tabular-nums; padding: 2px 10px; border-radius: 4px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); }
#hd-timer.low { color: #ff5252; border-color: #ff5252; animation: tblink .5s steps(2) infinite; }
@keyframes tblink { 50% { opacity: .45; } }
#hd-users { margin-left: auto; display: flex; gap: 8px; font-size: 12px; }
.user { padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); }
.user.off { opacity: .4; }
main { display: grid; grid-template-columns: 250px 1fr 370px; min-height: 0; }
#side { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel); min-height: 0; }
#center { display: grid; grid-template-rows: 1fr 168px; min-height: 0; min-width: 0; }
#tabs { display: flex; border-bottom: 1px solid var(--line); }
#tabs button { flex: 1; border: 0; border-radius: 0; background: transparent; padding: 9px 0; font-family: var(--head); }
#tabs button.on { background: var(--panel2); box-shadow: inset 0 -2px var(--accent); }
.tab { display: none; flex: 1; min-height: 0; overflow: auto; }
.tab.on { display: flex; flex-direction: column; }
#tab-chat.on { overflow: hidden; }

/* stage */
#stage { position: relative; overflow: hidden; min-height: 0; }
#bg { position: absolute; inset: 0; background-size: cover; background-position: center; transition: background .6s; }
#bg::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px); pointer-events: none; }
#cast { position: absolute; inset: 0 0 0 0; display: flex; justify-content: space-evenly; align-items: flex-end; pointer-events: none; }
.sprite { display: flex; flex-direction: column; align-items: center; transition: filter .3s, transform .3s, opacity .3s; filter: brightness(.55); transform: scale(.96); }
.sprite.speaking { filter: none; transform: scale(1); }
.sprite img { max-height: 62vh; max-width: 28vw; object-fit: contain; }
.sprite svg { height: calc(52vh * var(--crowd, 1)); }
.sprite .nm { font: 600 13px var(--head); margin-top: -4px; padding: 1px 10px; border-radius: 10px; background: rgba(0,0,0,.6); }
#dialogue { position: absolute; left: 6%; right: 6%; bottom: 6%; height: 25%; min-height: 128px; padding: 28px 30px 16px;
  background: linear-gradient(180deg, rgba(8,14,24,.82), rgba(8,14,24,.94)); border: 1px solid rgba(79,195,247,.45);
  border-radius: 10px; box-shadow: 0 0 24px rgba(0,0,0,.6); z-index: 5; }
#dl-name { position: absolute; top: -14px; left: 18px; padding: 3px 16px; border-radius: 6px; font: 700 15px var(--head);
  background: #0f2a40; border: 1px solid var(--accent); }
#dl-name:empty { display: none; }
#dl-text { font-size: var(--dl-size, 19px); line-height: 1.6; white-space: pre-wrap; max-height: 100%; overflow: auto; }
#dl-next { position: absolute; right: 18px; bottom: 10px; color: var(--accent); font-size: 14px; opacity: 0; }
#dl-next.on { opacity: 1; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
/* chat */
#chat-list { flex: 1; overflow: auto; padding: 8px 10px; }
.msg { margin: 4px 0; }
.msg .who { font-weight: 600; margin-right: 6px; }
.msg.system { color: var(--muted); font-size: 12px; }
.msg.ooc { color: var(--muted); }
.msg.roll { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: #ffe082; }
.chat-input { display: flex; gap: 5px; padding: 8px; border-top: 1px solid var(--line); align-items: center; }
.chat-input select { width: 110px; }
.chat-input input[type=text], #chat-text { flex: 1; }
.chat-input .radio { margin: 0; }
/* ---------------- login page (LGN-05): key art + box on the right */
#login { position: fixed; inset: 0; display: grid; grid-template-columns: 1fr minmax(340px, 420px); z-index: 50;
  background: #000; background-size: cover; background-position: center; }   /* LGN-07: pure black until the GM sets a picture / clip */
.keyart { position: relative; overflow: hidden; }
.keyart .sun { position: absolute; width: 180px; height: 180px; border-radius: 50%; left: 18%; bottom: 14%;
  background: radial-gradient(circle, #ffe7b0 0%, #ffb36b 55%, rgba(255,140,80,0) 72%); filter: blur(2px); }
.keyart .cloud { position: absolute; height: 26px; border-radius: 20px; background: rgba(255,255,255,.18); filter: blur(6px); animation: drift 60s linear infinite; }
.keyart .c1 { width: 340px; top: 30%; left: -20%; } .keyart .c2 { width: 520px; top: 58%; left: -40%; animation-duration: 90s; } .keyart .c3 { width: 260px; top: 70%; left: -10%; animation-duration: 45s; }
.keyart .jet { position: absolute; color: #0b1422; font-size: 46px; transform: rotate(-12deg); text-shadow: 0 0 1px #000; animation: fly 14s linear infinite; }
.keyart .j1 { top: 34%; left: -10%; } .keyart .j2 { top: 39%; left: -16%; font-size: 34px; animation-delay: .35s; } .keyart .j3 { top: 30%; left: -18%; font-size: 30px; animation-delay: .6s; }
@keyframes drift { to { transform: translateX(160vw); } }
@keyframes fly { from { transform: translate(0, 0) rotate(-12deg); } to { transform: translate(120vw, -22vh) rotate(-12deg); } }
@media (prefers-reduced-motion: reduce) { .keyart .cloud, .keyart .jet { animation: none; } }
.lg-side { background: rgba(0,0,0,.78); backdrop-filter: blur(6px); padding: 38px 28px 20px; display: flex; flex-direction: column; gap: 14px; overflow: auto; border-left: 1px solid rgba(255,255,255,.1); }
#login:not(.has-art) .keyart > * { display: none; }        /* no sunset, clouds or jets — the GM's art goes here */
.lg-logo h1 { font-size: 34px; letter-spacing: .04em; }
.lg-news { border-left: 3px solid var(--warn); padding: 8px 12px; background: rgba(255,183,77,.08); border-radius: 6px; white-space: pre-wrap; }
.lg-side .card { width: auto; padding: 18px; }
.lg-row { justify-content: space-between; } .lg-row .room { display: flex; align-items: center; gap: 6px; margin: 0; } .lg-row .room input { width: 90px; }
.lg-links { display: flex; gap: 14px; margin: 6px 0; } .lg-links a { color: var(--accent); }
.lg-version { margin-top: auto; font-size: 11px; color: var(--muted); }
button.wide { width: 100%; padding: 9px; margin-top: 6px; }
@media (max-width: 760px) { #login { grid-template-columns: 1fr; } .keyart { display: none; } }
header #hd-profile { margin-left: 8px; }
table.acc { width: 100%; border-collapse: collapse; margin-top: 6px; }
table.acc td, table.acc th { border-bottom: 1px solid var(--line); padding: 3px 4px; text-align: left; }
table.acc tr.req td { background: rgba(255,183,77,.1); }
table.acc button { padding: 0 5px; }
.nowrap { white-space: nowrap; }
#acc-issued textarea { font-family: ui-monospace, Consolas, monospace; font-size: 12px; margin: 4px 0; }

/* ---------------- IC chat under the stage (VNL-02) */
#ic { display: flex; flex-direction: column; min-height: 0; border-top: 1px solid var(--line); background: #0c121b; }
#ic-list { flex: 1; overflow: auto; padding: 6px 14px; font-size: 14px; }
#ic-list .msg .who { min-width: 80px; display: inline-block; }
#ic .chat-input { border-top: 1px solid var(--line); padding: 6px 10px; }
#ic-as { width: 130px; }

/* ---------------- Status panel (VNL-03/04) */
#status { position: relative; border-right: 1px solid var(--line); background: var(--panel); overflow: auto; padding: 10px; }
#st-toggle { position: absolute; top: 6px; right: 6px; padding: 0 6px; z-index: 2; }
.st-portrait { width: 100%; aspect-ratio: 1 / 1; border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center;
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.08), rgba(0,0,0,.2)); overflow: hidden; }
.st-portrait svg { height: 90%; }
.st-name { font: 700 20px var(--head); margin-top: 8px; }
.st-sub { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.st-row { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 6px; margin: 5px 0; font-size: 13px; }
.st-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.st-bar i { height: 10px; border-radius: 2px; background: #233041; }
.st-bar.w i.on { background: #ef5350; } .st-bar.m i.on { background: #b39ddb; }
.st-barw small { color: var(--muted); font-size: 11px; }
.st-sec { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.st-sec .label { margin-bottom: 4px; }
.st-people div { font-size: 13px; margin: 2px 0; }
.st-people .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
main.st-mini { grid-template-columns: 56px 1fr 370px; }
main.st-mini #st-body > *:not(.st-portrait) { display: none; }
main.st-mini .st-portrait { margin-top: 26px; }
@media (max-width: 1279px) { main { grid-template-columns: 56px 1fr 340px; } main #st-body > *:not(.st-portrait) { display: none; }
  main .st-portrait { margin-top: 26px; } main.st-open { grid-template-columns: 250px 1fr 340px; } main.st-open #st-body > * { display: revert; } }
/* ------------------------------------------------------------------ VN-06 cast positions */
#cast { display: block; }
#cast .sprite { position: absolute; bottom: 0; transform: translateX(-50%) scale(.96); transition: left .35s ease, filter .3s, transform .3s; }
#cast .sprite.speaking { transform: translateX(-50%) scale(1); }
#cast .sprite.flip img, #cast .sprite.flip svg { transform: scaleX(-1); }
#cast.gm .sprite { pointer-events: auto; cursor: grab; }
#cast.gm .sprite.drag { cursor: grabbing; transition: none; filter: none; }
.cast-row { display: flex; align-items: center; gap: 4px; margin: 3px 0; }
.cast-row .nm { flex: 1; font-weight: 600; }
.cast-row button { padding: 2px 8px; }
/* ------------------------------------------------------------------ VN-04 fade the text box */
#dl-fade { position: absolute; top: 6px; right: 8px; padding: 0 7px; font-size: 13px; line-height: 20px; opacity: .55; background: transparent; border: 1px solid rgba(255,255,255,.25); }
#dl-fade:hover { opacity: 1; }
#stage.vnfade #dialogue { opacity: 0; pointer-events: none; transform: translateY(8px); }
#dialogue { transition: opacity .35s, transform .35s; }
#vn-show { position: absolute; right: 14px; bottom: 14px; z-index: 9; opacity: .8; }
/* admin log */
#log .lg { padding: 1px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
#log .lg .t { color: #607d8b; margin-right: 6px; }
#log .lg.roll { color: #ffd54f; } #log .lg.system { color: #b0bec5; } #log .lg.chat { color: #e3f2fd; }
/* settings popover */
#settings { position: fixed; top: 46px; right: 120px; z-index: 40; width: 260px; padding: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
#settings label { margin: 6px 0; }
/* line icons */
svg.i { pointer-events: none; width: 1.1em; height: 1.1em; vertical-align: -.18em; fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
button svg.i:only-child { vertical-align: -.2em; }
#gm-mood button { min-width: 92px; }
#gm-mood button .sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
#ic { background: var(--panel2); }
.st-bar i { background: var(--line); }
.slot .th { background: var(--input); }

/* PNL-01 panels that fold and move */
.pnl > .pnl-bar { display: flex; align-items: center; gap: 4px; margin: -4px -4px 4px; padding: 1px 4px; cursor: grab; user-select: none;
  touch-action: none; border-bottom: 1px dashed rgba(255,255,255,.12); font-size: 11px; color: #90a4ae; }
.pnl > .pnl-bar:active { cursor: grabbing; }
.pnl > .pnl-bar .pnl-grip { flex: 1; letter-spacing: .06em; text-transform: uppercase; }
.pnl > .pnl-bar .pnl-grip i { font-style: normal; }
.pnl > .pnl-bar button { padding: 0 6px; font-size: 11px; line-height: 16px; min-height: 0; }
.pnl.pnl-folded > :not(.pnl-bar) { display: none !important; }
.pnl.pnl-folded { max-height: none !important; width: auto !important; min-width: 150px; overflow: visible !important; }
.pnl.pnl-folded > .pnl-bar { margin-bottom: -4px; border-bottom: 0; }
/* HDR-01 people in the header: one button + drop-down */
#hd-users { position: relative; flex: 0 0 auto; }
#hd-users .hu-list { position: absolute; right: 0; top: 110%; z-index: 90; min-width: 180px; max-height: 60vh; overflow: auto; padding: 6px 8px;
  background: #0d1522; border: 1px solid #3b5274; border-radius: 8px; box-shadow: 0 8px 22px rgba(0,0,0,.5); }
#hd-users .hu { font-size: 13px; padding: 2px 0; white-space: nowrap; } #hd-users .hu.off { opacity: .45; }
#hd-users .hu .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
#tabs button { position: relative; } .ooc-dot { position: absolute; top: 2px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: #e53935; color: #fff; font: 700 10px/16px var(--body); text-align: center; }
