/* dnd-tui web: drawn like the terminal app (boxes with the title in the border, green selection),
   one column on a phone, two on wide screens */
:root {
  --bg: #232634; --panel: #292c3c; --ink: #c6d0f5; --dim: #737994; --line: #414559;
  --accent: #a6d189; --accent-ink: #232634; --warn: #e5c890; --bad: #e78284; --info: #99d1db; --magic: #ca9ee6;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 ui-monospace, "JetBrains Mono", "Fira Code", "Cascadia Code", Menlo, Consolas, monospace; }
#app { max-width: 1100px; margin: 0 auto; padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; background: none; border: 1px solid var(--line); border-radius: 4px;
  padding: 8px 10px; min-height: 40px; cursor: pointer; text-align: left; }
button:active { background: var(--accent); color: var(--accent-ink); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
button.danger { color: var(--bad); }
button.icon { min-width: 44px; text-align: center; font-size: 20px; padding: 4px; border: none; }
input { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; width: 100%; min-height: 42px; }
input:focus { outline: none; border-color: var(--accent); }
h1 { margin: 0; font-size: 20px; color: var(--accent); }
small, .dim { color: var(--dim); }
a { color: var(--info); word-break: break-all; }
b { font-weight: 700; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.big > button { flex: 1; text-align: center; min-height: 48px; }

/* the terminal's block: green border, bold green title in it */
.box { border: 1px solid var(--accent); border-radius: 2px; margin: 0 0 10px; padding: 4px 8px 8px; min-width: 0; }
.box > legend { color: var(--accent); font-weight: 700; padding: 0 4px; }
.box > legend small { font-weight: 400; }
.ln { margin: 2px 0; }
.text .gap { height: 10px; }
.chunks { display: flex; flex-wrap: wrap; gap: 0 2ch; }
.chunks > span { white-space: nowrap; }

header.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 6px 10px 8px; border-bottom: 1px solid var(--accent); }
header.top .who { flex: 1; min-width: 0; }
header.top .who b, header.top .who small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.top .who b { color: var(--accent); }
.hp { width: 100%; display: flex; align-items: center; gap: 8px; margin: 4px 0; border-color: var(--line); }
.hp em { color: var(--info); font-style: normal; }
.bar { flex: 1; height: 14px; background: var(--panel); }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.mid { background: var(--warn); }
.bar i.low { background: var(--bad); }
.stats { gap: 4px 14px; }
.stats button { border: none; padding: 4px 0; min-height: 34px; }
.stats .adv { margin-left: auto; border: 1px solid var(--line); padding: 2px 10px; }
.adv-advantage { background: var(--accent); color: var(--accent-ink); }
.adv-disadvantage { background: var(--bad); color: var(--accent-ink); }

main { padding: 8px 10px; }

/* rows inside a box: the selected one is green, like the terminal's highlight */
.item { width: 100%; display: flex; gap: 10px; align-items: center; border: none; border-radius: 0; border-bottom: 1px solid var(--line); }
.box > .item:last-child, .items .item:last-child { border-bottom: none; }
.item > b { flex: 1; font-weight: 400; }
.item.sel { background: var(--accent); color: var(--accent-ink); }
.item.sel .dim, .item.sel small, .item.sel .c-red { color: var(--accent-ink); }
.act { display: block; }
.act .top { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; }
.act .top > span { white-space: nowrap; }
.act small { display: block; }
.spent { opacity: .45; }
.tag { border: 1px solid var(--line); padding: 0 6px; }
.tag.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.detail { padding: 6px 4px 10px; border-bottom: 1px solid var(--line); }
.note { white-space: pre-wrap; }

.abs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
@media (max-width: 360px) { .abs { grid-template-columns: repeat(3, 1fr); } }
.ab { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 2px; }
.ab button { border: none; border-radius: 0; text-align: center; padding: 4px 0; }
.ab button:first-child { display: flex; flex-direction: column; line-height: 1.2; }
.ab button:first-child b { font-size: 20px; }
.ab .save { border-top: 1px solid var(--line); min-height: 36px; font-size: 13px; }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.skill { border: none; padding: 6px 2px; min-height: 36px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cmds { display: flex; flex-wrap: wrap; gap: 6px; }
.cmds button { padding: 6px 10px; min-height: 38px; }
.cmds b { color: var(--accent); }
.search { margin: 0 0 10px; }
.sheet { border-bottom: 1px solid var(--line); padding: 4px 0 8px; }
.sheet:last-child { border-bottom: none; }
.sheet .open { width: 100%; border: none; padding: 4px 0 8px; }
.sheet .open b, .sheet .open small { display: block; }
.sheet .open b { color: var(--accent); }
.sheet .row button { flex: 1; text-align: center; min-height: 38px; padding: 4px; }

nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 4px; background: var(--bg);
  border-top: 1px solid var(--accent); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
nav.tabs button { flex: 1; border: none; text-align: center; min-height: 44px; color: var(--dim); }
nav.tabs button.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.toast { position: fixed; left: 10px; right: 10px; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 7; max-width: 700px; margin: 0 auto;
  background: var(--panel); border: 1px solid var(--accent); padding: 10px 12px; box-shadow: 0 6px 24px #0008; cursor: pointer; }
.veil { position: fixed; inset: 0; background: #000a; z-index: 8; border: none; border-radius: 0; }
.sheet-panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; max-height: 85vh; overflow: auto; max-width: 700px; margin: 0 auto;
  background: var(--bg); border: 1px solid var(--accent); border-bottom: none; padding: 4px 12px calc(12px + env(safe-area-inset-bottom)); }
.sheet-panel h2 { color: var(--accent); font-size: 16px; margin: 10px 2px; }
.sheet-panel .row { margin-top: 10px; justify-content: flex-end; }
.items { display: flex; flex-direction: column; }
.item .tick { width: 20px; height: 20px; border: 1px solid var(--dim); display: inline-grid; place-items: center; flex: none; }
.item.on .tick { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.item.sel .tick { border-color: var(--accent-ink); }
.log div { padding: 6px 2px; border-bottom: 1px solid var(--line); }

.c-green, .t-good { color: var(--accent); }
.c-yellow, .t-warn { color: var(--warn); }
.c-red { color: var(--bad); }
.c-cyan { color: var(--info); }
.c-magenta { color: var(--magic); }
.c-darkgray, .t-dim { color: var(--dim); }
.b { font-weight: 700; }

footer.legal { font-size: 11px; color: var(--dim); padding: 16px 12px 90px; max-width: 1100px; margin: 0 auto; }

/* wide screens: two columns, like the terminal's side panels */
@media (min-width: 900px) {
  main { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: start; }
  main > .wide, main > .search, main > p, main > .row { grid-column: 1 / -1; }
}
