/* IdleRPG Web - IRC client look */
:root {
  --bg: #0f1216;
  --panel: #161a20;
  --panel-2: #1c2129;
  --line: #2a313b;
  --text: #c9d1d9;
  --muted: #7d8590;
  --accent: #58a6ff;
  --me: #ffd866;
  --good: #7ee787;
  --bad: #ff7b72;
  --god: #d2a8ff;
  --item: #79c0ff;
  --quest: #ffa657;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--mono);
}
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }

.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { font-weight: 700; font-size: 18px; color: #fff; white-space: nowrap; }
.brand .hash { color: var(--accent); }
.brand .version { font-size: 12px; font-weight: 400; color: var(--muted); }
.topic { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }

/* layout */
.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; }
.chat { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); }

/* chat */
.chat-tabs, .side-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--line); background: var(--panel); align-items: flex-end; }
.tab, .stab {
  background: transparent; border: 1px solid transparent; border-bottom: none;
  padding: 6px 12px; cursor: pointer; color: var(--muted); border-radius: 6px 6px 0 0;
}
.tab.active, .stab.active { background: var(--bg); color: var(--text); border-color: var(--line); margin-bottom: -1px; }
.side-tabs .stab.active { background: var(--panel-2); }
.online-count { margin-left: auto; padding: 0 4px 6px; color: var(--muted); font-size: 12px; }

.log { flex: 1; overflow-y: auto; padding: 8px 16px; min-height: 0; }
.line { padding: 1px 0; word-wrap: break-word; }
.line .ts { color: var(--muted); margin-right: 6px; }
.line .nick { color: var(--accent); margin-right: 6px; }
.line.mine { background: rgba(255, 216, 102, 0.06); border-left: 2px solid var(--me); padding-left: 6px; margin-left: -8px; }
.line .me-name { color: var(--me); font-weight: 700; }
.t-level .msg { color: #fff; }
.t-item .msg { color: var(--item); }
.t-item-bad .msg { color: var(--muted); }
.t-unique .msg { color: var(--me); font-weight: 700; }
.t-battle-win .msg { color: var(--good); }
.t-battle-loss .msg { color: var(--bad); }
.t-crit .msg { color: var(--bad); font-weight: 700; }
.t-good .msg { color: var(--good); }
.t-bad .msg { color: var(--bad); }
.t-god .msg { color: var(--god); }
.t-god-bad .msg { color: var(--god); font-style: italic; }
.t-quest .msg { color: var(--quest); }
.t-quest-bad .msg { color: var(--quest); font-style: italic; }
.t-steal .msg { color: var(--god); }
.t-join .msg, .t-quit .msg { color: var(--muted); }
.t-cmd .msg { color: var(--muted); font-style: italic; }
.t-notice .msg { color: var(--text); }

.cmd { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--line); background: var(--panel); }
.cmd .prompt { color: var(--accent); white-space: nowrap; }
.cmd input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; outline: none; }
.cmd input:focus { border-color: var(--accent); }

/* side panels */
.panel { display: none; overflow-y: auto; padding: 14px 16px; flex: 1; min-height: 0; background: var(--panel-2); }
.panel.active { display: block; }
.panel h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.hero-name { font-size: 20px; font-weight: 700; color: var(--me); }
.hero-class { color: var(--muted); margin-bottom: 10px; }
.hero-level { font-size: 28px; font-weight: 700; color: #fff; }
.lvl-label { font-size: 14px; color: var(--muted); font-weight: 400; }
.bar { height: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; margin: 6px 0; }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--good)); transition: width .9s linear; }
.hero-ttl b { color: #fff; font-weight: 600; }
.hero-real { color: var(--muted); font-size: 12px; min-height: 1.2em; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 12px 0 0; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; }

table { width: 100%; border-collapse: collapse; }
.items td { padding: 3px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.items td.slot { color: var(--muted); white-space: nowrap; width: 1%; }
.items td.lvl { text-align: right; color: #fff; width: 1%; white-space: nowrap; }
.items .unique { color: var(--me); }
.items .none { color: var(--muted); font-style: italic; }

.quest-box { margin-top: 16px; padding: 10px; border: 1px dashed var(--quest); border-radius: 6px; color: var(--quest); font-size: 13px; }
.quest-box:empty { display: none; }

.players th, .players td { padding: 3px 4px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
.players th { color: var(--muted); font-weight: 400; position: sticky; top: -14px; background: var(--panel-2); }
.players tr { cursor: pointer; }
.players tr:hover td { background: rgba(88, 166, 255, 0.08); }
.players tr.me td { color: var(--me); }
.players tr.offline td { color: var(--muted); opacity: .6; }
.players td.name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.al { display: inline-block; width: 1.2em; }
.al-g { color: var(--good); } .al-e { color: var(--bad); } .al-n { color: var(--muted); }
.inspect { margin-top: 14px; font-size: 13px; }
.inspect h4 { margin: 0 0 4px; color: #fff; }

#map { width: 100%; height: auto; aspect-ratio: 1; background: #0b0e11; border: 1px solid var(--line); border-radius: 4px; image-rendering: pixelated; }
.hint { color: var(--muted); font-size: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; }
.dot.me { background: var(--me); } .dot.other { background: var(--accent); } .dot.quester { background: var(--quest); } .dot.goal { background: var(--god); }

.field { display: flex; flex-direction: column; gap: 4px; margin: 12px 0 0; color: var(--muted); }
.field input, .field select { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 7px 8px; color: var(--text); }
.btn-row { display: flex; gap: 8px; margin: 16px 0 8px; flex-wrap: wrap; }
.btn { display: inline-block; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 7px 12px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #0b0e11; border-color: var(--accent); font-weight: 700; width: 100%; margin-top: 18px; }
.btn.danger { color: var(--bad); }
.btn.danger.armed { background: var(--bad); color: #0b0e11; }
.about p { color: var(--muted); font-size: 13px; }

/* modals */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal[hidden] { display: none; }
.modal-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 24px; width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto; }
.modal-card h2 { margin: 0 0 8px; color: var(--accent); font-size: 18px; }
.modal-card p { color: var(--muted); margin: 0 0 6px; }
#awayText ul { padding-left: 18px; }
#awayText li { margin: 3px 0; }
.loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .75); color: var(--accent); z-index: 20; }
.loading[hidden] { display: none; }

/* mobile */
@media (max-width: 820px) {
  .app { height: auto; min-height: 100vh; }
  .layout { grid-template-columns: 1fr; }
  .chat { border-right: none; border-bottom: 1px solid var(--line); height: 60vh; }
  .side { min-height: 60vh; }
  .topbar { flex-wrap: wrap; gap: 4px 12px; }
  .topic { white-space: normal; flex-basis: 100%; font-size: 12px; }
  .log { padding: 8px 12px; font-size: 13px; }
  .cmd { padding: 8px 12px; }
  .cmd .prompt { display: none; }
}
