* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0b0e14;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #eee;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-touch-callout: none;   /* no native long-press menu on iOS (the contextmenu event is cancelled too) */
  user-select: none;
  -webkit-user-select: none;
}

#game-container, #game-container canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
}

.hidden { display: none !important; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 8, 14, 0.82);
  z-index: 50;
  touch-action: auto;
}
.login-card {
  background: #141a26;
  border: 1px solid #2c3a55;
  border-radius: 14px;
  padding: 28px 26px;
  width: min(92vw, 360px);
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.login-card h1 { margin: 0 0 6px; font-size: 26px; }
.subtitle { margin: 0 0 18px; color: #9fb0cc; font-size: 14px; }
.link-btn {
  background: none; border: none; color: #6ea8fe;
  font-size: 14px; margin-top: 12px; cursor: pointer; text-decoration: underline;
}
#logout-btn {
  min-height: 40px; padding: 0 14px; font-size: 14px;
  border-radius: 8px; border: 1px solid #2c3a55;
  background: #1a2233; color: #cfd8ea; cursor: pointer;
  align-self: flex-start;
}
/* Phase 6: mute toggle + fps meter */
#mute-btn {
  min-height: 44px; min-width: 44px; font-size: 20px;
  border-radius: 8px; border: 1px solid #2c3a55;
  background: #1a2233; color: #cfd8ea; cursor: pointer;
  align-self: flex-start; margin-top: 6px;
}
#fps-meter {
  position: fixed; left: 8px; bottom: 8px; z-index: 9999;
  background: rgba(0, 0, 0, 0.65); color: #7dff9a;
  font: 12px monospace; padding: 4px 8px; border-radius: 6px;
  pointer-events: none;
}
.big-btn {
  width: 100%; min-height: 52px;
  font-size: 20px; font-weight: bold;
  border: none; border-radius: 10px;
  background: linear-gradient(180deg, #3fae5a, #2c7f41);
  color: #fff; cursor: pointer;
}
.big-btn:active { transform: scale(0.98); }
.status { min-height: 20px; font-size: 13px; color: #9fb0cc; margin: 10px 0 0; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#hud > * { pointer-events: auto; }

#top-left {
  position: absolute; top: 10px; left: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
#hp-bar {
  position: relative;
  width: 170px; height: 26px;
  background: #3a0d0d; border: 2px solid #111; border-radius: 6px;
  overflow: hidden;
}
#hp-fill {
  height: 100%; width: 100%;
  background: linear-gradient(180deg, #e04040, #a02020);
  transition: width 0.25s;
}
#hp-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: bold; text-shadow: 0 1px 2px #000;
}
#combat-label {
  font-size: 14px; font-weight: bold; color: #ffd54a;
  text-shadow: 0 1px 3px #000;
}
#conn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #9fb0cc; }
#conn-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #e04040; display: inline-block;
}
#conn-dot.on { background: #3fae5a; }

#minimap {
  position: absolute; top: 10px; right: 10px;
  width: 140px; height: 140px;
  border: 2px solid #2c3a55; border-radius: 8px;
  background: #12300f;
}

#panel-toggle {
  position: absolute; top: 160px; right: 10px;
  width: 48px; height: 48px;
  font-size: 24px;
  border: 2px solid #2c3a55; border-radius: 10px;
  background: rgba(20, 26, 38, 0.92); color: #fff;
  cursor: pointer;
}
#side-panel {
  position: absolute; bottom: 10px; right: 10px;
  width: min(280px, 70vw); max-height: 52vh;
  display: flex; flex-direction: column;
  background: rgba(20, 26, 38, 0.94);
  border: 2px solid #2c3a55; border-radius: 10px;
  overflow: hidden;
}
#side-panel.collapsed { display: none; }
.tabs { display: flex; background: #1a1a1a; border-bottom: 2px solid #5a5a5a; }
.cr-tabs .tab {
  flex: 1; min-height: 48px;
  background: linear-gradient(180deg, #2a2a2a 0%, #1f1f1f 100%);
  border: 1px solid #3a3a3a; border-bottom: none;
  border-radius: 4px 4px 0 0;
  color: #999; font-size: 20px; cursor: pointer;
  margin: 0 1px;
}
.cr-tabs .tab:hover { background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%); }
.cr-tabs .tab.active {
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
  border-color: #ffd54a;
  color: #ffd54a;
  box-shadow: inset 0 2px 0 #ffd54a;
}
.tab-panel { display: none; overflow-y: auto; padding: 8px; touch-action: pan-y; background: #1e1e1e; }
.tab-panel.active { display: block; }

/* 28-slot inventory grid */
.cr-inv-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.cr-inv-slot {
  min-height: 56px;
  background: #0f0f0f;
  border: 2px solid #3a3a3a;
  border-radius: 4px;
}
.cr-inv-slot.empty {
  background: #0a0a0a;
  border-color: #2a2a2a;
  opacity: 0.5;
}
.cr-inv-slot.sel {
  border-color: #ffd54a;
  box-shadow: 0 0 6px rgba(255, 213, 74, 0.5);
}

#inv-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.inv-slot {
  min-height: 52px;
  background: #0d1220; border: 1px solid #2c3a55; border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; padding: 2px; text-align: center;
  overflow: hidden;
}
.inv-item { color: #cfe0ff; word-break: break-word; }
.inv-n { color: #ffd54a; font-weight: bold; }
.inv-empty { grid-column: 1 / -1; color: #667; text-align: center; padding: 16px 0; font-size: 13px; }

.skill-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 4px; border-bottom: 1px solid #22304a;
  font-size: 14px;
}
.skill-row:last-child { border-bottom: none; }
.skill-name { flex: 1; color: #cfe0ff; }
.skill-lv {
  background: #2c3a55; border-radius: 6px;
  padding: 3px 8px; font-weight: bold; color: #ffd54a; font-size: 13px;
}
.skill-xp { color: #66788f; font-size: 12px; }

/* Overlay close X button */
.overlay-x {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  background: #5a1a1a;
  border: 2px solid #8a2a2a;
  border-radius: 4px;
  color: #ffaaaa;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}
.overlay-x:hover {
  background: #7a2a2a;
  color: #fff;
}
.big-card { position: relative; }

/* Bottom icon bar */
#bottom-icon-bar {
  display: flex;
  justify-content: space-around;
  background: #1a1a1a;
  border-top: 2px solid #5a5a5a;
  padding: 6px 4px;
}
.bottom-icon {
  background: linear-gradient(180deg, #2a2a2a 0%, #1f1f1f 100%);
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  width: 40px; height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bottom-icon:hover {
  border-color: #c9a227;
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
}
.bottom-icon .medieval-icon {
  width: 24px; height: 24px;
}

/* Medieval icons */
.medieval-icon {
  display: inline-block;
  width: 24px; height: 24px;
  vertical-align: middle;
}
.medieval-icon svg {
  width: 100%; height: 100%;
  display: block;
}
.medieval-icon-svg svg {
  width: 28px; height: 28px;
}
.cr-tabs .tab .medieval-icon {
  width: 26px; height: 26px;
}
.cr-skill-icon.medieval-icon-svg {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

/* Equipment paper doll */
.cr-equip-paperdoll {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas:
    ". head ."
    "cape neck ammo"
    "weapon body shield"
    ". legs ."
    "hands feet ring";
  gap: 6px;
  max-width: 240px;
  margin: 0 auto 12px;
  padding: 12px;
  background: #151515;
  border: 2px solid #5a5a5a;
  border-radius: 4px;
}
.cr-equip-slot[data-slot="head"] { grid-area: head; }
.cr-equip-slot[data-slot="weapon"] { grid-area: weapon; }
.cr-equip-slot[data-slot="body"] { grid-area: body; }
.cr-equip-slot[data-slot="shield"] { grid-area: shield; }
.cr-equip-slot[data-slot="legs"] { grid-area: legs; }
.cr-equip-slot[data-slot="cape"] { grid-area: cape; }
.cr-equip-slot[data-slot="neck"] { grid-area: neck; }
.cr-equip-slot[data-slot="ammo"] { grid-area: ammo; }
.cr-equip-slot[data-slot="hands"] { grid-area: hands; }
.cr-equip-slot[data-slot="feet"] { grid-area: feet; }
.cr-equip-slot[data-slot="ring"] { grid-area: ring; }
.cr-equip-slot { position: relative; }
.cr-equip-slot .slot-count { position: absolute; left: 3px; top: 1px; font: bold 11px sans-serif; color: #ffd54a; text-shadow: 1px 1px 0 #000; }
.gs-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 12px; }
.gs-table th { color: #c9a227; font-weight: normal; text-align: right; }
.gs-table td { text-align: right; padding: 1px 4px; }
.gs-table td:first-child { text-align: left; color: #aaa; }
.gs-other { margin-top: 6px; font-size: 12px; color: #bbb; }
.cr-equip-slot {
  width: 46px; height: 46px;
  background: #0f0f0f;
  border: 2px solid #3a3a3a;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 24px;
  margin: 0 auto;
}
.cr-equip-slot:hover { border-color: #ffd54a; }
.cr-equip-slot.filled { border-color: #6a6a6a; background: #1a1a1a; }
.cr-equip-icon { opacity: 0.4; }
.cr-equip-slot.filled .cr-equip-icon { opacity: 1; }
.cr-equip-stats {
  background: #0f0f0f;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  padding: 8px;
  font-size: 13px;
  color: #ccc;
  margin-bottom: 8px;
}

/* Devotion (prayer) grid */
.cr-prayer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.cr-prayer-cell {
  background: #0f0f0f;
  border: 2px solid #3a3a3a;
  border-radius: 4px;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
}
.cr-prayer-cell:hover { border-color: #ffd54a; }
.cr-prayer-cell.active {
  border-color: #ffd54a;
  background: #2a2a1a;
  box-shadow: 0 0 8px rgba(255, 213, 74, 0.4);
}
.cr-prayer-cell.locked { opacity: 0.4; cursor: not-allowed; }
.cr-prayer-icon { font-size: 24px; }
.cr-prayer-name { font-size: 10px; color: #999; margin-top: 2px; }
.cr-prayer-pts {
  text-align: center;
  padding: 8px;
  background: #0f0f0f;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  margin-bottom: 8px;
  color: #ffd54a;
  font-weight: bold;
}

/* Emote grid */
.cr-emote-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.cr-emote-cell {
  background: #0f0f0f;
  border: 2px solid #3a3a3a;
  border-radius: 4px;
  padding: 10px 4px;
  text-align: center;
  cursor: pointer;
}
.cr-emote-cell:hover { border-color: #ffd54a; background: #1a1a1a; }
.cr-emote-icon { font-size: 28px; }
.cr-emote-name { font-size: 11px; color: #999; margin-top: 4px; }

/* Spellbook grid */
.cr-spell-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

/* Settings */
.cr-settings { display: flex; flex-direction: column; gap: 8px; }
.cr-btn {
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
  border: 2px solid #5a5a5a;
  border-radius: 4px;
  color: #ffd54a;
  font-weight: bold;
  padding: 12px;
  cursor: pointer;
  font-size: 14px;
}
.cr-btn:hover { border-color: #ffd54a; background: linear-gradient(180deg, #4a4a4a 0%, #3a3a3a 100%); }

/* Skills grid */
.cr-skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: #1a1a1a;
  border: 3px solid #5a5a5a;
  border-radius: 4px;
  padding: 4px;
  /* Stone texture border */
  box-shadow: inset 0 0 0 1px #2a2a2a, 0 2px 8px rgba(0,0,0,0.5);
}
.cr-skill-cell {
  background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
  border: 1px solid #3a3a3a;
  border-radius: 3px;
  padding: 6px 4px;
  text-align: center;
  cursor: pointer;
  position: relative;
}
.cr-skill-cell:hover {
  background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
  border-color: #ffd54a;
}
.cr-skill-icon {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 2px;
}
.cr-skill-level {
  font-size: 16px;
  font-weight: bold;
  color: #ffd54a;
  text-shadow: 1px 1px 0 #000;
  line-height: 1.1;
}
.cr-skill-xp {
  font-size: 10px;
  color: #999;
  line-height: 1;
}
.cr-total-level {
  grid-column: 1 / -1;
  text-align: center;
  padding: 8px;
  background: #0f0f0f;
  border-top: 2px solid #5a5a5a;
  color: #ffd54a;
  font-weight: bold;
  font-size: 14px;
  text-shadow: 1px 1px 0 #000;
}

/* ---------- Chat ---------- */
#chat-panel {
  position: absolute; left: 10px; bottom: 10px;
  width: min(330px, 72vw);
  display: flex; flex-direction: column;
  background: rgba(10, 14, 22, 0.78);
  border: 1px solid #2c3a55; border-radius: 10px;
  overflow: hidden;
}
#chat-log {
  height: 120px; overflow-y: auto;
  padding: 6px 8px; font-size: 13px; line-height: 1.35;
  touch-action: pan-y; user-select: text; -webkit-user-select: text;
}
.chat-msg { margin: 1px 0; word-break: break-word; }
.chat-from { color: #ffd54a; font-weight: bold; }
.chat-sys { color: #7fd4ff; font-style: italic; }
#chat-row { display: flex; border-top: 1px solid #2c3a55; }
#chat-input {
  flex: 1; min-height: 44px;
  border: none; background: transparent; color: #fff;
  font-size: 15px; padding: 0 10px; outline: none;
  user-select: text; -webkit-user-select: text;
}
/* Minimize: a small button on the chat box's top-right corner (over the log, nothing moves);
   minimized, the box becomes a small "Chat" button in the same corner of the screen. */
#chat-min {
  position: absolute; top: 3px; right: 3px; z-index: 2;
  width: 30px; height: 26px; padding: 0;
  border: 1px solid var(--gold-dim, #8a7030); border-radius: 4px;
  background: rgba(20, 16, 10, 0.88); color: var(--gold-hi, #ffd54a);
  font-size: 18px; font-weight: bold; line-height: 1; cursor: pointer;
  touch-action: manipulation;
}
#chat-min:hover { border-color: var(--gold, #c9a227); }
#chat-mini {
  position: absolute; left: 10px; bottom: 10px;
  min-height: 44px; min-width: 72px; padding: 0 16px;
  background: rgba(28, 24, 18, 0.9); color: var(--gold-hi, #ffd54a);
  border: 2px solid var(--gold, #c9a227); border-radius: 4px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.5);
  font-size: 15px; font-weight: bold; cursor: pointer;
  touch-action: manipulation;
}
#chat-send {
  min-width: 64px; min-height: 44px;
  border: none; background: #2c5f8a; color: #fff;
  font-size: 15px; font-weight: bold; cursor: pointer;
}

/* ---------- Toast ---------- */
#toast {
  position: absolute; top: 14px; left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(20, 26, 38, 0.95);
  border: 1px solid #ffd54a; border-radius: 10px;
  color: #ffd54a; font-size: 15px; font-weight: bold;
  padding: 10px 18px; white-space: nowrap;
  opacity: 0; transition: opacity 0.25s, transform 0.25s;
  pointer-events: none; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  #minimap { width: 104px; height: 104px; }
  #panel-toggle { top: 124px; }
  #side-panel { bottom: 10px; top: auto; }
  #hp-bar { width: 130px; height: 24px; }
  #chat-panel { width: min(300px, 66vw); }
  #chat-log { height: 92px; }
}

/* ---------- Phase 2: gear, friends, bank, shop ---------- */
#coins-row, .coins-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 16px; font-weight: bold; color: #ffd54a;
  padding: 6px 4px;
}
#inv-grid.sel-mode .inv-slot { cursor: pointer; }
.inv-slot.sel {
  border-color: #ffd54a;
  box-shadow: 0 0 0 2px #ffd54a;
}
#inv-actions { padding-top: 8px; }
.sel-name {
  font-size: 14px; color: #cfe0ff; text-align: center;
  margin-bottom: 6px; min-height: 18px;
}
.btn-row { display: flex; gap: 6px; }
.btn-row.wrap { flex-wrap: wrap; }
.btn-row.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
.btn-row.grid2 button { min-width: 0; }
.btn-row button {
  flex: 1; min-height: 44px; min-width: 70px;
  border-radius: 8px; border: 1px solid #2c3a55;
  background: #22304a; color: #fff; font-size: 14px; font-weight: bold;
  cursor: pointer;
}
.btn-row button:active { background: #2c3f5e; }

#gear-stats {
  font-size: 14px; color: #ffd54a; font-weight: bold;
  padding: 6px 4px; text-align: center;
}
.friend-row, .block-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 4px; border-bottom: 1px solid #22304a; font-size: 14px;
}
.friend-row .f-name, .block-row .f-name { flex: 1; color: #cfe0ff; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #667; flex: none; }
.dot.on { background: #3fae5a; }
.mini-btn {
  min-height: 44px; min-width: 52px; padding: 0 10px;
  border-radius: 8px; border: 1px solid #2c3a55;
  background: #22304a; color: #fff; font-size: 13px; font-weight: bold;
  cursor: pointer; flex: none;
}
#friend-add-row, #block-add-row { display: flex; gap: 6px; margin: 6px 0; }
#friend-add-row input, #block-add-row input {
  flex: 1; min-height: 44px; min-width: 0;
  border-radius: 8px; border: 1px solid #2c3a55;
  background: #0d1220; color: #fff; font-size: 15px; padding: 0 10px;
  user-select: text; -webkit-user-select: text;
}
#friend-add-row button, #block-add-row button {
  min-height: 44px; min-width: 64px;
  border-radius: 8px; border: none;
  background: #2c5f8a; color: #fff; font-size: 14px; font-weight: bold;
  cursor: pointer; flex: none;
}
.friends-sub {
  font-size: 13px; color: #9fb0cc; font-weight: bold;
  margin: 10px 0 2px; text-transform: uppercase; letter-spacing: 0.5px;
}
.friends-empty { color: #667; font-size: 13px; text-align: center; padding: 10px 0; }
.chat-pm { color: #d48aff; }

/* ---------- Bank & shop overlays ---------- */
.big-card {
  background: #141a26;
  border: 1px solid #2c3a55;
  border-radius: 14px;
  padding: 18px;
  width: min(94vw, 480px);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  touch-action: pan-y;
}
.big-card h2 { margin: 0 0 4px; font-size: 22px; text-align: center; }
.big-card h3 {
  margin: 14px 0 6px; font-size: 15px; color: #9fb0cc;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.big-card .big-btn { margin-top: 14px; }
.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.slot-grid .inv-slot.sel {
  border-color: #7fd4ff;
  box-shadow: 0 0 0 2px #7fd4ff;
}
.qty-row {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  font-size: 15px; color: #9fb0cc; margin: 6px 0;
}
.qty {
  min-width: 52px; min-height: 44px;
  border-radius: 8px; border: 1px solid #2c3a55;
  background: #0d1220; color: #9fb0cc; font-size: 15px; font-weight: bold;
  cursor: pointer;
}
.qty.active { background: #2c5f8a; color: #fff; border-color: #2c5f8a; }
.shop-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px; border-bottom: 1px solid #22304a; font-size: 14px;
}
.shop-row .s-name { flex: 1; color: #cfe0ff; }
.shop-row .s-stats { color: #66788f; font-size: 12px; }
.shop-row .s-price { color: #ffd54a; font-weight: bold; white-space: nowrap; }
.shop-empty { color: #667; font-size: 13px; text-align: center; padding: 8px 0; }

/* Phase 3: crafting UI */
.hint {
  font-size: 12px; color: #9fb0cc; text-align: center;
  padding: 6px 4px 0; font-style: italic;
}
#action-busy {
  position: fixed; left: 50%; bottom: 118px; transform: translateX(-50%);
  background: rgba(10, 16, 30, 0.85); border: 1px solid #2c3a55;
  color: #ffd54a; font-size: 14px; font-weight: bold;
  padding: 8px 18px; border-radius: 20px; z-index: 60;
  pointer-events: none; white-space: nowrap;
}
#action-busy::after {
  content: ''; display: inline-block; width: 10px; height: 10px; margin-left: 8px;
  border-radius: 50%; background: #ffd54a;
  animation: busyPulse 0.7s ease-in-out infinite alternate;
}
@keyframes busyPulse { from { opacity: 0.25; } to { opacity: 1; } }
.recipe-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 4px; border-bottom: 1px solid #22304a; font-size: 14px;
}
.recipe-row .r-name { flex: 1; color: #cfe0ff; }
.recipe-row .r-sub { display: block; font-size: 12px; color: #9fb0cc; }
.recipe-row button {
  min-height: 44px; min-width: 76px; padding: 0 12px;
  border-radius: 8px; border: 1px solid #2c3a55;
  background: #22304a; color: #fff; font-size: 14px; font-weight: bold;
  cursor: pointer;
}
.recipe-row button:active { background: #2c3f5e; }

/* ---------- Phase 4: combat ---------- */
.fight-sec { margin-bottom: 14px; }
.fight-title { font-size: 14px; font-weight: bold; color: #ffd54a; margin-bottom: 6px; }
#stance-row button.active { background: #2c5f8a; border-color: #7fd4ff; }
.spell-row {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 8px 10px; margin-bottom: 6px;
}
.spell-row.sel { border-color: #b44dff; background: rgba(180,77,255,0.10); }
.spell-row .r-name { flex: 1; color: #cfe0ff; font-size: 14px; }
.spell-row .r-sub { display: block; font-size: 12px; color: #9fb0cc; }
#spec-bar {
  height: 14px; background: #2e1a1a; border: 1px solid #8a5a5a;
  border-radius: 7px; overflow: hidden; margin-bottom: 8px;
}
#spec-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #ff6b35, #ffd23f);
  transition: width 0.3s;
}
#spec-btn .cost { opacity: 0.7; font-size: 0.9em; }
/* The bar itself fires the special (2026-11-15): it reads as a button while there's energy for it, greyed when not. */
#spec-bar { cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s, filter 0.15s; }
#spec-bar:hover, #spec-bar:focus-visible { border-color: #ffd23f; box-shadow: 0 0 6px rgba(255, 190, 70, 0.55); outline: none; }
#spec-bar.disabled { cursor: not-allowed; filter: grayscale(0.75) brightness(0.8); }
#spec-bar.disabled:hover { border-color: #8a5a5a; box-shadow: none; }
#spec-btn:disabled { opacity: 0.55; cursor: not-allowed; }
#splat-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.splat {
  position: absolute; transform: translate(-50%, -100%);
  font-size: 20px; font-weight: bold; color: #ffd54a;
  text-shadow: 0 2px 4px #000, 0 0 6px rgba(0,0,0,0.8);
  animation: splat-rise 1.1s ease-out forwards;
  pointer-events: none; white-space: nowrap;
}
.splat.hurt { color: #ff6b6b; }
.splat.miss { color: #9fb0cc; font-size: 15px; font-style: italic; }
.splat.crit { color: #ff9a3c; font-size: 26px; text-shadow: 0 2px 4px #000, 0 0 10px rgba(255, 120, 30, 0.9); }
@keyframes splat-rise {
  0% { opacity: 0; transform: translate(-50%, -60%) scale(0.6); }
  15% { opacity: 1; transform: translate(-50%, -100%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -220%) scale(1); }
}
#boss-banner {
  position: absolute; top: 54px; left: 50%; transform: translateX(-50%);
  background: rgba(60, 8, 8, 0.92); border: 2px solid #ff4040; border-radius: 10px;
  color: #ffb0b0; font-size: 17px; font-weight: bold;
  padding: 8px 20px; pointer-events: none; white-space: nowrap;
  animation: boss-pulse 1.6s ease-in-out infinite;
}
@keyframes boss-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255,64,64,0.4); }
  50% { box-shadow: 0 0 22px rgba(255,64,64,0.9); }
}

/* ---------- Phase 5: quests, NPCs, regions, map ---------- */
#region-banner {
  position: absolute; top: 100px; left: 50%; transform: translateX(-50%);
  background: rgba(10, 20, 40, 0.88); border: 1px solid #7fd4ff; border-radius: 12px;
  color: #dff1ff; text-align: center; padding: 10px 26px; pointer-events: none;
  max-width: 86vw; animation: region-in 0.4s ease-out;
}
#region-name { font-size: 22px; font-weight: bold; color: #ffd54a; }
#region-desc { font-size: 13px; color: #b3d9ff; margin-top: 2px; }
@keyframes region-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
#map-btn {
  position: absolute; right: 12px; top: 160px; font-size: 26px;
  background: rgba(10, 20, 40, 0.8); border: 1px solid #7fd4ff; border-radius: 10px;
  padding: 8px 10px; cursor: pointer;
}
#zoom-controls {
  position: absolute; right: 12px; top: 220px; display: flex; flex-direction: column; gap: 8px;
}
#zoom-controls button {
  font-size: 22px; width: 44px; height: 44px;
  background: rgba(10, 20, 40, 0.8); border: 1px solid #7fd4ff; border-radius: 10px;
  color: #fff; cursor: pointer;
}
.npc-role { text-align: center; color: #8aa0c0; font-size: 13px; margin-bottom: 8px; }
#npc-text { font-size: 15px; line-height: 1.45; color: #eee; margin: 0 0 12px; }
#npc-options { display: flex; flex-direction: column; gap: 8px; }
#npc-options button {
  min-height: 44px; font-size: 15px; border-radius: 8px; cursor: pointer;
  background: #1d3a5f; color: #dff1ff; border: 1px solid #7fd4ff;
}
#npc-options button:active { background: #2a4f7d; }
.quest {
  border: 1px solid #444; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
}
.quest.active { border-color: #ffd54a; }
.quest.done { border-color: #2fd44a; opacity: 0.75; }
.q-name { font-weight: bold; font-size: 15px; color: #ffd54a; }
.quest.done .q-name { color: #2fd44a; }
.q-stage { font-size: 13px; color: #dff1ff; margin-top: 2px; }
.q-prog { color: #7fd4ff; font-weight: bold; }
.q-desc { font-size: 13px; color: #b0b0c0; margin-top: 2px; }
.q-giver { font-size: 13px; color: #b3d9ff; margin-top: 2px; }
.q-done { font-size: 13px; color: #2fd44a; margin-top: 2px; }

/* ----- context menu (right-click / long-press) ----- */
#ctx-menu {
  position: fixed; z-index: 1000; min-width: 180px; max-width: 260px;
  background: rgba(12, 22, 40, 0.97); border: 1px solid #7fd4ff; border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6); padding: 6px; display: none;
}
#ctx-menu.show { display: block; }
#ctx-menu .ctx-title {
  font-size: 13px; color: #ffd54a; font-weight: bold; padding: 6px 10px 4px;
  border-bottom: 1px solid rgba(127, 212, 255, 0.25); margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#ctx-menu button {
  display: block; width: 100%; text-align: left; padding: 10px 12px; margin: 2px 0;
  background: transparent; border: none; border-radius: 6px; color: #dff1ff;
  font-size: 15px; cursor: pointer; min-height: 44px;
}
#ctx-menu button:hover, #ctx-menu button:active { background: #1d3a5f; }
#ctx-menu button.ctx-danger { color: #ff9a9a; }

/* ----- amount input modal (bank withdraw/deposit X) ----- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: rgba(12, 22, 40, 0.98); border: 1px solid #7fd4ff; border-radius: 12px;
  padding: 20px; min-width: 260px; max-width: 90vw; text-align: center;
}
.modal-box h3 { color: #ffd54a; margin: 0 0 12px; font-size: 17px; }
.modal-box input[type="number"] {
  width: 100%; padding: 10px; font-size: 18px; text-align: center;
  background: #0a1628; border: 1px solid #7fd4ff; border-radius: 8px; color: #fff;
  margin-bottom: 14px; box-sizing: border-box;
}
.modal-box .btn-row { display: flex; gap: 10px; justify-content: center; }
.modal-box .btn-row button {
  padding: 10px 24px; font-size: 15px; border-radius: 8px; cursor: pointer;
  background: #1d3a5f; color: #dff1ff; border: 1px solid #7fd4ff; min-height: 44px;
}
.modal-box .btn-row button:active { background: #2a4f7d; }

/* ----- XP drops (floating notifications) ----- */
#xp-drops {
  position: fixed; right: 12px; top: 80px; z-index: 1500;
  display: flex; flex-direction: column; gap: 6px; pointer-events: none;
}
.xp-drop {
  background: rgba(10, 20, 40, 0.9); border: 1px solid #7fd4ff; border-radius: 8px;
  padding: 6px 12px; font-size: 14px; color: #dff1ff;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
}
.xp-drop.show { opacity: 1; transform: translateY(0); }
.xp-drop.fade { opacity: 0; transform: translateY(-10px); }
.xp-drop .xp-amt { color: #ffd54a; font-weight: bold; }
.xp-drop .xp-skill { color: #8aa0c0; font-size: 12px; }

/* ----- minimap ----- */
#minimap {
  position: fixed; right: 12px; top: 12px; z-index: 900;
  width: 160px; height: 160px; border-radius: 50%;
  border: 2px solid #7fd4ff; background: rgba(8, 16, 32, 0.85);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
#minimap canvas { width: 100%; height: 100%; border-radius: 50%; }

/* ===== Visual overhaul: stone, gold and parchment ===== */
:root {
  --cr-stone: #3a3226;
  --cr-stone-dark: #2a241a;
  --cr-gold: #d4a017;
  --cr-gold-light: #ffd54a;
  --cr-parchment: #d4c49a;
}

/* Side panel: stone texture with gold trim */
#side-panel {
  background: linear-gradient(180deg, #4a4030 0%, #3a3226 50%, #2a241a 100%);
  border: 3px solid #d4a017;
  border-radius: 4px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.6);
}

/* Tabs */
.tab {
  background: linear-gradient(180deg, #5a5040 0%, #3a3226 100%);
  border: 1px solid #d4a017;
  color: #d4c49a;
  text-shadow: 1px 1px 2px #000;
  font-weight: bold;
}
.tab.active {
  background: linear-gradient(180deg, #6a6048 0%, #4a4030 100%);
  color: #ffd54a;
  border-bottom: 3px solid #ffd54a;
}

/* Buttons: chunky, with a bevel */
button {
  background: linear-gradient(180deg, #6a6048 0%, #4a4030 50%, #3a3226 100%);
  border: 2px solid #d4a017;
  border-radius: 4px;
  color: #ffd54a;
  text-shadow: 1px 1px 2px #000;
  font-weight: bold;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 4px rgba(0,0,0,0.4);
  cursor: pointer;
}
button:hover {
  background: linear-gradient(180deg, #7a7050 0%, #5a5040 50%, #4a4030 100%);
}
button:active {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Inventory grid: slots */
#inv-grid {
  gap: 2px;
  background: #2a241a;
  padding: 4px;
  border: 2px solid #d4a017;
  border-radius: 4px;
}
.inv-slot {
  background: linear-gradient(180deg, #3a3226 0%, #2a241a 100%);
  border: 1px solid #5a5040;
  border-radius: 2px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

/* Card (the death screen) */
.login-card {
  background: linear-gradient(180deg, #4a4030 0%, #3a3226 50%, #2a241a 100%);
  border: 3px solid #d4a017;
  border-radius: 8px;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.5), 0 8px 32px rgba(0,0,0,0.7);
}
.login-card h1 {
  color: #ffd54a;
  text-shadow: 2px 2px 4px #000;
  font-size: 32px;
}

/* Minimap: gold rim */
#minimap {
  border: 3px solid #d4a017;
  box-shadow: 0 0 0 1px #000, 0 4px 16px rgba(0,0,0,0.6);
}

/* Context menu: parchment style */
.ctx-menu {
  background: linear-gradient(180deg, #d4c49a 0%, #c4b48a 100%);
  border: 2px solid #3a3226;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  color: #2a241a;
}
.ctx-menu .ctx-item {
  color: #2a241a;
  font-weight: bold;
}
.ctx-menu .ctx-item:hover {
  background: #b4a47a;
}

/* ===== Dunmere theme: one gold-on-dark-stone look for every HUD element =====
   (Overrides the older navy styles above; keep new UI inside these tokens.) */
:root {
  --stone-hi: #5a4e3a;
  --stone: #3a3226;
  --stone-lo: #2a241a;
  --stone-deep: #1c1812;
  --gold: #d4a017;
  --gold-hi: #ffd54a;
  --gold-dim: #8a6a1e;
  --parch: #e6d6ae;
  --parch-dim: #a8977a;
  --ink: #f2e8cf;
  --stone-grad: linear-gradient(180deg, #4a4030 0%, #3a3226 55%, #2a241a 100%);
  --btn-grad: linear-gradient(180deg, #6a5c42 0%, #4a4030 55%, #3a3226 100%);
  --btn-grad-hi: linear-gradient(180deg, #7c6c4c 0%, #5a4e3a 55%, #4a4030 100%);
  --btn-grad-on: linear-gradient(180deg, #8a6a24 0%, #6a501a 100%);
}
html, body { background: #14110c; color: var(--ink); }
.overlay { background: rgba(12, 9, 5, 0.8); }

/* Cards: login, dialogue, bank, shop, map, furnace, anvil */
.login-card, .big-card, .modal-box {
  background: var(--stone-grad);
  border: 3px solid var(--gold);
  border-radius: 8px;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.5), 0 8px 32px rgba(0,0,0,0.7);
  color: var(--ink);
}
.big-card h2, .modal-box h3 { color: var(--gold-hi); text-shadow: 2px 2px 3px #000; font-family: Georgia, "Times New Roman", serif; }
.login-card h1 { font-family: Georgia, "Times New Roman", serif; letter-spacing: 1px; }
.big-card h3 { color: var(--parch); border-bottom: 1px solid var(--gold-dim); padding-bottom: 3px; }
.subtitle, .status, .hint, .npc-role { color: var(--parch-dim); }
.link-btn { color: var(--gold-hi); text-shadow: none; box-shadow: none; }

/* Text inputs */
#chat-input, #friend-add-row input, #block-add-row input,
.modal-box input[type="number"] {
  background: var(--stone-deep); color: var(--ink);
  border: 1px solid var(--gold-dim); border-radius: 4px;
}
#chat-input { border: none; background: transparent; }
#friend-add-row input:focus, #block-add-row input:focus,
.modal-box input[type="number"]:focus { outline: none; border-color: var(--gold-hi); }
::placeholder { color: #7d6f56; }

/* Every button family shares the stone bevel + gold trim */
.big-btn, #logout-btn, #mute-btn, #panel-toggle, #map-btn, #zoom-controls button, #chat-send,
.btn-row button, .recipe-row button, #npc-options button, .modal-box .btn-row button,
#friend-add-row button, #block-add-row button, .qty, .mini-btn, .cr-btn, .overlay-x {
  background: var(--btn-grad);
  border: 2px solid var(--gold);
  border-radius: 4px;
  color: var(--gold-hi);
  text-shadow: 1px 1px 2px #000;
  font-weight: bold;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 2px 4px rgba(0,0,0,0.45);
}
.big-btn:hover, #logout-btn:hover, #mute-btn:hover, #panel-toggle:hover, #map-btn:hover, #zoom-controls button:hover,
#chat-send:hover, .btn-row button:hover, .recipe-row button:hover, #npc-options button:hover,
.modal-box .btn-row button:hover, #friend-add-row button:hover, #block-add-row button:hover, .qty:hover,
.mini-btn:hover, .cr-btn:hover, .overlay-x:hover {
  background: var(--btn-grad-hi); border-color: var(--gold-hi);
}
.btn-row button:active, .recipe-row button:active, #npc-options button:active, .modal-box .btn-row button:active {
  background: var(--btn-grad-on);
}
.big-btn { font-family: Georgia, "Times New Roman", serif; font-size: 20px; letter-spacing: 0.5px; }
#stance-row button.active, .qty.active {
  background: var(--btn-grad-on); border-color: var(--gold-hi); color: #fff3c4;
  box-shadow: inset 0 0 8px rgba(255, 213, 74, 0.35), 0 0 0 1px #000;
}
#npc-options button { text-align: left; padding: 0 14px; color: var(--ink); }
#chat-send { border-width: 0 0 0 2px; border-radius: 0; }
#map-btn, #zoom-controls button { color: var(--gold-hi); }
#mute-btn, #logout-btn { color: var(--gold-hi); }

/* Chat box */
#chat-panel {
  background: rgba(28, 24, 18, 0.86);
  border: 2px solid var(--gold); border-radius: 4px;
  box-shadow: inset 0 0 14px rgba(0,0,0,0.5), 0 3px 10px rgba(0,0,0,0.5);
}
#chat-row { border-top: 1px solid var(--gold-dim); }
.chat-msg { color: var(--ink); text-shadow: 1px 1px 0 #000; }
.chat-sys { color: #e8c86a; }
.chat-pm { color: #f0a0e0; }

/* Panel interiors */
.tabs { background: var(--stone-lo); border-bottom: 2px solid var(--gold-dim); }
.tab-panel { background: rgba(20, 17, 12, 0.55); }
#bottom-icon-bar { background: var(--stone-lo); border-top: 2px solid var(--gold-dim); }
.bottom-icon { background: var(--btn-grad); border: 1px solid var(--gold-dim); box-shadow: none; }
.bottom-icon:hover { background: var(--btn-grad-hi); border-color: var(--gold); }
.bottom-icon.active { background: var(--btn-grad-on); border-color: var(--gold-hi); }
.inv-item, .skill-name, .friend-row .f-name, .block-row .f-name,
.shop-row .s-name, .recipe-row .r-name, .spell-row .r-name, .q-stage { color: var(--ink); }
.recipe-row .r-sub, .spell-row .r-sub, .shop-row .s-stats, .skill-xp, .q-desc, .q-giver { color: var(--parch-dim); }
.inv-empty, .friends-empty, .shop-empty { color: #7d6f56; }
.friends-sub { color: var(--parch); }
.shop-row, .skill-row, .friend-row, .block-row { border-bottom-color: rgba(138, 106, 30, 0.35); }
.spell-row { border-color: var(--gold-dim); }
.spell-row.sel { border-color: var(--gold-hi); background: rgba(255, 213, 74, 0.08); }
.slot-grid .inv-slot.sel { border-color: var(--gold-hi); box-shadow: 0 0 0 2px var(--gold-hi); }
.slot-grid .inv-slot { background: linear-gradient(180deg, #3a3226 0%, #2a241a 100%); border: 1px solid #5a5040; }
.quest { background: rgba(0, 0, 0, 0.25); border-color: var(--gold-dim); }
.q-prog { color: var(--gold-hi); }

/* Magic tab spellbook grid */
.cr-spell-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 64px; padding: 4px 2px;
  background: linear-gradient(180deg, #2e2820 0%, #221d16 100%);
  border: 1px solid #5a5040; border-radius: 3px; box-shadow: none;
  color: var(--ink); text-shadow: 1px 1px 0 #000; font-weight: normal;
}
.cr-spell-cell:hover { border-color: var(--gold-hi); background: linear-gradient(180deg, #3a3226 0%, #2a241a 100%); }
.cr-spell-cell.sel { border-color: var(--gold-hi); box-shadow: inset 0 0 10px rgba(255, 213, 74, 0.35); }
.cr-spell-cell.locked { opacity: 0.45; }
/* Level met but runes missing: dark and unclickable, like a locked spell. */
.cr-spell-cell.norunes { opacity: 0.45; filter: grayscale(0.85) brightness(0.8); }
.cr-spell-cell.locked:hover, .cr-spell-cell.norunes:hover { border-color: #5a5040; background: linear-gradient(180deg, #2e2820 0%, #221d16 100%); cursor: not-allowed; }
.cr-spell-cell .sp-icon { font-size: 20px; color: #9ad0ff; line-height: 1; }
.cr-spell-cell.small .sp-icon { font-size: 15px; }   /* Support fill: the smaller spell icon */
.cr-spell-cell.sel .sp-icon { color: var(--gold-hi); }
.cr-spell-cell .sp-name { font-size: 10px; line-height: 1.1; text-align: center; }
.cr-spell-cell .sp-lv { font-size: 10px; color: var(--gold-hi); }
#magic-info { margin-top: 6px; }

/* Floating HUD bits */
#toast, #action-busy, .xp-drop, #region-banner {
  background: var(--stone-grad);
  border: 2px solid var(--gold);
  box-shadow: 0 4px 14px rgba(0,0,0,0.55);
}
#toast { border-radius: 4px; }
#action-busy, .xp-drop { border-radius: 4px; }
#region-banner { border-radius: 6px; color: var(--ink); }
#region-name { font-family: Georgia, "Times New Roman", serif; color: var(--gold-hi); text-shadow: 2px 2px 3px #000; }
#region-desc { color: var(--parch); }
.xp-drop { color: var(--ink); }
.xp-drop .xp-skill { color: var(--parch-dim); }
#conn { color: var(--parch-dim); text-shadow: 1px 1px 0 #000; }
#hp-bar { border: 2px solid #000; box-shadow: 0 0 0 1px var(--gold-dim); border-radius: 3px; }
#hp-fill { background: linear-gradient(180deg, #2fc04a, #1c8a31); }
#hp-bar { background: #8a1414; }

/* Right-click menu: a dark box with a gold title */
#ctx-menu {
  background: rgba(28, 24, 18, 0.97);
  border: 2px solid var(--gold); border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.65);
}
#ctx-menu .ctx-title { color: var(--gold-hi); border-bottom-color: var(--gold-dim); }
#ctx-menu button {
  background: transparent; border: none; box-shadow: none; text-shadow: 1px 1px 0 #000;
  color: var(--ink); font-weight: normal; border-radius: 2px;
}
#ctx-menu button:hover, #ctx-menu button:active { background: rgba(212, 160, 23, 0.25); transform: none; }
#ctx-menu button.ctx-danger { color: #ff9a8a; }

/* World map */

/* Inventory slots: big icon, small name, the stack count in the corner */
#inv-grid .inv-slot, .slot-grid .inv-slot { position: relative; min-height: 50px; gap: 1px; }
#inv-grid .inv-ico, .slot-grid .inv-ico { font-size: 21px; line-height: 1; filter: drop-shadow(1px 1px 0 #000); }
#inv-grid .inv-item, .slot-grid .inv-item { font-size: 9.5px; line-height: 1.1; color: var(--parch); }
#inv-grid .inv-stack, .slot-grid .inv-stack { position: absolute; top: 2px; left: 4px; font-size: 11px; color: #ffff40; text-shadow: 1px 1px 0 #000; }
.cr-equip-slot.filled .cr-equip-icon { filter: drop-shadow(1px 1px 0 #000); }

/* ===== Item sprites (inline SVG, medieval style) ===== */
.mi { width: 100%; height: 100%; display: block; overflow: visible; }
#inv-grid .inv-ico, .slot-grid .inv-ico { width: 28px; height: 28px; opacity: 0.93; filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.55)); font-size: 0; }
.cr-equip-icon { width: 34px; height: 34px; display: inline-block; opacity: 0.92; }
.cr-equip-icon.empty { opacity: 0.28; filter: grayscale(1) brightness(1.5) sepia(0.35); }
.cr-equip-slot.filled .cr-equip-icon { opacity: 0.94; filter: drop-shadow(1px 1px 0 #000); }
.st-ico, .coin-ico { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; opacity: 0.92; }
#coins-row .coin-ico, .coins-row .coin-ico { width: 20px; height: 20px; vertical-align: -4px; }
.s-ico { display: inline-block; width: 24px; height: 24px; flex: none; opacity: 0.93; }

/* ===== Speech bubbles ===== */
#bubble-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.bubble {
  position: absolute; left: 0; top: 0; max-width: 190px;
  background: rgba(244, 234, 208, 0.95); color: #2a1e10;
  border: 2px solid #5a4630; border-radius: 10px;
  padding: 4px 9px; font: 600 13px/1.25 Georgia, "Times New Roman", serif; text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.45); white-space: normal; word-break: break-word;
  transition: opacity 0.4s;
}
.bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%);
  border: 8px solid transparent; border-top-color: #5a4630; border-bottom: 0;
}
.bubble::before {
  content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); z-index: 1;
  border: 6px solid transparent; border-top-color: rgba(244, 234, 208, 0.95); border-bottom: 0;
}
.bubble.out { opacity: 0; }

/* ===== Character creator (2026-10-29: per part) ===== */
.creator-card { width: min(96vw, 900px); }
.creator-body { display: flex; gap: 14px; align-items: flex-start; justify-content: center; }
.creator-preview { flex: none; width: 300px; text-align: center; }
#creator-canvas {
  width: 300px; height: 380px; display: block; cursor: grab; touch-action: none;
  background: radial-gradient(ellipse at 50% 40%, #4a4232 0%, #241f17 75%);
  border: 2px solid var(--gold-dim); border-radius: 6px;
}
.cc-side { flex: 1; min-width: 0; max-width: 270px; }
.cc-head { color: var(--gold-hi); font-weight: bold; font-family: Georgia, "Times New Roman", serif; text-align: center;
  margin: 2px 0 8px; text-shadow: 1px 1px 0 #000; letter-spacing: 0.05em; }
.cc-rows { display: flex; flex-direction: column; gap: 6px; }
.cc-row { display: flex; align-items: center; gap: 6px; }
.cc-val { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 38px;
  background: rgba(0, 0, 0, 0.25); border: 1px solid #3a2e1e; border-radius: 4px; }
.cc-label { color: var(--parch); font-size: 11px; font-weight: bold; font-family: Georgia, "Times New Roman", serif; opacity: 0.85; }
.cc-choice { color: var(--gold-hi); font-weight: bold; text-shadow: 1px 1px 0 #000; font-size: 13px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%; }
.cc-val .cc-swatch { width: 54px; height: 14px; border-radius: 3px; border: 1px solid #1b130a; margin-top: 2px; }
.cc-arrow { width: 36px; height: 38px; padding: 0; font-size: 14px; flex: none; }
.cc-seg { display: flex; gap: 6px; }
.cc-seg button { min-height: 44px; padding: 0 14px; }
.cc-seg button.active { background: var(--btn-grad-on); border-color: var(--gold-hi); color: #fff3c4; }
.cc-actions { margin-top: 12px; align-items: center; flex-wrap: wrap; }
.cc-actions button:not(.big-btn) { min-height: 44px; padding: 0 16px; }
.cc-actions .big-btn { flex: 1; margin: 0; min-width: 140px; }
.save-status { font-style: normal; color: #9ad08a; }
@media (max-width: 760px) {
  /* a phone: the preview on top, Design and Colour side by side under it */
  .creator-body { flex-wrap: wrap; gap: 8px; }
  .creator-preview { order: -1; width: 100%; display: flex; flex-direction: column; align-items: center; }
  .creator-preview, #creator-canvas { height: 230px; }
  #creator-canvas { width: 182px; }
  .cc-side { flex: 1 1 45%; max-width: none; }
  .cc-arrow { width: 30px; height: 34px; }
  .cc-val { min-height: 34px; }
  .cc-choice { font-size: 12px; }
  .creator-preview .hint { display: none; }
}

/* Line-art icons that replaced emoji */
#mute-btn svg, #map-btn .medieval-icon, #panel-toggle .medieval-icon { width: 24px; height: 24px; display: inline-block; vertical-align: middle; }
#map-btn .medieval-icon svg, #panel-toggle .medieval-icon svg { width: 100%; height: 100%; }
#map-btn { padding: 8px; line-height: 0; }
.xp-ico { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; }
.xp-ico svg { width: 100%; height: 100%; }
.cr-emote-icon, .cr-prayer-icon { width: 30px; height: 30px; margin: 0 auto; }
.cr-emote-icon svg, .cr-prayer-icon svg { width: 100%; height: 100%; }
.cr-spell-cell .sp-icon svg { width: 18px; height: 18px; }

/* ----- Run energy orb (beside the minimap) ----- */
#run-orb {
  --run: 100%;
  position: fixed; right: 158px; top: 132px; z-index: 901;
  width: 48px; height: 48px; border-radius: 50%; padding: 0;
  border: 2px solid #d4a017; box-shadow: 0 0 0 1px #000, 0 3px 10px rgba(0,0,0,0.55);
  background: linear-gradient(to top, #c9a227 var(--run), #2a241a var(--run));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; font: bold 13px/1 Georgia, "Times New Roman", serif;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}
#run-orb .run-icon { width: 20px; height: 20px; display: block; margin-bottom: 1px; }
#run-orb .run-icon svg { width: 20px; height: 20px; stroke: #fff; filter: drop-shadow(0 0 1px #000); }
#run-orb.off { background: linear-gradient(to top, #6b7a8c var(--run), #2a241a var(--run)); border-color: #8a8a8a; }
#run-orb.ex { background: linear-gradient(to top, #a33a2a var(--run), #2a1a16 var(--run)); border-color: #e05a3a;
  animation: run-ex 1.6s ease-in-out infinite; }
@keyframes run-ex { 50% { box-shadow: 0 0 0 1px #000, 0 0 14px rgba(224, 90, 58, 0.8); } }
@media (max-width: 640px) {
  #run-orb { right: 104px; top: 86px; width: 40px; height: 40px; font-size: 11px; }
  #run-orb .run-icon, #run-orb .run-icon svg { width: 16px; height: 16px; }
}

#autoret-btn.active { background: #2c5f8a; border-color: #7fd4ff; }

/* ----- Gravestone timer, Outlands depth, casting cursor ----- */
#grave-hud, #outlands-badge {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 902;
  padding: 4px 12px; border-radius: 4px; font: bold 13px Georgia, serif;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
#grave-hud { top: 10px; background: rgba(40, 30, 60, 0.92); color: #e0d0ff; border: 1px solid #9a86d8; cursor: pointer; }
#outlands-badge { top: 40px; background: rgba(70, 18, 12, 0.92); color: #ffd6c8; border: 1px solid #e05a3a; }
#grave-hud.hidden, #outlands-badge.hidden { display: none; }
.died-sub { color: #e8dcc0; max-width: 420px; margin: 8px auto 0; line-height: 1.4; }
body.casting #game-canvas, body.casting canvas { cursor: crosshair; }
.cr-spell-cell.util .sp-icon { color: #9fd4ff; }
.cr-prayer-cell.ward .cr-prayer-name { color: #9fd4ff; }

/* ---------- Phase C7: make-X, use mode, skill tooltip and guide ---------- */
.make-row { gap: 10px; }
.make-row .m-ico { width: 34px; height: 34px; flex: 0 0 34px; display: flex; align-items: center; justify-content: center; }
.make-row .m-ico svg { width: 34px; height: 34px; }
.make-row.locked .r-name { color: #8a8f99; }
.make-row .lvl-low { color: #ff7b6b; font-weight: bold; }
.make-row .have-no { color: #ff9a8a; }
#use-hint {
  position: fixed; left: 50%; top: 64px; transform: translateX(-50%);
  background: rgba(10, 16, 30, 0.9); border: 1px solid #c8a85a; color: #ffe9a0;
  font-size: 14px; padding: 6px 14px; border-radius: 16px; z-index: 61; pointer-events: none;
}
#skill-tip {
  position: fixed; z-index: 80; pointer-events: none; min-width: 180px; max-width: 260px;
  background: rgba(12, 16, 26, 0.96); border: 1px solid #5a4a2a; border-radius: 8px;
  padding: 8px 10px; color: #e8dcc0; font-size: 13px; line-height: 1.35;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}
#skill-tip b { color: #ffd54a; font-size: 14px; }
#skill-tip .tip-bar { height: 6px; background: #2a2a2a; border-radius: 3px; margin-top: 6px; overflow: hidden; }
#skill-tip .tip-bar span { display: block; height: 100%; background: linear-gradient(90deg, #c8a040, #ffd54a); }
.cr-skill-cell { cursor: pointer; }
/* Skill progression page: header (icon, level, XP bar, next unlock), then one section per level
   milestone, unlocked ones bright with a tick, locked ones dimmed with a padlock. */
.guide-card { --b-ico: 28px; --b-cell: 38px; width: min(96vw, 620px); max-height: 94vh; display: flex; flex-direction: column; position: relative; }
.gd-head { display: flex; align-items: center; gap: 12px; padding-right: 36px; }
.gd-ico { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #3a3226, #2a241a); border: 1px solid var(--gold-dim); border-radius: 6px; }
.gd-ico svg { width: 32px; height: 32px; }
.gd-head-text { flex: 1; min-width: 0; text-align: left; }
.gd-head-text h2 { margin: 0; text-align: left; }
.guide-sub { text-align: left; color: var(--parch-dim); font-size: 12.5px; margin: 2px 0 0; }
.gd-level { font-size: 28px; font-weight: bold; color: var(--gold-hi); line-height: 1; white-space: nowrap; }
.gd-level small { font-size: 13px; color: var(--parch-dim); margin-left: 3px; }
.gd-xp { margin: 10px 0 6px; }
.gd-bar { height: 10px; background: #161310; border: 1px solid #5a5040; border-radius: 5px; overflow: hidden; }
.gd-bar span { display: block; height: 100%; background: linear-gradient(90deg, #3a9a4a, #7ad46a); transition: width 0.3s; }
.gd-xp-text { font-size: 12px; color: var(--parch); margin-top: 3px; text-align: right; }
.gd-next { font-size: 13px; color: var(--parch); background: rgba(0, 0, 0, 0.25); border: 1px solid var(--gold-dim); border-radius: 4px; padding: 6px 8px; }
.gd-next:empty { display: none; }
.gd-next-k { font-weight: bold; color: var(--gold-hi); margin-right: 4px; }
.gd-togo { color: var(--parch-dim); }
.gd-filter { display: flex; gap: 6px; margin: 8px 0 4px; }
.gd-filter .mini-btn { min-height: 30px; padding: 0 12px; font-size: 13px; }
.gd-filter .mini-btn.on { background: #5a4a1a; border-color: #c8a85a; color: #ffe9a0; }
.q-filter { flex-wrap: wrap; justify-content: center; margin: 0 0 8px; }   /* the quest journal's three toggles: wrap on a narrow phone */
.q-filter .mini-btn { padding: 0 9px; min-height: 32px; }
.gd-list { flex: 1; min-height: 120px; overflow-y: auto; margin-bottom: 8px; }
.gd-ms { margin: 6px 0 2px; }
.gd-ms-head { display: flex; justify-content: space-between; align-items: center; padding: 3px 6px; border-radius: 3px;
  background: rgba(122, 212, 106, 0.12); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
.gd-ms.locked .gd-ms-head { background: rgba(0, 0, 0, 0.3); }
.gd-ms-lvl { font-weight: bold; color: var(--gold-hi); }
.gd-ms-state { color: #7ad46a; }
.gd-ms.locked .gd-ms-state { color: var(--parch-dim); }
.guide-row { display: flex; gap: 10px; padding: 5px 4px; border-bottom: 1px solid rgba(138, 106, 30, 0.25); font-size: 14px; align-items: center; }
.guide-row .g-cell { width: var(--b-cell); height: var(--b-cell); }
.guide-row .b-ico.medieval-icon-svg svg { width: 22px; height: 22px; }
.guide-row .g-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.guide-row .g-text { color: var(--ink); }
.guide-row .g-where { font-size: 11.5px; color: var(--parch-dim); margin-top: 1px; }
.guide-row .g-req { flex: none; width: 22px; text-align: center; color: #7ad46a; }
.guide-row.locked .g-text { color: #8a8f99; }
.guide-row.locked .g-cell { opacity: 0.5; filter: grayscale(0.7); }
.guide-row.locked .g-req { color: var(--parch-dim); }
@media (max-width: 560px) {
  .gd-level { font-size: 22px; }
  .guide-row { font-size: 13px; }
}

/* ---------- Phase C8: bank tabs, search, notes ---------- */
.bank-card { width: min(96vw, 560px); }
.bank-top { display: flex; justify-content: space-between; align-items: center; }
.bank-count { color: #9fb0cc; font-size: 13px; }
.bank-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0 6px; }
.bank-tabs button {
  min-width: 44px; height: 40px; border-radius: 8px 8px 2px 2px; border: 1px solid #2c3a55;
  background: #0d1220; color: #c8b890; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px;
}
.bank-tabs button.active { background: #2c3f5e; border-color: #c8a85a; color: #ffe9a0; }
.bank-tabs button svg { width: 24px; height: 24px; }
.bank-search {
  width: 100%; box-sizing: border-box; margin-bottom: 6px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid #2c3a55; background: #0d1220; color: #e8dcc0; font-size: 14px;
}
.bank-grid { grid-template-columns: repeat(6, 1fr); max-height: 34vh; overflow-y: auto; }
.bank-grid .tab-break { grid-column: 1 / -1; font-size: 11px; color: #8a7a4a; border-bottom: 1px solid #3a3020; padding-top: 4px; }
.bank-actions { flex-wrap: wrap; justify-content: center; }
.bank-actions button.on { background: #5a4a1a; border-color: #c8a85a; color: #ffe9a0; }
.h3-hint { font-size: 11px; color: #667; text-transform: none; letter-spacing: 0; }
.inv-ico.noted { position: relative; display: inline-flex; }
.inv-ico.noted::before {
  content: ''; position: absolute; inset: 2px 4px; background: #efe6c8; border: 1px solid #8a7a4a; border-radius: 2px; z-index: 0;
}
.inv-ico.noted svg { position: relative; z-index: 1; transform: scale(0.7); }

/* ---------- Phase C9: trade window ---------- */
.trade-card { width: min(96vw, 620px); }
.trade-cols { display: flex; gap: 10px; }
.trade-col { flex: 1; min-width: 0; }
.trade-col h3 { margin-top: 6px; }
.trade-grid { grid-template-columns: repeat(4, 1fr); min-height: 120px; background: rgba(0,0,0,0.18); border-radius: 8px; padding: 4px; }
.trade-val { color: #ffd54a; font-size: 12px; text-transform: none; letter-spacing: 0; }
.trade-warn { background: #4a1a14; border: 1px solid #c84a3a; color: #ffd0c0; border-radius: 8px; padding: 6px 10px; margin: 6px 0; text-align: center; font-weight: bold; }
.trade-card.confirm .trade-grid { border: 1px solid #c8a85a; }
#trade-ask {
  position: fixed; left: 50%; top: 104px; transform: translateX(-50%); z-index: 62;
  background: rgba(14, 18, 30, 0.95); border: 1px solid #c8a85a; color: #e8dcc0; border-radius: 12px;
  padding: 8px 12px; font-size: 14px; display: flex; gap: 8px; align-items: center;
}
#trade-ask button { min-height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid #c8a85a; background: #3a3020; color: #ffe9a0; font-weight: bold; cursor: pointer; }
.big-btn.danger { background: #4a1a14; border-color: #8a3a2a; }

/* ---------- Phase C9: the Tradekeep exchange ---------- */
/* Item icons use the store window's scale everywhere in this window (search results, offer
   slots, the chosen item, recent trades): a 28 px sprite, framed like a shop slot where it
   stands alone. Sizes are fixed in px and capped, so no viewport or SVG can blow them up. */
.bourse-card { --b-ico: 28px; --b-cell: 38px; width: min(96vw, 660px); max-height: 94vh; position: relative; overflow-y: auto; }
.bourse-sub { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 16px; font-size: 13px; color: var(--parch-dim); margin-bottom: 8px; }
.bourse-sub .coins-row { margin: 0; font-size: 15px; color: var(--gold-hi); }
.b-ico { display: inline-flex; align-items: center; justify-content: center; width: var(--b-ico, 28px); height: var(--b-ico, 28px);
  max-width: 28px; max-height: 28px; flex: none; overflow: hidden; filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.6)); }
.b-ico svg, .b-ico .mi { width: 100%; height: 100%; max-width: 28px; max-height: 28px; display: block; }
.b-cell { display: inline-flex; align-items: center; justify-content: center; flex: none; width: var(--b-cell); height: var(--b-cell);
  background: linear-gradient(180deg, #3a3226 0%, #2a241a 100%); border: 1px solid #5a5040; border-radius: 4px; box-sizing: border-box; }
.bourse-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 10px; }
.bourse-slot {
  display: flex; flex-direction: column; gap: 4px; min-height: 168px; padding: 8px;
  background: linear-gradient(180deg, #3a3226 0%, #2a241a 100%); border: 2px solid #5a5040; border-radius: 6px;
  color: var(--parch); font-size: 13px;
}
.bourse-slot.empty { align-items: center; justify-content: center; border-style: dashed; border-color: #6a5a3a; }
.bourse-slot .b-empty { color: var(--parch-dim); font-style: italic; margin-bottom: 8px; }
.bourse-slot .b-row { display: flex; gap: 6px; width: 100%; margin-top: auto; }
.bourse-slot .b-row button { flex: 1; min-height: 34px; font-size: 14px; }
.bourse-slot .b-buy { color: #a8f0a0; }
.bourse-slot .b-sell { color: #ffc890; }
.bourse-slot .b-top { display: flex; justify-content: space-between; align-items: center; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; }
.bourse-slot .b-kind { font-weight: bold; padding: 1px 6px; border-radius: 3px; background: #24402a; color: #a8f0a0; }
.bourse-slot.sell .b-kind { background: #4a2e1a; color: #ffc890; }
.bourse-slot .b-state { color: var(--parch-dim); }
.bourse-slot.done .b-state { color: #7ad46a; }
.bourse-slot.aborted .b-state { color: #ff8a7a; }
.bourse-slot .b-head { display: flex; gap: 6px; align-items: center; font-weight: bold; color: var(--gold-hi); min-width: 0; }
.bourse-slot .b-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bourse-slot .b-line { display: flex; justify-content: space-between; font-size: 12.5px; }
.bourse-slot .b-line b { color: var(--ink); }
.bourse-slot .b-bar { height: 8px; background: #161310; border: 1px solid #5a5040; border-radius: 4px; overflow: hidden; }
.bourse-slot .b-bar span { display: block; height: 100%; background: linear-gradient(90deg, #c87a1a, #ffb84a); }
.bourse-slot.done .b-bar span { background: linear-gradient(90deg, #3a9a4a, #7ad46a); }
.bourse-slot.aborted .b-bar span { background: #8a3a2a; }
.bourse-slot .b-collect { font-size: 11.5px; color: var(--gold-hi); min-height: 15px; }
.bourse-slot .b-abort { color: #ffb0a0; }
.bourse-form { margin: 2px 0 10px; }
.bf-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.bf-head h3 { flex: 1; margin: 0; border: none; }
.bf-head .mini-btn, .bf-item .mini-btn { min-height: 32px; padding: 0 10px; }
.bf-hint { color: var(--parch-dim); font-size: 13px; padding: 6px 2px; }
.bf-warn { color: #ff9a7a; }
.bf-pick .bank-search { width: 100%; box-sizing: border-box; }
.bourse-results { max-height: min(46vh, 320px); overflow-y: auto; margin-top: 6px; }
.bourse-result { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 3px 6px; border-bottom: 1px solid rgba(138, 106, 30, 0.35); cursor: pointer; }
.bourse-result:hover { background: rgba(255, 213, 74, 0.08); }
.bourse-result .r-name { flex: 1; min-width: 0; color: var(--ink); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bourse-result .r-sale { color: #a8d890; font-size: 12px; white-space: nowrap; }
.bourse-result .r-sale.none { color: var(--parch-dim); }
.bourse-result .r-guide { color: var(--gold-hi); font-size: 12.5px; white-space: nowrap; min-width: 64px; text-align: right; }
.bf-book { margin: 10px 0 0; padding: 6px 8px; font-size: 12.5px; color: var(--parch); background: rgba(0, 0, 0, 0.22); border-radius: 4px; }
.bf-book .bf-fill { margin-top: 3px; color: #ffc890; }
.bf-book .bf-fill.all { color: #7ad46a; }
.bourse-history { margin: -2px 0 10px; padding: 6px 8px; background: rgba(0, 0, 0, 0.22); border-radius: 4px; }
.bourse-history .bh-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--parch-dim); margin-bottom: 4px; }
.bourse-history .bh-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--parch); padding: 1px 0; }
.bourse-history .bh-kind { font-weight: bold; min-width: 52px; }
.bourse-history .bh-kind.buy { color: #a8f0a0; }
.bourse-history .bh-kind.sell { color: #ffc890; }
.bourse-history .bh-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bourse-history .bh-price { color: var(--gold-hi); white-space: nowrap; }
#bourse-place:disabled { opacity: 0.55; cursor: wait; }
.bourse-pack { grid-template-columns: repeat(7, 46px); grid-auto-rows: 46px; gap: 4px; justify-content: center; margin-top: 4px; }
.bourse-pack .shop-cell .inv-ico { margin-bottom: 0; }
.bf-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--gold-dim); border-radius: 4px; background: rgba(0, 0, 0, 0.25); }
.bf-item-text { flex: 1; min-width: 0; }
.bf-name { font-weight: bold; color: var(--gold-hi); font-size: 16px; }
.bf-sub { font-size: 12px; color: var(--parch-dim); }
.bf-row { display: grid; grid-template-columns: 92px 1fr; gap: 6px 10px; align-items: center; margin-top: 10px; }
.bf-row label { color: var(--parch); font-size: 14px; }
.bf-row input { padding: 8px; border-radius: 4px; border: 1px solid var(--gold-dim); background: #161310; color: var(--ink); font-size: 16px; min-width: 0; }
.bf-btns { grid-column: 2; display: flex; gap: 6px; flex-wrap: wrap; }
.bf-btns .mini-btn { flex: 1; min-height: 34px; min-width: 56px; font-size: 14px; }
.bf-total { margin: 12px 0 8px; font-size: 15px; color: var(--parch); text-align: center; }
.bf-total b { color: var(--gold-hi); }
.bourse-card #bourse-place { margin-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 560px) {
  .bourse-card { padding: 12px 10px; }
  .bourse-slots { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .bourse-slot { min-height: 150px; padding: 6px; font-size: 12px; }
  .bourse-pack { grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: auto; }
  .bourse-pack .shop-cell { aspect-ratio: 1; }
  .bf-row { grid-template-columns: 78px 1fr; }
}

/* ---------- Phase C11: quest journal ---------- */
.q-points { font-weight: bold; color: #ffd54a; text-align: center; padding: 4px 0 8px; border-bottom: 1px solid #3a3020; margin-bottom: 6px; }
.quest { cursor: pointer; }
.q-qp { font-size: 11px; color: #ffd54a; border: 1px solid #6a5a2a; border-radius: 6px; padding: 0 5px; margin-left: 4px; }
.q-diff { font-size: 11px; color: #9fb0cc; margin-left: 4px; }
.q-reqs { display: flex; flex-direction: column; gap: 2px; font-size: 12px; margin-top: 4px; }
.q-reqs .met { color: #7ad46a; }
.q-reqs .unmet { color: #ff8a7a; }
.q-unlock { font-size: 12px; color: #c8b890; margin-top: 4px; font-style: italic; }

/* ---------- World map: full screen; the key and your waypoints on the left, the map on the right ---------- */
#map-overlay { background: #0c0906; padding: 0; }
.map-shell {
  position: relative; display: flex; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden;
  background: #0c0906; color: var(--ink);
}
.map-side {
  flex: 0 0 272px; width: 272px; display: flex; flex-direction: column; min-height: 0; z-index: 3;
  background: linear-gradient(180deg, #2f271c 0%, #241e16 45%, #1a1510 100%);
  border-right: 2px solid var(--gold); box-shadow: 4px 0 22px rgba(0, 0, 0, 0.65), inset -1px 0 0 rgba(255, 213, 74, 0.15);
}
.map-side-head {
  padding: 14px 16px 10px; border-bottom: 1px solid rgba(212, 160, 23, 0.35);
  background: radial-gradient(ellipse 120% 90% at 50% 0%, rgba(255, 128, 32, 0.22), transparent 70%);
}
.map-side-head h2 {
  margin: 0; font: bold 21px Georgia, "Times New Roman", serif; letter-spacing: 0.5px; color: var(--gold-hi);
  text-shadow: 0 0 12px rgba(255, 140, 40, 0.45), 2px 2px 2px #000;
}
.map-where { margin-top: 3px; font-size: 12px; color: var(--parch-dim); font-style: italic; min-height: 15px; }
.map-filter-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px 8px 16px;
  border-bottom: 1px solid rgba(212, 160, 23, 0.25); background: rgba(0, 0, 0, 0.22);
}
.map-filter-state { font-size: 12px; color: var(--parch); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-filter-state b { color: var(--gold-hi); }
.map-clear, .map-wp-box .wb, .map-side-toggle, .map-tools button {
  font: bold 12px Georgia, serif; color: var(--gold-hi); cursor: pointer; border: 1px solid var(--gold); border-radius: 5px;
  background: linear-gradient(180deg, #5a4a30, #3a2f20); box-shadow: inset 0 1px 0 rgba(255, 220, 140, 0.18), 0 1px 3px rgba(0, 0, 0, 0.6);
}
.map-clear { flex: 0 0 auto; padding: 4px 9px; }
.map-clear:disabled { color: #8a7a5a; border-color: #5a4a2a; background: #2a2218; box-shadow: none; cursor: default; }
.map-clear:not(:disabled):hover, .map-wp-box .wb:hover, .map-side-toggle:hover, .map-tools button:hover { filter: brightness(1.2); }
.map-side-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 8px 12px; scrollbar-width: thin; scrollbar-color: #6a5430 transparent; }
.map-side-scroll::-webkit-scrollbar { width: 8px; }
.map-side-scroll::-webkit-scrollbar-thumb { background: #5a4628; border-radius: 4px; }

/* The key: one group a kind of place, opened and closed like an accordion. */
.map-group { margin: 6px 0; border: 1px solid rgba(212, 160, 23, 0.25); border-radius: 6px; background: rgba(0, 0, 0, 0.2); overflow: hidden; }
.map-group-head {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; cursor: pointer; text-align: left;
  font: bold 13px Georgia, serif; letter-spacing: 0.3px; color: var(--gold-hi); background: linear-gradient(180deg, #3d3223, #2b2319);
}
.map-group-head:hover { background: linear-gradient(180deg, #4a3d2a, #33291d); }
.map-group-head .chev { display: inline-block; width: 10px; color: var(--gold); transition: transform 0.18s ease; }
.map-group.open .map-group-head .chev { transform: rotate(90deg); }
.map-group-head .gn { margin-left: auto; font: normal 11px sans-serif; color: var(--parch-dim); }
.map-group.has-on .map-group-head { color: #fff0c8; text-shadow: 0 0 8px rgba(255, 160, 50, 0.6); }
.map-group-body { display: none; padding: 4px; }
.map-group.open .map-group-body { display: block; }
.map-type {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 4px 8px; margin: 1px 0; cursor: pointer; text-align: left;
  font: 13px Georgia, serif; color: var(--parch); background: transparent; border: 1px solid transparent; border-radius: 5px;
  transition: background 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.map-type img { width: 22px; height: 22px; flex: 0 0 22px; }
.map-type .n { margin-left: auto; min-width: 18px; text-align: center; font: 11px sans-serif; color: var(--parch-dim); background: rgba(0, 0, 0, 0.35); border-radius: 8px; padding: 1px 6px; }
.map-type:hover { background: rgba(212, 160, 23, 0.13); }
.map-type.all { font-style: italic; color: var(--parch-dim); }
.map-type.on {
  color: #fff3d0; border-color: var(--gold); background: linear-gradient(90deg, rgba(255, 140, 40, 0.32), rgba(212, 160, 23, 0.08));
  box-shadow: 0 0 12px rgba(255, 150, 40, 0.4), inset 0 0 10px rgba(255, 180, 60, 0.15);
}
.map-type.on img { filter: drop-shadow(0 0 5px rgba(255, 190, 80, 0.95)); }
.map-type.on .n { color: var(--gold-hi); }

/* Your waypoint */
.map-wps { margin-top: 12px; border-top: 1px solid rgba(212, 160, 23, 0.3); padding-top: 8px; }
.map-wps-head { padding: 0 4px 6px 6px; }
.map-wps-head h3 { margin: 0; font: bold 14px Georgia, serif; color: var(--gold-hi); letter-spacing: 0.3px; }
.map-wp-box {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px;
  border: 1px solid rgba(212, 160, 23, 0.35); background: rgba(0, 0, 0, 0.25);
}
.map-wp-box.none { display: block; padding: 6px 8px; font-size: 12px; line-height: 1.45; color: var(--parch-dim); font-style: italic; border-color: rgba(212, 160, 23, 0.2); }
.map-wp-box.hl { border-color: var(--gold-hi); box-shadow: 0 0 12px rgba(255, 170, 60, 0.5); }
.map-wp-box img { width: 22px; height: 22px; flex: 0 0 22px; }
.map-wp-box .wn { flex: 1; min-width: 0; }
.map-wp-box .wt { display: block; font: bold 13px Georgia, serif; color: var(--parch); }
.map-wp-box .wd { display: block; font-size: 11px; color: var(--parch-dim); }
.map-wp-box .wb { flex: 0 0 auto; padding: 4px 8px; }
.map-side-foot { padding: 8px 12px 10px; font-size: 11px; line-height: 1.45; color: var(--parch-dim); text-align: center; border-top: 1px solid rgba(212, 160, 23, 0.2); }

/* The map itself */
.map-main { position: relative; flex: 1; min-width: 0; min-height: 0; }
.map-main::after {   /* an ember vignette round the edge */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 70px rgba(10, 5, 0, 0.75), inset 0 0 18px rgba(255, 120, 30, 0.12);
}
#world-map { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; background: #1a1814; }
#world-map.dragging { cursor: grabbing; }
#map-close { top: 12px; right: 14px; width: 34px; height: 34px; font-size: 17px; z-index: 4; }
.map-tools { position: absolute; top: 60px; right: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 4; }
.map-tools button { width: 34px; height: 34px; padding: 0; font-size: 18px; }
#map-tip {
  position: absolute; z-index: 5; pointer-events: none; white-space: normal; max-width: 260px; font-size: 12px; padding: 5px 10px;
  color: var(--parch); background: rgba(20, 14, 8, 0.95); border: 1px solid var(--gold); border-radius: 5px; line-height: 1.35;
  box-shadow: 0 0 12px rgba(255, 140, 40, 0.25), 0 3px 10px rgba(0, 0, 0, 0.6);
}
#map-tip .mt-kind { color: var(--parch-dim); font-size: 11px; }
#map-tip .mt-detail { color: #e8dcc0; font-size: 11px; margin-top: 2px; }
.map-side-toggle { display: none; position: absolute; top: 12px; left: 12px; z-index: 4; padding: 7px 12px; font-size: 13px; }

/* Phones and narrow windows: the key slides in over the map. */
@media (max-width: 760px) {
  .map-side {
    position: absolute; left: 0; top: 0; bottom: 0; width: min(86vw, 300px); transform: translateX(-104%);
    transition: transform 0.22s ease; z-index: 6;
  }
  .map-shell.side-open .map-side { transform: none; }
  .map-side-toggle { display: block; }
  .map-shell.side-open .map-side-toggle { display: none; }
  .map-side-head h2 { font-size: 18px; }
  .map-tools button, #map-close { width: 40px; height: 40px; }
  .map-tools { top: 64px; }
}

/* Shop window: the shop's 40 slots (5 rows of 8) beside your 28-slot pack, no scrolling.
   On a narrow screen the pack goes underneath, 7 across. */
.shop-card { --cell: 48px; width: auto; max-width: 96vw; max-height: 96vh; padding: 14px 18px; position: relative; }
.shop-card h2 { margin-bottom: 2px; }
.shop-card h3 { margin: 4px 0 6px; font-size: 14px; }
.shop-sub { display: flex; justify-content: center; align-items: center; gap: 18px; font-size: 14px; }
.shop-sub .coins-row { margin: 0; }
#shop-refresh { color: var(--parch-dim); font-size: 12.5px; cursor: help; }
.shop-card .qty-row { margin: 6px 0 4px; }
.shop-card .qty { min-height: 36px; min-width: 46px; }
.shop-panes { display: flex; gap: 16px; align-items: flex-start; justify-content: center; }
.shop-grid, .pack-grid { display: grid; gap: 4px; }
.shop-grid { grid-template-columns: repeat(8, var(--cell)); grid-auto-rows: var(--cell); }
.pack-grid { grid-template-columns: repeat(4, var(--cell)); grid-auto-rows: var(--cell); }
.slot-grid .shop-cell { min-height: 0; padding: 0; cursor: pointer; user-select: none; }
.slot-grid .shop-cell.empty { cursor: default; opacity: 0.45; }
.slot-grid .shop-cell.out .inv-ico { opacity: 0.35; }
.slot-grid .shop-cell .inv-ico { width: 60%; height: 60%; margin-bottom: 8px; }
.shop-cell .c-price {
  position: absolute; left: 0; right: 0; bottom: 1px;
  font-size: 10px; line-height: 1; color: var(--gold-hi); text-shadow: 1px 1px 0 #000; text-align: center;
}
.shop-info {
  display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 8px 0 6px; padding: 4px 8px;
  border: 1px solid var(--gold-dim); border-radius: 4px; background: rgba(0, 0, 0, 0.25);
}
#shop-info-text { flex: 1; font-size: 13.5px; color: var(--parch); text-align: left; }
#shop-act { min-width: 82px; min-height: 34px; }
.shop-card #shop-close { margin-top: 0; padding: 6px 0; font-size: 17px; }
@media (max-width: 699px) {
  .shop-card { --cell: min(46px, calc((100vw - 64px) / 8)); padding: 12px 10px; }
  .shop-panes { flex-direction: column; align-items: center; gap: 4px; }
  .pack-grid { grid-template-columns: repeat(7, var(--cell)); }
  .shop-cell .c-price { font-size: 9px; }
}

/* ---------- Dungeon entrance: intensities ---------- */
.dungeon-card { width: min(96vw, 640px); max-height: 94vh; overflow-y: auto; position: relative; }
.dg-title { display: flex; align-items: center; justify-content: center; gap: 10px; }
.dg-ico { display: inline-flex; width: 30px; height: 30px; flex: none; }
.dg-ico svg { width: 100%; height: 100%; }
.dg-desc { font-size: 13.5px; color: var(--parch); text-align: center; margin: 0 0 10px; }
.dg-ints { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.dg-int { padding: 8px 10px; border: 2px solid #5a5040; border-radius: 6px; background: linear-gradient(180deg, #3a3226, #2a241a); }
.dg-int.locked { opacity: 0.6; }
.dg-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dg-badge { font-weight: bold; padding: 1px 8px; border-radius: 3px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; }
.dg-i1 .dg-badge { background: #24402a; color: #a8f0a0; }
.dg-i2 .dg-badge { background: #4a3a14; color: #ffd890; }
.dg-i3 .dg-badge { background: #4a1a14; color: #ffb0a0; }
.dg-lv { color: var(--gold-hi); font-size: 13px; font-weight: bold; }
.dg-text { font-size: 12.5px; color: var(--parch); margin: 4px 0; }
.dg-facts { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.dg-facts span { background: rgba(0, 0, 0, 0.3); border-radius: 3px; padding: 1px 6px; color: var(--parch); }
.dg-mons { font-size: 11.5px; color: var(--parch-dim); margin-top: 4px; }
.dg-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.dg-req.ok { color: #7ad46a; font-size: 12.5px; }
.dg-req.no { color: #ff9a7a; font-size: 12.5px; }
.dg-go { min-height: 34px; min-width: 90px; font-size: 14px; }
.dg-go:disabled { opacity: 0.5; cursor: not-allowed; }

/* The staff crown before an admin's name in chat, private messages and the friends list. */
img.crown { width: 17px; height: 14px; vertical-align: -2px; margin-right: 3px; image-rendering: auto; }

/* Quest page: the journal's detail view (built like the skill guide page). Tasks you have done are
   ticked and struck through, the current one is highlighted with its progress. */
.quest-card .gd-head { margin-bottom: 4px; }
.qd-state { font-size: 13px; font-weight: bold; white-space: nowrap; padding: 4px 10px; border-radius: 12px; border: 1px solid var(--gold-dim); color: var(--parch); }
.qd-state.active { color: #ffd54a; border-color: #c8a85a; background: rgba(200, 168, 90, 0.12); }
.qd-state.done { color: #7ad46a; border-color: #4a8a3a; background: rgba(122, 212, 106, 0.12); }
.qd-body { padding-right: 4px; }
.qd-desc { color: var(--parch); font-style: italic; font-size: 13.5px; line-height: 1.4; margin: 4px 0 6px; }
.qd-sec { margin: 10px 0 4px; padding: 3px 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.3); color: var(--gold-hi);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; display: flex; justify-content: space-between; }
.qd-count { color: var(--parch-dim); }
.qd-start { display: flex; align-items: center; gap: 8px; padding: 4px; font-size: 14px; color: var(--ink); }
.qd-start-text { flex: 1; min-width: 0; }
.qd-start b { color: #9fd4ff; }
.qd-start .mini-btn { flex: none; min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.qd-req { font-size: 13.5px; padding: 2px 4px; }
.qd-req.met { color: #7ad46a; }
.qd-req.unmet { color: #ff8a6a; }
.qd-mark { display: inline-block; width: 20px; }
.qd-steps { list-style: none; margin: 0; padding: 0; }
.qd-step { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid rgba(138, 106, 30, 0.25); font-size: 14px; color: #b8b0a0; }
.qd-check { flex: none; width: 20px; height: 20px; border: 1px solid #5a5040; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; background: #161310; }
.qd-step-text { flex: 1; min-width: 0; }
.qd-step.done { color: #7f8a78; }
.qd-step.done .qd-step-text { text-decoration: line-through; text-decoration-color: rgba(122, 212, 106, 0.7); }
.qd-step.done .qd-check { color: #7ad46a; border-color: #4a8a3a; background: rgba(122, 212, 106, 0.15); }
.qd-step.current { color: var(--ink); background: rgba(255, 213, 74, 0.08); }
.qd-step.current .qd-check { color: #ffd54a; border-color: #c8a85a; }
.qd-prog { flex: none; color: var(--gold-hi); font-weight: bold; font-size: 13px; }
.qd-step.done .qd-prog { color: #7f8a78; font-weight: normal; }
.qd-rewards { display: flex; flex-direction: column; gap: 2px; }
.qd-rw { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); padding: 3px 4px; }
.qd-rw-ico { width: 26px; height: 26px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.qd-rw-ico svg { width: 24px; height: 24px; }
.qd-unlock { color: #ffe9a0; }
.quest { cursor: pointer; }

/* Inventory drag and drop: the item follows the pointer; the slot it leaves is dimmed, the one under it lit. */
.inv-drag-ghost {
  position: fixed; z-index: 9999; pointer-events: none;
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(40, 32, 20, 0.85); border: 2px solid var(--gold, #c9a227); border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6); opacity: 0.92;
}
.inv-drag-ghost svg, .inv-drag-ghost img { width: 34px; height: 34px; }
.cr-inv-slot.drag-from { opacity: 0.35; }
.cr-inv-slot.drag-over { outline: 2px solid var(--gold-hi, #ffd54a); outline-offset: -2px; }
.cr-inv-slot { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }

/* Music track list (Settings) */
.cr-music-track { padding: 2px 4px; font-size: 13px; }
.cr-music-track.unlocked { color: #7ee787; }
.cr-music-track.locked { color: #f47067; opacity: 0.75; }
.cr-music-diag {
  margin-top: 4px; padding: 6px; border-radius: 4px; background: rgba(0, 0, 0, 0.35);
  font: 11px/1.35 ui-monospace, Menlo, Consolas, monospace; color: #d8cfb8;
  white-space: pre-wrap; word-break: break-word; user-select: text; -webkit-user-select: text;
}

/* The Queen's Silent Court (2026-11-10): the crystal's vision. A veil darkens the edges of the view (the world shows
   through, the makers rising over the forge) and each line comes up in a band at the foot of the screen. Clicks
   pass through: the server holds you still while it lasts. */
#court-vision { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
#court-vision.hidden { display: none; }
#court-vision .cv-veil { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 42%, rgba(10, 6, 18, 0) 38%, rgba(10, 6, 18, 0.78) 100%); }
#court-vision .cv-band { position: absolute; left: 50%; bottom: max(9vh, 84px); transform: translateX(-50%); width: min(720px, calc(100vw - 32px));
  padding: 14px 18px; border-radius: 10px; background: rgba(14, 10, 22, 0.78); border: 1px solid rgba(201, 162, 39, 0.55);
  box-shadow: 0 0 28px rgba(138, 74, 216, 0.35); }
#court-vision .cv-line { color: #f2e8d8; font: italic 17px/1.45 Georgia, 'Times New Roman', serif; text-align: center; opacity: 0; text-shadow: 0 1px 2px #000; }
#court-vision .cv-line.in { animation: cv-in 0.9s ease forwards; }
@keyframes cv-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) { #court-vision .cv-line { font-size: 15px; } #court-vision .cv-band { bottom: max(18vh, 120px); padding: 10px 12px; } }

/* =====================================================================================================
   Popup theme (2026-11-12): one dark-wood-and-gold look for every surface where the UI pops up.
   Panels are dark wood (CSS-drawn planks and grain, no images) in a gold double frame: the outer bright
   gold is each panel's own border, the inner darker bronze line an inset shadow, a soft drop shadow lifts
   the panel off the world. Grid cells are recessed squares; coins sit in a framed chip; buttons are chunky
   and gold-bordered, primary actions filled gold-brown.

   The shared pieces, consumed by every popup (index.html and game.js put the classes on):
     .cr-pop   a panel: overlays' cards, modal boxes, the side panel, the right-click menu, the front door
     .cr-tip   a notice: toasts, XP drops, banners, tooltips, the trade request, HUD badges
     .cr-well  a recessed area inside a panel: trays, info boxes, offer slots, intensity cards
     .cr-cell  a recessed grid cell: inventory, bank, shop, trade, spellbook, devotions, emotes, skills, gear
     .cr-chip  a small framed counter: the coins (or glass shards) of the inventory, bank, shop, Tradekeep
   Buttons, tabs, inputs, the close (x) button, headers and dividers are themed by their existing classes.

   Paint only: colours, gradients, borders' colours, radii and shadows. No sizes, paddings, margins or
   border widths change (the chip's padding is the one exception, its border taking the place of padding),
   so every grid, click target and window keeps its exact layout. The primitives carry :not(#_) (it matches
   every element and weighs as an id), so they outrank the older per-id rules above without !important.
   ===================================================================================================== */
:root {
  --cr-popup-theme: wood-gold-1;
  --wood-hi: #5a3c22;
  --wood: #3f2816;
  --wood-lo: #2b1a0d;
  --wood-deep: #170e06;
  --wood-grad: linear-gradient(180deg, #553820 0%, #412917 34%, #34200f 72%, #2a190b 100%);
  --wood-grain: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 3px, rgba(0, 0, 0, 0.05) 3px 4px, rgba(0, 0, 0, 0) 4px 9px, rgba(255, 214, 150, 0.025) 9px 10px, rgba(0, 0, 0, 0) 10px 17px);
  --wood-planks: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 61px, rgba(0, 0, 0, 0.32) 61px 62px, rgba(255, 210, 150, 0.06) 62px 63px, rgba(0, 0, 0, 0) 63px 64px);
  --frame-gold: #d9a73b;
  --frame-gold-hi: #ffd66b;
  --frame-bronze: #7d5422;
  --frame-gap: #170d05;
  --frame-inner: inset 0 0 0 1px var(--frame-gap), inset 0 0 0 2px var(--frame-bronze);
  --pop-drop: 0 0 0 1px rgba(0, 0, 0, 0.85), 0 10px 28px rgba(0, 0, 0, 0.6);
  --cell-fill: linear-gradient(180deg, #100904 0%, #1b1108 45%, #23170b 100%);
  --cell-edge: #4b3216;
  --cell-sunk: inset 0 2px 5px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(150, 104, 40, 0.24), 0 1px 0 rgba(255, 214, 150, 0.07);
  --count: #ffd84a;
  --divider: rgba(125, 84, 34, 0.55);
  /* Buttons: the older button rules read these, so every button family follows. */
  --btn-grad: linear-gradient(180deg, #6e4a27 0%, #50331b 52%, #3c2512 100%);
  --btn-grad-hi: linear-gradient(180deg, #80592f 0%, #603f21 52%, #482d16 100%);
  --btn-grad-on: linear-gradient(180deg, #a87a2c 0%, #7c5419 100%);
  --btn-gold: linear-gradient(180deg, #c3933a 0%, #8f6420 50%, #654312 100%);
  --btn-gold-hi: linear-gradient(180deg, #d6a748 0%, #a07328 50%, #745016 100%);
  /* The older theme's names, retuned to the wood so anything still reading them matches. */
  --stone-grad: var(--wood-grad);
  --gold: var(--frame-gold);
  --gold-dim: var(--frame-bronze);
}

/* ---------- Panels ---------- */
.cr-pop:not(#_) {
  background-color: var(--wood);
  background-image: var(--wood-planks), var(--wood-grain), var(--wood-grad);
  border-color: var(--frame-gold);
  border-radius: 7px;
  box-shadow: var(--frame-inner), inset 0 0 28px rgba(0, 0, 0, 0.42), var(--pop-drop);
  color: var(--ink);
  scrollbar-color: #8a6326 rgba(0, 0, 0, 0.3);
}
/* The side panel's tab strip and icon row cover its edges, so its inner line is drawn over them. */
#side-panel.cr-pop::after {
  content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  border-radius: 4px; box-shadow: var(--frame-inner);
}
/* Panels docked to a screen edge (the world map's key, the front door's drawers): the frame on the open edge only. */
#map-side.cr-pop:not(#_) { border-radius: 0; box-shadow: inset -1px 0 0 var(--frame-gap), inset -2px 0 0 var(--frame-bronze), 4px 0 22px rgba(0, 0, 0, 0.65); }
.fd-drawer.cr-pop:not(#_) {
  border-radius: 0; border-left-color: var(--frame-gold);
  box-shadow: inset 1px 0 0 var(--frame-gap), inset 2px 0 0 var(--frame-bronze), -6px 0 24px rgba(0, 0, 0, 0.7);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.fd-card.cr-pop:not(#_) { border-color: var(--frame-gold); backdrop-filter: none; -webkit-backdrop-filter: none; }

/* Headers: the game's gold display style, a fine gold rule beneath the title. */
.cr-pop h2, .cr-pop .fd-drawer-title, .login-card.cr-pop h1 {
  color: var(--frame-gold-hi);
  text-shadow: 0 1px 0 #2a1406, 0 2px 4px rgba(0, 0, 0, 0.85), 0 0 12px rgba(255, 180, 60, 0.22);
}
/* The rule is the title's own background (no positioning, no pseudo-element), so nothing new stacks over the
   close button or takes a tap: click targets stay exactly as they were. */
.cr-pop > h2 {
  background: linear-gradient(90deg, transparent, var(--frame-bronze) 15%, var(--frame-gold-hi) 50%, var(--frame-bronze) 85%, transparent)
    no-repeat center bottom / min(240px, 64%) 1px;
}
.cr-pop .fight-title, .cr-pop .cc-head, .modal-box.cr-pop h3 { color: var(--frame-gold-hi); }
.cr-pop h3 { color: #ecc777; border-bottom-color: var(--divider); }
.modal-box.cr-pop h3 { color: var(--frame-gold-hi); text-shadow: 0 1px 0 #2a1406, 0 2px 4px rgba(0, 0, 0, 0.85); }
.cr-pop .fight-title, .cr-pop .cc-head { text-shadow: 1px 1px 0 #1a0d04, 0 0 8px rgba(255, 180, 60, 0.18); }

/* Dividers and quiet text in the bronze family. */
.cr-pop .shop-row, .cr-pop .skill-row, .cr-pop .friend-row, .cr-pop .block-row, .cr-pop .recipe-row,
.cr-pop .guide-row, .cr-pop .qd-step, .cr-pop .bourse-result { border-bottom-color: var(--divider); }
.cr-pop .bank-count, .cr-pop .h3-hint, .cr-pop .q-diff { color: var(--parch-dim); }
.cr-pop .sel-name { color: var(--ink); }
/* Dimmed text (locked unlocks and recipes, finished quest steps, "Empty") stays dimmer than the rest but readable on
   the wood: 4.8-5.3 : 1 instead of the stone theme's greys (2.8-4.2 : 1 here). */
.cr-pop .guide-row.locked .g-text, .cr-pop .make-row.locked .r-name { color: #a8a090; }
.cr-pop .qd-step.done, .cr-pop .qd-step.done .qd-prog { color: #9aa492; }
.cr-pop .inv-empty, .cr-pop .friends-empty, .cr-pop .shop-empty { color: var(--parch-dim); }
.cr-pop .qty-row { color: var(--parch); }
.cr-pop .bank-grid .tab-break { color: var(--parch-dim); border-bottom-color: var(--divider); }

/* The close (x) button: a little framed wooden square with a gold cross. */
.overlay-x:not(#_) {
  background: linear-gradient(180deg, #5c3b1f 0%, #3a2411 100%);
  border-color: var(--frame-gold);
  color: var(--frame-gold-hi);
  box-shadow: inset 0 0 0 1px #6b461c, inset 0 1px 0 rgba(255, 220, 150, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.5);
  text-shadow: 0 1px 0 #000, 0 0 6px rgba(255, 190, 80, 0.35);
}
.overlay-x:not(#_):hover { background: linear-gradient(180deg, #74502a 0%, #4a3017 100%); border-color: var(--frame-gold-hi); color: #fff3c4; }

/* ---------- Notices: toasts, XP drops, banners, tooltips ---------- */
.cr-tip:not(#_) {
  background-color: var(--wood-lo);
  background-image: var(--wood-grain), linear-gradient(180deg, #4b311b 0%, #35210f 100%);
  border-color: var(--frame-gold);
  box-shadow: inset 0 0 0 1px var(--frame-gap), inset 0 0 0 2px rgba(125, 84, 34, 0.85), 0 0 0 1px rgba(0, 0, 0, 0.8), 0 6px 16px rgba(0, 0, 0, 0.55);
  color: var(--ink);
}
#toast.cr-tip:not(#_), #action-busy.cr-tip:not(#_), #crucible-hud.cr-tip:not(#_) { color: var(--frame-gold-hi); }
#use-hint.cr-tip:not(#_) { color: #ffe9a0; }
/* Badges keep their warning colour in the frame: the boss's red, the gravestone's ghostly violet, the Outlands' ember. */
#boss-banner.cr-tip:not(#_) { border-color: #e0503a; color: #ffc4b4; }
#grave-hud.cr-tip:not(#_) { color: #e6d8ff; }
#outlands-badge.cr-tip:not(#_) { border-color: #e0703a; color: #ffd6c8; }
#crucible-hud .crucible-label { font-size: 12px; letter-spacing: 1px; color: #f0a860; }
#crucible-hud .crucible-sub { font-size: 12px; color: var(--parch); }
#crucible-hud .mini-btn { margin-top: 4px; }

/* ---------- Recessed areas ---------- */
.cr-well:not(#_) {
  background-color: rgba(14, 8, 3, 0.45);
  background-image: none;
  border-color: #5e3f1a;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(150, 104, 40, 0.16), 0 1px 0 rgba(255, 214, 150, 0.06);
}
.bourse-slot.cr-well:not(#_) { background-color: rgba(14, 8, 3, 0.38); }
.bourse-slot.empty.cr-well:not(#_) { border-color: #6e4c22; }
.dg-int.cr-well:not(#_) { background-color: rgba(14, 8, 3, 0.4); }
/* Wells that keep a state on their rim (quests active / done, the waypoint flash, the key's groups) take the fill only. */
.cr-pop .quest, .cr-pop .map-group, .cr-pop .map-wp-box, .cr-pop .bf-book, .cr-pop .bourse-history, .cr-pop .gd-next, .cr-pop .shop-info,
.cr-pop .bf-item, .cr-pop .trade-grid, .cr-pop .qd-state, .cr-pop .fd-server {
  background-color: rgba(14, 8, 3, 0.4);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(150, 104, 40, 0.14);
}
.cr-pop .qd-state.active { background-color: rgba(200, 150, 50, 0.16); }
.cr-pop .qd-state.done { background-color: rgba(122, 212, 106, 0.12); }
.cr-pop .quest, .cr-pop .map-wp-box:not(.hl), .cr-pop .gd-next, .cr-pop .shop-info, .cr-pop .bf-item { border-color: #5e3f1a; }
.cr-pop .quest.active { border-color: var(--frame-gold-hi); }
.cr-pop .quest.done { border-color: #4fae4a; }
.cr-pop .map-group-head { background: linear-gradient(180deg, #4a311b, #34210f); }
.cr-pop .map-group-head:hover { background: linear-gradient(180deg, #5a3c22, #3e2814); }
.cr-pop .gd-ms-head, .cr-pop .qd-sec { box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5); }
.cr-pop .gd-bar, .cr-pop .bourse-slot .b-bar, .cr-pop .qd-check { background: #120a04; border-color: var(--cell-edge); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7); }
#creator-canvas { border-color: var(--frame-bronze); box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.6); }
.cr-pop .cr-music-diag { background: rgba(10, 6, 2, 0.5); box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6); }
.cr-pop .tabs { background: rgba(10, 6, 2, 0.35); border-bottom-color: var(--frame-bronze); }
.cr-pop .tab-panel { background: transparent; }
.cr-pop #bottom-icon-bar { background: rgba(10, 6, 2, 0.35); border-top-color: var(--frame-bronze); }

/* ---------- Recessed cells ----------
   States, inside the cell:
     plain     dark sunken square, bronze rim, a faint gold inner edge
     hover     (mouse only) the rim turns mid gold, a faint warm glow inside
     selected  bright gold rim + a 2 px gold ring round the cell + a warm inner glow (the picked slot)
     equipped  a worn paper-doll slot: a lighter, lifted fill and a bronze-gold rim (empty ones stay dark, icon dimmed)
     active    a devotion that is on: an amber-lit fill, bright rim and a soft outer glow
     locked    dimmed (as before); no-runes spells greyed (as before); no hover on either
     dragging  the slot left dimmed, the one under the item outlined in gold (as before) */
.cr-cell:not(#_) {
  background-color: #1a1009;
  background-image: var(--cell-fill);
  border-color: var(--cell-edge);
  box-shadow: var(--cell-sunk);
}
@media (hover: hover) {
  .cr-cell:not(#_):not(.locked):not(.norunes):not(.empty):not(.sel):not(.active):hover {
    border-color: #b8862e;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 200, 90, 0.32), inset 0 0 10px rgba(255, 190, 80, 0.14), 0 1px 0 rgba(255, 214, 150, 0.07);
  }
}
.cr-cell.sel:not(#_) {
  border-color: var(--frame-gold-hi);
  background-image: linear-gradient(180deg, #24170a 0%, #33230e 100%);
  box-shadow: 0 0 0 2px var(--frame-gold-hi), inset 0 0 12px rgba(255, 200, 80, 0.35), inset 0 0 0 1px rgba(255, 220, 140, 0.35);
}
.cr-equip-slot.filled.cr-cell:not(#_) {
  border-color: #9a7230;
  background-image: linear-gradient(180deg, #2a1b0d 0%, #3a2713 100%);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 210, 120, 0.22), 0 1px 0 rgba(255, 214, 150, 0.08);
}
.cr-cell.active:not(#_) {
  border-color: var(--frame-gold-hi);
  background-image: radial-gradient(ellipse at 50% 40%, rgba(255, 196, 80, 0.42) 0%, rgba(150, 90, 20, 0.3) 55%, #24170b 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 230, 160, 0.4), inset 0 0 10px rgba(255, 190, 70, 0.35), 0 0 8px rgba(255, 200, 80, 0.5);
}
.cr-cell.drag-over { outline-color: var(--frame-gold-hi); }
/* Counts in the cells: the same gold-yellow everywhere. */
.cr-cell .inv-stack, .cr-cell .inv-n, .cr-cell .c-price, .cr-cell .slot-count, .cr-cell .cr-skill-level, .cr-cell .sp-lv { color: var(--count); }
#inv-grid .cr-cell .inv-stack, .slot-grid .cr-cell .inv-stack { color: var(--count); }
.cr-pop .cr-prayer-name, .cr-pop .cr-emote-name, .cr-pop .cr-skill-xp { color: var(--parch-dim); }
.cr-cell.active .cr-prayer-name { color: #fff0c0; }

/* ---------- The coin chip ---------- */
.cr-chip:not(#_) {
  width: max-content; max-width: 100%;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--frame-gold);
  border-radius: 13px;
  background: linear-gradient(180deg, #160d06 0%, #26180b 100%);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.75), inset 0 0 0 1px rgba(125, 84, 34, 0.7), 0 1px 0 rgba(255, 214, 150, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.6);
  color: var(--count);
  text-shadow: 0 1px 0 #000;
}

/* ---------- Buttons and tabs ----------
   One chunky gold-bordered family (the dialogue's); primary actions filled gold-brown; a lit fill for what is on. */
button {
  background: var(--btn-grad);
  border-color: var(--frame-gold);
  box-shadow: inset 0 1px 0 rgba(255, 220, 150, 0.16), 0 2px 4px rgba(0, 0, 0, 0.45);
}
button:hover { background: var(--btn-grad-hi); }
button.big-btn, #shop-act, #shop-amount-ok, button.dg-go {
  background: var(--btn-gold);
  border-color: var(--frame-gold-hi);
  color: #fff6d8;
  text-shadow: 0 1px 0 #3a2208, 0 0 3px rgba(0, 0, 0, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.35), inset 0 -2px 0 rgba(60, 34, 8, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.7), 0 3px 6px rgba(0, 0, 0, 0.5);
}
button.big-btn:hover, #shop-act:hover, #shop-amount-ok:hover, button.dg-go:not(:disabled):hover { background: var(--btn-gold-hi); border-color: #fff0b0; }
button.big-btn:active, #shop-act:active, #shop-amount-ok:active, button.dg-go:active { background: var(--btn-gold); box-shadow: inset 0 2px 5px rgba(40, 20, 4, 0.6); }
button.big-btn.danger { background: linear-gradient(180deg, #8e341f 0%, #62200f 52%, #46160a 100%); border-color: #e0a050; color: #ffe8d8; }
button.big-btn.danger:hover { background: linear-gradient(180deg, #a23e26 0%, #722713 52%, #521a0c 100%); }
/* What is on: a toggle, the chosen amount, the stance, the open tab. */
#stance-row button.active, .qty.active, #autoret-btn.active, .cc-seg button.active,
.bank-tabs button.active, .gd-filter .mini-btn.on, .bank-actions button.on, .bottom-icon.active {
  background: var(--btn-grad-on); border-color: var(--frame-gold-hi); color: #fff3c4;
  box-shadow: inset 0 0 8px rgba(255, 213, 74, 0.35), 0 0 0 1px #000;
}
.bank-tabs button { background: var(--btn-grad); border-color: var(--frame-bronze); color: var(--parch); }
.bank-tabs button:not(.active):hover { background: var(--btn-grad-hi); border-color: var(--frame-gold); }
#npc-options button { color: var(--ink); }
#npc-options button:hover { color: #fff3d0; }
.cr-tabs .tab {
  background: linear-gradient(180deg, #5a3c20 0%, #3e2813 100%);
  border-color: var(--frame-bronze); color: var(--parch);
  box-shadow: inset 0 1px 0 rgba(255, 220, 150, 0.12);
}
.cr-tabs .tab:not(.active):hover { background: linear-gradient(180deg, #6a4826 0%, #4a3017 100%); border-color: var(--frame-gold); }
.cr-tabs .tab.active {
  background: linear-gradient(180deg, #7a5428 0%, #563817 100%);
  border-color: var(--frame-gold-hi); color: var(--frame-gold-hi);
  box-shadow: inset 0 2px 0 var(--frame-gold-hi), inset 0 0 10px rgba(255, 200, 80, 0.2);
}
.bottom-icon { background: var(--btn-grad); border-color: var(--frame-bronze); box-shadow: inset 0 1px 0 rgba(255, 220, 150, 0.14), 0 1px 3px rgba(0, 0, 0, 0.5); }
.bottom-icon:not(.active):hover { background: var(--btn-grad-hi); border-color: var(--frame-gold); }
.map-clear, .map-wp-box .wb, .map-side-toggle, .map-tools button { background: var(--btn-grad); border-color: var(--frame-gold); }
.map-clear:disabled { background: #2a1a0d; border-color: #5a3d1a; }
#trade-ask button { background: var(--btn-grad); border-color: var(--frame-gold); color: var(--frame-gold-hi); }

/* The right-click menu's rows. */
#ctx-menu.cr-pop .ctx-title { border-bottom-color: var(--divider); }
#ctx-menu.cr-pop button:hover, #ctx-menu.cr-pop button:active { background: linear-gradient(90deg, rgba(255, 190, 80, 0.26), rgba(255, 190, 80, 0.08)); color: #fff3d0; }

/* ---------- Inputs: recessed, a gold rim when focused ---------- */
.cr-pop .bank-search, .cr-pop .bf-row input, .cr-pop input[type="number"], .cr-pop #friend-add-row input, .cr-pop #block-add-row input,
.cr-pop .shard-xp input, .cr-pop .shard-xp select {
  background: #150c05; color: var(--ink); border-color: #6b4a20;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}
.cr-pop .shard-xp input, .cr-pop .shard-xp select { border: 1px solid #6b4a20; border-radius: 4px; padding: 4px 6px; font-size: 14px; }
.cr-pop .bank-search:focus, .cr-pop .bf-row input:focus, .cr-pop input[type="number"]:focus, .cr-pop #friend-add-row input:focus,
.cr-pop #block-add-row input:focus, .cr-pop .shard-xp input:focus, .cr-pop .shard-xp select:focus { outline: none; border-color: var(--frame-gold-hi); }
.shard-xp-title { font-weight: 600; margin-bottom: 4px; color: var(--frame-gold-hi); }
.shard-xp-note { font-size: 12px; opacity: 0.85; margin-top: 4px; }

/* ---------- Scrollbars (where the client draws its own): bronze on dark ---------- */
.map-side-scroll { scrollbar-color: #8a6326 transparent; }
.map-side-scroll::-webkit-scrollbar-thumb { background: #7d5422; }

/* ---------- The front door: its card, fields and button in the same wood and gold ---------- */
.fd .fd-input { background: #140b05; border-color: #5a3d1a; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6); }
.fd .fd-input:focus { border-color: var(--frame-gold); }
.fd .fd-tabs, .fd .fd-drawer-head { border-bottom-color: var(--divider); }
.fd .fd-server { border-color: #5a3d1a; }
.fd .fd-submit {
  background: var(--btn-gold); border-color: var(--frame-gold-hi); color: #fff6d8;
  text-shadow: 0 1px 0 #3a2208, 0 0 3px rgba(0, 0, 0, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.35), inset 0 -2px 0 rgba(60, 34, 8, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.7), 0 4px 12px rgba(0, 0, 0, 0.6);
}
.fd .fd-submit:hover:not(:disabled), .fd .fd-submit:focus-visible {
  background: var(--btn-gold-hi); border-color: #fff0b0;
  box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.7), 0 0 18px rgba(255, 190, 80, 0.35);
}
.fd-discord {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin: -6px 0 18px; padding: 9px 14px;
  background: #140b05; border: 1px solid #5a3d1a; border-radius: 4px; color: #e8d29a; text-decoration: none;
  font-weight: 700; font-size: 0.85rem; letter-spacing: 1px; text-transform: uppercase;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.5);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.fd-discord svg { width: 20px; height: 20px; flex: none; fill: currentColor; }
.fd-discord:hover, .fd-discord:focus-visible {
  color: #fff0b0; border-color: var(--frame-gold, #c89528); outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 14px rgba(255, 190, 80, 0.3);
}
.fd .fd-news-item, .fd .fd-setting { border-bottom-color: rgba(125, 84, 34, 0.45); }

/* ---------- Icon Rework, Phase 1 (2026-11-14): the painted PNG icons (client/icons/, README.md there) ----------
   Each <img class="cr-ico"> fills a box its slot sizes; its colours are baked in (nothing here sets one). A PNG that
   fails to load is hidden, its box kept: no collapse, no broken-image glyph, the slot's own backing still shows.
   The art sits in a ~62% safe area, so a slot shows it a little bigger than the line art it replaces. */
.cr-ico { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.cr-ico.ico-missing { visibility: hidden; }
/* The tabs Phase 1 covers: 34 px (Combat and Devotion keep 26 px line art). Six side tabs fit a 267 px phone panel only
   without the buttons' default padding, so the tabs drop it and may shrink, and the icon never outgrows its tab. */
.cr-tabs .tab { padding: 0; min-width: 0; }
.cr-tabs .tab .medieval-icon.png-icon { width: 34px; height: 34px; max-width: 100%; }
.bottom-icon .medieval-icon.png-icon { width: 34px; height: 34px; flex: none; }   /* never squeezed by the 40 px button's padding */
.cr-skill-icon .cr-ico { width: 32px; height: 32px; }   /* the skills panel */
.gd-ico .cr-ico { width: 40px; height: 40px; }   /* the skill guide's and the quest page's headers */
.guide-row .b-ico .cr-ico { width: var(--b-ico, 28px); height: var(--b-ico, 28px); }   /* the guide's rows with no item picture */
.qd-rw-ico .cr-ico { width: 26px; height: 26px; }   /* quest rewards: quest points, XP */
.xp-ico { width: 20px; height: 20px; vertical-align: -5px; }   /* XP drops (16 px before: the disc needs a little more) */

/* ---------- Currency pouch (v=20261121a) ---------- */
/* v=20261124f: the button sits in the flow below the item grid (it was absolute and the full grid painted over it). */
#pouch-btn {
  position: relative; z-index: 1; margin: 8px 6px 6px auto; height: 48px; min-width: 96px; padding: 0 12px 0 8px;
  display: flex; width: fit-content; align-items: center; gap: 6px; cursor: pointer;
  background: radial-gradient(ellipse at 50% 30%, #7a5230 0%, #50331b 55%, #2f1c0d 100%);
  border: 2px solid #d9a73b; border-radius: 14px 14px 18px 18px;
  color: #ffd84a; font: bold 16px Georgia, serif; text-shadow: 1px 1px 2px #000;
  box-shadow: inset 0 0 0 1px #170d05, inset 0 -4px 8px rgba(0,0,0,0.5), 0 2px 5px rgba(0,0,0,0.6);
}
#pouch-btn:hover, #pouch-btn.on { border-color: #ffd66b; filter: brightness(1.15); }
#pouch-btn .pouch-ico {
  width: 20px; height: 26px; flex: none; border-radius: 40% 40% 50% 50%;
  background: radial-gradient(circle at 40% 35%, #8a5d34, #4a2e17 70%); border: 1px solid #d9a73b;
}
#pouch-btn .coin-ico { width: 20px; height: 20px; }
#pouch-panel {
  position: fixed; right: 10px; bottom: 120px; width: min(260px, 80vw); z-index: 40; padding: 10px 12px;
  background: var(--wood-grad, #3f2816); border: 3px solid #d9a73b; border-radius: 6px; color: #e8d7b0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}
#pouch-panel.hidden { display: none; }
.pouch-title { font: bold 17px Georgia, serif; color: #ffd84a; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.pouch-row { display: flex; justify-content: space-between; padding: 5px 0; border-top: 1px solid rgba(125,84,34,0.55); font-size: 15px; }
.pouch-row b { color: #ffd84a; }
.pouch-row.dim { opacity: 0.55; }
.bank-coin-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.bank-coin-row .bank-chip { padding: 4px 8px; font-weight: bold; color: #ffd54a; }
.bank-coin-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }

/* Quest-complete scroll (2026-11-24): parchment on the game's stone/gold palette. Only the scroll takes
   clicks; the rest of the screen stays playable. */
.qscroll-root { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; pointer-events: none; padding: 12px; }
.qscroll { pointer-events: auto; position: relative; display: flex; gap: 14px; align-items: center; width: min(460px, 100%); max-height: 86vh; overflow-y: auto; box-sizing: border-box;
  padding: 18px 34px 16px 16px; color: #2a1d0c; text-align: center;
  background: radial-gradient(ellipse at 50% 40%, #ead9ae 0%, #d4c49a 65%, #b49a62 100%);
  border: 3px solid var(--gold, #d4a017); border-radius: 6px;
  box-shadow: inset 0 0 26px rgba(90, 50, 10, 0.55), 0 0 22px rgba(255, 120, 30, 0.45), 0 6px 22px rgba(0, 0, 0, 0.7); }
.qscroll::before, .qscroll::after { content: ''; position: absolute; left: 10px; right: 10px; height: 6px; border-radius: 3px; background: linear-gradient(180deg, #6a501a, #3a2a0c); }
.qscroll::before { top: -2px; } .qscroll::after { bottom: -2px; }
.qscroll-seal { flex: 0 0 64px; width: 64px; height: 64px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55)); }
.qscroll-seal svg { width: 100%; height: 100%; display: block; }
.qscroll-body { flex: 1; min-width: 0; }
.qscroll h2 { margin: 0 0 4px; font-size: 22px; color: #8a2a0c; text-shadow: 0 1px 0 rgba(255, 240, 200, 0.6); }
.qscroll p { margin: 4px 0; font-size: 14px; overflow-wrap: anywhere; }
.qscroll-done b { color: #5a1a08; }
.qscroll-aw { font-style: italic; }
.qscroll ul { list-style: none; margin: 2px 0 6px; padding: 0; }
.qscroll li { font-size: 14px; font-weight: bold; color: #3a2408; margin: 2px 0; overflow-wrap: anywhere; }
.qscroll-qp { margin-top: 8px; padding-top: 6px; border-top: 1px solid rgba(90, 50, 10, 0.4); font-weight: bold; color: #6a3a0a; }
.qscroll-x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 1px solid #8a6a1e; border-radius: 4px; background: rgba(58, 50, 38, 0.85); color: #e6d6ae; cursor: pointer; font-size: 13px; line-height: 1; }
/* The readable panel (2026-11-24): a plaque's words or a book's pages, a parchment that takes only its own taps. */
.readable-root { position: fixed; inset: 0; z-index: 890; display: flex; align-items: center; justify-content: center; pointer-events: none; padding: 12px; }
.readable { pointer-events: auto; position: relative; width: min(500px, 100%); max-height: 80vh; overflow-y: auto; box-sizing: border-box; padding: 22px 22px 16px;
  background: linear-gradient(180deg, #e9d9ae, #d9c58f); color: #3a2408; border: 2px solid #8a6a1e; border-radius: 6px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(120, 80, 20, 0.25); }
.readable-title { margin: 0 24px 10px 0; font-size: 20px; color: #7a240a; text-shadow: 0 1px 0 rgba(255, 240, 200, 0.6); }
.readable-text { font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; font-style: italic; min-height: 3em; }
.readable-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 8px; border-top: 1px solid rgba(90, 50, 10, 0.4); }
.readable-nav button { border: 1px solid #8a6a1e; border-radius: 4px; background: rgba(58, 50, 38, 0.85); color: #e6d6ae; cursor: pointer; font-size: 13px; padding: 4px 10px; }
.readable-nav button:disabled { opacity: 0.35; cursor: default; }
.rd-n { font-size: 13px; color: #6a3a0a; font-weight: bold; }
.readable-x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 1px solid #8a6a1e; border-radius: 4px; background: rgba(58, 50, 38, 0.85); color: #e6d6ae; cursor: pointer; font-size: 13px; line-height: 1; }
@media (max-width: 480px) { .qscroll { flex-direction: column; padding: 16px 14px 14px; } .qscroll h2 { font-size: 20px; } }

/* Party system v1 (2026-11-24) */
#party-panel { position: absolute; top: 190px; left: 10px; width: 168px; padding: 4px 6px; border-radius: 8px;
  background: rgba(14, 18, 30, 0.88); border: 1px solid #c8a85a; color: #e8dcc0; font-size: 12px; }
#party-head { display: flex; justify-content: space-between; align-items: center; font-weight: bold; color: #ffe9a0; margin-bottom: 3px; }
#party-head button, .party-kick { min-height: 20px; padding: 0 6px; border-radius: 6px; border: 1px solid #8a3a2a; background: #4a1a14; color: #ffd0c0; font-size: 11px; cursor: pointer; }
.party-row { margin: 3px 0; }
.party-name { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.party-name .pn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.party-lead { color: #ffd54a; }
.party-cb { color: #b8b8c8; font-size: 11px; }
.party-hp { height: 8px; margin-top: 2px; background: #8a1414; border: 1px solid #000; border-radius: 2px; overflow: hidden; }
.party-hp > div { height: 100%; background: #3aa34a; }
.party-hptext { font-size: 10px; color: #cfcfd8; }
#party-ask { position: fixed; left: 50%; top: 144px; transform: translateX(-50%); z-index: 62; background: rgba(14, 18, 30, 0.95);
  border: 1px solid #c8a85a; color: #e8dcc0; border-radius: 12px; padding: 8px 12px; font-size: 14px; display: flex; gap: 8px; align-items: center; }
#party-ask button { min-height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid #c8a85a; background: #3a3020; color: #ffe9a0; font-weight: bold; cursor: pointer; }
#party-ask.hidden, #party-panel.hidden { display: none; }
.chat-party { color: #7fd6ff; }

#duel-ask { position: fixed; left: 50%; top: 190px; transform: translateX(-50%); z-index: 62; background: rgba(14, 18, 30, 0.95);
  border: 1px solid #c8a85a; color: #e8dcc0; border-radius: 12px; padding: 8px 12px; font-size: 14px; display: flex; gap: 8px; align-items: center; }
#duel-ask button { min-height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid #c8a85a; background: #3a3020; color: #ffe9a0; font-weight: bold; cursor: pointer; }
#duel-ask.hidden, #arena-bar.hidden { display: none; }
.stake-opts { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0; font-size: 13px; }
.stake-coins { font-size: 13px; color: #ffe9a0; margin-top: 4px; }
.stake-card #stake-final:not(:disabled) { background: #7a2a1a; border-color: #ff9060; }
#arena-bar { position: fixed; left: 50%; top: 8px; transform: translateX(-50%); z-index: 61; background: rgba(40, 14, 10, 0.92); border: 1px solid #e0603a;
  color: #ffe9d0; border-radius: 12px; padding: 8px 14px; font-size: 14px; text-align: center; max-width: 94vw; }
#arena-bar button { min-height: 34px; padding: 0 12px; margin: 4px 3px 0; border-radius: 8px; border: 1px solid #c8a85a; background: #3a3020; color: #ffe9a0; font-weight: bold; cursor: pointer; }
.arena-row { margin: 6px 0; } .arena-row button { margin-left: 8px; }
/* Arena build 2 (v=20261124s): the FFA queue strip, the Rewards Shop and the title list. */
#arena-qbar { position: fixed; left: 50%; top: 8px; transform: translateX(-50%); z-index: 61; background: rgba(40, 14, 10, 0.92); border: 1px solid #e0603a;
  color: #ffe9d0; border-radius: 12px; padding: 8px 14px; font-size: 14px; text-align: center; max-width: 94vw; }
#arena-qbar.hidden { display: none; }
#arena-qbar button { min-height: 34px; padding: 0 12px; margin-left: 6px; border-radius: 8px; border: 1px solid #c8a85a; background: #3a3020; color: #ffe9a0; font-weight: bold; cursor: pointer; }
#arena-result { font-size: 12px; line-height: 1.35; max-width: 92vw; }
#arena-shop-list h3 { margin: 12px 0 4px; color: #ffcf8a; }
#arena-shop-list .shop-row { font-size: 13px; }
.shop-refuse { color: #ff9a80; }

/* The sailing cinematic (2026-11-26): the world is hidden behind the open-water stage while it runs; any tap skips it */
#sail-ui { position: fixed; inset: 0; z-index: 400; pointer-events: auto; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
#sail-ui .sail-fade { position: absolute; inset: 0; background: #05080c; opacity: 1; pointer-events: none; }
#sail-ui .sail-cap { position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%); width: min(86vw, 620px); text-align: center; color: #f6ecd2; font-size: 16px; line-height: 1.4; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85), 0 0 2px #000; opacity: 0; transition: opacity 500ms; pointer-events: none; }
#sail-ui .sail-skip { position: absolute; right: 14px; bottom: 10px; color: rgba(246, 236, 210, 0.65); font-size: 12px; text-shadow: 0 1px 3px #000; pointer-events: none; }
body.sailing > *:not(#game-container):not(#sail-ui) { visibility: hidden !important; }   /* the HUD, panels, toasts, the clock chip: the stage is all there is */

/* Ashfall Arena duels (2026-11-27): the giant flashing X over a pack item the duel's food/potion rules forbid; the scoreboard's rows. */
.duel-x { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 46px; line-height: 1; font-weight: 900; color: #ff2a1a;
  text-shadow: 0 0 3px #000, 0 0 10px #ff0000, 2px 2px 0 #000; pointer-events: none; z-index: 5; animation: duel-x-flash 0.7s steps(1, end) infinite; }
@keyframes duel-x-flash { 0%, 100% { opacity: 1; } 50% { opacity: 0.12; } }
.arena-board-row { display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px solid rgba(180, 150, 90, 0.25); padding: 3px 0; }
.arena-board-when { color: #b8a888; font-size: 12px; white-space: nowrap; }
#arena-board-rows { max-height: 60vh; overflow-y: auto; }

/* Arena setup (rev 3, v=20261126w): the worn-gear figures on the duel and free-for-all setup screens; a blocked slot wears our own red prohibition mark (SVG, no art files). */
.stake-dolls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 4px 0 8px; }
.stake-doll-col { flex: 0 1 200px; text-align: center; }
.stake-doll-h { font-size: 12px; color: #ffe9a0; margin-bottom: 2px; }
.stake-dolls .cr-equip-paperdoll { max-width: 200px; padding: 8px; gap: 4px; margin: 0 auto; }
.arena-doll-slot { position: relative; cursor: pointer; }
.arena-doll-slot.locked { cursor: default; }
.arena-doll-slot.blocked { border-color: #c0301f; }
.arena-doll-slot .slot-block { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); pointer-events: none; z-index: 5; filter: drop-shadow(0 0 2px #000); }
.ffa-setup-players { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; margin: 6px 0; }
.ffa-setup-players .yes { color: #9be07a; }
.ffa-setup-players .no { color: #c9b98a; }
