:root {
  --bg: #0f1220;
  --panel: #171b2f;
  --soft: #222844;
  --text: #e8ecff;
  --muted: #99a3d1;
  --accent: #77d0ff;
  --success: #72e2a1;
  --warn: #ffd479;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: radial-gradient(circle at top, #1b2040, var(--bg));
  color: var(--text);
}
.app { max-width: 1600px; margin: 0 auto; padding: 20px; }

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
h1 { margin: 0; font-size: 2rem; }
.sub { color: var(--muted); margin: 4px 0 0; font-size: 0.85rem; }
.header-right { display: flex; align-items: center; gap: 12px; }
.badge { padding: 8px 14px; background: var(--soft); border-radius: 999px; color: var(--accent); font-size: 0.88rem; }

/* ── Base panel ──────────────────────────────────────────────────────────── */
.panel {
  background: rgba(23, 27, 47, 0.92);
  border: 1px solid rgba(119, 208, 255, 0.14);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* ── Auth ────────────────────────────────────────────────────────────────── */
.auth-panel { margin-bottom: 16px; }
.auth-panel a { color: var(--muted); text-decoration: underline; }
.auth-panel a:hover { color: var(--text); }
#resetMsg { margin-top: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
input, select, button {
  border: 1px solid rgba(255,255,255,0.12);
  background: #0e1328;
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
}
input, select { flex: 1; min-width: 180px; }
button { cursor: pointer; background: linear-gradient(180deg, #1b7db0, #125879); }
button.secondary { background: linear-gradient(180deg, #414971, #2b3354); }
button:hover { filter: brightness(1.1); }
button:disabled { cursor: default; filter: none; opacity: 0.6; }
button.small { padding: 6px 12px; font-size: 0.85rem; }
.hint, .meta, .muted { color: var(--muted); font-size: 0.88rem; }
.hidden { display: none !important; }

/* ── Game grid ───────────────────────────────────────────────────────────── */
.game {
  display: grid;
  grid-template-columns: 290px 1fr 310px;
  gap: 14px;
  align-items: start;
}
.side-col { display: flex; flex-direction: column; gap: 12px; }
.center-col { display: flex; flex-direction: column; gap: 12px; }

/* ── Float / collapsible panels ──────────────────────────────────────────── */
.float-panel { padding: 0; overflow: hidden; }

.panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: none;
  border: none;
  border-radius: 18px 18px 0 0;
  cursor: pointer;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.panel-toggle:hover { background: rgba(119,208,255,0.05); filter: none; }

.panel-title { color: var(--accent); }
.toggle-icon { color: var(--muted); font-size: 0.75rem; transition: transform 0.22s ease; }
.float-panel.collapsed .toggle-icon { transform: rotate(-90deg); }

.panel-body { padding: 4px 14px 14px; }
.float-panel.collapsed .panel-body { display: none; }

/* ── Room (center) ───────────────────────────────────────────────────────── */
.room-image {
  width: 100%;
  height: 260px;
  border-radius: 16px;
  background-color: var(--soft);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.4s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}
.room-info { padding: 14px 18px; }
.room-info h2 { margin: 0 0 6px; font-size: 1.2rem; }
.room-info p { margin: 0 0 8px; color: var(--muted); line-height: 1.55; font-size: 0.9rem; }

/* ── Map ─────────────────────────────────────────────────────────────────── */
.map-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.map-arrow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  background: rgba(119, 208, 255, 0.18);
  border: 2px solid rgba(119, 208, 255, 0.55);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  min-height: unset;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: background 0.15s, transform 0.1s;
}
.map-arrow:hover {
  background: rgba(119, 208, 255, 0.38);
  transform: translate(-50%, -50%) scale(1.12);
  filter: none;
}
.map-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.07);
  background: #10162d;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 3px;
  min-height: 50px;
}
.map-cell .icon { font-size: 0.9rem; line-height: 1; }
.map-cell .label { font-size: 0.58rem; color: var(--text); margin-top: 3px; }
.map-cell.void { background: #0a0f20; border-style: dashed; opacity: 0.45; }
.map-cell.unknown { background: linear-gradient(180deg, #2e3448, #24293d); color: #c4cae4; }
.map-cell.current { background: linear-gradient(180deg, #2d6f8e, #17455f); border-color: rgba(119, 208, 255, 0.5); }
.map-cell.theme-forest  { background: linear-gradient(180deg, #1d4738, #123327); }
.map-cell.theme-town    { background: linear-gradient(180deg, #4b4267, #302946); }
.map-cell.theme-inn     { background: linear-gradient(180deg, #6b4a2e, #473019); }
.map-cell.theme-gate    { background: linear-gradient(180deg, #4e5c70, #334050); }
.map-cell.theme-shrine  { background: linear-gradient(180deg, #5b4772, #3a2b4b); }
.map-cell.theme-forge   { background: linear-gradient(180deg, #6b3e2c, #4a271b); }
.map-cell.theme-camp    { background: linear-gradient(180deg, #6a5420, #46370d); }
.map-cell.theme-road    { background: linear-gradient(180deg, #54565a, #393b3f); }
.map-cell.theme-plain   { background: linear-gradient(180deg, #34415d, #222b3f); }
.map-cell.theme-dungeon  { background: linear-gradient(180deg, #2a1a2e, #1a1020); border-color: rgba(180, 80, 220, 0.35); }
.map-cell.theme-mountain { background: linear-gradient(180deg, #4a4e5a, #2e3240); border-color: rgba(180, 190, 210, 0.35); }
.map-cell.theme-harbor   { background: linear-gradient(180deg, #1a3f5c, #0f2a3f); border-color: rgba(80, 160, 220, 0.35); }

/* ── Status: portrait ────────────────────────────────────────────────────── */
.stat-portrait-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}
.stat-portrait {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(119,208,255,0.4);
  box-shadow: 0 4px 18px rgba(0,0,0,0.45);
}
.stat-portrait-fallback {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--soft);
  border: 2px solid rgba(119,208,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: bold;
  color: var(--accent);
}
.stat-grid { display: grid; gap: 6px; }
.card {
  background: rgba(14,19,40,0.7);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.87rem;
  line-height: 1.4;
}

/* ── Equipment slots ─────────────────────────────────────────────────────── */
.equip-section { margin-top: 10px; }
.equip-divider {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 8px;
  margin-bottom: 6px;
}
.equip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 0.83rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.equip-row:last-child { border-bottom: none; }
.equip-slot-label {
  color: var(--muted);
  font-size: 0.78rem;
  min-width: 72px;
  flex-shrink: 0;
}
.equip-slot-item {
  color: var(--fg);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.equip-slot-item.empty { color: rgba(255,255,255,0.2); font-style: italic; }

/* ── Reputation (Ansehen) ────────────────────────────────────────────────── */
.rep-section { margin-top: 10px; }
.rep-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  font-size: 0.78rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.rep-row:last-child { border-bottom: none; }
.rep-faction { color: var(--muted); min-width: 80px; flex-shrink: 0; }
.rep-value { font-size: 0.75rem; font-weight: 600; }
.rep-tier-verhasst     { color: #c0392b; }
.rep-tier-feindlich    { color: #e74c3c; }
.rep-tier-misstrauisch { color: #e67e22; }
.rep-tier-neutral      { color: var(--muted); }
.rep-tier-freundlich   { color: #2ecc71; }
.rep-tier-angesehen    { color: #27ae60; }
.rep-tier-beruehmt     { color: #f1c40f; }

/* ── Inventory ───────────────────────────────────────────────────────────── */
.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 7px;
}
.inv-slot {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  background: #0e1328;
  border: 1px solid rgba(255,255,255,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: default;
  transition: border-color 0.15s;
}
.inv-slot:hover { border-color: rgba(119,208,255,0.5); }
.inv-slot.equipped { border-color: rgba(255,200,60,0.7); box-shadow: 0 0 6px rgba(255,200,60,0.25); }
.inv-slot img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.inv-slot .inv-emoji { font-size: 1.7rem; line-height: 1; }
.inv-count {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(119,208,255,0.9);
  color: #0f1220;
  border-radius: 999px;
  min-width: 17px;
  height: 17px;
  font-size: 0.62rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.empty-note { color: var(--muted); font-size: 0.9rem; }

/* ── Log ─────────────────────────────────────────────────────────────────── */
.log-panel-body { display: flex; flex-direction: column; gap: 8px; }
.log {
  height: 320px;
  overflow-y: auto;
  background: #0b1022;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.07);
  white-space: pre-wrap;
  font-size: 0.875rem;
  line-height: 1.45;
}
.log-entry { margin-bottom: 8px; }
.log-entry.system { color: var(--accent); }
.log-entry.chat   { color: var(--success); }
.log-entry.room   { color: var(--warn); }
.command-row { display: flex; gap: 8px; }
.command-row input { flex: 1; }
.command-row button { min-width: 44px; padding: 10px; }

/* ── Map + Actions row ───────────────────────────────────────────────────── */
.map-actions-row {
  display: flex;
  gap: 10px;
  align-items: start;
}
.map-actions-row #mapPanel { flex: 1; min-width: 0; }
.map-actions-row #actionsPanel { width: 176px; flex-shrink: 0; }

/* ── Actions ─────────────────────────────────────────────────────────────── */
.action-sections { display: grid; gap: 6px; margin-top: 6px; }
.action-group { display: grid; gap: 3px; }
.action-group h4 { margin: 2px 0 0; color: var(--accent); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 5px; }
.guild-section-icon { width: 14px; height: 14px; object-fit: contain; }
.guild-rank-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(114,226,161,0.1);
  border: 1px solid rgba(114,226,161,0.25);
  border-radius: 20px;
  padding: 2px 10px;
  margin-bottom: 8px;
}
.guild-action-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.guild-btn-icon { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }
.guild-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.guild-action-btn:hover { background: rgba(255,255,255,0.13); border-color: var(--accent); }
.guild-action-btn:active { background: rgba(255,255,255,0.2); }
.action-icon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; }
.action-icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 5px 3px;
  min-height: 42px;
  aspect-ratio: 1;
  width: 100%;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
}
.action-btn-icon { font-size: 1.05rem; line-height: 1; }
.action-btn-label {
  font-size: 0.6rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  display: block;
  opacity: 0.85;
}
/* Portrait-style action button (Talk/Sprechen) */
.action-portrait-btn {
  background-size: cover;
  background-position: center top;
  position: relative;
  min-height: unset;
  aspect-ratio: 1;
  width: 100%;
  padding: 0;
  overflow: hidden;
}
.action-portrait-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
}
.action-portrait-overlay {
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: 0.85rem;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
}

/* Quick actions (Schnell-Bereich) */
.quick-icon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; }

/* ── Notice ──────────────────────────────────────────────────────────────── */
.notice-card {
  background: rgba(255, 212, 121, 0.08);
  border: 1px solid rgba(255, 212, 121, 0.22);
  border-radius: 10px;
  padding: 10px;
  color: var(--warn);
  font-size: 0.85rem;
}

/* ── Combat Modal ────────────────────────────────────────────────────────── */
.combat-modal {
  position: fixed;
  inset: 0;
  z-index: 998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(3px);
}
.combat-modal.hidden { display: none !important; }
.combat-dialog {
  position: relative;
  background: var(--panel);
  border: 1px solid rgba(255,80,80,0.32);
  border-radius: 18px;
  padding: 20px;
  width: min(660px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(160,0,0,0.35);
}
.combat-header {
  font-size: 1.1rem;
  font-weight: bold;
  color: #ff6b6b;
  text-align: center;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.combat-player-hp { margin-bottom: 12px; }
.combat-player-hp-inner { display: flex; align-items: center; gap: 8px; background: rgba(76,175,80,0.08); border: 1px solid rgba(76,175,80,0.25); border-radius: 8px; padding: 6px 10px; }
.combat-player-name { font-size: 0.85rem; font-weight: bold; color: #ccc; white-space: nowrap; }
.combat-player-bar.hp-bar-wrap { height: 14px; }
.combat-player-hp-text { font-size: 0.85rem; font-weight: bold; color: #eee; white-space: nowrap; min-width: 70px; text-align: right; }
.combat-monsters { display: grid; gap: 8px; margin-bottom: 16px; }
.monster-card {
  background: #0e1328;
  border: 1px solid rgba(255,80,80,0.18);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.monster-card-clickable {
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.monster-card-clickable:hover { background: #161d38; border-color: rgba(255,80,80,0.55); }
.monster-card-clickable:active { background: #1e2545; }
.monster-portrait-wrap {
  position: relative;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
}
.monster-portrait {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255,80,80,0.25);
  display: block;
}
.monster-attack-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(0,0,0,0.45);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.monster-card-clickable:hover .monster-attack-overlay { opacity: 1; }
.monster-info { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.monster-name { font-weight: bold; }
.hp-bar-wrap { flex: 1; height: 10px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; }
.hp-bar-fill { height: 100%; background: linear-gradient(90deg, #c0392b, #ff6b6b); border-radius: 999px; transition: width 0.35s ease; }
.hp-text { font-size: 0.8rem; color: var(--muted); min-width: 72px; text-align: right; }
.combat-actions { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 14px; }
.combat-section h4 { margin: 0 0 8px; color: var(--accent); font-size: 0.9rem; }
/* ── Combat Allies ── */
.combat-allies {
  display: flex;
  gap: 10px;
  padding: 10px 0 6px;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin-bottom: 10px;
  overflow-x: auto;
}
.combat-allies.hidden { display: none; }
.ally-card { display: flex; align-items: center; gap: 8px; flex-shrink: 0; min-width: 130px; }
.ally-portrait-wrap { flex-shrink: 0; }
.ally-portrait {
  width: 40px; height: 40px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(100,180,255,0.4);
}
.ally-portrait-fallback {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid rgba(100,180,255,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: bold; color: var(--accent);
}
.ally-info { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 80px; }
.ally-name { font-size: 0.78rem; font-weight: bold; color: rgba(100,180,255,0.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flee-btn { width: 100%; }
.ability-btn { position: relative; min-width: 80px; aspect-ratio: unset; padding: 8px 14px; gap: 6px; flex-direction: row; justify-content: center; }
.ability-btn.ability-disabled { opacity: 0.4; cursor: not-allowed; }
.ability-cost { font-size: 0.72rem; color: var(--muted); }
#combatAbilitySection { margin-top: 4px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.07); }
@media (max-width: 500px) { .combat-actions { grid-template-columns: 1fr; } }

/* ── Shop Modal ──────────────────────────────────────────────────────────── */
.shop-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shop-modal.hidden { display: none !important; }
.shop-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(4px); }
.shop-dialog {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 1px solid rgba(119,208,255,0.28);
  border-radius: 18px;
  padding: 20px;
  width: min(820px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}
.shop-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.shop-header h3 { margin: 0; color: var(--accent); font-size: 1.15rem; }
.shop-header button { min-width: 36px; padding: 6px 10px; font-size: 1rem; }
.shop-body { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.shop-section h4 { margin: 0 0 10px; color: var(--muted); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }
.shop-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.inv-slot.buyable,
.shop-grid .inv-slot { cursor: pointer; }
.shop-grid .inv-slot:hover { border-color: rgba(119,208,255,0.7); transform: scale(1.04); transition: transform 0.12s, border-color 0.12s; }
.price-badge {
  position: absolute;
  bottom: 3px;
  left: 3px;
  border-radius: 999px;
  min-width: 22px;
  height: 18px;
  font-size: 0.6rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.price-badge.buy  { background: rgba(114,226,161,0.88); color: #0a1a10; }
.price-badge.sell { background: rgba(255,212,121,0.88); color: #1a1200; }
.shop-confirm {
  margin-top: 16px;
  background: rgba(119,208,255,0.06);
  border: 1px solid rgba(119,208,255,0.22);
  border-radius: 12px;
  padding: 14px 16px;
}
.shop-confirm p { margin: 0 0 12px; color: var(--text); }
.shop-confirm-btns { display: flex; gap: 10px; }
@media (max-width: 600px) { .shop-body { grid-template-columns: 1fr; } }

/* ── Guild Bank Modal ────────────────────────────────────────────────────── */
.guild-bank-dialog { max-width: 480px; }
.guild-bank-body { display: flex; flex-direction: column; gap: 18px; padding: 8px 0 4px; max-height: 70vh; overflow-y: auto; }
.guild-bank-section { display: flex; flex-direction: column; gap: 10px; }
.guild-bank-section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 5px;
  font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent);
}
.guild-bank-sub { font-size: 0.75rem; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.guild-bank-gold-row { display: flex; flex-direction: column; gap: 8px; }
.guild-bank-quick-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.guild-bank-quick-btn {
  padding: 6px 12px; font-size: 0.8rem; border-radius: 20px;
  background: rgba(255,212,121,0.12); border: 1px solid rgba(255,212,121,0.3);
  color: #ffd479; cursor: pointer; transition: background 0.15s;
}
.guild-bank-quick-btn:hover { background: rgba(255,212,121,0.25); }
.guild-bank-input-row { display: flex; gap: 8px; }
.guild-bank-input-row input {
  flex: 1; min-width: 0;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px; color: var(--fg); font-size: 0.95rem; padding: 8px 12px; outline: none;
}
.guild-bank-input-row input:focus { border-color: var(--accent); }
.guild-bank-action-btn { white-space: nowrap; flex-shrink: 0; }

/* ── Guild Create Modal ──────────────────────────────────────────────────── */
.guild-create-dialog { max-width: 360px; }
.guild-create-body { padding: 6px 0 14px; display: flex; flex-direction: column; gap: 14px; }
.guild-create-row { display: flex; flex-direction: column; gap: 5px; }
.guild-create-row label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.guild-create-hint { font-size: 0.72rem; color: rgba(255,255,255,0.3); text-transform: none; letter-spacing: 0; }
.guild-create-row input {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: var(--fg);
  font-size: 0.95rem;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.guild-create-row input:focus { border-color: var(--accent); }
.guild-create-cost {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,212,121,0.07);
  border: 1px solid rgba(255,212,121,0.2);
  border-radius: 8px;
  padding: 8px 12px;
}
.guild-create-cost-label { font-size: 0.82rem; color: var(--muted); }
.guild-create-cost-amount { font-weight: 700; color: #ffd479; font-size: 0.95rem; }
.guild-create-error { color: #e74c3c; font-size: 0.82rem; margin: 0; }
.guild-create-error.hidden { display: none; }
.guild-create-actions { display: flex; gap: 10px; margin-top: 6px; }
.guild-create-actions button { flex: 1; }

/* ── Guild Buildings Modal ───────────────────────────────────────────────── */
.guild-buildings-dialog { max-width: 520px; }
.guild-buildings-info {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.guild-bank-gold-display { font-weight: 700; color: #ffd479; }
.guild-buildings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 4px;
}
.guild-building-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 12px;
}
.guild-building-icon-wrap { flex-shrink: 0; }
.guild-building-icon { width: 48px; height: 48px; object-fit: contain; border-radius: 6px; }
.guild-building-info { flex: 1; min-width: 0; }
.guild-building-name-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.guild-building-name { font-weight: 700; font-size: 0.95rem; }
.guild-building-stars { font-size: 1rem; letter-spacing: 2px; }
.star-filled { color: #ffd479; }
.star-empty  { color: rgba(255,255,255,0.25); }
.guild-building-desc { font-size: 0.78rem; color: var(--muted); margin: 0; line-height: 1.4; }
.guild-building-btn-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-width: 120px;
}
.guild-building-upgrade-btn {
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--accent);
  color: #000;
  border: none;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.guild-building-upgrade-btn:disabled {
  background: rgba(255,255,255,0.15);
  color: var(--muted);
  cursor: not-allowed;
}
.guild-building-cost-note { font-size: 0.75rem; color: var(--muted); text-align: right; }
.guild-building-maxed { font-size: 0.78rem; color: #2ecc71; font-weight: 600; }

/* ── Character Panel ─────────────────────────────────────────────────────── */
.character-panel { margin-bottom: 16px; }
.char-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.char-panel-header h2 { margin: 0; }

.char-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .char-slots { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .char-slots { grid-template-columns: repeat(2, 1fr); } }

.char-slot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  background: var(--soft);
  border: 1px solid rgba(119,208,255,0.15);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
}
.char-slot-card:hover { border-color: var(--accent); background: rgba(119,208,255,0.08); }
.char-slot-empty { border-style: dashed; color: var(--muted); }
.char-slot-plus { font-size: 2rem; line-height: 1; color: var(--accent); }

.char-portrait {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(119,208,255,0.3);
}
.char-portrait-fallback {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--soft);
  border: 2px solid rgba(119,208,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  color: var(--accent);
}
.char-slot-name    { font-weight: bold; font-size: 1rem; color: var(--text); }
.char-slot-details { font-size: 0.8rem; color: var(--muted); }
.char-slot-level   { font-size: 0.8rem; color: var(--accent); }

.char-create-form { border-top: 1px solid rgba(119,208,255,0.15); padding-top: 18px; }
.char-create-error {
  background: rgba(255, 80, 80, 0.12);
  border: 1px solid rgba(255, 80, 80, 0.4);
  border-radius: 10px;
  color: #ff9090;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}
.char-create-form h3 { margin: 0 0 14px; }
.char-create-fields { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.char-create-fields input,
.char-create-fields select { flex: 1; min-width: 140px; }

.skin-color-row { display: flex; align-items: center; gap: 12px; flex: 100%; }
.skin-color-row label { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.skin-color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.skin-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.skin-swatch:hover { transform: scale(1.15); }
.skin-swatch.selected { border-color: var(--accent); transform: scale(1.2); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1300px) {
  .game { grid-template-columns: 260px 1fr 280px; }
}
@media (max-width: 1100px) {
  .game {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
  .left-col  { grid-column: 1; }
  .center-col { grid-column: 1 / -1; order: -1; }
  .right-col { grid-column: 2; }
}
@media (max-width: 700px) {
  .game { grid-template-columns: 1fr; }
  .left-col, .right-col { grid-column: 1; }
  .log { height: 240px; }
  .room-image { height: 180px; }
}
