/*
 * Icesus Web Client — style.css
 * Copyright (c) 2025 Icesus MUD / Idles (icesus.org). All rights reserved.
 *
 * This software is the proprietary property of Icesus MUD and its authors.
 * Unauthorized copying, modification, distribution, or use of this code,
 * in whole or in part, is strictly prohibited without prior written
 * permission from the copyright holders.
 *
 * Fingerprint: IC-ICESUS-WC-2025-a7f3e9b1d4c8
 */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-deep: #0c0e1a;
  --bg-main: #131629;
  --bg-panel: #1a1e35;
  --bg-input: #0f1225;
  --border: #2a2f4e;
  --border-focus: #4f6ef7;
  --text: #c8cdd8;
  --text-dim: #5e6380;
  --text-bright: #eef0f6;
  --accent: #4f6ef7;
  --accent-glow: rgba(79, 110, 247, 0.15);
  --ice: #7dd3fc;
  --ice-bright: #bae6fd;
  --ice-glow: rgba(125, 211, 252, 0.25);
  --ice-dim: rgba(125, 211, 252, 0.15);
  --green: #3ddc84;
  --red: #f87171;
  --system: #7aa2f7;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a3f5e; }

/* === HUD (top) === */
#hud {
  background: linear-gradient(180deg, #0f1a2e 0%, #0c1424 100%);
  border-bottom: 2px solid #1a3050;
  flex-shrink: 0;
  position: relative;
}
#hud::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--ice-glow), transparent);
}

#header {
  padding: 8px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(125,211,252,0.1);
}
#header h1 {
  font-size: 16px; font-weight: 600; color: var(--ice-bright);
  letter-spacing: 2px; text-shadow: 0 0 14px rgba(125,211,252,0.4);
}
.header-right { display: flex; align-items: center; gap: 16px; }
#status {
  font-size: 11px; font-weight: 500; color: var(--text-dim);
  display: flex; align-items: center; gap: 6px; cursor: pointer;
}
#status::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-dim); display: inline-block;
}
#status.connected { color: var(--green); }
#status.connected::before { background: var(--green); box-shadow: 0 0 8px var(--green); }
#server-info {
  font-size: 10px; color: var(--text-dim); letter-spacing: 0.5px;
}
#latency {
  font-size: 10px; color: var(--text-dim); font-weight: 500;
  letter-spacing: 0.5px;
}
#debug-toggle {
  cursor: pointer; font-size: 11px; color: var(--text-dim);
  transition: color 0.2s; user-select: none;
}
#debug-toggle:hover { color: var(--ice); }

/* Character info — two-line identity block */
#char-row {
  padding: 7px 20px; display: flex; align-items: center; gap: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  justify-content: space-between;
}
#char-info {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
}
#char-name {
  font-size: 15px; font-weight: 700; color: var(--ice-bright);
  letter-spacing: 0.5px;
  text-shadow: 0 0 10px rgba(125,211,252,0.2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#char-meta {
  font-size: 11px; color: #8892a8; display: flex; gap: 6px;
  align-items: center; flex-wrap: wrap; font-weight: 500;
}
#char-meta span { white-space: nowrap; }
#char-meta .char-title { color: #a0aec0; }
#char-meta .char-sep { color: #3a3f5e; font-size: 10px; }
#char-meta .level { color: #5eead4; }
#char-carry {
  display: none; flex-direction: column; gap: 2px;
  flex-shrink: 0; align-items: flex-end;
}
.carry-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; white-space: nowrap; font-weight: 600;
}
.carry-money { color: #fbbf24; position: relative; }
.carry-bank { color: #a08520; font-size: 11px; }
.carry-dfavor { color: #c084fc; position: relative; }
.carry-wt { color: #5eead4; }
.carry-vol { color: #7dd3fc; }
.carry-over { color: #ef4444; font-weight: 700; }
.carry-pct { color: #5a5f78; font-size: 10px; font-weight: 500; }
#char-meta span.combat { color: var(--red); font-weight: 600; }
#char-meta span.cond-bad { color: #f87171; font-weight: 600; }
#char-meta span.cond-drunk { color: #fbbf24; font-style: italic; }

/* Status / Combat row */
#status-row {
  padding: 4px 20px; display: none; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background 0.3s;
}
#effects-row {
  padding: 3px 20px; display: none; align-items: center; gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.effect-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 3px; white-space: nowrap;
  animation: effect-pulse 2s ease-in-out infinite;
}
@keyframes effect-pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}
.effect-death-sickness { color: #a78bfa; background: rgba(167,139,250,0.15); border: 1px solid rgba(167,139,250,0.3); }
.effect-bleeding { color: #f87171; background: rgba(248,113,113,0.15); border: 1px solid rgba(248,113,113,0.3); }
.effect-stunned { color: #fbbf24; background: rgba(251,191,36,0.15); border: 1px solid rgba(251,191,36,0.3); }
.effect-poisoned { color: #4ade80; background: rgba(74,222,128,0.15); border: 1px solid rgba(74,222,128,0.3); }
.effect-burning { color: #fb923c; background: rgba(251,146,60,0.15); border: 1px solid rgba(251,146,60,0.3); }
#status-row.in-combat {
  background: rgba(220,38,38,0.08);
  border-bottom: 1px solid rgba(248,113,113,0.15);
}
#hud.in-combat {
  background: linear-gradient(180deg, #1a0f0f 0%, #140c0c 100%);
  border-bottom-color: #3a1515;
}
#hud.in-combat::after {
  background: linear-gradient(90deg, transparent, rgba(248,113,113,0.3), transparent);
}
#player-state {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;
  padding: 2px 10px; border-radius: 3px; white-space: nowrap;
}
#player-state.idle { display: none; }
#player-state.resting { color: #5eead4; background: rgba(94,234,212,0.1); border: 1px solid rgba(94,234,212,0.2); }
#player-state.sleeping { color: #818cf8; background: rgba(129,140,248,0.1); border: 1px solid rgba(129,140,248,0.2); }
#player-state.meditating { color: #c084fc; background: rgba(192,132,252,0.1); border: 1px solid rgba(192,132,252,0.2); }
#player-state.combat { color: var(--red); background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.25); }

#combat-info { display: none; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; }
#combat-info.active { display: flex; }
.enemy-entry { display: flex; align-items: center; gap: 8px; }
.enemy-name { font-size: 12px; color: #e8c4a0; font-weight: 600; white-space: nowrap; }
.enemy-bar {
  width: 160px; height: 18px; background: #0a0c18;
  border-radius: 3px; overflow: hidden; border: 1px solid rgba(255,255,255,0.08);
  position: relative;
}
.enemy-fill {
  height: 100%; transition: width 0.3s ease; border-radius: 2px;
}
.enemy-fill.excellent { background: linear-gradient(90deg, #166534, #22c55e); }
.enemy-fill.good { background: linear-gradient(90deg, #166534, #4ade80); }
.enemy-fill.slight { background: linear-gradient(90deg, #4d7c0f, #a3e635); }
.enemy-fill.moderate { background: linear-gradient(90deg, #854d0e, #eab308); }
.enemy-fill.notgood { background: linear-gradient(90deg, #854d0e, #d97706); }
.enemy-fill.severe { background: linear-gradient(90deg, #9a3412, #f97316); }
.enemy-fill.bad { background: linear-gradient(90deg, #991b1b, #ef4444); }
.enemy-fill.vbad { background: linear-gradient(90deg, #7f1d1d, #dc2626); }
.enemy-fill.critical { background: linear-gradient(90deg, #7f1d1d, #b91c1c); }
.enemy-shape {
  position: absolute; top: 0; left: 0; right: 0; text-align: center;
  font-size: 10px; font-weight: 700; line-height: 18px;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  white-space: nowrap; pointer-events: none;
}

/* Momentum button */
#momentum-btn {
  display: none;
  background: rgba(251,146,60,0.15);
  border: 1px solid rgba(251,146,60,0.5);
  color: #fb923c;
  padding: 4px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: momentum-pulse 0.8s ease-in-out infinite alternate;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
#momentum-btn:hover {
  background: rgba(251,146,60,0.3);
  border-color: #fb923c;
  color: #fed7aa;
}
#momentum-btn:active { transform: scale(0.95); }
#momentum-btn.visible { display: inline-block; }
#special-momentum-btn {
  display: none;
  background: rgba(192,132,252,0.15);
  border: 1px solid rgba(192,132,252,0.5);
  color: #c084fc;
  padding: 4px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: momentum-pulse 0.8s ease-in-out infinite alternate;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
#special-momentum-btn:hover {
  background: rgba(192,132,252,0.3);
  border-color: #c084fc;
  color: #e9d5ff;
}
#special-momentum-btn:active { transform: scale(0.95); }
#special-momentum-btn.visible { display: inline-block; }
@keyframes momentum-pulse {
  from { box-shadow: 0 0 4px rgba(251,146,60,0.3); }
  to { box-shadow: 0 0 12px rgba(251,146,60,0.6); }
}

/* Exp gain notification */
.exp-gain {
  position: absolute; right: -4px; top: -2px;
  font-size: 12px; font-weight: 700; color: #fde047;
  text-shadow: 0 0 6px rgba(253,224,71,0.6), 0 1px 2px rgba(0,0,0,0.8);
  white-space: nowrap; pointer-events: none;
  animation: exp-float 2s ease-out forwards;
  z-index: 10;
}
.exp-gain.loss { color: #f87171; text-shadow: 0 0 6px rgba(248,113,113,0.6), 0 1px 2px rgba(0,0,0,0.8); }
@keyframes exp-float {
  0% { opacity: 1; transform: translateY(0); }
  70% { opacity: 1; transform: translateY(-18px); }
  100% { opacity: 0; transform: translateY(-28px); }
}
#gauge-exp { position: relative; }
#gauge-hp { position: relative; }
#gauge-mana { position: relative; }
#gauge-moves { position: relative; }

/* Vital delta notifications (damage/healing) */
.vital-delta {
  position: absolute; right: -4px; top: -2px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap; pointer-events: none;
  z-index: 10;
  animation: vital-float 1.6s ease-out forwards;
}
.vital-delta.damage {
  color: #f87171;
  text-shadow: 0 0 6px rgba(248,113,113,0.6), 0 1px 2px rgba(0,0,0,0.8);
}
.vital-delta.heal {
  color: #4ade80;
  text-shadow: 0 0 6px rgba(74,222,128,0.6), 0 1px 2px rgba(0,0,0,0.8);
}
@keyframes vital-float {
  0% { opacity: 1; transform: translateY(0); }
  60% { opacity: 1; transform: translateY(-14px); }
  100% { opacity: 0; transform: translateY(-22px); }
}
.party-vital-delta {
  position: absolute; right: 0; top: -10px;
  font-size: 9px; font-weight: 700;
  white-space: nowrap; pointer-events: none;
  z-index: 10;
  animation: party-vital-float 1.6s ease-out forwards;
}
.party-vital-delta.damage {
  color: #f87171;
  text-shadow: 0 0 4px rgba(248,113,113,0.6), 0 1px 1px rgba(0,0,0,0.8);
}
.party-vital-delta.heal {
  color: #4ade80;
  text-shadow: 0 0 4px rgba(74,222,128,0.6), 0 1px 1px rgba(0,0,0,0.8);
}
@keyframes party-vital-float {
  0% { opacity: 1; transform: translateY(0); }
  60% { opacity: 1; transform: translateY(-10px); }
  100% { opacity: 0; transform: translateY(-16px); }
}

/* Money / Divine Favor gain/loss floats */
.carry-delta {
  position: absolute; right: -4px; top: -2px;
  font-size: 12px; font-weight: 700;
  white-space: nowrap; pointer-events: none;
  z-index: 10;
  animation: carry-float 2.1s ease-out forwards;
}
.carry-delta.gain {
  color: #fde047;
  text-shadow: 0 0 6px rgba(253,224,71,0.6), 0 1px 2px rgba(0,0,0,0.8);
}
.carry-delta.loss {
  color: #f87171;
  text-shadow: 0 0 6px rgba(248,113,113,0.6), 0 1px 2px rgba(0,0,0,0.8);
}
.carry-delta.df-gain {
  color: #d8b4fe;
  text-shadow: 0 0 6px rgba(192,132,252,0.6), 0 1px 2px rgba(0,0,0,0.8);
}
@keyframes carry-float {
  0% { opacity: 1; transform: translateY(0); }
  70% { opacity: 1; transform: translateY(-18px); }
  100% { opacity: 0; transform: translateY(-28px); }
}

/* Party HUD */
#party-row {
  padding: 4px 20px; display: none; flex-direction: column; gap: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
#party-row.visible { display: flex; }
#party-label {
  font-size: 9px; font-weight: 600; color: #5a5f78;
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 1px;
}
#party-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, auto);
  gap: 2px; width: 100%;
}
.party-cell {
  min-height: 20px; padding: 2px 4px; border-radius: 2px;
  background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.04);
}
.party-cell.empty { border-color: transparent; background: transparent; }
.party-cell.is-self { border-color: rgba(94,234,212,0.25); background: rgba(94,234,212,0.05); }
.party-cell.is-self .party-cell-name { color: #5eead4; }
.party-cell.is-leader { border-color: rgba(125,211,252,0.2); background: rgba(125,211,252,0.04); }
.party-cell.is-dead { opacity: 0.4; }
.party-cell.is-ld { opacity: 0.5; border-style: dashed; }
.party-cell-top {
  display: flex; align-items: center; gap: 4px; margin-bottom: 1px;
}
.party-cell-name {
  font-size: 10px; font-weight: 600; color: #b8c4e0; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.party-cell.is-leader .party-cell-name { color: var(--ice-bright); }
.party-cell-status { font-size: 8px; font-weight: 400; color: #f87171; font-style: italic; }
.party-cell-flags {
  font-size: 8px; color: #fbbf24; font-weight: 600; flex-shrink: 0;
}
.party-cell-role {
  font-size: 8px; color: #5e6380; text-transform: uppercase; flex-shrink: 0;
  font-weight: 600; padding: 0 2px; border-radius: 2px;
}
.party-cell.is-leader .party-cell-role { color: var(--ice); }
.party-cell-role.role-fol { color: #4ade80; }
.party-cell-role.role-vic { color: #fbbf24; }
.party-cell-role.role-flk { color: #fb923c; }
.party-cell-role.role-ld { color: #6b7280; }
.party-cell-role.role-rip { color: #f87171; }
.party-cell-bars { display: flex; gap: 2px; }
.party-mini-bar {
  flex: 1; height: 6px; background: #0a0c18; border-radius: 1px;
  overflow: hidden; position: relative;
}
.party-mini-fill {
  height: 100%; border-radius: 1px; transition: width 0.3s ease;
}
.party-mini-fill.hp { background: linear-gradient(90deg, #8b1a1a, #dc2626); }
.party-mini-fill.sp { background: linear-gradient(90deg, #1a3a8b, #3b82f6); }
.party-mini-fill.ep { background: linear-gradient(90deg, #8b6914, #d97706); }
.party-unplaced {
  display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px;
  padding-top: 4px; border-top: 1px solid rgba(255,255,255,0.05);
}
.party-unplaced-tag {
  font-size: 10px; color: #fbbf24; padding: 2px 8px; font-weight: 600;
  background: rgba(251,191,36,0.08); border: 1px solid rgba(251,191,36,0.2);
  border-radius: 3px;
}

/* XP gauge (top bar — inline: label | bar | values) */
#exp-gauge-row {
  padding: 4px 20px 6px; display: flex; align-items: center; gap: 10px;
}
#exp-gauge-row .gauge-wide { flex: 1; max-width: 684px; min-width: 200px; }
.exp-label {
  font-size: 10px; font-weight: 700; color: #8892a8; text-transform: uppercase;
  letter-spacing: 1px; white-space: nowrap;
}
.exp-values {
  font-size: 10px; font-weight: 600; color: #a0aec0; white-space: nowrap;
}
.gauge-bar-tall { height: 20px; }
.gauge-text-tall { font-size: 10px; line-height: 20px; }

/* Vitals (HP/SP/EP — bottom bar) */
#vitals {
  padding: 5px 20px; display: flex; gap: 12px; align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.gauge { flex: 1; max-width: 220px; min-width: 100px; }
.gauge-label {
  font-size: 9px; font-weight: 600; color: #8892a8; margin-bottom: 2px;
  display: flex; justify-content: space-between;
  text-transform: uppercase; letter-spacing: 1px;
}
.gauge-bar {
  height: 18px; background: #0a0c18; border-radius: 3px; overflow: hidden;
  position: relative; border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
}
.gauge-fill {
  height: 100%; transition: width 0.4s ease; border-radius: 2px; position: relative;
}
.gauge-fill::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.15), transparent);
  border-radius: 2px 2px 0 0;
}
.gauge-fill.hp { background: linear-gradient(90deg, #8b1a1a, #dc2626); box-shadow: 0 0 8px rgba(220,38,38,0.3); transition: all 0.3s; }
.gauge-fill.hp.critical { background: linear-gradient(90deg, #7f1d1d, #b91c1c); box-shadow: 0 0 12px rgba(239,68,68,0.5), 0 0 20px rgba(239,68,68,0.2); animation: hp-pulse 1.5s ease-in-out infinite; }
@keyframes hp-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }
.gauge-fill.mana { background: linear-gradient(90deg, #1a3a8b, #3b82f6); box-shadow: 0 0 8px rgba(59,130,246,0.3); }
.gauge-fill.moves { background: linear-gradient(90deg, #8b6914, #d97706); box-shadow: 0 0 8px rgba(217,119,6,0.3); }
.gauge-fill.exp { background: linear-gradient(90deg, #166534, #22c55e); box-shadow: 0 0 8px rgba(34,197,94,0.3); }
.gauge-text {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  font-size: 10px; font-weight: 600; line-height: 18px;
  color: white; text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* === Main output === */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }
#output {
  flex: 1; overflow-y: auto; padding: 10px 20px;
  font-size: 14px; line-height: 1.4;
  white-space: pre-wrap; word-wrap: break-word;
  background: var(--bg-main);
}
#output div { padding: 0; }
#output .system { color: var(--system); font-style: italic; }
#output .error { color: var(--red); }
#output .ansi-bold { font-weight: 600; }
#output .ansi-dim { opacity: 0.6; }
#output .ansi-red { color: #f87171; }
#output .ansi-green { color: #4ade80; }
#output .ansi-yellow { color: #fbbf24; }
#output .ansi-blue { color: #60a5fa; }
#output .ansi-magenta { color: #c084fc; }
#output .ansi-cyan { color: #22d3ee; }
#output .ansi-white { color: #f1f5f9; }
#output .ansi-bright-red { color: #fca5a5; }
#output .ansi-bright-green { color: #86efac; }
#output .ansi-bright-yellow { color: #fde68a; }
#output .ansi-bright-blue { color: #93c5fd; }
#output .ansi-bright-magenta { color: #d8b4fe; }
#output .ansi-bright-cyan { color: #67e8f9; }
#output .ansi-bright-white { color: #ffffff; }

/* URL links in output */
#output a.url-link {
  color: var(--ice);
  text-decoration: underline;
  text-decoration-color: rgba(125,211,252,0.4);
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color 0.15s, text-decoration-color 0.15s;
}
#output a.url-link:hover {
  color: var(--ice-bright);
  text-decoration-color: var(--ice-bright);
}
#output a.url-link:visited { color: #a78bfa; text-decoration-color: rgba(167,139,250,0.4); }

/* Scroll to bottom button */
#scroll-bottom-btn {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(26,30,53,0.95);
  border: 1px solid var(--ice-dim);
  color: var(--ice);
  padding: 5px 14px;
  border-radius: 16px;
  cursor: pointer;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  font-weight: 600;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  transition: background 0.15s, border-color 0.15s;
}
#scroll-bottom-btn:hover {
  background: rgba(26,30,53,1);
  border-color: var(--ice);
  box-shadow: 0 4px 16px rgba(125,211,252,0.2);
}
#scroll-bottom-btn .scroll-arrow { font-size: 10px; }
#scroll-bottom-btn .scroll-count { color: var(--text-dim); font-size: 10px; }

/* GMCP Debug */
#gmcp-debug {
  background: var(--bg-deep); border-top: 1px solid var(--border);
  max-height: 150px; overflow-y: auto; padding: 6px 20px;
  font-size: 11px; color: #7c3aed; display: none;
}
#gmcp-debug.visible { display: block; }

/* === Casting bar === */
#casting-row {
  padding: 5px 20px;
  display: none;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(192,132,252,0.15);
  background: rgba(192,132,252,0.04);
}
#casting-row.visible { display: flex; }
#cast-spell-name {
  font-size: 11px;
  font-weight: 700;
  color: #e9d5ff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(192,132,252,0.4);
}
#cast-bar {
  flex: 1;
  max-width: 300px;
  min-width: 120px;
  height: 18px;
  background: #0a0c18;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(192,132,252,0.2);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
}
#cast-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #6b21a8, #a855f7, #c084fc);
  box-shadow: 0 0 10px rgba(168,85,247,0.4);
  transition: width 1.8s linear;
  position: relative;
}
#cast-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.2), transparent);
  border-radius: 2px 2px 0 0;
}
#cast-fill.complete {
  background: linear-gradient(90deg, #16a34a, #4ade80, #86efac);
  box-shadow: 0 0 14px rgba(74,222,128,0.6);
  transition: width 0.15s ease-out;
}
@keyframes cast-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
#casting-row.visible #cast-fill:not(.complete):not(.busy-pulse) {
  background: linear-gradient(90deg, #6b21a8, #a855f7 30%, #d8b4fe 50%, #a855f7 70%, #c084fc);
  background-size: 200% 100%;
  animation: cast-shimmer 2s linear infinite;
}
@keyframes busy-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1.0; }
}
#cast-fill.busy-pulse {
  background: linear-gradient(90deg, #b45309, #f59e0b 30%, #fcd34d 50%, #f59e0b 70%, #d97706);
  background-size: 200% 100%;
  animation: cast-shimmer 2s linear infinite, busy-pulse 1.5s ease-in-out infinite;
}
#cast-pct {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  line-height: 18px;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
#cast-cps {
  font-size: 10px;
  color: #a78bfa;
  white-space: nowrap;
  font-weight: 500;
}

/* === Bottom bar: exits + input === */
#bottom-bar {
  background: linear-gradient(0deg, #0f1a2e 0%, #0c1424 100%);
  border-top: 2px solid #1a3050;
  flex-shrink: 0;
  position: relative;
}
#bottom-bar::before {
  content: ''; position: absolute; top: -2px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--ice-glow), transparent);
}

#combat-row {
  padding: 6px 20px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(220,38,38,0.06); flex-wrap: wrap;
}
#combat-label {
  font-size: 11px; font-weight: 700; color: var(--red); text-transform: uppercase;
  letter-spacing: 1px; white-space: nowrap;
  border: 1px solid var(--red); padding: 3px 10px;
}
#location-bar {
  padding: 4px 20px; display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
#location-bar.hidden { display: none; }
#room-name {
  font-size: 12px; font-weight: 600; color: var(--ice-bright);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 0 6px rgba(125,211,252,0.2);
}
#room-area {
  font-size: 12px; color: #5e6380; white-space: nowrap; font-style: italic;
}
#room-safe {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px;
  color: #5eead4; background: rgba(94,234,212,0.1); border: 1px solid rgba(94,234,212,0.2);
  padding: 1px 8px; border-radius: 3px; white-space: nowrap; display: none;
}
#room-safe.inn {
  color: #4ade80; background: rgba(74,222,128,0.15); border-color: rgba(74,222,128,0.3);
}
#exits-bar {
  padding: 4px 20px; display: flex; align-items: center; gap: 5px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
#exits-bar.hidden { display: none; }
#exits-label {
  font-size: 11px; font-weight: 600; color: #5a5f78;
  text-transform: uppercase; letter-spacing: 1px; margin-right: 4px;
}
.exit-btn {
  background: rgba(10,12,24,0.6);
  border: 1px solid var(--ice-dim);
  color: var(--ice); padding: 5px 14px; border-radius: 3px;
  cursor: pointer;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 13px; font-weight: 600; text-transform: lowercase;
  transition: all 0.15s; white-space: nowrap;
}
.exit-btn:hover {
  background: var(--ice-dim); color: var(--ice-bright);
  border-color: rgba(125,211,252,0.5); box-shadow: 0 0 6px var(--ice-glow);
}
.exit-btn:active { transform: scale(0.95); }
.exit-btn.cardinal { color: #5eead4; border-color: rgba(94,234,212,0.2); }
.exit-btn.cardinal:hover {
  background: rgba(94,234,212,0.12); color: #5eead4;
  border-color: rgba(94,234,212,0.5); box-shadow: 0 0 6px rgba(94,234,212,0.2);
}
.exit-btn.vertical { color: #c084fc; border-color: rgba(192,132,252,0.2); }
.exit-btn.vertical:hover {
  background: rgba(192,132,252,0.12); color: #c084fc;
  border-color: rgba(192,132,252,0.5); box-shadow: 0 0 6px rgba(192,132,252,0.2);
}

#input-area {
  padding: 8px 20px; display: flex; gap: 10px;
}
#input {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-bright); padding: 10px 14px;
  font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 14px;
  outline: none; border-radius: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
#input::placeholder { color: var(--text-dim); }
#send-btn {
  background: var(--accent); color: white; border: none;
  padding: 10px 20px; border-radius: 6px; cursor: pointer;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 13px; font-weight: 600; letter-spacing: 0.5px;
  transition: background 0.2s, transform 0.1s;
}
#send-btn:hover { background: #6382f9; }
#send-btn:active { transform: scale(0.97); }
.send-icon { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.send-short { display: none; }
@media (max-width: 640px) {
  .send-full { display: none; }
  .send-short { display: inline; }
}
#reconnect-btn {
  display: none; background: var(--ice); color: #0c0e1a; border: none;
  padding: 10px 20px; border-radius: 6px; cursor: pointer;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 13px; font-weight: 600; letter-spacing: 0.5px;
  transition: background 0.2s, transform 0.1s;
}
#reconnect-btn:hover { background: var(--ice-bright); }
#reconnect-btn:active { transform: scale(0.97); }
#reconnect-btn.visible { display: block; }

/* Mobile D-pad */
#mobile-dpad {
  display: none;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
#mobile-dpad .dpad-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 3px;
  max-width: 280px;
  margin: 0 auto;
}
#mobile-dpad .dpad-btn {
  background: rgba(10,12,24,0.6);
  border: 1px solid var(--ice-dim);
  color: var(--ice);
  padding: 6px 0;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
#mobile-dpad .dpad-btn:active {
  background: var(--ice-dim);
  color: var(--ice-bright);
}
#mobile-dpad .dpad-btn.empty {
  visibility: hidden;
}
#mobile-dpad .dpad-btn.look {
  color: #5eead4;
  border-color: rgba(94,234,212,0.2);
}
#mobile-dpad .dpad-btn.vert {
  color: #c084fc;
  border-color: rgba(192,132,252,0.2);
}
#special-exits {
  display: none;
  padding: 3px 8px;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
}
#special-exits .exit-btn {
  padding: 4px 10px;
  font-size: 10px;
}

/* Responsive */
@media (max-width: 640px) {
  #header { padding: 2px 8px; }
  #header h1 { font-size: 11px; letter-spacing: 1px; }
  #char-row { padding: 2px 8px; gap: 6px; }
  #char-name { font-size: 11px; }
  #char-meta { font-size: 9px; gap: 3px; }
  .carry-row { font-size: 9px; gap: 4px; }
  #status-row { padding: 2px 8px; gap: 6px; }
  #party-row { padding: 2px 8px; gap: 2px; }
  .party-cell-name { font-size: 8px; }
  .party-mini-bar { height: 3px; }
  #exp-gauge-row { padding: 2px 8px; }
  .gauge-bar-tall { height: 14px; }
  .gauge-text-tall { font-size: 9px; line-height: 14px; }
  #vitals { flex-wrap: wrap; gap: 3px; padding: 3px 8px; }
  #vitals .gauge { max-width: none; min-width: 50px; flex: 1 1 30%; }
  .gauge-label { font-size: 7px; }
  .gauge-bar { height: 12px; }
  .gauge-text { font-size: 8px; line-height: 12px; }
  #room-name { max-width: 160px; font-size: 10px; }
  #location-bar { padding: 2px 8px; }
  #exits-bar { display: none !important; }
  .exit-btn { padding: 2px 7px; font-size: 10px; }
  #special-exits { display: flex; }
  #output { padding: 4px 6px; font-size: 10px; line-height: 1.25; }
  #mobile-dpad { display: block; }
  #input-area { padding: 3px 6px; gap: 4px; }
  #input { padding: 6px 8px; font-size: 12px; }
  #send-btn { padding: 6px 10px; font-size: 12px; font-weight: 700; min-width: 32px; }
  #reconnect-btn { padding: 8px 12px; font-size: 12px; }
  .enemy-bar { width: 100px; height: 16px; }
  .enemy-name { font-size: 10px; }
  .enemy-shape { font-size: 9px; line-height: 16px; }
  #combat-info { gap: 4px; }
  .enemy-entry { gap: 4px; }
  #debug-toggle { display: none; }
  #gmcp-debug { font-size: 9px; }
  #casting-row { padding: 4px 10px; gap: 6px; }
  #cast-spell-name { font-size: 10px; }
  #cast-bar { height: 14px; }
  #cast-pct { font-size: 9px; line-height: 14px; }
}
/* === Hotkey Bar === */
#hotkey-bar {
  display: none; align-items: center; gap: 4px;
  padding: 4px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
#hotkey-bar.visible { display: flex; }
#hotkey-buttons { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.hotkey-btn {
  background: rgba(10,12,24,0.6);
  border: 1px solid rgba(79,110,247,0.25);
  color: var(--text);
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 10px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.hotkey-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--text-bright);
}
.hotkey-btn:active { transform: scale(0.95); }
.hotkey-btn .hk-label {
  color: var(--accent);
  font-weight: 700;
  margin-right: 4px;
  font-size: 9px;
}
.hotkey-btn .hk-cmd {
  color: var(--text);
}
.hotkey-btn.hk-empty .hk-cmd {
  color: var(--text-dim);
  font-style: italic;
}
#hotkey-edit-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-dim);
  padding: 3px 6px;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 10px;
  transition: color 0.2s;
}
#hotkey-edit-btn:hover { color: var(--ice); border-color: var(--ice-dim); }

/* Hotkey edit modal */
#hotkey-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
#hotkey-modal.visible { display: flex; }
#hotkey-modal-inner {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  position: relative;
}
#hk-close-x {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--dim);
  font-size: 20px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}
#hk-close-x:hover { color: #ff6666; }
#hotkey-modal h2 {
  font-size: 14px;
  color: var(--ice-bright);
  margin-bottom: 14px;
  font-weight: 600;
  letter-spacing: 1px;
}
.hk-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.hk-edit-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  width: 28px;
  flex-shrink: 0;
}
.hk-edit-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-bright);
  padding: 6px 10px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  border-radius: 4px;
  outline: none;
}
.hk-edit-input:focus {
  border-color: var(--border-focus);
}
#hotkey-modal-btns {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  justify-content: flex-end;
}
#hotkey-modal-btns button {
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  font-weight: 600;
  border: none;
}
#hk-save-btn {
  background: var(--accent);
  color: white;
}
#hk-save-btn:hover { background: #6382f9; }
#hk-cancel-btn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border) !important;
}
#hk-cancel-btn:hover { color: var(--text); }
#hk-add-btn {
  background: transparent;
  color: var(--green);
  border: 1px solid rgba(61,220,132,0.3) !important;
  margin-right: auto;
}
#hk-add-btn:hover { background: rgba(61,220,132,0.1); }
.hk-remove-btn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 14px; padding: 0 4px; line-height: 1;
}
.hk-remove-btn:hover { color: var(--red); }

/* Tooltips toggle in modal */
#hk-tips-toggle {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#hk-tips-toggle label {
  font-size: 11px; color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; gap: 6px; user-select: none;
}
#hk-tips-toggle input[type="checkbox"] {
  accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer;
}

/* Newbie tooltips */
.ic-tooltip {
  position: fixed;
  z-index: 2000;
  background: #1e2340;
  color: #c8cdd8;
  border: 1px solid rgba(125,211,252,0.25);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.5;
  max-width: 320px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.ic-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 640px) {
  #hotkey-bar { padding: 3px 10px; gap: 3px; flex-wrap: wrap; }
  .hotkey-btn { padding: 3px 6px; font-size: 9px; max-width: 100px; }
  .hotkey-btn .hk-label { font-size: 8px; }
  #hotkey-modal-inner { padding: 14px; width: 320px; }
  .ic-tooltip { max-width: 260px; font-size: 10px; }
}
