/* Extra client styles: settings, themes, chat/combat panes, prompt line, search, quest tracker, reconnect banner. */

/* ---- text size (Settings) ---- */
html, body { font-size: var(--fs, 14px); }
#output { font-size: var(--fs, 14px); }
@media (max-width: 760px) { #output { font-size: calc(var(--fs, 14px) - 1px); } }

/* ---- prompt line ---- */
#promptline {
  padding: 3px 12px; background: var(--bg2); color: var(--accent); font-size: .9em; border-top: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#promptline[hidden] { display: none; }

/* ---- separate chat / combat panes ---- */
#panes { display: flex; max-height: 30%; min-height: 0; border-top: 1px solid var(--line); background: var(--bg); }
#panes[hidden] { display: none; }
.pane { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.pane:last-child { border-right: 0; }
.pane[hidden] { display: none; }
.paneHead { padding: 2px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); background: var(--bg2); border-bottom: 1px solid var(--line); }
.paneOut { flex: 1; overflow-y: auto; padding: 4px 8px; font-size: .92em; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 3.5em; }

/* ---- timestamps and search ---- */
.ts { color: var(--dim); font-size: .8em; margin-right: 6px; }
#searchbar { display: flex; gap: 4px; padding: 4px 8px; background: var(--bg2); border-bottom: 1px solid var(--line); align-items: center; }
#searchbar[hidden] { display: none; }
#searchIn { flex: 1; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 5px 8px; font: inherit; font-size: 14px; }
#searchbar button { background: var(--bg3); color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 4px 9px; font: inherit; cursor: pointer; }
#searchCount { color: var(--dim); font-size: 12px; min-width: 4.5em; text-align: right; }
.line.hit { background: rgba(255, 215, 0, .16); }
.line.cur { background: rgba(255, 215, 0, .42); }

/* ---- quest tracker ---- */
.trk { margin: 5px 0; font-size: 12px; line-height: 1.3; }
.trk b { color: #ffdf5d; }
.trk .trkText { color: var(--text); margin-top: 1px; }

/* ---- reconnect banner ---- */
#conn .sub { font-size: 13px; color: var(--dim); }

/* ---- settings dialog ---- */
#settings { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; z-index: 50; }
#settings[hidden] { display: none; }
#settingsBox { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; min-width: 290px; max-width: 92vw; max-height: 90vh; overflow: auto; }
#settingsBox h3 { margin: 0 0 8px; font-size: 16px; }
.srow { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 9px 0; font-size: 13px; }
.srow select, .srow input[type=number] { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 4px 6px; font: inherit; }
.srow input[type=checkbox] { width: 18px; height: 18px; }
#settingsBox .sbtns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
#settingsBox button { background: var(--bg3); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 14px; font: inherit; cursor: pointer; }

/* ---- reduced motion, and flashes switched off ---- */
@media (prefers-reduced-motion: reduce) {
  .fx.go { animation: none; }
  .mfill.hp.crit { animation: none; }
  .mfill { transition: none; }
}
body.noflash .fx { display: none; }

/* ---- light theme ---- */
:root[data-theme="light"] { --bg: #fafbfc; --bg2: #eef1f5; --bg3: #dfe4ec; --line: #b8c0cc; --text: #1f2933; --dim: #5a6472; --accent: #0b5fcc; }
:root[data-theme="light"] .pname { color: #111; }
:root[data-theme="light"] .c-title, :root[data-theme="light"] .c-banner { color: #a04a00; }
:root[data-theme="light"] .c-hl { color: #000; }
:root[data-theme="light"] .c-room, :root[data-theme="light"] .roomtext { color: #0b4f9c; }
:root[data-theme="light"] .c-desc, :root[data-theme="light"] .c-say, :root[data-theme="light"] .c-loot, :root[data-theme="light"] .c-common { color: #1f2933; }
:root[data-theme="light"] .c-exits, :root[data-theme="light"] .c-good, :root[data-theme="light"] .c-exit, :root[data-theme="light"] .c-buff, :root[data-theme="light"] .c-heal, :root[data-theme="light"] .c-uncommon { color: #0f7a2b; }
:root[data-theme="light"] .c-mob, :root[data-theme="light"] .c-hurt, :root[data-theme="light"] .c-error, :root[data-theme="light"] .c-hp, :root[data-theme="light"] .c-admin { color: #b3261e; }
:root[data-theme="light"] .c-npc, :root[data-theme="light"] .c-spell, :root[data-theme="light"] .c-epic, :root[data-theme="light"] .c-guild, :root[data-theme="light"] .c-xp { color: #6b3fc4; }
:root[data-theme="light"] .c-player, :root[data-theme="light"] .c-group { color: #0f6b2c; }
:root[data-theme="light"] .c-boss, :root[data-theme="light"] .c-death { color: #a30000; }
:root[data-theme="light"] .c-elite { color: #b34a00; }
:root[data-theme="light"] .c-tell { color: #a3167f; }
:root[data-theme="light"] .c-shout, :root[data-theme="light"] .c-hit, :root[data-theme="light"] .c-gold, :root[data-theme="light"] .c-stamina, :root[data-theme="light"] .c-combat { color: #8a5a00; }
:root[data-theme="light"] .c-chat { color: #00707a; }
:root[data-theme="light"] .c-emote, :root[data-theme="light"] .c-system, :root[data-theme="light"] .c-mana, :root[data-theme="light"] .c-rare { color: #0b5fcc; }
:root[data-theme="light"] .c-miss, :root[data-theme="light"] .c-info, :root[data-theme="light"] .c-dim, :root[data-theme="light"] .c-dmg { color: #5a6472; }
:root[data-theme="light"] .c-debuff { color: #b4236c; }
:root[data-theme="light"] .c-level, :root[data-theme="light"] .c-quest { color: #7a5a00; }
:root[data-theme="light"] .c-legendary { color: #b35900; }
:root[data-theme="light"] .link { border-bottom-color: rgba(31, 41, 51, .4); }
:root[data-theme="light"] #minimap { background: #f3f5f8; }
:root[data-theme="light"] #minimap .mr { fill: #cfd6e2; stroke: #99a4b5; }
:root[data-theme="light"] .menu button:hover { background: #cdd6e6; }
:root[data-theme="light"] .hb .cd { background: rgba(240, 243, 248, .85); color: #111; }

/* ---- high-contrast theme ---- */
:root[data-theme="contrast"] { --bg: #000; --bg2: #0a0a0a; --bg3: #1a1a1a; --line: #8a8a8a; --text: #ffffff; --dim: #c8c8c8; --accent: #4db3ff; }
:root[data-theme="contrast"] .c-miss, :root[data-theme="contrast"] .c-info, :root[data-theme="contrast"] .c-dim, :root[data-theme="contrast"] .c-dmg { color: #d0d0d0; }
:root[data-theme="contrast"] .c-error, :root[data-theme="contrast"] .c-hurt, :root[data-theme="contrast"] .c-mob, :root[data-theme="contrast"] .c-hp { color: #ff8080; }
:root[data-theme="contrast"] .c-good, :root[data-theme="contrast"] .c-exits, :root[data-theme="contrast"] .c-exit, :root[data-theme="contrast"] .c-buff { color: #6dff8c; }
:root[data-theme="contrast"] .c-spell, :root[data-theme="contrast"] .c-npc, :root[data-theme="contrast"] .c-epic { color: #d9b8ff; }
:root[data-theme="contrast"] .c-rare, :root[data-theme="contrast"] .c-mana { color: #7ec0ff; }
:root[data-theme="contrast"] .link { border-bottom-color: #fff; }
:root[data-theme="contrast"] #cmd:focus, :root[data-theme="contrast"] button:focus-visible { outline: 2px solid #ffea00; outline-offset: 1px; }

/* ---- panel buttons and the soft reconnect banner ---- */
.nameBtns { display: flex; gap: 4px; }
#panelToggle ~ #panelBody .nameBtns { margin-right: 36px; }
#panelToggle ~ #panelBody .nameBtns .iconBtn { margin-right: 0; }
#conn.soft { inset: 0 0 auto 0; flex-direction: row; flex-wrap: wrap; padding: 8px 12px; background: rgba(0, 0, 0, .88); font-size: 14px; }
#conn.soft #connSub { flex-basis: 100%; text-align: center; }
#conn.soft button { padding: 5px 12px; }
@media (max-width: 760px) { #panelToggle ~ #panelBody .nameBtns { margin-right: 40px; } }

/* ---- phone usability (batch 1) ---- */
[hidden] { display: none !important; }
#mstrip, #actbar { display: none; }
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  #app { flex-direction: row; }
  #output { font-size: max(14px, var(--fs, 14px)); }
  #mstrip { display: flex; align-items: center; gap: 8px; padding: 4px 8px; padding-top: max(4px, env(safe-area-inset-top));
    background: var(--bg2); border-bottom: 1px solid var(--line); }
  .msBars { display: flex; flex-direction: column; gap: 2px; width: 34%; flex-shrink: 0; }
  .msBar { height: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
  #msRoom { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
  #msMore { min-width: 44px; min-height: 44px; background: var(--bg3); color: var(--text); border: 1px solid var(--line); border-radius: 6px; font-size: 18px; }
  /* the panel becomes an overlay sheet opened from the strip */
  #panel { position: fixed; left: 0; right: 0; top: 0; z-index: 20; max-height: 70vh; max-height: 70dvh; width: 100%;
    border-left: 0; border-bottom: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.6);
    padding-top: max(8px, env(safe-area-inset-top)); }
  #panel.collapsed { display: none; }
  #panelToggle { min-width: 44px; min-height: 44px; }
  #actbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 8px 0; background: var(--bg2); border-top: 1px solid var(--line); }
  #actbar .dpad, #actbar .acts { display: flex; gap: 4px; }
  #actbar .dpad { flex: 1 1 auto; }
  #actbar .acts button { min-width: 52px; }
  #actbar button { flex: 1 1 0; min-width: 40px; min-height: 44px; background: var(--bg3); color: var(--text); border: 1px solid var(--line);
    border-radius: 6px; font: inherit; font-size: 15px; padding: 0 6px; touch-action: manipulation; }
  #actbar button.noexit { opacity: .3; }
  #actbar button.closed { color: var(--dim); font-style: italic; }
  #inputbar { border-top: 0; }
  #send { min-width: 60px; min-height: 44px; }
  .iconBtn, .quick button, .exits button, #searchbar button, #settingsBox button { min-height: 44px; min-width: 44px; }
  #searchIn, .srow select { font-size: 16px; }
  .hb { min-height: 44px; }
  .hb .hk { display: none; }
  #main { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}
/* landscape phones: hide the slim strip's bars spacing a bit and keep the action bar on one row */
@media (max-height: 500px) and (pointer: coarse) {
  #actbar { flex-wrap: nowrap; }
  #actbar button { min-height: 40px; }
}
