/* ===== Tokens ===== */
:root {
  --ink: #120d09;
  --stone: #1c1712;
  --wood: #3a2817;
  --gold: #d9a64e;
  --gold_light: #f3d48f;
  --bronze: #8e5a2a;
  --parchment: #ead9b4;
  --text_soft: #cdbb95;
  --danger: #d06a4f;
  /* popups: cooler slate tone so they stand out from the warm screens */
  --popup_bg: #1f252c;
  --popup_bg_2: #161b21;
  --font_title: "Cinzel", "Trajan Pro", "Times New Roman", serif;
  --font_body: "Alegreya", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #0b0806;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
           env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

/* ===== Stage: keeps the image's aspect ratio, fits the window ===== */
.stage {
  position: relative;
  width: min(100vw, calc(100vh * var(--img_w) / var(--img_h)));
  width: min(100vw, calc(100dvh * var(--img_w) / var(--img_h)));
  aspect-ratio: var(--img_w) / var(--img_h);
  container-type: inline-size;   /* 1cqw = 1% of the stage width */
  overflow: hidden;
  background: var(--stone);
  user-select: none;
  -webkit-user-select: none;
  font-family: var(--font_body);
  color: var(--parchment);
}

.stage_bg, .stage_svg, .stage_layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.stage_bg { display: block; pointer-events: none; }
.stage_layer { pointer-events: none; }
.stage_layer > * { pointer-events: auto; }

.stage_missing {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font: 600 1.4cqw var(--font_body);
  color: var(--danger);
}

/* ===== Hotspots ===== */
/* Step 52b: NO outline in any state (hover, selected, locked, armed). The
   soft highlight = the background inside the shape brightens, feathered
   edge, faint warm tint (js/engine/hotspots.js: one shared filter + mask per
   screen). Only the debug view (D key / Test tools: Show click zones) draws
   outlines (.stage.debug .hotspot below). */
.hotspot {
  fill: transparent;
  stroke: none;
  cursor: pointer;
  outline: none;
}
.hotspot.disabled {
  fill: rgba(8, 5, 3, 0.55);
  cursor: not-allowed;
}
/* the brightened copy of the background, seen only through the mask */
.hotspot_hl { display: none; pointer-events: none; }
.hotspot_hl.active { display: inline; }
.hotspot_hl_shape { opacity: 0; transition: opacity 0.16s ease; }
.hotspot_hl_shape.on { opacity: 1; }
.hotspot.nudge { animation: nudge 0.35s ease; }
@keyframes nudge {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.hotspot_label {
  position: absolute;
  left: 0; top: 0;
  z-index: 20;
  padding: 0.35em 0.8em;
  font: 600 clamp(11px, 0.95cqw, 18px) / 1.2 var(--font_title);
  letter-spacing: 0.05em;
  color: var(--gold_light);
  white-space: nowrap;
  background: linear-gradient(180deg, rgba(42, 29, 18, 0.95), rgba(20, 14, 9, 0.95));
  border: 1px solid var(--bronze);
  border-radius: 3px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  will-change: transform;   /* moved with a transform: no repaint under it */
}
.hotspot_label.visible { opacity: 1; }

/* ===== HUD (coded top bar) ===== */
.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.2cqw;
  background: linear-gradient(180deg, rgba(14, 10, 7, 0.92), rgba(14, 10, 7, 0.72));
  border-bottom: 1px solid rgba(217, 166, 78, 0.55);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.hud_left, .hud_right { display: flex; align-items: center; height: 100%; gap: 0.9cqw; }
.hud_portrait {
  height: 82%;
  aspect-ratio: 1;
  border: 2px solid var(--gold);
  border-radius: 4px;
  box-shadow: 0 0 0 1px #000;
}
.hud_identity { line-height: 1.1; }
.hud_name {
  font: 700 1.2cqw var(--font_title);
  color: var(--gold_light);
  letter-spacing: 0.04em;
}
.hud_sub { font: 400 0.9cqw var(--font_body); color: var(--text_soft); white-space: pre; }
.hud_currency {
  display: flex; align-items: center; gap: 0.45cqw;
  height: 70%;
  padding: 0 0.8cqw 0 0.15cqw;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(142, 90, 42, 0.8);
  border-radius: 4px;
  font: 600 1.05cqw var(--font_body);
  color: var(--parchment);
  font-variant-numeric: tabular-nums;
}
.hud_currency img { height: 86%; border-radius: 3px; }
.hud_menu {
  height: 70%;
  aspect-ratio: 1;
  font-size: 1.3cqw;
  color: var(--gold_light);
  background: linear-gradient(180deg, #3a2817, #22170d);
  border: 1px solid var(--gold);
  border-radius: 4px;
  cursor: pointer;
}
.hud_menu:hover, .hud_menu:focus-visible { background: linear-gradient(180deg, #4d3520, #2d1f12); outline: none; }

/* ===== Character selection ===== */
.name_field { display: flex; }
.name_field input {
  width: 100%;
  height: 100%;
  padding: 0 1cqw;
  font: 600 1.35cqw var(--font_title);
  letter-spacing: 0.04em;
  color: var(--gold_light);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  caret-color: var(--gold_light);
}
.name_field input::placeholder { color: rgba(205, 187, 149, 0.45); font-weight: 500; }
.name_field input:focus { border-color: rgba(243, 212, 143, 0.55); box-shadow: 0 0 10px rgba(255, 200, 97, 0.25) inset; }
.name_field.invalid input { border-color: rgba(208, 106, 79, 0.8); }

.class_info {
  display: flex;
  flex-direction: column;
  gap: 0.3cqw;               /* step 15b: tighter, room for the off-hand skill line */
  padding: 0.6cqw 1cqw;
  overflow: hidden;
  font-size: 0.8cqw;
  line-height: 1.35;
  color: var(--parchment);
  transition: box-shadow 0.2s;
}
.class_info.pulse { box-shadow: 0 0 18px rgba(255, 200, 97, 0.55) inset; }
.class_info_empty { margin: auto; text-align: center; color: var(--text_soft); }
.class_info_empty p { margin: 0.4cqw 0 0; font-style: italic; }
.class_info_heading { font: 700 1.05cqw var(--font_title); color: var(--gold_light); letter-spacing: 0.05em; }
.class_info_desc { margin: 0; font-style: italic; color: var(--text_soft); }
.class_info_stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.3cqw;
}
.class_info_stats div {
  display: flex; flex-direction: column; align-items: center;
  padding: 0.15cqw 0;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(142, 90, 42, 0.7);
  border-radius: 3px;
}
.class_info_stats span { font: 600 0.62cqw var(--font_title); color: var(--text_soft); letter-spacing: 0.06em; }
.class_info_stats b { font: 700 0.95cqw var(--font_title); color: var(--gold_light); }
.class_info_traits div { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(142, 90, 42, 0.35); }
.class_info_traits span { color: var(--text_soft); }
.class_info_traits b { font-weight: 600; color: var(--parchment); }
.class_info_skill {
  display: flex; justify-content: space-between; gap: 0.6cqw;
  padding: 0.1cqw 0.5cqw;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(142, 90, 42, 0.6);
  border-radius: 3px;
}
.class_info_skill span { font: 600 0.7cqw var(--font_title); color: var(--text_soft); letter-spacing: 0.05em; }
.class_info_skill b { font-weight: 700; color: #9fe0a8; }
.class_info_hint { margin-top: auto; color: var(--danger); font-weight: 600; }

/* ===== Popups ===== */
.popup_overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(5, 4, 3, 0.55);
  animation: fade_in 0.15s ease;
}
.popup {
  min-width: min(340px, 86vw);
  max-width: min(520px, 92vw);
  padding: 22px 26px 20px;
  text-align: center;
  color: #dfe3e6;
  font-family: var(--font_body);
  background: linear-gradient(180deg, var(--popup_bg), var(--popup_bg_2));
  border: 2px solid var(--gold);
  border-radius: 6px;
  box-shadow: 0 0 0 4px #0d0f12, 0 0 0 5px var(--bronze), 0 18px 50px rgba(0, 0, 0, 0.7);
  animation: pop_in 0.18s ease;
}
.popup_title {
  margin: 0 0 10px;
  font: 700 22px var(--font_title);
  color: var(--gold_light);
  letter-spacing: 0.06em;
}
.popup_text { margin: 0 0 18px; font-size: 18px; line-height: 1.4; }
.popup_buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.ui_button {
  min-width: 110px;
  padding: 9px 18px;
  font: 600 15px var(--font_title);
  letter-spacing: 0.05em;
  color: var(--parchment);
  background: linear-gradient(180deg, #3a2817, #22170d);
  border: 1px solid var(--bronze);
  border-radius: 4px;
  cursor: pointer;
}
.ui_button.primary { color: var(--gold_light); border-color: var(--gold); }
.ui_button:hover, .ui_button:focus-visible { background: linear-gradient(180deg, #4d3520, #2d1f12); outline: none; border-color: var(--gold_light); }

@keyframes fade_in { from { opacity: 0; } }
@keyframes pop_in { from { opacity: 0; transform: scale(0.96); } }

/* Compact HUD (world map): two floating plates instead of a full bar */
.hud.compact {
  background: none;
  border-bottom: none;
  box-shadow: none;
  padding: 0.5cqw 0.8cqw 0;
  align-items: flex-start;
}
.hud.compact .hud_left, .hud.compact .hud_right {
  padding: 0.25cqw 0.7cqw 0.25cqw 0.3cqw;
  background: linear-gradient(180deg, rgba(14, 10, 7, 0.9), rgba(14, 10, 7, 0.78));
  border: 1px solid rgba(217, 166, 78, 0.55);
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.hud.compact .hud_right { padding-left: 0.5cqw; }

/* ===== World map ===== */
/* Locked zone: darker; on hover a slightly weaker soft highlight (hotspots.js
   LOOK.locked) + the "… — locked" label; click = the "is locked" popup */
.hotspot.locked { fill: rgba(10, 6, 3, 0.38); cursor: pointer; }
.hotspot.locked:hover, .hotspot.locked:focus-visible, .hotspot.locked.armed { fill: rgba(10, 6, 3, 0.3); }

/* ===== Zone maps: enemies drawn by code ===== */
.enemy_spot {
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  cursor: pointer;
  outline: none;
}
.enemy_spot::before {            /* soft ground shadow under the feet */
  content: "";
  position: absolute;
  left: 22%; right: 22%; bottom: 1%;
  height: 9%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(40, 22, 6, 0.45), rgba(40, 22, 6, 0));
}
.enemy_spot img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  transform-origin: 50% 92%;
  transition: transform 0.15s ease, filter 0.15s ease;
  filter: drop-shadow(0 0 0 rgba(255, 200, 97, 0));
}
.enemy_spot:hover img, .enemy_spot:focus-visible img {
  transform: scale(1.05);
  filter: drop-shadow(0 0 0.35cqw rgba(255, 210, 120, 0.95)) drop-shadow(0 0 1cqw rgba(255, 180, 70, 0.55));
}
.enemy_spot.boss:hover img, .enemy_spot.boss:focus-visible img {
  filter: drop-shadow(0 0 0.35cqw rgba(255, 120, 90, 0.95)) drop-shadow(0 0 1.2cqw rgba(255, 90, 60, 0.6));
}
/* Step 37: an enemy that is not open yet (the one before it is not beaten) */
.enemy_spot.locked { cursor: not-allowed; }
.enemy_spot.locked img { filter: grayscale(0.85) brightness(0.55); }
.enemy_spot.locked:hover img, .enemy_spot.locked:focus-visible img {
  transform: none;
  filter: grayscale(0.85) brightness(0.65) drop-shadow(0 0 0.3cqw rgba(200, 70, 60, 0.9));
}

.map_back_button {
  font: 600 1.15cqw var(--font_title);
  letter-spacing: 0.05em;
  color: var(--gold_light);
  background: linear-gradient(180deg, rgba(58, 40, 23, 0.95), rgba(34, 23, 13, 0.95));
  border: 1px solid var(--gold);
  border-radius: 5px;
  box-shadow: 0 0 0 2px rgba(13, 9, 6, 0.85), 0 4px 12px rgba(0, 0, 0, 0.55);
  cursor: pointer;
}
.map_back_button:hover, .map_back_button:focus-visible {
  background: linear-gradient(180deg, #4d3520, #2d1f12);
  border-color: var(--gold_light);
  outline: none;
}

.zone_banner {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  padding: 1.2cqw 3cqw;
  text-align: center;
  background: linear-gradient(180deg, rgba(20, 14, 9, 0.9), rgba(14, 10, 7, 0.9));
  border: 2px solid var(--gold);
  border-radius: 6px;
  box-shadow: 0 0 0 4px rgba(13, 9, 6, 0.8), 0 12px 40px rgba(0, 0, 0, 0.6);
}
.zone_banner b { display: block; font: 700 2.4cqw var(--font_title); color: var(--gold_light); letter-spacing: 0.08em; }
.zone_banner span { font: italic 400 1.3cqw var(--font_body); color: var(--text_soft); }

/* Enemy info popup */
.enemy_info {
  display: flex;
  gap: 18px;
  align-items: center;
  margin: 4px 0 18px;
  text-align: left;
}
.enemy_info_pic {
  width: 150px;
  height: 150px;
  object-fit: contain;
  flex: none;
  background: radial-gradient(closest-side, rgba(217, 166, 78, 0.18), rgba(0, 0, 0, 0));
}
.enemy_info_stats { flex: 1; min-width: 210px; font-size: 16px; }
.enemy_info_stats div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(142, 90, 42, 0.35);
}
.enemy_info_stats span { color: #aab3bb; }
.enemy_info_stats b { font-weight: 600; color: var(--gold_light); font-variant-numeric: tabular-nums; }
@media (max-width: 480px) {
  .enemy_info { flex-direction: column; }
  .enemy_info_pic { width: 110px; height: 110px; }
}

/* HUD quest status (right side, before the currencies) */
.hud_quest {
  height: 70%;
  padding: 0 0.8cqw;
  font: 600 0.95cqw var(--font_body);
  color: var(--text_soft);
  white-space: pre;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(142, 90, 42, 0.8);
  border-radius: 4px;
  cursor: pointer;
}
.hud_quest.active { color: var(--gold_light); border-color: var(--gold); box-shadow: 0 0 8px rgba(255, 200, 97, 0.25) inset; }
.hud_quest:hover, .hud_quest:focus-visible { border-color: var(--gold_light); outline: none; }

/* Enemy of the running quest pulses on the zone map */
.enemy_spot.questing img { animation: questing 1.6s ease-in-out infinite; }
@keyframes questing {
  50% { filter: drop-shadow(0 0 0.4cqw rgba(255, 210, 120, 0.95)) drop-shadow(0 0 1.2cqw rgba(255, 180, 70, 0.6)); }
}
.enemy_info_blocked { margin: -6px 0 16px; color: var(--danger); font-weight: 600; font-size: 16px; }
.ui_button:disabled, .ui_button:disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
  background: linear-gradient(180deg, #3a2817, #22170d);
  border-color: var(--bronze);
}

/* ===== Battle screen ===== */
.battle_name {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 2.6cqw;            /* keep clear of the scroll rolls */
  color: #3b2412;
  text-shadow: 0 1px 0 rgba(255, 240, 210, 0.5);
  overflow: hidden;
}
.battle_name.enemy { align-items: flex-end; text-align: right; }
.battle_name_main {
  display: flex; align-items: center; gap: 0.7cqw;
  max-width: 100%; min-width: 0;   /* step 52a fix: FitText shrinks long names */
  font: 700 1.95cqw/1.1 var(--font_title);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.battle_name_main .battle_boss_tag, .battle_name_main .class_icon { flex: none; }
.battle_name_sub { max-width: 100%; font: 600 1.05cqw var(--font_body); color: #5a3a1e; white-space: nowrap; }
.battle_boss_tag {
  padding: 0.1cqw 0.6cqw;
  font: 700 0.95cqw var(--font_title);
  letter-spacing: 0.12em;
  color: #fff1d6;
  text-shadow: none;
  background: linear-gradient(180deg, #a3271c, #6d150e);
  border: 1px solid #3b0a05;
  border-radius: 3px;
}

.battle_hp { overflow: hidden; border-radius: 999px; pointer-events: none; }
.battle_hp_dark {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 0;
  background: linear-gradient(180deg, rgba(10, 6, 6, 0.86), rgba(0, 0, 0, 0.94));
  box-shadow: -2px 0 4px rgba(0, 0, 0, 0.6);
  transition: width 0.45s ease;
}
.battle_hp.hit { animation: hp_hit 0.3s ease; }
.battle_hp.hit.big { animation: hp_hit_big 0.5s ease; }
@keyframes hp_hit {
  0% { filter: brightness(1.8); }
  30% { transform: translateX(-0.25cqw); }
  60% { transform: translateX(0.25cqw); }
}
@keyframes hp_hit_big {
  0% { filter: brightness(2.4) saturate(1.4); }
  20% { transform: translateX(-0.5cqw); }
  40% { transform: translateX(0.5cqw); }
  60% { transform: translateX(-0.3cqw); }
  80% { transform: translateX(0.3cqw); }
}
.battle_hp_text {
  display: grid; place-items: center;
  font: 700 1.05cqw var(--font_title);
  color: #fff3dc;
  text-shadow: 0 1px 2px #000, 0 0 4px #000;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.battle_stats {
  display: flex;
  flex-direction: column;
  padding: 1.5cqw 1.4cqw;
  background: linear-gradient(180deg, rgba(14, 10, 7, 0.72), rgba(14, 10, 7, 0.6));
  background-clip: content-box;
  font-size: 1.12cqw;
}
.battle_stats_title {
  padding: 0.9cqw 0.8cqw 0.7cqw;
  font: 700 1.35cqw var(--font_title);
  letter-spacing: 0.1em;
  text-align: center;
  color: var(--gold_light);
  border-bottom: 1px solid rgba(217, 166, 78, 0.6);
}
.battle_stats_row {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6cqw;
  padding: 0 0.8cqw;
  border-bottom: 1px solid rgba(142, 90, 42, 0.35);
}
.battle_stats_row span { color: var(--text_soft); }
.battle_stats_row b { font-weight: 600; color: var(--gold_light); font-variant-numeric: tabular-nums; }

.battle_log { padding: 0.7cqw 1.4cqw; }
.battle_log_scroll {
  height: 100%;
  overflow-y: auto;
  padding: 0.3cqw 0;
  background: rgba(10, 7, 5, 0.6);
  font: 400 1.02cqw/1.4 var(--font_body);
  color: var(--parchment);
  scrollbar-width: thin;
  scrollbar-color: var(--bronze) transparent;
}
.battle_log_inner { padding: 0 0.6cqw; }
.battle_log_line { animation: fade_in 0.2s ease; }
.battle_log_line.special { color: #ffe3a3; }
.battle_log_line.result { font-weight: 600; color: var(--gold_light); }
.battle_log_line.result.defeat { color: var(--danger); }
.battle_log_line.loot_head { margin-top: 0.2cqw; font: 700 1cqw var(--font_title); letter-spacing: 0.08em; color: var(--gold); }
.battle_log_line.loot { padding-left: 1cqw; color: #f3e6c4; }
.battle_log_line.loot_dim { padding-left: 1cqw; color: var(--text_soft); font-style: italic; }
.battle_log_line.levelup { padding-left: 1cqw; font-weight: 700; color: #9fe07a; }
.battle_log_line.continue {
  margin-top: 0.3cqw;
  text-align: center;
  font: 700 1.1cqw var(--font_title);
  letter-spacing: 0.1em;
  color: var(--gold_light);
  animation: pulse_text 1.4s ease-in-out infinite;
}
@keyframes pulse_text { 50% { opacity: 0.45; } }
.battle_log_line.warn { padding-left: 1cqw; font-weight: 600; color: var(--danger); }
.log_item_name { font-weight: 700; }
.log_item { cursor: help; text-decoration: underline dotted rgba(255, 255, 255, 0.35); text-underline-offset: 0.2em; }
.log_item_name.lost { text-decoration: line-through; opacity: 0.6; }
.log_lost_note { color: var(--danger); font-style: italic; }
.log_mail_note { color: #e8b25c; font-style: italic; }  /* step 40 */
.log_player { font-weight: 700; color: var(--gold_light); }
.log_enemy { font-weight: 700; color: #f08a6a; }
.log_num { font-weight: 700; color: #fff; }
.log_tag { font-weight: 700; color: #ffd35c; letter-spacing: 0.03em; }
.battle_log_line.skill { color: #b9f0c0; }
.battle_log_line.skill_info { color: var(--text_soft); font-style: italic; }
.log_skill { color: #7fe39a; }

.battle_result {
  display: grid; place-items: center;
  font: 700 2.6cqw var(--font_title);
  letter-spacing: 0.08em;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}
.battle_result.shown { opacity: 1; transform: none; }
.battle_result.victory {
  color: #ffd977;
  text-shadow: 0 0 1cqw rgba(255, 190, 70, 0.75), 0 2px 3px #000;
}
.battle_result.defeat {
  color: #b9a9a2;
  text-shadow: 0 2px 3px #000;
  font-size: 2.3cqw;
}
.battle_stage.battle_done { cursor: pointer; }

/* ===== Debug view (press D) ===== */
.stage.debug .hotspot { stroke: #39e6ff; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-dasharray: 6 4; fill: rgba(57, 230, 255, 0.08); }
.stage.debug .stage_layer > * { outline: 1px dashed #ff5ad1; }
.stage.debug .enemy_spot img { filter: none; }
.debug_readout {
  position: absolute;
  left: 8px; bottom: 8px;
  z-index: 30;
  padding: 4px 8px;
  font: 600 13px ui-monospace, Consolas, monospace;
  color: #39e6ff;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 3px;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ===== Inventory component (shared by all buildings) ===== */
.inv_slot {
  display: grid;
  place-items: center;
  border-radius: 6px;
  touch-action: none;
  cursor: default;
  transition: box-shadow 0.12s, background-color 0.12s;
}
.inv_slot.filled { cursor: grab; }
.inv_slot:hover { box-shadow: 0 0 0 2px rgba(243, 212, 143, 0.55), 0 0 10px rgba(255, 200, 97, 0.35); }
.inv_slot.has_rarity { box-shadow: inset 0 0 0 2px var(--rarity), inset 0 0 10px color-mix(in srgb, var(--rarity) 55%, transparent); }
.inv_slot.has_rarity:hover { box-shadow: inset 0 0 0 2px var(--rarity), 0 0 0 2px rgba(243, 212, 143, 0.55), 0 0 10px rgba(255, 200, 97, 0.35); }
.inv_icon {
  grid-area: 1 / 1;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
.inv_qty {
  grid-area: 1 / 1;
  align-self: end;
  justify-self: end;
  padding: 0 0.22cqw 0.05cqw;
  font: 700 0.8cqw / 1 var(--font_body);
  color: #fff;
  text-shadow: 0 0 2px #000, 0 0 3px #000, 0 0 4px #000;
  pointer-events: none;
}
.inv_lock {
  grid-area: 1 / 1;
  align-self: start;
  justify-self: start;
  font-size: 0.8cqw;
  pointer-events: none;
}
.inv_slot.drag_source .inv_icon { opacity: 0.3; }
.inv_slot.drop_ok { background-color: rgba(120, 220, 120, 0.16); box-shadow: 0 0 0 2px rgba(140, 230, 140, 0.75); }
.inv_slot.drop_hover { background-color: rgba(255, 214, 130, 0.22); box-shadow: 0 0 0 2px var(--gold_light), 0 0 12px rgba(255, 200, 97, 0.6); }
.inv_ghost {
  position: fixed;
  z-index: 300;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.7));
}
.inv_ghost.returning { transition: left 0.2s ease, top 0.2s ease, opacity 0.2s ease; opacity: 0.4; }
.inv_currency {
  display: grid;
  place-items: center;
  font: 700 1.25cqw var(--font_title);
  letter-spacing: 0.03em;
  color: #f6e7c2;
  text-shadow: 0 1px 2px #000, 0 0 4px rgba(0, 0, 0, 0.8);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* ===== Global item tooltip ===== */
.item_tooltip {
  position: fixed;
  z-index: 400;
  left: 0; top: 0;
  min-width: 190px;
  max-width: 290px;
  padding: 10px 13px 9px;
  font: 400 15px / 1.35 var(--font_body);
  color: #dfe3e6;
  background: linear-gradient(180deg, var(--popup_bg), var(--popup_bg_2));
  border: 1px solid var(--gold);
  border-radius: 5px;
  box-shadow: 0 0 0 3px #0d0f12, 0 0 0 4px var(--bronze), 0 10px 30px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.1s;
}
.item_tooltip.visible { opacity: 1; visibility: visible; }
.tt_name { font: 700 17px var(--font_title); letter-spacing: 0.03em; }
.tt_type { margin-bottom: 6px; font-size: 13px; font-style: italic; color: #9aa6b0; }
.tt_stats { padding: 5px 0; border-top: 1px solid rgba(142, 90, 42, 0.5); border-bottom: 1px solid rgba(142, 90, 42, 0.5); font-weight: 600; }
.tt_text { color: #e9e2d0; }
.tt_note { margin-top: 5px; font-size: 13px; color: #e8c27a; }
.tt_skill { margin-top: 5px; font-size: 13px; font-weight: 600; color: #9fe0a8; }
.tt_skill.bad { color: var(--danger); }
.tt_skill_note { font-weight: 500; font-size: 12px; }
.tt_req { margin-top: 5px; font-size: 13px; color: #9aa6b0; }
.tt_req.bad { color: var(--danger); font-weight: 600; }
.tt_qty, .tt_extra { margin-top: 4px; font-size: 13px; color: #c9d0d6; }
.tt_hint { margin-top: 6px; font-size: 12px; font-style: italic; color: #7f8b95; }
.tt_plain { font: 600 14px var(--font_title); color: var(--gold_light); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 6vh;
  z-index: 350;
  transform: translate(-50%, 10px);
  padding: 9px 18px;
  font: 600 16px var(--font_body);
  color: #f3e6c4;
  background: linear-gradient(180deg, rgba(31, 37, 44, 0.96), rgba(22, 27, 33, 0.96));
  border: 1px solid var(--bronze);
  border-radius: 5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.good { border-color: #7fb86a; color: #c9f0b5; }
.toast.bad { border-color: var(--danger); color: #ffc9b8; }

/* ===== Step 5a: Home Tent side panels (Stash, Character Stat) ===== */
/* Same cool slate tone as the other popups, but placed on the left picture
   and non-blocking, so the inventory on the right stays usable. */
.is_hidden { display: none !important; }

.side_panel {
  display: flex;
  flex-direction: column;
  padding: 0.7cqw 1.2cqw 0.9cqw;
  color: #dfe3e6;
  background: linear-gradient(180deg, var(--popup_bg), var(--popup_bg_2));
  border: 0.12cqw solid var(--gold);
  border-radius: 0.4cqw;
  box-shadow: 0 0 0 0.25cqw #0d0f12, 0 0 0 0.32cqw var(--bronze), 0 1cqw 3cqw rgba(0, 0, 0, 0.7);
  animation: pop_in 0.16s ease;
  overflow: hidden;
}
.side_panel_head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.45cqw;
  margin-bottom: 0.55cqw;
  border-bottom: 1px solid rgba(217, 166, 78, 0.45);
}
.side_panel_title {
  margin: 0;
  font: 700 1.45cqw var(--font_title);
  color: var(--gold_light);
  letter-spacing: 0.06em;
}
.side_panel_close {
  width: 1.9cqw;
  height: 1.9cqw;
  padding: 0;
  font: 700 1cqw / 1 var(--font_body);
  color: var(--parchment);
  background: linear-gradient(180deg, #3a2817, #22170d);
  border: 1px solid var(--bronze);
  border-radius: 0.25cqw;
  cursor: pointer;
}
.side_panel_close:hover, .side_panel_close:focus-visible { border-color: var(--gold_light); color: var(--gold_light); outline: none; }
.side_panel_body { flex: 1; min-height: 0; overflow-y: auto; }

/* Stash: the slots themselves are separate elements on top of the frame */
.stash_footer {
  margin-top: auto;
  text-align: center;
  font: 400 max(10px, 0.85cqw) var(--font_body);
  font-style: italic;
  color: #9aa6b0;
}
.inv_slot.stash_slot {
  background: radial-gradient(circle at 50% 40%, #2b2219, #16110c 75%);
  box-shadow: inset 0 0 0 1px rgba(142, 90, 42, 0.9), inset 0 0.15cqw 0.4cqw rgba(0, 0, 0, 0.8);
}
.inv_slot.stash_slot:hover { box-shadow: inset 0 0 0 1px rgba(142, 90, 42, 0.9), 0 0 0 2px rgba(243, 212, 143, 0.55), 0 0 10px rgba(255, 200, 97, 0.35); }

/* Character Stat panel */
.stat_who { font: 600 1.05cqw var(--font_title); color: var(--parchment); letter-spacing: 0.03em; }
.stat_free {
  margin: 0.4cqw 0 0.35cqw;
  font: 600 1cqw var(--font_body);
  color: #9aa6b0;
}
.stat_free.has_points { color: #c9f0b5; }
.stat_list { display: flex; flex-direction: column; }
.stat_row {
  display: grid;
  grid-template-columns: 1fr auto 2.1cqw;
  align-items: center;
  column-gap: 0.7cqw;
  min-height: 2.75cqw;
  border-bottom: 1px solid rgba(142, 90, 42, 0.35);
}
.stat_name { display: flex; flex-direction: column; line-height: 1.15; }
.stat_name b { font: 700 1.05cqw var(--font_title); color: var(--gold_light); letter-spacing: 0.03em; }
.stat_breakdown { font-size: max(10px, 0.78cqw); color: #9aa6b0; }
.stat_value { font: 700 1.35cqw var(--font_title); color: #f6e7c2; font-variant-numeric: tabular-nums; text-align: right; }
.stat_plus {
  grid-column: 3;
  width: 1.8cqw;
  height: 1.8cqw;
  padding: 0;
  font: 700 1.25cqw / 1 var(--font_body);
  color: #c9f0b5;
  background: linear-gradient(180deg, #2f4a26, #1b2c16);
  border: 1px solid #7fb86a;
  border-radius: 0.25cqw;
  cursor: pointer;
}
.stat_plus:hover, .stat_plus:focus-visible { background: linear-gradient(180deg, #3e6132, #24391d); border-color: #c9f0b5; outline: none; }
.stat_note { margin-top: 0.3cqw; font-size: max(10px, 0.78cqw); font-style: italic; color: #e8c27a; }
.stat_section {
  margin: 0.6cqw 0 0.2cqw;
  padding-bottom: 0.2cqw;
  font: 700 1.05cqw var(--font_title);
  color: var(--gold_light);
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(217, 166, 78, 0.45);
}
.stat_line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.18cqw 0;
  font-size: max(11px, 0.98cqw);
}
.stat_line span { color: var(--text_soft); }
.stat_line b { font-weight: 700; color: #f6e7c2; font-variant-numeric: tabular-nums; }
.stat_line.big span { font: 700 1.05cqw var(--font_title); color: var(--gold_light); }
.stat_line.big b { font: 700 1.3cqw var(--font_title); color: #f6e7c2; }
.stat_line.total { border-top: 1px solid rgba(142, 90, 42, 0.35); margin-top: 0.1cqw; }
.stat_line.total span { color: var(--gold_light); font-weight: 600; }
.stat_line.small { font-size: max(10px, 0.85cqw); padding: 0.1cqw 0; }
.stat_sub { margin: -0.1cqw 0 0.25cqw; font-size: max(10px, 0.78cqw); font-style: italic; color: #9aa6b0; }
.inv_slot.stash_slot.has_rarity { box-shadow: inset 0 0 0 2px var(--rarity), inset 0 0 10px color-mix(in srgb, var(--rarity) 55%, transparent); }
.inv_slot.stash_slot.has_rarity:hover { box-shadow: inset 0 0 0 2px var(--rarity), 0 0 0 2px rgba(243, 212, 143, 0.55), 0 0 10px rgba(255, 200, 97, 0.35); }
.inv_slot.stash_slot.drop_hover { background-color: rgba(255, 214, 130, 0.22); box-shadow: 0 0 0 2px var(--gold_light), 0 0 12px rgba(255, 200, 97, 0.6); }

/* ===== Step 5b: Rest Menu (Bed) ===== */
.rest_intro { margin: 0 0 0.4cqw; font-size: max(11px, 0.92cqw); color: var(--text_soft); line-height: 1.3; }
.rest_hp { margin-bottom: 0.45cqw; font: 600 1cqw var(--font_body); color: #f6e7c2; font-variant-numeric: tabular-nums; }
.rest_options { display: flex; flex-direction: column; gap: 0.22cqw; }
.rest_option {
  display: grid;
  grid-template-columns: 6.5cqw auto 1fr;
  align-items: baseline;
  column-gap: 0.8cqw;
  width: 100%;
  padding: 0.3cqw 0.7cqw;
  text-align: left;
  font: 400 max(11px, 0.95cqw) var(--font_body);
  color: var(--parchment);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(142, 90, 42, 0.55);
  border-radius: 0.25cqw;
  cursor: pointer;
}
.rest_option:hover, .rest_option:focus-visible { border-color: var(--gold_light); outline: none; }
.rest_option.selected { background: rgba(217, 166, 78, 0.18); border-color: var(--gold); box-shadow: 0 0 0.5cqw rgba(255, 200, 97, 0.3) inset; }
.rest_time { font: 600 max(11px, 0.95cqw) var(--font_title); color: var(--gold_light); }
.rest_amount { font-weight: 700; color: #c9f0b5; font-variant-numeric: tabular-nums; }
.rest_gain { justify-self: end; font-size: max(10px, 0.78cqw); font-style: italic; color: #9aa6b0; }
.rest_blocked { margin: 0.45cqw 0 0; font-weight: 600; font-size: max(11px, 0.9cqw); color: var(--danger); }
.rest_button {
  display: block;
  margin: 0.6cqw auto 0;
  min-width: 11cqw;
  padding: 0.45cqw 1.2cqw;
  font: 700 max(12px, 1.05cqw) var(--font_title);
  letter-spacing: 0.05em;
  color: var(--gold_light);
  background: linear-gradient(180deg, #3a2817, #22170d);
  border: 1px solid var(--gold);
  border-radius: 0.3cqw;
  cursor: pointer;
}
.rest_button:hover:not(:disabled), .rest_button:focus-visible { background: linear-gradient(180deg, #4d3520, #2d1f12); border-color: var(--gold_light); outline: none; }
.rest_button:disabled { opacity: 0.45; cursor: not-allowed; }
.rest_button.danger { color: #ffc9b8; border-color: var(--danger); }
.rest_button.danger:hover, .rest_button.danger:focus-visible { background: linear-gradient(180deg, #5a2a1e, #331710); border-color: #ffc9b8; }
.rest_running { text-align: center; padding-top: 1.2cqw; }
.rest_run_title { font: 700 1.3cqw var(--font_title); color: var(--gold_light); letter-spacing: 0.04em; }
.rest_run_amount { margin: 0.3cqw 0 0.9cqw; font: 600 1.05cqw var(--font_body); color: #c9f0b5; }
.rest_bar { height: 1.1cqw; margin: 0 1cqw; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--bronze); border-radius: 0.6cqw; overflow: hidden; }
.rest_bar_fill { height: 100%; width: 0; background: linear-gradient(90deg, #7fb86a, #c9f0b5); transition: width 0.9s linear; }
.rest_run_left { margin-top: 0.6cqw; font: 700 1.9cqw var(--font_title); color: #f6e7c2; font-variant-numeric: tabular-nums; }
.rest_run_end { margin-top: 0.2cqw; font-size: max(11px, 0.9cqw); color: #9aa6b0; font-variant-numeric: tabular-nums; }
.rest_run_note { margin: 1cqw 1cqw 0; font-size: max(11px, 0.88cqw); font-style: italic; color: #e8c27a; line-height: 1.3; }

/* HUD: the running rest uses a calm blue-green tone instead of the quest gold */
.hud_quest.active.resting { color: #c9f0e0; border-color: #6fb3a0; box-shadow: 0 0 8px rgba(120, 220, 190, 0.25) inset; }

/* ===== Compare tooltip: the equipped item next to its slot ===== */
.item_tooltip.compare { z-index: 399; border-color: #9aa6b0; }
.tt_badge {
  display: inline-block;
  margin-bottom: 5px;
  padding: 1px 7px;
  font: 700 11px var(--font_title);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #10141a;
  background: #c9d0d6;
  border-radius: 3px;
}
.inv_slot.equip_slot.comparing { box-shadow: 0 0 0 2px #c9d0d6, 0 0 12px rgba(201, 208, 214, 0.6); }

/* ===== Step 6: Blacksmith ===== */
/* Dismantle slot: the circle in the art, so the highlights are round too */
.inv_slot.smith_input { border-radius: 50%; }
.inv_slot.smith_input:hover,
.inv_slot.smith_input.has_rarity:hover { box-shadow: 0 0 0 2px rgba(243, 212, 143, 0.6), 0 0 18px rgba(255, 170, 70, 0.55); }
.inv_slot.smith_input.has_rarity { box-shadow: inset 0 0 0 3px var(--rarity), inset 0 0 18px color-mix(in srgb, var(--rarity) 55%, transparent); }
.inv_slot.smith_input.drop_ok { background-color: rgba(120, 220, 120, 0.14); box-shadow: 0 0 0 3px rgba(140, 230, 140, 0.8), 0 0 16px rgba(140, 230, 140, 0.45); }
.inv_slot.smith_input.drop_hover { background-color: rgba(255, 214, 130, 0.2); box-shadow: 0 0 0 3px var(--gold_light), 0 0 20px rgba(255, 200, 97, 0.7); }

/* Result slots: a soft pulse while materials wait to be collected */
.inv_slot.smith_result { border-radius: 8px; }
.inv_slot.smith_result.filled { animation: smith_wait 1.6s ease-in-out infinite; }
@keyframes smith_wait {
  0%, 100% { box-shadow: 0 0 0 2px rgba(243, 212, 143, 0.35), 0 0 6px rgba(255, 190, 90, 0.25); }
  50%      { box-shadow: 0 0 0 2px rgba(243, 212, 143, 0.85), 0 0 16px rgba(255, 190, 90, 0.6); }
}
.inv_slot.smith_result .inv_qty { font-size: 1cqw; }

/* Short forge flash on the dismantle slot after a dismantle */
.inv_slot.smith_flash { animation: smith_flash 0.7s ease-out; }
@keyframes smith_flash {
  0%   { background-color: rgba(255, 220, 140, 0.85); box-shadow: 0 0 30px 12px rgba(255, 150, 40, 0.9); }
  100% { background-color: transparent; box-shadow: 0 0 0 0 rgba(255, 150, 40, 0); }
}

/* The baked DISMANTLE button: code adds hover glow / inactive dimming */
.smith_button {
  padding: 0;
  border: none;
  border-radius: 0.8cqw;
  background: transparent;
  cursor: pointer;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.smith_button:hover, .smith_button:focus-visible {
  outline: none;
  background-color: rgba(255, 200, 110, 0.1);
  box-shadow: 0 0 0 2px rgba(255, 210, 130, 0.7), 0 0 22px rgba(255, 150, 50, 0.6);
}
.smith_button.inactive {
  cursor: not-allowed;
  background-color: rgba(12, 8, 5, 0.55);
  box-shadow: none;
}
.smith_button.inactive:hover, .smith_button.inactive:focus-visible {
  background-color: rgba(12, 8, 5, 0.5);
  box-shadow: 0 0 0 1px rgba(150, 120, 90, 0.5);
}

/* Confirmation popup */
.smith_confirm { display: grid; gap: 0.35em; text-align: center; }
.smith_confirm_name { font: 700 1.25em var(--font_title); letter-spacing: 0.03em; margin-bottom: 0.2em; }

/* ===== Step 7: Nomad Sage (Enchanter) ===== */
/* Item and scroll slots: square frames in the art */
.inv_slot.sage_slot { border-radius: 6px; }
.inv_slot.sage_slot:hover,
.inv_slot.sage_slot.has_rarity:hover { box-shadow: 0 0 0 2px rgba(243, 212, 143, 0.6), 0 0 18px rgba(110, 170, 255, 0.55); }
.inv_slot.sage_slot.has_rarity { box-shadow: inset 0 0 0 3px var(--rarity), inset 0 0 18px color-mix(in srgb, var(--rarity) 55%, transparent); }
.inv_slot.sage_slot.drop_ok,
.inv_slot.sage_result.drop_ok { background-color: rgba(120, 220, 120, 0.14); box-shadow: 0 0 0 3px rgba(140, 230, 140, 0.8), 0 0 16px rgba(140, 230, 140, 0.45); }
.inv_slot.sage_slot.drop_hover { background-color: rgba(255, 214, 130, 0.2); box-shadow: 0 0 0 3px var(--gold_light), 0 0 20px rgba(255, 200, 97, 0.7); }
.inv_slot.sage_slot .inv_qty,
.inv_slot.sage_result .inv_qty { font-size: 1cqw; }

/* While the Sage works: item and scroll pulse with the blue rune light */
.inv_slot.sage_slot.sage_working { animation: sage_work 0.9s ease-in-out infinite; cursor: not-allowed; }
@keyframes sage_work {
  0%, 100% { box-shadow: 0 0 0 2px rgba(120, 180, 255, 0.45), 0 0 10px rgba(90, 160, 255, 0.35); }
  50%      { box-shadow: 0 0 0 3px rgba(170, 215, 255, 0.95), 0 0 28px rgba(90, 160, 255, 0.85); }
}

/* Result slot: a soft glow while an item waits, a flash after the attempt */
.inv_slot.sage_result { border-radius: 6px; }
.inv_slot.sage_result.filled { animation: smith_wait 1.6s ease-in-out infinite; }
.inv_slot.sage_result.sage_flash_success { animation: sage_flash_success 1.1s ease-out; }
.inv_slot.sage_result.sage_flash_fail    { animation: sage_flash_fail 1.1s ease-out; }
@keyframes sage_flash_success {
  0%   { background-color: rgba(170, 255, 170, 0.75); box-shadow: 0 0 36px 14px rgba(110, 230, 120, 0.9); }
  100% { background-color: transparent; box-shadow: 0 0 0 0 rgba(110, 230, 120, 0); }
}
@keyframes sage_flash_fail {
  0%   { background-color: rgba(200, 200, 210, 0.45); box-shadow: 0 0 26px 8px rgba(170, 180, 200, 0.7); }
  100% { background-color: transparent; box-shadow: 0 0 0 0 rgba(170, 180, 200, 0); }
}

/* CHANCE number (the % sign is baked into the image) */
.sage_chance {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.35cqw;
  box-sizing: border-box;
  font: 700 1.55cqw var(--font_title);
  color: #f6e7c2;
  text-shadow: 0 0 0.5cqw rgba(110, 170, 255, 0.7), 0 1px 2px #000;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* The baked UPGRADE button: code adds hover glow / inactive dimming */
.sage_button {
  padding: 0;
  border: none;
  border-radius: 0.6cqw;
  background: transparent;
  cursor: pointer;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.sage_button:hover, .sage_button:focus-visible {
  outline: none;
  background-color: rgba(255, 200, 110, 0.1);
  box-shadow: 0 0 0 2px rgba(255, 210, 130, 0.7), 0 0 22px rgba(110, 170, 255, 0.55);
}
.sage_button.inactive { cursor: not-allowed; background-color: rgba(12, 8, 5, 0.5); box-shadow: none; }
.sage_button.inactive:hover, .sage_button.inactive:focus-visible { background-color: rgba(12, 8, 5, 0.45); box-shadow: 0 0 0 1px rgba(150, 120, 90, 0.5); }
.sage_button.working { cursor: wait; background-color: rgba(60, 110, 200, 0.12); box-shadow: 0 0 0 2px rgba(150, 200, 255, 0.6), 0 0 22px rgba(90, 160, 255, 0.5); }

/* 5 s timer box at the button's right end: number + a filling ring */
.sage_timer {
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font: 700 1.35cqw var(--font_title);
  color: #f6e7c2;
  text-shadow: 0 1px 2px #000;
  background:
    radial-gradient(circle, rgba(18, 22, 40, 0.95) 56%, transparent 58%),
    conic-gradient(#8fc4ff calc(var(--p, 0) * 360deg), rgba(255, 255, 255, 0.12) 0);
  box-shadow: 0 0 0.8cqw rgba(90, 160, 255, 0.6);
  pointer-events: none;
}
.sage_timer.active { display: flex; }

/* Cost tooltip above the button (inside the shared item tooltip box) */
.sage_cost { display: grid; gap: 3px; min-width: 260px; }
.sage_cost_title { font: 700 16px var(--font_title); letter-spacing: 0.02em; margin-bottom: 3px; }
.sage_cost_row { display: flex; justify-content: space-between; gap: 14px; font-size: 14px; }
.sage_cost_row span { color: #9aa6b0; }
.sage_cost_row b { color: #f6e7c2; font-weight: 700; font-variant-numeric: tabular-nums; }
.sage_cost_row.bad b { color: var(--danger); }
.sage_cost_note { margin-top: 3px; font-size: 13px; color: #c9d0d6; }
.sage_cost_note.good, .tt_extra.good { color: #9fe39a; }
.sage_cost_note.bad, .tt_extra.bad { color: #ff9f8a; }
.sage_cost_problem { margin-top: 5px; font-size: 13px; font-weight: 600; color: var(--danger); }
.item_tooltip { max-width: 330px; }

/* Upgrade part of a stat line, and the +level line */
.tt_up { color: #9fe39a; font-weight: 600; }
.tt_split { color: #c9c2b0; font-weight: 400; }   /* step 18 fix: (original + upgrade) */
.tt_upgrade { margin-top: 5px; font-size: 13px; color: #9fd0ff; font-weight: 600; }

/* ===== Step 8: Crafting Workshop ===== */
/* Recipe slots: the empty dark frames in the art; code draws the product icon */
.craft_slot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0.35cqw;
  background: transparent;
  cursor: pointer;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.craft_slot_icon { object-fit: contain; pointer-events: none; filter: drop-shadow(0 0.2cqw 0.3cqw rgba(0, 0, 0, 0.7)); }
.craft_slot:hover, .craft_slot:focus-visible {
  outline: none;
  background-color: rgba(255, 214, 130, 0.08);
  box-shadow: 0 0 0 2px rgba(243, 212, 143, 0.6), 0 0 18px rgba(140, 230, 120, 0.45);
}
.craft_slot.selected {
  background-color: rgba(255, 214, 130, 0.14);
  box-shadow: 0 0 0 3px var(--gold_light), 0 0 22px rgba(255, 200, 97, 0.75);
}

/* The baked CRAFT button: code adds hover glow / inactive dimming */
.craft_button {
  padding: 0;
  border: none;
  border-radius: 0.6cqw;
  background: transparent;
  cursor: pointer;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.craft_button:hover, .craft_button:focus-visible {
  outline: none;
  background-color: rgba(255, 200, 110, 0.1);
  box-shadow: 0 0 0 2px rgba(255, 210, 130, 0.7), 0 0 22px rgba(140, 230, 120, 0.5);
}
.craft_button.inactive { cursor: not-allowed; background-color: rgba(12, 8, 5, 0.5); box-shadow: none; }
.craft_button.inactive:hover, .craft_button.inactive:focus-visible { background-color: rgba(12, 8, 5, 0.45); box-shadow: 0 0 0 1px rgba(150, 120, 90, 0.5); }

/* Recipe panel (side panel on the left picture) */
.craft_result { display: flex; align-items: center; gap: 0.8cqw; margin-bottom: 0.3cqw; }
.craft_panel .side_panel_head { padding-bottom: 0.3cqw; margin-bottom: 0.4cqw; }
.craft_result_icon {
  flex: none;
  display: flex; align-items: center; justify-content: center;
  width: 3.6cqw; height: 3.6cqw;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--bronze);
  border-radius: 0.3cqw;
}
.craft_result_icon img { width: 85%; height: 85%; object-fit: contain; }
.craft_result_name { font: 700 1.2cqw var(--font_title); letter-spacing: 0.03em; }
.craft_result_type { font-size: max(10px, 0.78cqw); font-style: italic; color: #9aa6b0; }
.craft_result_effect { font-size: max(11px, 0.88cqw); color: #e8c27a; }
.craft_reqs_head {
  margin: 0.15cqw 0 0.2cqw;
  padding-top: 0.3cqw;
  border-top: 1px solid rgba(217, 166, 78, 0.3);
  font: 600 max(11px, 0.85cqw) var(--font_title);
  color: var(--gold_light);
}
.craft_reqs { display: flex; flex-direction: column; gap: 0.12cqw; }
.craft_reqs .craft_req {
  display: grid;
  grid-template-columns: 1.5cqw 1fr auto;
  align-items: center;
  gap: 0.55cqw;
  padding: 0.04cqw 0.4cqw;
  font-size: max(11px, 0.88cqw);
  border-radius: 0.2cqw;
  border-left: 0.2cqw solid transparent;
}
.craft_reqs .craft_req:hover { background: rgba(255, 255, 255, 0.05); }
.craft_reqs .craft_req.ok  { border-left-color: rgba(127, 184, 106, 0.8); }
.craft_reqs .craft_req.bad { border-left-color: var(--danger); background: rgba(208, 106, 79, 0.08); }
.craft_req_icon { display: flex; align-items: center; justify-content: center; width: 1.5cqw; height: 1.5cqw; }
.craft_req_icon img { width: 100%; height: 100%; object-fit: contain; }
.craft_req.kind_sacrifice .craft_req_icon { border: 1px dashed rgba(217, 166, 78, 0.6); border-radius: 0.2cqw; }
.craft_req_name { color: #dfe3e6; }
.craft_req_count { font-weight: 700; font-variant-numeric: tabular-nums; }
.craft_req.ok .craft_req_count  { color: #9fe39a; }
.craft_req.bad .craft_req_count { color: var(--danger); }
.craft_status { margin-top: 0.35cqw; font-weight: 600; font-size: max(11px, 0.88cqw); line-height: 1.3; }
.craft_status.good { color: #9fe39a; }
.craft_status.bad  { color: var(--danger); }

/* Recipe tooltips (recipe slots, CRAFT button) inside the shared tooltip box */
.craft_tip { display: grid; gap: 2px; min-width: 250px; }
.craft_tip_title { font: 700 16px var(--font_title); letter-spacing: 0.02em; }
.craft_tip_effect { font-size: 13px; color: #e8c27a; margin-bottom: 3px; }
.craft_tip_head { font-size: 12px; color: #9aa6b0; }
.craft_tip_reqs { display: grid; gap: 1px; }
.craft_tip_reqs .craft_req { display: flex; justify-content: space-between; gap: 14px; font-size: 14px; }
.craft_tip_reqs .craft_req.ok .craft_req_count  { color: #9fe39a; }
.craft_tip_reqs .craft_req.bad .craft_req_count { color: var(--danger); }
.craft_tip .craft_status { margin-top: 4px; font-size: 13px; }

/* Step 8b: the chosen sacrificial item (stays in its inventory slot).
   A dashed red outline, so it never looks like a rarity frame. */
.inv_slot.craft_sacrifice {
  outline: 3px dashed #ff5a4a;
  outline-offset: 2px;
  background-color: rgba(255, 70, 50, 0.16);
  animation: craft_sacrifice 1.4s ease-in-out infinite;
}
@keyframes craft_sacrifice {
  0%, 100% { outline-color: #ff5a4a; }
  50%      { outline-color: #ffb0a0; }
}
.craft_reqs .craft_req.kind_sacrifice { grid-template-columns: 1.5cqw 1fr auto auto; }
.craft_unchoose {
  width: 1.35cqw; height: 1.35cqw; padding: 0;
  font: 700 max(9px, 0.7cqw) / 1 var(--font_body);
  color: var(--parchment);
  background: linear-gradient(180deg, #3a2817, #22170d);
  border: 1px solid var(--bronze);
  border-radius: 0.2cqw;
  cursor: pointer;
}
.craft_unchoose:hover, .craft_unchoose:focus-visible { border-color: var(--gold_light); color: var(--gold_light); outline: none; }
.craft_confirm_warn { color: var(--danger); font-weight: 600; }

/* Step 8b: crafting in progress (3 s) */
.craft_status.working { color: #9fd0ff; }
.craft_button.working { cursor: wait; background-color: rgba(90, 200, 110, 0.1); box-shadow: 0 0 0 2px rgba(170, 240, 170, 0.6), 0 0 22px rgba(110, 220, 120, 0.5); }
.craft_slot.crafting { animation: craft_work 0.9s ease-in-out infinite; }
@keyframes craft_work {
  0%, 100% { box-shadow: 0 0 0 2px rgba(150, 230, 140, 0.45), 0 0 10px rgba(110, 220, 120, 0.35); }
  50%      { box-shadow: 0 0 0 3px rgba(200, 255, 190, 0.95), 0 0 28px rgba(110, 220, 120, 0.85); }
}
.craft_slot.craft_flash { animation: craft_flash 1.1s ease-out; }
@keyframes craft_flash {
  0%   { background-color: rgba(170, 255, 170, 0.7); box-shadow: 0 0 36px 14px rgba(110, 230, 120, 0.9); }
  100% { background-color: transparent; box-shadow: 0 0 0 0 rgba(110, 230, 120, 0); }
}
.craft_timer {
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font: 700 1.35cqw var(--font_title);
  color: #f6e7c2;
  text-shadow: 0 1px 2px #000;
  background:
    radial-gradient(circle, rgba(16, 30, 18, 0.95) 56%, transparent 58%),
    conic-gradient(#9fe39a calc(var(--p, 0) * 360deg), rgba(255, 255, 255, 0.12) 0);
  box-shadow: 0 0 0.8cqw rgba(110, 220, 120, 0.6);
  pointer-events: none;
}
.craft_timer.active { display: flex; }
@media (prefers-reduced-motion: reduce) {
  .inv_slot.craft_sacrifice, .craft_slot.crafting, .craft_slot.craft_flash { animation: none; }
}

/* ===== Step 9a: Merchant ===== */
/* Shop slots: the dark square frames in the art */
.inv_slot.shop_slot { border-radius: 4px; }
.inv_slot.shop_slot:hover,
.inv_slot.shop_slot.has_rarity:hover { box-shadow: 0 0 0 2px rgba(243, 212, 143, 0.65), 0 0 18px rgba(255, 190, 90, 0.55); }
.inv_slot.shop_slot.has_rarity { box-shadow: inset 0 0 0 3px var(--rarity), inset 0 0 18px color-mix(in srgb, var(--rarity) 55%, transparent); }
.inv_slot.shop_slot.sold_out { cursor: default; }
.inv_slot.shop_slot .inv_qty { font-size: 1cqw; padding: 0 0.3cqw 0.15cqw; }

/* Price under each slot: number only (the gold icon is in the image) */
.shop_price {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2cqw;
  white-space: nowrap;
  font: 700 0.88cqw / 1 var(--font_title);
  letter-spacing: 0.02em;
  color: #f6e7c2;
  text-shadow: 0 1px 2px #000, 0 0 4px rgba(0, 0, 0, 0.8);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.shop_price.too_expensive { color: #ff6a4f; }
.shop_price.sold { color: #8d8478; font-weight: 600; }
.shop_price_dia { display: inline-flex; align-items: center; font-size: 0.72cqw; color: #9fd8ff; }
.shop_price.too_expensive .shop_price_dia { color: #ff6a4f; }
.shop_price_dia img { height: 0.85cqw; width: auto; margin-left: 0.05cqw; }

/* "New goods in 3:59:12" on the bottom frame */
.shop_refresh {
  display: flex;
  align-items: center;
  padding-left: 0.6cqw;
  font: 600 0.95cqw var(--font_title);
  letter-spacing: 0.04em;
  color: #e8c27a;
  text-shadow: 0 1px 2px #000, 0 0 4px rgba(0, 0, 0, 0.8);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* ===== Step 9b: Merchant selling + Skip ===== */
.shop_skip {
  font: 600 0.95cqw var(--font_title);
  letter-spacing: 0.04em;
  color: #bfe6ff;
  background: linear-gradient(180deg, rgba(40, 52, 70, 0.95), rgba(22, 28, 40, 0.95));
  border: 1px solid #7fb6dd;
  border-radius: 5px;
  box-shadow: 0 0 0 2px rgba(13, 9, 6, 0.85), 0 4px 12px rgba(0, 0, 0, 0.55);
  cursor: pointer;
}
.shop_skip:hover, .shop_skip:focus-visible { outline: none; background: linear-gradient(180deg, #3a4d68, #1f2a3b); border-color: #bfe6ff; }
.shop_skip.inactive { opacity: 0.5; cursor: not-allowed; }
.sell_confirm { text-align: center; }
.sell_confirm_name { font: 700 18px var(--font_title); margin-bottom: 4px; }
.sell_confirm_note { font-size: 13px; color: #c9d0d6; font-style: italic; }

/* ===== Step 10: Stable ===== */
/* The 5 mount sale slots (frames are in the image; code draws the mount) */
.stable_slot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0.35cqw;
  background: transparent;
  cursor: pointer;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.stable_slot_icon { object-fit: contain; pointer-events: none; filter: drop-shadow(0 0.2cqw 0.3cqw rgba(0, 0, 0, 0.7)); }
.stable_slot:hover, .stable_slot:focus-visible {
  outline: none;
  background-color: rgba(255, 214, 130, 0.08);
  box-shadow: 0 0 0 2px rgba(243, 212, 143, 0.6), 0 0 18px rgba(255, 200, 97, 0.45);
}
.stable_slot.selected {
  background-color: rgba(255, 214, 130, 0.14);
  box-shadow: 0 0 0 3px var(--gold_light), 0 0 22px rgba(255, 200, 97, 0.75);
}

/* The selected mount's popup: the global tooltip look, pinned above its slot */
.item_tooltip.stable_pin {
  position: absolute;
  z-index: 60;
  transform: translate(-50%, calc(-100% - 14px));
  min-width: 210px;
  max-width: 270px;
  border-color: var(--gold_light);
  pointer-events: none;
}
.item_tooltip.stable_pin::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -9px;
  width: 14px; height: 14px;
  transform: translateX(-50%) rotate(45deg);
  background: rgba(22, 27, 33, 0.97);
  border-right: 1px solid var(--gold_light);
  border-bottom: 1px solid var(--gold_light);
}

/* The baked BUY button: code adds hover glow / inactive dimming */
.stable_buy {
  padding: 0;
  border: none;
  border-radius: 0.6cqw;
  background: transparent;
  cursor: pointer;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.stable_buy:hover, .stable_buy:focus-visible {
  outline: none;
  background-color: rgba(255, 200, 110, 0.1);
  box-shadow: 0 0 0 2px rgba(255, 210, 130, 0.7), 0 0 22px rgba(140, 230, 120, 0.5);
}
.stable_buy.inactive { cursor: not-allowed; background-color: rgba(12, 8, 5, 0.5); box-shadow: none; }
.stable_buy.inactive:hover, .stable_buy.inactive:focus-visible { background-color: rgba(12, 8, 5, 0.45); box-shadow: 0 0 0 1px rgba(150, 120, 90, 0.5); }

/* ===== Step 11: Arena ===== */
/* The baked "1 VS 1" / "3 VS 3" buttons: code adds hover glow / dimming */
.arena_mode_button {
  padding: 0;
  border: none;
  border-radius: 0.8cqw;
  background: transparent;
  cursor: pointer;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.arena_mode_button:hover, .arena_mode_button:focus-visible {
  outline: none;
  background-color: rgba(255, 200, 110, 0.1);
  box-shadow: 0 0 0 2px rgba(255, 210, 130, 0.75), 0 0 22px rgba(255, 190, 90, 0.55);
}
.arena_mode_button.inactive { cursor: not-allowed; background-color: rgba(12, 8, 5, 0.5); box-shadow: none; }
.arena_mode_button.inactive:hover, .arena_mode_button.inactive:focus-visible { background-color: rgba(12, 8, 5, 0.45); box-shadow: 0 0 0 1px rgba(150, 120, 90, 0.5); }

/* Attempts and cooldown, written into the two dark boxes under each button */
.arena_info {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0.4cqw;
  background: transparent;
  font: 600 1.05cqw var(--font_title);
  letter-spacing: 0.04em;
  color: var(--gold_light);
  text-shadow: 0 1px 2px #000, 0 0 4px rgba(0, 0, 0, 0.8);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: default;
}
.arena_info.empty { color: #ff8a6a; }
.arena_timer { cursor: pointer; color: #9fe08a; transition: box-shadow 0.15s; }
.arena_timer.running { color: #e8c27a; }
.arena_timer:hover, .arena_timer:focus-visible { outline: none; box-shadow: 0 0 0 1px rgba(255, 210, 130, 0.6), 0 0 12px rgba(255, 190, 90, 0.35); }

/* Leaderboard: column titles on the parchment, 12 rows, page line */
.arena_lb_header, .arena_lb_row {
  display: flex;
  align-items: center;
  gap: 0.6cqw;
  padding: 0 1.4cqw 0 0.5cqw;
  white-space: nowrap;
}
.arena_lb_header {
  font: 700 0.78cqw var(--font_title);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3b2412;
  pointer-events: none;
}
.arena_lb_row {
  font: 600 1.02cqw var(--font_body);
  color: var(--parchment);
  text-shadow: 0 1px 2px #000;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.arena_lb_row.me {
  color: var(--gold_light);
  background: linear-gradient(90deg, rgba(217, 166, 78, 0.22), rgba(217, 166, 78, 0.06));
  box-shadow: inset 0 0 0 1px rgba(243, 212, 143, 0.35);
  border-radius: 0.25cqw;
  /* keep the highlight clear of the frame's corner ornament */
  clip-path: inset(2px 0.9cqw 2px 0 round 0.25cqw);
}
.lb_rank { flex: 0 0 2.6cqw; text-align: left; }
.lb_name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.lb_points { flex: 0 0 auto; text-align: right; }
.arena_lb_page {
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 0.85cqw var(--font_title);
  letter-spacing: 0.06em;
  color: var(--text_soft);
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}

/* Red / blue banners under the leaderboard: previous / next page */
.arena_page_button {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0.3cqw 0 0;
  border: none;
  border-radius: 0.3cqw;
  background: transparent;
  font: 700 1.6cqw var(--font_title);
  color: var(--gold_light);
  text-shadow: 0 1px 3px #000, 0 0 6px rgba(0, 0, 0, 0.9);
  cursor: pointer;
  transition: box-shadow 0.15s, background-color 0.15s, opacity 0.15s;
}
.arena_page_button:hover, .arena_page_button:focus-visible {
  outline: none;
  background-color: rgba(255, 214, 130, 0.12);
  box-shadow: 0 0 0 2px rgba(243, 212, 143, 0.65), 0 0 16px rgba(255, 200, 97, 0.45);
}
.arena_page_button.inactive { opacity: 0.45; cursor: not-allowed; }
.arena_page_button.inactive:hover, .arena_page_button.inactive:focus-visible { background-color: transparent; box-shadow: 0 0 0 1px rgba(150, 120, 90, 0.5); }

/* ===== Step 14b: buff potion icons in the HUD ===== */
.hud_buffs { display: flex; align-items: center; gap: 0.35cqw; height: 100%; }
.hud_buffs:empty { display: none; }
.hud_buff {
  position: relative;
  height: 84%;
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #6fbf7a;
  border-radius: 4px;
  box-shadow: 0 0 6px rgba(120, 220, 140, 0.25) inset;
  cursor: help;
}
.hud_buff img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hud_buff_time {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font: 700 0.62cqw var(--font_body);
  line-height: 1.25;
  text-align: center;
  color: #d9ffd9;
  background: rgba(0, 0, 0, 0.72);
  border-radius: 0 0 3px 3px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.hud_buff_tip .tt_note { color: #9fe0a8; }
/* Character Stat panel and battle screen: values raised by a potion */
.stat_value.buffed, .stat_line b.buffed, .battle_stats_row b.buffed { color: #8fe39b; }

/* ===== Step 33: dungeon entrance on the zone maps ===== */
.dungeon_spot {
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  cursor: pointer;
  outline: none;
}
.dungeon_spot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;          /* the picture keeps its own proportions */
  pointer-events: none;
  transform-origin: 50% 85%;
  transition: transform 0.15s ease, filter 0.15s ease;
  filter: drop-shadow(0 0.3cqw 0.5cqw rgba(0, 0, 0, 0.55));
}
.dungeon_spot:hover img, .dungeon_spot:focus-visible img {
  transform: scale(1.04);
  filter: drop-shadow(0 0 0.4cqw rgba(190, 140, 255, 0.95)) drop-shadow(0 0 1.3cqw rgba(150, 90, 255, 0.6));
}

/* ===== Step 33: dungeon panel (popup) ===== */
.popup.dungeon_popup { max-width: min(1060px, 96vw); width: min(1060px, 96vw); }
.dungeon_panel {
  display: grid;
  grid-template-columns: 1.05fr 0.85fr 1.2fr;
  gap: 18px;
  text-align: left;
  margin-bottom: 14px;
  max-height: 72vh;
  overflow: auto;
}
.dungeon_left { display: flex; flex-direction: column; gap: 8px; }
.dungeon_pic {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  align-self: center;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.6));
}
.dungeon_summary { font-size: 15px; }
.dungeon_summary div {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 3px 0; border-bottom: 1px solid rgba(142, 90, 42, 0.35);
}
.dungeon_summary span { color: #aab3bb; }
.dungeon_summary b { color: var(--gold_light); font-weight: 600; text-align: right; }
.dungeon_story { margin: 2px 0 0; font-style: italic; color: var(--text_soft); font-size: 15px; }
.dungeon_rule { margin: 2px 0 0; color: #aab3bb; font-size: 14px; line-height: 1.35; }

.dungeon_floors { display: flex; flex-direction: column; gap: 5px; }
.dungeon_floor {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font: 600 15px var(--font_body);
  color: #dfe3e6;
  text-align: left;
  background: rgba(20, 24, 30, 0.75);
  border: 1px solid rgba(142, 90, 42, 0.55);
  border-radius: 4px;
  cursor: pointer;
}
.dungeon_floor .df_icon { text-align: center; }
.dungeon_floor .df_name { font-family: var(--font_title); letter-spacing: 0.04em; }
.dungeon_floor .df_state { font-size: 13px; }
.dungeon_floor.won { border-color: rgba(110, 190, 110, 0.7); }
.dungeon_floor.won .df_icon, .dungeon_floor.won .df_state { color: #8fd48f; }
.dungeon_floor.open { border-color: var(--gold); background: rgba(70, 50, 20, 0.7); }
.dungeon_floor.open .df_icon, .dungeon_floor.open .df_state { color: var(--gold_light); }
.dungeon_floor.locked { opacity: 0.6; }
.dungeon_floor.locked .df_state { color: #aab3bb; }
.dungeon_floor:hover { filter: brightness(1.2); }
.dungeon_floor.selected { box-shadow: 0 0 0 2px var(--gold_light); opacity: 1; }

.dungeon_details { display: flex; flex-direction: column; gap: 8px; }
.dungeon_details_title { margin: 0; font: 700 20px var(--font_title); color: var(--gold_light); letter-spacing: 0.05em; }
.dungeon_status { margin: 0; font-weight: 600; }
.dungeon_status.won { color: #8fd48f; }
.dungeon_status.open { color: var(--gold_light); }
.dungeon_status.locked { color: var(--danger); }
.dungeon_stats { flex: none; min-width: 0; font-size: 15px; }
.dungeon_fight { align-self: flex-start; margin-top: 4px; }
.dungeon_note { margin: 0; color: #aab3bb; font-size: 14px; font-style: italic; }

/* ===== Step 34: dungeon fights in the panel ===== */
.dungeon_spot.questing img { animation: dungeon_running 1.6s ease-in-out infinite; }
@keyframes dungeon_running {
  50% { filter: drop-shadow(0 0 0.5cqw rgba(255, 210, 120, 0.95)) drop-shadow(0 0 1.4cqw rgba(190, 140, 255, 0.7)); }
}
.dungeon_lock_line { margin: 2px 0 0; color: var(--danger); font-weight: 600; font-size: 15px; line-height: 1.35; }
.dungeon_sub_title {
  margin-top: 2px; font: 700 15px var(--font_title); color: var(--gold_light); letter-spacing: 0.05em;
}
.dungeon_btn_row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.dungeon_btn_row .dungeon_fight { margin-top: 4px; }
.dungeon_note.blocked { color: var(--danger); font-style: normal; font-weight: 600; }

/* ===== Step 35: Stash pages (arrows, page label, locked page box) ===== */
.stash_pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1cqw;
}
.stash_arrow {
  width: 2.2cqw;
  height: 100%;
  padding: 0;
  font: 700 1cqw / 1 var(--font_body);
  color: var(--gold_light);
  background: linear-gradient(180deg, #3a2817, #22170d);
  border: 1px solid var(--bronze);
  border-radius: 0.25cqw;
  cursor: pointer;
}
.stash_arrow:hover:not(:disabled), .stash_arrow:focus-visible { border-color: var(--gold_light); outline: none; }
.stash_arrow.drag_turn { border-color: var(--gold_light); box-shadow: 0 0 10px rgba(255, 200, 97, 0.6); }
.stash_arrow:disabled { opacity: 0.35; cursor: default; }
.stash_page_label {
  min-width: 7cqw;
  text-align: center;
  font: 600 max(11px, 0.95cqw) var(--font_title);
  color: var(--parchment);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.stash_lock_box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45cqw;
  text-align: center;
  background: radial-gradient(circle at 50% 40%, rgba(43, 34, 25, 0.95), rgba(22, 17, 12, 0.95) 75%);
  border: 1px dashed rgba(142, 90, 42, 0.9);
  border-radius: 0.3cqw;
}
.stash_lock_icon { font-size: 2.2cqw; line-height: 1; }
.stash_lock_title { font: 700 1.15cqw var(--font_title); color: var(--gold_light); letter-spacing: 0.04em; }
.stash_lock_price { font: 600 max(11px, 0.95cqw) var(--font_body); color: var(--parchment); }
.stash_lock_price .missing { color: var(--danger); }
.stash_unlock_button { font-size: max(11px, 0.95cqw); }
.stash_lock_why { font: italic 400 max(10px, 0.82cqw) var(--font_body); color: #9aa6b0; max-width: 90%; }
.stash_lock_why.bad { color: #ffb29c; }

/* ===== Step 36: inventory (bag) pages: arrows + label between the gold and
   diamond counters, locked page box over the 3x7 grid ===== */
.bag_pager {
  gap: 0.5cqw;
  padding: 0.15cqw 0.25cqw;
  background: linear-gradient(180deg, rgba(43, 30, 18, 0.92), rgba(26, 18, 11, 0.92));
  border: 1px solid rgba(142, 90, 42, 0.85);
  border-radius: 1cqw;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  z-index: 3;
}
.bag_arrow { width: 1.9cqw; border-radius: 0.8cqw; }
.bag_page_label { min-width: 5.6cqw; font-size: max(10px, 0.85cqw); }
.bag_lock_box { z-index: 3; }
.bag_lock_box .stash_lock_icon { font-size: 1.9cqw; }

/* ===== Step 39: Camp jobs (soldiers on the camp hub + panel) ===== */
/* Step 40: the soldiers are drawn by CampArt (see the step 40 block below) */
.camp_jobs_art.working .camp_art_img { animation: camp_jobs_working 1.8s ease-in-out infinite; }
@keyframes camp_jobs_working {
  50% { filter: drop-shadow(0 0 5px rgba(255, 210, 120, 0.95)) drop-shadow(0 0 12px rgba(255, 180, 70, 0.55)); }
}
.camp_jobs_pic { max-width: 260px; }
.camp_jobs_list { align-self: start; }
.job_btn { padding: 10px 12px; font-size: 16px; }
.job_btn .df_icon { font-size: 18px; }
.job_desc { font-style: normal; color: var(--text_soft); }
.job_hours { display: flex; flex-wrap: wrap; gap: 6px; }
.job_hour {
  min-width: 58px;
  padding: 6px 10px;
  font: 600 15px var(--font_body);
  color: #dfe3e6;
  background: rgba(20, 24, 30, 0.75);
  border: 1px solid rgba(142, 90, 42, 0.55);
  border-radius: 4px;
  cursor: pointer;
}
.job_hour:hover:not(:disabled) { filter: brightness(1.2); }
.job_hour.selected { border-color: var(--gold); background: rgba(70, 50, 20, 0.8); color: var(--gold_light); box-shadow: 0 0 0 1px var(--gold_light); }
.job_hour:disabled { opacity: 0.4; cursor: not-allowed; }
.hud_quest.active.working { color: #f3dfb0; border-color: var(--gold); }

/* Job finished popup */
.job_result { text-align: left; margin: 4px 0 14px; font-size: 16px; line-height: 1.5; }
.job_result_line.muted { color: #aab3bb; font-size: 14px; }
.job_result_line.good { color: #8fd48f; font-weight: 600; }
.job_item_name { font-weight: 700; cursor: help; text-decoration: underline dotted; }


/* ===== Step 40: pictures drawn on the Camp hub (Camp jobs, Mailbox) ===== */
/* Hover = no outline: only the picture brightens slightly (+ the name
   label). The click polygon stays invisible (Hotspots.add highlight: false). */
.camp_art { pointer-events: none; }
.camp_art_shadow { fill: rgba(45, 22, 6, 0.42); }
.camp_art_img { transition: filter 0.15s ease; }
.camp_art.hover .camp_art_img { filter: brightness(1.18); }

/* Unread badge on the mailbox */
.mailbox_badge circle { fill: #c0392b; stroke: #f3d48f; stroke-width: 1.5; }
.mailbox_badge text { fill: #fff; font-family: var(--font_body); font-weight: 700; }

/* HUD envelope (unread letters) */
.hud_mail {
  display: flex; align-items: center; gap: 0.25cqw;
  padding: 0.15cqw 0.6cqw;
  font: 700 max(11px, 0.95cqw) var(--font_body);
  color: var(--gold_light);
  background: linear-gradient(180deg, #4a2c16, #2a190c);
  border: 1px solid var(--gold);
  border-radius: 4px;
  cursor: pointer;
  animation: hud_mail_pulse 2s ease-in-out infinite;
}
.hud_mail[hidden] { display: none; }
.hud_mail_icon { font-size: max(14px, 1.35cqw); line-height: 1; }
.hud_mail:hover, .hud_mail:focus-visible { border-color: var(--gold_light); outline: none; filter: brightness(1.15); }
@keyframes hud_mail_pulse {
  50% { box-shadow: 0 0 10px rgba(255, 210, 120, 0.65); }
}

/* Mailbox panel: two halves */
.popup.mailbox_popup { max-width: min(1080px, 96vw); width: min(1080px, 96vw); }
.mailbox_panel {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  text-align: left;
  margin-bottom: 14px;
  max-height: 74vh;
  overflow: auto;
}
.mail_half { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mail_log { border-left: 1px solid rgba(142, 90, 42, 0.45); padding-left: 18px; }
.mail_tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.mail_tab {
  position: relative;
  padding: 5px 10px;
  font: 600 14px var(--font_body);
  color: #dfe3e6;
  background: rgba(20, 24, 30, 0.75);
  border: 1px solid rgba(142, 90, 42, 0.55);
  border-radius: 4px;
  cursor: pointer;
}
.mail_tab.selected { border-color: var(--gold_light); color: var(--gold_light); background: rgba(70, 50, 20, 0.7); }
.mail_tab:hover { filter: brightness(1.2); }
.mail_tab_unread {
  margin-left: 6px; padding: 0 6px;
  font-size: 12px; color: #fff;
  background: #c0392b; border-radius: 8px;
}
.mail_list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 190px; overflow-y: auto;
  padding-right: 4px;
}
.mail_row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font: 15px var(--font_body);
  text-align: left;
  color: #cfd5da;
  background: rgba(20, 24, 30, 0.7);
  border: 1px solid rgba(142, 90, 42, 0.45);
  border-radius: 4px;
  cursor: pointer;
}
.mail_row:hover { filter: brightness(1.2); }
.mail_row.unread { color: var(--gold_light); font-weight: 600; border-color: var(--gold); }
.mail_row.selected { box-shadow: 0 0 0 2px var(--gold_light); }
.mail_dot { color: #e2574c; font-size: 12px; }
.mail_row_title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail_row_meta { color: #95a0a8; font-size: 13px; font-weight: 400; white-space: nowrap; }
.mail_empty { margin: 6px 0; color: #95a0a8; font-style: italic; }
.mail_reader {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px;
  background: rgba(234, 217, 180, 0.06);
  border: 1px solid rgba(142, 90, 42, 0.45);
  border-radius: 4px;
  min-height: 150px;
}
.mail_reader_title { font: 700 18px var(--font_title); color: var(--gold_light); letter-spacing: 0.04em; overflow-wrap: anywhere; }
.mail_reader_meta { color: #95a0a8; font-size: 13px; }
.mail_body { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.mail_line.muted { color: #aab3bb; }
.mail_line.good { color: #8fd48f; }
.mail_item_name { font-weight: 600; cursor: help; }
.mail_items { display: flex; flex-wrap: wrap; gap: 6px; }
.mail_item_slot {
  position: relative;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: rgba(10, 12, 15, 0.75);
  border: 2px solid #f2efe6;
  border-radius: 4px;
  cursor: help;
}
.mail_item_slot img { width: 44px; height: 44px; object-fit: contain; }
.mail_item_qty {
  position: absolute; right: 3px; bottom: 1px;
  font: 700 12px var(--font_body); color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000;
}
.dungeon_note.mail_ok { color: #8fd48f; font-style: normal; font-weight: 600; }
.mail_log_list { display: flex; flex-direction: column; gap: 6px; }
.mail_log_entry {
  padding: 6px 10px;
  background: rgba(20, 24, 30, 0.7);
  border: 1px solid rgba(142, 90, 42, 0.45);
  border-left-width: 4px;
  border-radius: 4px;
  font-size: 14px;
}
.mail_log_entry.victory { border-left-color: #6fbf6f; }
.mail_log_entry.defeat { border-left-color: var(--danger); }
.mail_log_entry.victory b { color: #8fd48f; }
.mail_log_entry.defeat b { color: var(--danger); }
.mail_log_top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.mail_log_top .mail_row_meta { margin-left: auto; }
.mail_log_rewards { color: #cfd5da; }
.mail_new {
  padding: 0 6px; margin-left: 6px;
  font-size: 12px; font-weight: 700; color: #1b1208;
  background: var(--gold_light); border-radius: 8px;
}
.job_result_line.warn { color: #e8b25c; font-weight: 600; font-size: 14px; }

/* ===== Step 41: Clan hall ===== */
.log_clan_note { color: #9fd7a0; font-style: italic; }

/* Transparent buttons over the baked upgrade icons, RANKING banner, send arrow */
.clan_icon_button {
  padding: 0;
  border: none;
  border-radius: 0.7cqw;
  background: transparent;
  cursor: pointer;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.clan_icon_button:hover, .clan_icon_button:focus-visible {
  outline: none;
  background-color: rgba(255, 200, 110, 0.1);
  box-shadow: 0 0 0 2px rgba(255, 210, 130, 0.75), 0 0 22px rgba(255, 190, 90, 0.55);
}
/* Step 43: CLAN WARS button (coded, ornate; mirrored from the RANKING banner) */
.clan_wars_button {
  display: flex; align-items: center; justify-content: center; gap: 0.6cqw;
  padding: 0;
  border: 0.16cqw solid #d9a84e;
  border-radius: 0.5cqw;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255, 120, 90, 0.35), transparent 65%),
    linear-gradient(180deg, #8e1d1d 0%, #5c0f12 55%, #3a080b 100%);
  box-shadow:
    inset 0 0 0 0.2cqw #3a1606,
    inset 0 0 0 0.3cqw rgba(240, 196, 110, 0.55),
    inset 0 0.25cqw 0.9cqw rgba(255, 170, 120, 0.25),
    0 0 0 0.12cqw #2a1205,
    0 0.25cqw 0.8cqw rgba(0, 0, 0, 0.7);
  cursor: pointer;
  overflow: visible;
  transition: filter 0.15s, box-shadow 0.15s;
}
/* gold diamond tips on both ends, like the baked banners */
.clan_wars_button::before, .clan_wars_button::after {
  content: "";
  position: absolute; top: 50%;
  width: 1.1cqw; height: 1.1cqw;
  background: linear-gradient(135deg, #ffe3a0, #b77a2a);
  border: 0.1cqw solid #3a1606;
  transform: translateY(-50%) rotate(45deg);
  box-shadow: 0 0 0.4cqw rgba(0, 0, 0, 0.6);
}
.clan_wars_button::before { left: -0.75cqw; }
.clan_wars_button::after  { right: -0.7cqw; }
.clan_wars_button .cw_text {
  font: 700 1.2cqw var(--font_title);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #ffdf9a;
  text-shadow: 0 1px 0 #3a0a0a, 0 0 0.6cqw rgba(255, 170, 80, 0.6);
}
.clan_wars_button .cw_icon {
  font-size: 1.25cqw;
  line-height: 1;
  color: #f2c46c;
  text-shadow: 0 1px 2px #000;
}
.clan_wars_button:hover, .clan_wars_button:focus-visible {
  outline: none;
  filter: brightness(1.18);
  box-shadow:
    inset 0 0 0 0.2cqw #3a1606,
    inset 0 0 0 0.3cqw rgba(255, 215, 130, 0.85),
    inset 0 0.25cqw 0.9cqw rgba(255, 170, 120, 0.35),
    0 0 0 0.12cqw #2a1205,
    0 0 1.4cqw rgba(255, 150, 70, 0.55);
}
.clan_level {
  display: flex; align-items: center; justify-content: center;
  font: 600 0.95cqw var(--font_title);
  letter-spacing: 0.05em;
  color: var(--gold_light);
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
  white-space: nowrap;
}
.clan_level.max { color: #9fe08a; }

.clan_name {
  display: flex; align-items: center;
  padding: 0 0.8cqw;
  font: 700 1.35cqw var(--font_title);
  letter-spacing: 0.06em;
  color: var(--gold_light);
  text-shadow: 0 1px 3px #000;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.clan_name.none { color: #8d8270; font-weight: 500; font-style: italic; }
.clan_members_count {
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 0.8cqw;
  font: 600 1cqw var(--font_title);
  color: var(--gold_light);
  text-shadow: 0 1px 2px #000;
  font-variant-numeric: tabular-nums;
}

/* Member list: 9 rows visible, scrolls with the wheel or the little bar */
.clan_member_list {
  overflow-y: auto;
  scrollbar-width: none;
}
.clan_member_list::-webkit-scrollbar { display: none; }
.clan_member_row {
  display: flex; align-items: center; gap: 0.5cqw;
  height: calc(100% / var(--rows));
  padding: 0 0.6cqw 0 1.9cqw;   /* leave the baked person icon visible */
  box-sizing: border-box;
  font: 600 1cqw var(--font_body);
  color: var(--parchment);
  text-shadow: 0 1px 2px #000;
}
.clan_member_row.me { color: var(--gold_light); }
.clan_member_row:hover { background: rgba(217, 166, 78, 0.08); }
.clan_dot { flex: 0 0 auto; width: 0.5cqw; height: 0.5cqw; border-radius: 50%; background: #5c5a55; }
.clan_dot.on { background: #6fd46f; box-shadow: 0 0 0.4cqw rgba(110, 220, 110, 0.7); }
.clan_rank { flex: 0 0 1.1cqw; text-align: center; color: var(--gold); }
.clan_rank.vice { color: #b9c7d6; }
.clan_member_name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clan_member_level { flex: 0 0 auto; font-size: 0.85cqw; color: var(--text_soft); font-variant-numeric: tabular-nums; }
.clan_member_actions { flex: 0 0 auto; display: flex; gap: 0.3cqw; }
.clan_row_button {
  width: 1.6cqw; height: 1.6cqw;
  display: grid; place-items: center;
  padding: 0;
  font: 700 0.85cqw var(--font_body);
  border-radius: 0.25cqw;
  border: 1px solid rgba(0, 0, 0, 0.6);
  cursor: pointer;
  color: #fff;
  text-shadow: 0 1px 1px #000;
}
.clan_row_button.leave, .clan_row_button.down { background: linear-gradient(180deg, #b23a2a, #6e1d14); }
.clan_row_button.up { background: linear-gradient(180deg, #3f9b45, #1f5a24); }
.clan_row_button:hover, .clan_row_button:focus-visible { outline: none; filter: brightness(1.25); box-shadow: 0 0 0.5cqw rgba(255, 220, 150, 0.6); }

/* Little scroll bars (member list, chat) */
.clan_scroll { position: absolute; border-radius: 0.4cqw; background: rgba(0, 0, 0, 0.35); }
.clan_scroll[hidden] { display: none; }
.clan_scroll_thumb {
  position: absolute; left: 0; right: 0;
  border-radius: 0.3cqw;
  background: linear-gradient(180deg, var(--gold_light), var(--bronze));
  box-shadow: 0 0 0.3cqw rgba(0, 0, 0, 0.8);
  cursor: grab;
  touch-action: none;
}
.clan_scroll_thumb:active { cursor: grabbing; }

/* "Players on" bar: players online, treasury, Donate */
.clan_bar_text {
  display: flex; align-items: center;
  padding-left: 0.6cqw;
  font: 600 0.95cqw var(--font_title);
  color: var(--gold_light);
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.clan_treasury { gap: 0.7cqw; border-left: 1px solid rgba(217, 166, 78, 0.35); }
.clan_coin { display: inline-flex; align-items: center; gap: 0.25cqw; }
.clan_coin img { width: 1.15cqw; height: 1.15cqw; object-fit: contain; }
.ui_button.clan_donate_button {
  min-width: 0;
  padding: 0;
  font-size: 0.8cqw;
  color: var(--gold_light);
  border-color: var(--gold);
}

/* Chat */
.clan_chat {
  overflow-y: auto;
  scrollbar-width: none;
  padding: 0.5cqw 0.9cqw;
  box-sizing: border-box;
  font: 400 0.95cqw / 1.35 var(--font_body);
  color: var(--parchment);
  text-shadow: 0 1px 2px #000;
  overflow-wrap: anywhere;
}
.clan_chat::-webkit-scrollbar { display: none; }
.clan_chat_line b { color: var(--gold_light); font-weight: 600; }
.clan_chat_empty { color: #8d8270; font-style: italic; }
.clan_input {
  box-sizing: border-box;
  padding: 0 0.8cqw;
  font: 400 1cqw var(--font_body);
  color: var(--parchment);
  caret-color: var(--gold_light);
  background: #15110d;
  border: 1px solid rgba(142, 90, 42, 0.8);
  border-radius: 0.3cqw;
}
.clan_input:focus { outline: none; border-color: var(--gold_light); box-shadow: 0 0 0.5cqw rgba(255, 200, 97, 0.35); }
.clan_input::placeholder { color: #8d8270; font-style: italic; }
.clan_chat_input { border-color: transparent; background: #110e0b; }

/* Without a clan: Clan Finder + Create a Clan */
.clan_finder {
  display: flex; flex-direction: column; gap: 1.2cqw;
  padding: 1.3cqw 1.5cqw;
  box-sizing: border-box;
  overflow: auto;
  color: #dfe3e6;
  background: linear-gradient(180deg, var(--popup_bg), var(--popup_bg_2));
  border: 2px solid var(--gold);
  border-radius: 0.4cqw;
  box-shadow: 0 0 0 0.25cqw #0d0f12, 0 0 0 0.3cqw var(--bronze), 0 1cqw 3cqw rgba(0, 0, 0, 0.7);
}
.clan_finder_part { display: flex; flex-direction: column; gap: 0.6cqw; }
.clan_finder_part + .clan_finder_part { padding-top: 1.1cqw; border-top: 1px solid rgba(142, 90, 42, 0.55); }
.clan_finder_title { margin: 0; font: 700 1.35cqw var(--font_title); letter-spacing: 0.06em; color: var(--gold_light); }
.clan_finder_text { margin: 0; font-size: 0.95cqw; line-height: 1.35; color: #c4cbd2; }
.clan_finder_row { display: flex; gap: 0.6cqw; }
.clan_finder_row .clan_input { flex: 1 1 auto; height: 2.4cqw; }
.clan_finder .ui_button { font-size: 0.9cqw; padding: 0.5cqw 1.1cqw; min-width: 0; }
.clan_finder_results {
  min-height: 6cqw;
  padding: 0.5cqw 0.8cqw;
  background: rgba(10, 12, 15, 0.6);
  border: 1px solid rgba(142, 90, 42, 0.45);
  border-radius: 0.3cqw;
}
.clan_finder_result { display: flex; justify-content: space-between; padding: 0.3cqw 0; font-size: 0.95cqw; }
.clan_cost { margin: 0; font-size: 1cqw; color: var(--parchment); }
.clan_cost .bad, .clan_summary b.bad { color: #ff8a6a; }
.clan_summary b.good { color: #9fe08a; }
.clan_create_button { align-self: flex-start; }
.ui_button.inactive { opacity: 0.5; cursor: not-allowed; }
.clan_reason { margin: 0; color: #ff8a6a; font-size: 0.9cqw; min-height: 1.2em; }
.clan_empty { margin: 0; color: #8d9399; font-style: italic; font-size: 0.95cqw; }

/* Popups: upgrade window, ranking, donate */
.popup.clan_popup { max-width: min(560px, 94vw); width: min(560px, 94vw); }
.clan_popup_body { text-align: left; margin-bottom: 14px; }
.clan_popup_body .clan_reason, .clan_popup_body .clan_empty { font-size: 15px; margin-top: 8px; }
.clan_popup_text { margin: 0 0 10px; font-size: 16px; line-height: 1.4; color: #c4cbd2; }
.clan_note { margin: 10px 0 0; font-size: 14px; color: #8d9399; font-style: italic; }
.clan_summary { font-size: 15px; margin-bottom: 10px; }
.clan_summary div {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 3px 0; border-bottom: 1px solid rgba(142, 90, 42, 0.35);
}
.clan_summary span { color: #aab3bb; }
.clan_summary b { color: var(--gold_light); font-weight: 600; text-align: right; }
.clan_table_wrap { max-height: 40vh; overflow: auto; }
.clan_table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.clan_table th {
  position: sticky; top: 0;
  padding: 4px 8px; text-align: right;
  font: 600 12px var(--font_title); letter-spacing: 0.06em;
  color: var(--gold); background: #1b2026;
  border-bottom: 1px solid var(--bronze);
}
.clan_table td { padding: 3px 8px; text-align: right; border-bottom: 1px solid rgba(142, 90, 42, 0.2); }
.clan_table th:first-child, .clan_table td:first-child { text-align: left; }
.clan_table th:nth-child(2), .clan_table td:nth-child(2) { text-align: left; }
.clan_table tr.owned td { color: #8fa58f; }
.clan_table tr.current td { color: var(--gold_light); background: rgba(217, 166, 78, 0.14); }
.clan_donate_row { display: grid; grid-template-columns: 80px 1fr auto auto; align-items: center; gap: 8px; margin: 8px 0; }
.clan_donate_label { font: 600 14px var(--font_title); color: var(--gold_light); }
.clan_donate_input { height: 34px; font-size: 16px; width: 100%; }
.ui_button.clan_small_button { min-width: 0; padding: 6px 10px; font-size: 12px; }
.clan_donate_have { font-size: 13px; color: #8d9399; white-space: nowrap; }

/* ===== Step 42: Auction House ===== */
/* Number fields over the baked frames (right of the coin / diamond icon) */
.auction_input, .auction_readonly {
  box-sizing: border-box;
  padding: 0 0.5cqw;
  font: 600 1.25cqw var(--font_body);
  color: var(--parchment);
  caret-color: var(--gold_light);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.3cqw;
  font-variant-numeric: tabular-nums;
}
.auction_input:hover { border-color: rgba(217, 166, 78, 0.35); }
.auction_input:focus { outline: none; border-color: var(--gold_light); background: rgba(10, 8, 6, 0.55); box-shadow: 0 0 0.5cqw rgba(255, 200, 97, 0.35); }
.auction_input::placeholder { color: #8d8270; font-style: italic; font-weight: 400; font-size: 0.95cqw; }
.auction_input:disabled { cursor: not-allowed; }
.auction_readonly { display: flex; align-items: center; color: #b9d3ff; cursor: default; }

/* One-line notes under the bid row and the price fields */
.auction_info {
  display: flex; align-items: center;
  padding: 0 0.4cqw;
  font: 400 0.85cqw / 1.1 var(--font_body);
  color: var(--text_soft);
  text-shadow: 0 1px 2px #000, 0 0 4px #000;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.auction_info.bad { color: #ff9a7a; }

/* SELECT ITEM: the whole baked bar is the button; the chosen listing is
   written right of the baked label */
.auction_select {
  padding: 0; border: none; border-radius: 0.5cqw;
  background: transparent; cursor: pointer;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.auction_select:hover, .auction_select:focus-visible, .auction_select.open {
  outline: none;
  background-color: rgba(255, 200, 110, 0.07);
  box-shadow: 0 0 0 2px rgba(255, 210, 130, 0.6), 0 0 18px rgba(255, 150, 50, 0.45);
}
.stage_layer > .auction_select_text { pointer-events: none; }
.auction_select_text {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.8cqw;
  overflow: hidden; white-space: nowrap;
  font: 600 1.1cqw var(--font_title);
  text-shadow: 0 1px 2px #000;
}
.auction_select_name { overflow: hidden; text-overflow: ellipsis; }
.auction_select_status { flex: none; font: 400 0.85cqw var(--font_body); color: var(--text_soft); }
.auction_select_hint { font: italic 400 0.9cqw var(--font_body); color: #8d8270; }

/* The list under SELECT ITEM */
.auction_dropdown {
  z-index: 40;
  display: flex; flex-direction: column; gap: 0.4cqw;
  padding: 0.6cqw;
  box-sizing: border-box;
  background: linear-gradient(180deg, var(--popup_bg), var(--popup_bg_2));
  border: 2px solid var(--gold);
  border-radius: 0.4cqw;
  box-shadow: 0 0 0 0.2cqw #0d0f12, 0 0 0 0.25cqw var(--bronze), 0 1cqw 3cqw rgba(0, 0, 0, 0.75);
}
.auction_dropdown.is_hidden { display: none; }
.auction_search {
  flex: none; height: 2.3cqw;
  padding: 0 0.7cqw;
  font: 400 1cqw var(--font_body);
  color: var(--parchment); caret-color: var(--gold_light);
  background: #15110d;
  border: 1px solid rgba(142, 90, 42, 0.8);
  border-radius: 0.3cqw;
}
.auction_search:focus { outline: none; border-color: var(--gold_light); }
.auction_search::placeholder { color: #8d8270; font-style: italic; }
.auction_count { flex: none; font: 400 0.8cqw var(--font_body); color: #8d9399; }
.auction_list { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.auction_row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.8fr) minmax(0, 1.2fr) minmax(0, 1.2fr);
  align-items: center; gap: 0.6cqw;
  padding: 0.35cqw 0.6cqw;
  font-size: 0.9cqw;
  color: #dfe3e6;
  border-bottom: 1px solid rgba(142, 90, 42, 0.25);
  cursor: pointer;
}
.auction_row:hover, .auction_row:focus-visible { outline: none; background: rgba(217, 166, 78, 0.14); }
.auction_row.selected { background: rgba(217, 166, 78, 0.22); box-shadow: inset 0.2cqw 0 0 var(--gold_light); }
.auction_row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auction_row_name { font: 700 0.95cqw var(--font_title); }
.auction_row_kind { color: #9aa6b0; font-style: italic; }
.auction_row_price { color: var(--gold_light); text-align: right; font-variant-numeric: tabular-nums; }
.auction_row_status { color: #aab3bb; text-align: right; font-variant-numeric: tabular-nums; }
.auction_row.mine .auction_row_status { color: #9fe08a; }
.auction_empty { padding: 1cqw 0.6cqw; font: italic 400 0.95cqw var(--font_body); color: #8d9399; }

/* The pinned card above SELECT ITEM (stays open; can be scrolled) */
.item_tooltip.auction_pin {
  z-index: 90;             /* inside #app: under popups (100); the hover tooltip (body, 400) stays on top */
  max-width: 320px;
  overflow-y: auto;
  pointer-events: auto;
  padding-right: 26px;
}
.auction_pin_close {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; padding: 0;
  font: 700 13px var(--font_body);
  color: var(--gold_light);
  background: transparent; border: none; border-radius: 3px; cursor: pointer;
}
.auction_pin_close:hover { background: rgba(255, 200, 110, 0.15); }

/* The sell slot (big square frame in the art) and the item it points at */
.inv_slot.auction_sell_slot { border-radius: 6px; }
.inv_slot.auction_sell_slot:hover,
.inv_slot.auction_sell_slot.has_rarity:hover { box-shadow: 0 0 0 2px rgba(243, 212, 143, 0.6), 0 0 18px rgba(255, 170, 70, 0.55); }
.inv_slot.auction_sell_slot.has_rarity { box-shadow: inset 0 0 0 3px var(--rarity), inset 0 0 18px color-mix(in srgb, var(--rarity) 55%, transparent); }
.inv_slot.auction_sell_slot.drop_ok { background-color: rgba(120, 220, 120, 0.14); box-shadow: 0 0 0 3px rgba(140, 230, 140, 0.8), 0 0 16px rgba(140, 230, 140, 0.45); }
.inv_slot.auction_sell_slot.drop_hover { background-color: rgba(255, 214, 130, 0.2); box-shadow: 0 0 0 3px var(--gold_light), 0 0 20px rgba(255, 200, 97, 0.7); }
.inv_slot.auction_picked { outline: 2px dashed rgba(243, 212, 143, 0.85); outline-offset: -2px; }
.inv_slot.auction_picked .inv_icon { opacity: 0.55; }

/* Listing confirmation */
.auction_confirm_rows { margin: 8px 0 10px; text-align: left; font-size: 15px; }
.auction_confirm_rows div { display: flex; justify-content: space-between; gap: 14px; padding: 3px 0; border-bottom: 1px solid rgba(142, 90, 42, 0.35); }
.auction_confirm_rows span { color: #aab3bb; }
.auction_confirm_rows b { color: var(--gold_light); font-weight: 600; text-align: right; }
.mail_line.bad { color: #ff9a7a; }
.auction_confirm .sell_confirm_note { margin-bottom: 14px; }

/* ===== Step 44a: Premium Merchant ===== */
.pm_title {
  display: flex; align-items: center; justify-content: center;
  font: 700 2.25cqw var(--font_title);
  letter-spacing: 0.08em;
  color: var(--gold_light);
  background: linear-gradient(180deg, #fff1c4 0%, #f3d48f 45%, #c98a32 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0.12cqw 0.12cqw rgba(0, 0, 0, 0.9)) drop-shadow(0 0 0.6cqw rgba(243, 180, 80, 0.35));
  pointer-events: none;
  white-space: nowrap;
}

/* the 8 Diamond Packages */
.pm_package {
  padding: 0.25cqw;
  background: none;
  border: 0;
  border-radius: 0.3cqw;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.pm_package img {
  width: 100%; height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0.25cqw 0.35cqw rgba(0, 0, 0, 0.7));
  pointer-events: none;
}
.pm_package:hover, .pm_package:focus-visible {
  outline: none;
  filter: brightness(1.15) drop-shadow(0 0 0.6cqw rgba(255, 210, 120, 0.75));
  transform: scale(1.04);
}
.pm_package_amount {
  position: absolute; left: 50%; bottom: 0.1cqw;
  transform: translateX(-50%);
  padding: 0.05cqw 0.45cqw;
  font: 700 0.82cqw var(--font_title);
  color: #e4f1ff;
  white-space: nowrap;
  background: rgba(8, 12, 22, 0.82);
  border: 1px solid rgba(120, 170, 255, 0.65);
  border-radius: 0.6cqw;
  text-shadow: 0 0 0.3cqw rgba(90, 160, 255, 0.9);
  pointer-events: none;
}
.pm_package_badge {
  position: absolute; top: -0.35cqw; right: -0.45cqw;
  padding: 0.12cqw 0.35cqw;
  font: 700 0.78cqw var(--font_title);
  color: #fff6dc;
  background: linear-gradient(180deg, #c8382a, #7c1712);
  border: 1px solid var(--gold_light);
  border-radius: 0.35cqw;
  box-shadow: 0 0.12cqw 0.3cqw rgba(0, 0, 0, 0.7);
  transform: rotate(8deg);
  pointer-events: none;
}
.pm_price {
  display: flex; align-items: center; justify-content: center;
  font: 700 0.95cqw var(--font_title);
  color: var(--gold_light);
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* small tooltip (packages, dimmed buttons) */
.pm_tip { font-family: var(--font_body); }
.pm_tip_title { font: 700 15px var(--font_title); color: var(--gold_light); margin-bottom: 3px; }
.pm_tip_line { font-size: 14px; color: #dfe3e6; }
.pm_tip_line.good { color: #8fd67a; }
.pm_tip_line.bad { color: #f08c74; }
.pm_tip_line.soft { color: var(--text_soft); }

/* the perk catalog */
.pm_catalog {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding: 0.5cqw 0.7cqw 0.8cqw;
  display: flex; flex-direction: column; gap: 0.6cqw;
  overscroll-behavior: contain;
}
.pm_catalog::-webkit-scrollbar { display: none; }
.pm_group {
  margin: 0.3cqw 0 -0.15cqw;
  font: 700 0.95cqw var(--font_title);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 1px 2px #000;
  border-bottom: 1px solid rgba(217, 166, 78, 0.35);
  padding-bottom: 0.15cqw;
}
.pm_card {
  flex: none;
  padding: 0.6cqw 0.8cqw 0.65cqw;
  color: #dfe3e6;
  font-family: var(--font_body);
  background: linear-gradient(180deg, var(--popup_bg), var(--popup_bg_2));
  border: 1px solid var(--gold);
  border-radius: 0.35cqw;
  box-shadow: 0 0 0 0.2cqw #0d0f12, 0 0 0 0.26cqw var(--bronze), 0 0.5cqw 1cqw rgba(0, 0, 0, 0.55);
  margin: 0.26cqw;
}
.pm_card.pm_kind_soon { opacity: 0.86; }
.pm_card_head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6cqw; }
.pm_card_name { font: 700 1.12cqw var(--font_title); color: var(--gold_light); letter-spacing: 0.04em; }
.pm_card_active {
  font: 600 0.8cqw var(--font_title);
  color: #8fd67a;
  white-space: nowrap;
}
.pm_card_lines { margin: 0.3cqw 0 0.35cqw; padding-left: 1.1cqw; font-size: 0.86cqw; line-height: 1.3; }
.pm_card_lines li::marker { color: var(--gold); }
.pm_card_note { font-size: 0.78cqw; font-style: italic; color: var(--text_soft); margin-bottom: 0.3cqw; }
.pm_card_foot { display: flex; align-items: center; justify-content: space-between; gap: 0.8cqw; }
.pm_card_price { flex: 1 1 auto; min-width: 0;   /* step 52a fix: the price may wrap, the button keeps its size */
  font: 600 0.92cqw var(--font_title); color: #cfe3ff; font-variant-numeric: tabular-nums; }
.pm_card_price .pm_missing { color: var(--danger); }
.ui_button.pm_card_button {
  min-width: 0; flex: none; max-width: 62%;   /* step 52a fix */
  padding: 0.3cqw 0.9cqw;
  font-size: 0.85cqw;
  white-space: nowrap;
}
.ui_button.pm_card_button.inactive,
.ui_button.pm_card_button.inactive:hover { opacity: 0.45; cursor: not-allowed; background: linear-gradient(180deg, #3a2817, #22170d); border-color: var(--bronze); }
.pm_card_reason { margin-top: 0.25cqw; font-size: 0.78cqw; color: #f08c74; text-align: right; }

/* popups */
.pm_confirm { text-align: left; margin-bottom: 16px; }
.pm_confirm_pic { display: block; width: 120px; height: 104px; object-fit: contain; margin: 0 auto 10px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6)); }
.pm_confirm_text { margin: 0 0 10px; font-size: 16px; line-height: 1.4; }
.pm_confirm .pm_card_lines { font-size: 15px; padding-left: 20px; margin: 0 0 10px; }
.pm_rows { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 16px; }
.pm_row_key { color: var(--text_soft); }
.pm_row_val { color: var(--gold_light); font-weight: 600; }
.pm_name_input {
  display: block; width: 100%; margin: 14px 0 6px; padding: 8px 10px;
  font: 600 17px var(--font_body);
  color: var(--parchment);
  background: #0f1317;
  border: 1px solid var(--bronze);
  border-radius: 4px;
}
.pm_name_input:focus { outline: none; border-color: var(--gold_light); }
.pm_name_msg { min-height: 20px; font-size: 15px; }
.pm_name_msg.good { color: #8fd67a; }
.pm_name_msg.bad { color: #f08c74; }
.pm_name_note { font-size: 14px; color: var(--text_soft); font-style: italic; }

/* ===== Step 44b: Pathfinder quest queue ===== */
.enemy_queue_badge {
  position: absolute; left: 50%; top: 4%; z-index: 2;
  transform: translateX(-50%);
  min-width: 1.5cqw;
  padding: 0.05cqw 0.4cqw;
  font: 700 0.95cqw var(--font_title);
  color: #1a1206;
  text-align: center;
  background: linear-gradient(180deg, var(--gold_light), var(--gold));
  border: 1px solid #3a2817;
  border-radius: 0.8cqw;
  box-shadow: 0 0.1cqw 0.35cqw rgba(0, 0, 0, 0.8);
  pointer-events: none;
  white-space: nowrap;
}
.enemy_queue_badge[hidden] { display: none; }
.queue_info { text-align: left; margin-bottom: 14px; min-width: min(460px, 80vw); }
.queue_row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; margin-bottom: 6px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(217, 166, 78, 0.3);
  border-radius: 4px;
}
.queue_row.running { border-color: var(--gold); background: rgba(217, 166, 78, 0.1); }
.queue_row b { color: var(--gold_light); }
.queue_name { flex: 1; color: var(--parchment); }
.queue_when { font-size: 14px; color: var(--text_soft); white-space: nowrap; }
.queue_remove {
  padding: 1px 7px; font-size: 14px; color: #f08c74; cursor: pointer;
  background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(240, 140, 116, 0.5); border-radius: 3px;
}
.queue_remove:hover { background: rgba(120, 30, 20, 0.5); }
.queue_note { margin: 8px 0 0; font-size: 14px; color: var(--text_soft); line-height: 1.35; }

/* ===== Step 48a: Nagrok's Cellar (20 floors in two columns) ===== */
.popup.dungeon_popup.cellar_popup { max-width: min(1180px, 97vw); width: min(1180px, 97vw); }
.dungeon_panel.cellar { grid-template-columns: 1fr 1.3fr 1.15fr; }
.dungeon_floors.two_columns {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(10, auto);
  grid-auto-columns: 1fr;
  gap: 5px 6px;
}
.dungeon_floors.two_columns .dungeon_floor {
  grid-template-columns: 20px 1fr auto;
  gap: 5px;
  padding: 5px 7px;
  font-size: 14px;
}
.dungeon_floors.two_columns .df_state { font-size: 12px; }
.dungeon_floor.gate_keeper {
  border: 2px solid var(--gold_light);
  background: linear-gradient(180deg, rgba(110, 78, 22, 0.85), rgba(60, 40, 12, 0.85));
  box-shadow: inset 0 0 6px rgba(255, 210, 120, 0.45), 0 0 6px rgba(255, 200, 90, 0.35);
}
.dungeon_floor.gate_keeper .df_name { color: var(--gold_light); }
.dungeon_floor.gate_keeper.locked { opacity: 0.85; }
.dungeon_floor.gate_keeper.selected { box-shadow: 0 0 0 2px var(--gold_light), 0 0 10px rgba(255, 210, 120, 0.6); }
.dungeon_warning { margin: 2px 0 0; color: #f0b35a; font-weight: 600; font-size: 14px; line-height: 1.35; }
.dungeon_cleared_line { margin: 2px 0 0; color: #8fd48f; font-weight: 700; font-size: 15px; line-height: 1.35; }
.dungeon_cleared_line span { display: block; margin-top: 2px; color: #aab3bb; font-weight: 600; font-size: 14px; font-style: italic; }
.battle_log_line.final_victory { color: var(--gold_light); }

/* ===== Step 48b: class icons (Nagrok_cellar.docx final rule 7) ===== */
/* Drawn by code (js/engine/class_icon.js); about 18-20 image px in the
   lists (1.15 x the row font), hover = the class name. */
.class_icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 1.15em; height: 1.15em;
  min-width: 14px; min-height: 14px;
  margin-right: 0.3em;
  vertical-align: -0.22em;
  pointer-events: auto;
  cursor: help;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7));
}
.class_icon svg { display: block; width: 100%; height: 100%; }
.class_icon.blank { visibility: hidden; cursor: default; pointer-events: none; }
.class_icon:hover { filter: drop-shadow(0 0 3px rgba(243, 212, 143, 0.85)); }

/* ===== Step 48b: titles (final rule 5) ===== */
/* HUD: the chosen title under the name (empty line = No title) */
/* three lines must fit the 50 px HUD: explicit line heights (the font
   shorthand resets them to "normal", which is about 1.3) */
.hud_identity { line-height: 1; }
.hud_name { font-size: 1.15cqw; line-height: 1; }
.hud_sub { font-size: 0.88cqw; line-height: 1.08; }
.hud_title {
  height: 0.74cqw;
  font: 600 0.7cqw / 0.74cqw var(--font_title);
  letter-spacing: 0.05em;
  color: var(--gold);
  white-space: nowrap;
}
/* Arena leaderboard: Rank / Player / Title / Points */
.lb_name { display: flex; align-items: center; min-width: 0; }
.lb_name .lb_name_text { overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%; }
.lb_title {
  flex: 0 0 10.2cqw;
  overflow: hidden; text-overflow: ellipsis;
  font: 600 0.8cqw var(--font_title);
  letter-spacing: 0.03em;
  color: var(--gold);
}
.arena_lb_header .lb_title { font: inherit; color: inherit; }
.lb_points { flex: 0 0 5.2cqw; }
/* Clan member list: ● ♛ [class] Name  Title  Lv 66 ▲ ▼ ✖ */
.clan_member_name { display: flex; align-items: center; min-width: 0; flex: 0 1 auto; }
.clan_member_name .clan_member_name_text { overflow: hidden; text-overflow: ellipsis; }
.clan_member_title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 600 0.74cqw var(--font_title);
  letter-spacing: 0.04em;
  color: var(--gold);
}
/* Clan Finder: the clan's Leader with the class icon */
.clan_finder_leader { display: inline-flex; align-items: center; color: var(--text_soft); }
/* Item tooltip extra row with players (auction seller / bidders) */
.tt_people_name { white-space: nowrap; }
/* Mailbox sender of a player letter */
.mail_reader_meta .class_icon { margin-right: 0.25em; }
/* Battle name box (Arena fights, both sides) */
.battle_name_main .class_icon { width: 1em; height: 1em; vertical-align: -0.12em; }
/* Arena opponent list (online play; step 48b) */
.arena_opponents { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.arena_opponent { display: flex; align-items: center; gap: 10px; font: 600 16px var(--font_body); color: var(--parchment); }
.arena_opponent_name { flex: 1 1 auto; display: flex; align-items: center; }
.arena_opponent .lb_title { flex: 0 0 auto; font-size: 13px; }
.arena_opponent_level { color: var(--text_soft); font-size: 14px; }

/* ===== Step 48b: Home Tent wardrobe (Skin / Title / Aura; final rule 6) ===== */
/* Three buttons touching each other on the bottom edge of the skin
   rectangle, slightly transparent (the silhouette shows through), fully
   visible on hover. Narrow screens: icons, label on hover. */
.wardrobe_buttons { display: flex; z-index: 3; }
.wardrobe_button {
  flex: 1 1 0;
  min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 0.25cqw;
  padding: 0;
  font: 700 0.78cqw var(--font_title);
  letter-spacing: 0.05em;
  color: var(--gold_light);
  background: linear-gradient(180deg, rgba(58, 40, 23, 0.82), rgba(30, 20, 11, 0.82));
  border: 1px solid var(--bronze);
  border-radius: 0;
  opacity: 0.62;
  cursor: pointer;
  transition: opacity 0.12s ease;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
  overflow: hidden;
}
.wardrobe_button + .wardrobe_button { border-left: none; }
.wardrobe_button:first-child { border-radius: 0.35cqw 0 0 0.35cqw; }
.wardrobe_button:last-child  { border-radius: 0 0.35cqw 0.35cqw 0; }
.wardrobe_buttons:hover .wardrobe_button,
.wardrobe_button:focus-visible { opacity: 1; outline: none; }
.wardrobe_button:hover, .wardrobe_button:focus-visible {
  background: linear-gradient(180deg, #4d3520, #2d1f12);
  border-color: var(--gold_light);
}
.wardrobe_button.active { opacity: 1; border-color: var(--gold); box-shadow: inset 0 0 0.5cqw rgba(243, 212, 143, 0.35); }
.wardrobe_icon { display: none; width: 1.05cqw; height: 1.05cqw; }
.wardrobe_icon svg { display: block; width: 100%; height: 100%; }
.wardrobe_buttons.icons .wardrobe_icon { display: block; }
.wardrobe_buttons.icons .wardrobe_label { display: none; }

/* The list panel */
.wardrobe_list { display: flex; flex-direction: column; gap: 0.45cqw; overflow-y: auto; }
.wardrobe_option {
  display: flex; align-items: center; gap: 0.8cqw;
  width: 100%;
  padding: 0.55cqw 0.8cqw;
  text-align: left;
  color: var(--parchment);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(142, 90, 42, 0.7);
  border-radius: 0.3cqw;
  cursor: pointer;
  font: 600 1cqw var(--font_body);
}
.wardrobe_option:hover, .wardrobe_option:focus-visible { border-color: var(--gold_light); background: rgba(217, 166, 78, 0.1); outline: none; }
.wardrobe_option.chosen { border-color: var(--gold); background: rgba(217, 166, 78, 0.16); cursor: default; }
.wardrobe_option_text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 0.15cqw; min-width: 0; }
.wardrobe_option_name { font: 700 1.02cqw var(--font_title); color: var(--gold_light); letter-spacing: 0.03em; }
.wardrobe_option_sub { font-size: 0.8cqw; font-weight: 400; color: var(--text_soft); }
.wardrobe_option_mark { flex: 0 0 auto; font-size: 0.8cqw; color: #9fe08a; }
.wardrobe_badge {
  align-self: flex-start;
  margin-top: 0.15cqw;
  padding: 0.05cqw 0.45cqw;
  font: 700 0.62cqw var(--font_title);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 0.2cqw;
  color: #1a1206;
  background: #b9c7d6;
}
.wardrobe_badge.earned { background: var(--gold); }
.wardrobe_skin_img { width: 2.6cqw; height: 3.9cqw; object-fit: cover; object-position: center top; border: 1px solid var(--gold); border-radius: 0.25cqw; flex: 0 0 auto; background: #1a140e; }
.wardrobe_skin_img.is_default { object-position: center; }
/* Step 50a: the worn skin over the Home Tent silhouette (skin_rect) */
.skin_figure { position: absolute; display: flex; justify-content: center; align-items: stretch; overflow: visible; pointer-events: none; }
.skin_figure img { height: 100%; width: auto; max-width: none; border-radius: 0.3cqw; box-shadow: 0 0 0.5cqw rgba(0, 0, 0, 0.75), 0 0 0.25cqw var(--skin_color, transparent); }
.wardrobe_note { margin: 0.8cqw 0 0; font-size: 0.82cqw; color: var(--text_soft); font-style: italic; }
.wardrobe_empty { margin: 1.2cqw 0 0.2cqw; text-align: center; font: 600 1.1cqw var(--font_body); color: var(--parchment); }

/* ===== Step 49: Auras (aura.docx; drawing: js/engine/aura_fx.js) ===== */
/* Two canvases per aura: one behind the item picture, one in front.
   They reach beyond the slot and never take the mouse. */
.has_aura { isolation: isolate; }
.aura_canvas { position: absolute; pointer-events: none; z-index: 0; }
.aura_canvas.aura_front { z-index: 2; }
.aura_icon { position: relative; z-index: 1; }
.inv_slot.has_aura .inv_qty,
.inv_slot.has_aura .inv_lock { position: relative; z-index: 3; }
.tt_extra.aura { color: #f3d48f; }
.tt_extra.soft { color: var(--text_soft); }

/* Preview box: an item picture with an aura on it */
.aura_preview {
  position: relative;
  display: grid; place-items: center;
  flex: 0 0 auto;
  background: radial-gradient(circle at 50% 45%, #2b2219, #120d09 75%);
  border: 1px solid rgba(142, 90, 42, 0.9);
  border-radius: 6px;
}
.aura_preview_img { width: 72%; height: 72%; object-fit: contain; pointer-events: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }

/* Premium shop: the aura list */
.popup.aura_shop_popup { max-width: min(1180px, 96vw); width: min(1180px, 96vw); padding: 16px 20px 16px; }
.aura_shop_intro { margin: 0 0 10px; font-size: 14px; color: var(--text_soft); line-height: 1.35; }
.aura_shop_grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  max-height: min(66vh, 640px);
  overflow-y: auto;
  padding: 14px 6px 6px;
  text-align: center;
}
.aura_card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 8px 9px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(142, 90, 42, 0.7);
  border-radius: 6px;
}
.aura_card.owned { border-color: rgba(143, 214, 122, 0.8); background: rgba(80, 140, 60, 0.12); }
.aura_card_preview { width: 84px; height: 84px; margin: 6px 0 8px; }
.aura_card_name { font: 700 15px var(--font_title); letter-spacing: 0.03em; }
.aura_card_rarity { font-size: 12px; color: var(--text_soft); text-transform: uppercase; letter-spacing: 0.08em; }
.aura_card_look {
  font-size: 12px; line-height: 1.3; color: #c9ced3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 3.9em;
}
.aura_card_button { margin-top: auto; min-width: 110px; padding: 5px 10px; font-size: 14px; }
.aura_card_button.inactive { opacity: 0.6; cursor: default; }
.aura_card.owned .aura_card_button { color: #bff0ad; opacity: 0.9; }
.aura_card_button.missing { color: #f08c74; }
.aura_confirm { display: flex; flex-direction: column; align-items: center; }
.aura_confirm_preview { width: 96px; height: 96px; margin: 14px 0 16px; }
@media (max-width: 1000px) { .aura_shop_grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Step 50a: Premium shop skin list (reuses the aura list layout) */
.skin_card_pic { width: 100%; max-width: 118px; aspect-ratio: 2 / 3; object-fit: cover; border: 2px solid var(--bronze); border-radius: 6px; margin: 2px 0 6px; cursor: zoom-in; background: #1a140e; }
.skin_card.owned .skin_card_pic { box-shadow: 0 0 0 2px rgba(143, 214, 122, 0.55); }
.skin_view { display: flex; justify-content: center; }
.skin_view_pic { height: min(68vh, 640px); width: auto; border: 2px solid var(--bronze); border-radius: 8px; }
.skin_confirm { display: flex; flex-direction: column; align-items: center; }
.skin_confirm_pic { height: 220px; width: auto; border: 2px solid var(--bronze); border-radius: 6px; margin: 6px 0 12px; }

/* Home Tent: the Aura list */
.aura_step { margin: 0.2cqw 0 0.35cqw; font: 700 0.85cqw var(--font_title); color: var(--gold_light); letter-spacing: 0.05em; }
.aura_items { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 0.3cqw; margin: 0 0 0.45cqw; padding: 0.6cqw 0.4cqw; }
.aura_item {
  position: relative;
  display: grid; place-items: center;
  aspect-ratio: 1;
  padding: 0;
  background: radial-gradient(circle at 50% 45%, #2b2219, #120d09 75%);
  border: 1px solid rgba(142, 90, 42, 0.9);
  border-radius: 0.3cqw;
  box-shadow: inset 0 0 0 1px var(--rarity, transparent);
  cursor: pointer;
}
.aura_item:hover { border-color: var(--gold_light); }
.aura_item.chosen { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 10px rgba(255, 200, 97, 0.55); }
.aura_item.empty { opacity: 0.5; cursor: default; }
.aura_item_img { width: 82%; height: 82%; object-fit: contain; pointer-events: none; }
.aura_item_empty { font-size: 0.55cqw; color: var(--text_soft); text-align: center; line-height: 1.1; }
.aura_chosen_line { margin: 0 0 0.6cqw; font-size: 0.85cqw; color: var(--parchment); }
.aura_option { gap: 0.9cqw; padding: 0.45cqw 0.8cqw 0.45cqw 0.6cqw; }
.aura_option.inactive { opacity: 0.6; }
.aura_option_preview { width: 2.8cqw; height: 2.8cqw; margin: 0.25cqw; }
.aura_list { overflow: visible; padding: 0.2cqw; }

/* ===== Step 49b: a player's panel (Arena leaderboard / clan member list) ===== */
.pp_link { cursor: pointer; }
.pp_link:hover { text-decoration: underline; color: var(--gold_light); }
.popup.player_panel_popup { max-width: min(560px, 94vw); width: min(560px, 94vw); }
.pp_head { margin-bottom: 12px; }
.pp_name { display: flex; justify-content: center; align-items: center; gap: 6px; font: 700 20px var(--font_title); color: var(--gold_light); }
.pp_title { min-height: 18px; font: 600 14px var(--font_title); color: var(--gold); }
.pp_sub { font-size: 14px; color: var(--text_soft); }
.pp_main { display: grid; grid-template-columns: 78px 1fr 78px; gap: 14px; align-items: center; padding: 14px 10px; }
.pp_col { display: flex; flex-direction: column; gap: 14px; }
.pp_slot {
  position: relative;
  display: grid; place-items: center;
  width: 78px; height: 60px;
  background: radial-gradient(circle at 50% 45%, #2b2219, #120d09 75%);
  border: 1px solid rgba(142, 90, 42, 0.9);
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px var(--rarity, transparent);
}
.pp_icon { width: 52px; height: 52px; object-fit: contain; pointer-events: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.pp_empty { font-size: 11px; color: var(--text_soft); opacity: 0.7; }
.pp_skin { display: grid; place-items: center; }
.pp_skin img { width: 100%; max-height: 360px; object-fit: contain; border: 1px solid var(--bronze); border-radius: 6px; background: #1a140e; }
.pp_note { margin: 4px 0 0; font-size: 13px; font-style: italic; color: var(--text_soft); }
/* the leaderboard rows ignore the mouse; only the clickable name takes it */
.arena_lb_row .pp_link { pointer-events: auto; }

/* Step 51: attack animations (js/engine/battle_fx.js). Clicks pass through
   (Click to continue, log tooltips, the test Skip button). */
.battle_fx { pointer-events: none; }
.battle_fx.off { display: none; }

/* ===== Step 52: main menu + Settings panel ===== */
.popup.main_menu_popup { min-width: min(300px, 86vw); max-width: min(340px, 90vw); }
.popup.main_menu_popup .popup_buttons { flex-direction: column; align-items: stretch; gap: 8px; }
.popup.main_menu_popup .popup_buttons .ui_button { width: 100%; }

.popup.settings_popup { min-width: min(440px, 92vw); max-width: min(480px, 94vw); }
.settings_panel { display: flex; flex-direction: column; gap: 14px; margin: 6px 0 18px; text-align: left; }
.settings_row {
  display: grid;
  grid-template-columns: 130px 1fr 44px;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(142, 90, 42, 0.55);
  border-radius: 4px;
}
.settings_label { font: 600 15px var(--font_title); letter-spacing: 0.04em; color: var(--parchment); }
.settings_value { font: 600 16px var(--font_body); color: var(--gold_light); text-align: right; font-variant-numeric: tabular-nums; }
.settings_slider {
  --fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  margin: 0;
  border-radius: 4px;
  border: 1px solid var(--bronze);
  background: linear-gradient(90deg, var(--gold) 0, var(--gold) var(--fill), #2a2016 var(--fill), #2a2016 100%);
  cursor: pointer;
  outline: none;
}
.settings_slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff2c8, var(--gold) 60%, #8a5f22);
  border: 1px solid #3a2410;
  box-shadow: 0 0 6px rgba(243, 212, 143, 0.45);
}
.settings_slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff2c8, var(--gold) 60%, #8a5f22);
  border: 1px solid #3a2410;
}
.settings_slider:focus-visible { box-shadow: 0 0 0 2px var(--gold_light); }
.settings_switch { position: relative; display: inline-block; width: 52px; height: 26px; justify-self: start; cursor: pointer; }
.settings_switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.settings_switch_knob {
  position: absolute; inset: 0;
  border-radius: 13px;
  background: #2a2016;
  border: 1px solid var(--bronze);
  transition: background 0.15s;
  pointer-events: none;
}
.settings_switch_knob::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--parchment);
  transition: transform 0.15s;
}
.settings_switch input:checked + .settings_switch_knob { background: #7a2f22; border-color: var(--danger); }
.settings_switch input:checked + .settings_switch_knob::after { transform: translateX(26px); background: #ffd9cc; }
.settings_switch input:focus-visible + .settings_switch_knob { box-shadow: 0 0 0 2px var(--gold_light); }
.settings_panel.muted .settings_row:not(.settings_mute_row) { opacity: 0.5; }
.settings_note { font-size: 13px; color: #9aa4ad; text-align: center; }

/* ===== Step 52b: the same soft highlight on the baked buttons ===== */
/* Transparent rectangle hotspots over baked buttons / banners (DISMANTLE,
   UPGRADE, CRAFT, BUY, 1 VS 1 / 3 VS 3, the Arena page arrows and timer
   boxes, the Clan hall icons / RANKING / send arrow, Auction House buttons
   and SELECT ITEM). No outline ring in any state any more: on hover the
   picture under the button brightens softly with a feathered edge (like
   the camp polygons, js/engine/hotspots.js). Inactive = dimmed, never lit;
   a running UPGRADE / CRAFT stays softly lit. Item slots keep their frames. */
:is(.smith_button, .sage_button, .craft_button, .stable_buy, .arena_mode_button,
    .arena_page_button, .arena_timer, .clan_icon_button, .auction_select) {
  --soft_feather: 0.8cqw;
}
:is(.smith_button, .sage_button, .craft_button, .stable_buy, .arena_mode_button,
    .arena_page_button, .arena_timer, .clan_icon_button, .auction_select)::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  -webkit-backdrop-filter: brightness(1.17) sepia(0.08);
  backdrop-filter: brightness(1.17) sepia(0.08);
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 var(--soft_feather), #000 calc(100% - var(--soft_feather)), transparent),
    linear-gradient(to bottom, transparent, #000 var(--soft_feather), #000 calc(100% - var(--soft_feather)), transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 var(--soft_feather), #000 calc(100% - var(--soft_feather)), transparent),
    linear-gradient(to bottom, transparent, #000 var(--soft_feather), #000 calc(100% - var(--soft_feather)), transparent);
  mask-composite: intersect;
  opacity: 0;
  transition: opacity 0.16s ease;
}
:is(.smith_button, .sage_button, .craft_button, .stable_buy, .arena_mode_button,
    .arena_page_button, .arena_timer, .clan_icon_button, .auction_select):is(:hover, :focus-visible)::before,
.auction_select.open::before,
.sage_button.working::before,
.craft_button.working::before {
  opacity: 1;
}
:is(.smith_button, .sage_button, .craft_button, .stable_buy, .arena_mode_button,
    .arena_page_button, .arena_timer, .clan_icon_button, .auction_select).inactive::before {
  display: none;
}
:is(.smith_button, .sage_button, .craft_button, .stable_buy, .arena_mode_button,
    .arena_page_button, .arena_timer, .clan_icon_button, .auction_select):is(:hover, :focus-visible),
.auction_select.open {
  outline: none;
  box-shadow: none;
  background-color: transparent;
}
:is(.smith_button, .sage_button, .craft_button, .stable_buy, .arena_mode_button,
    .arena_page_button, .arena_timer, .clan_icon_button, .auction_select).inactive:is(:hover, :focus-visible) {
  box-shadow: none;
}
.sage_button.working, .craft_button.working { box-shadow: none; }

/* ===== Login screen (server step 1) ===== */
.login_dim {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(8, 6, 4, 0.55), rgba(5, 4, 3, 0.82));
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.login_panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 27cqw;
  min-width: 300px;
  max-width: 92vw;
  padding: 1.6cqw 2cqw 1.3cqw;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  text-align: center;
  color: #dfe3e6;
  background: linear-gradient(180deg, var(--popup_bg), var(--popup_bg_2));
  border: 2px solid var(--gold);
  border-radius: 6px;
  box-shadow: 0 0 0 4px #0d0f12, 0 0 0 5px var(--bronze), 0 18px 50px rgba(0, 0, 0, 0.7);
  animation: pop_in 0.2s ease;
}
.login_title {
  margin: 0 0 0.9cqw;
  font: 700 max(22px, 1.9cqw) var(--font_title);
  color: var(--gold_light);
  letter-spacing: 0.08em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
.login_subtitle {
  margin: 0 0 0.6cqw;
  font: 700 max(16px, 1.2cqw) var(--font_title);
  color: var(--gold_light);
  letter-spacing: 0.05em;
}
.login_tabs {
  display: flex;
  margin-bottom: 1cqw;
  border-bottom: 1px solid rgba(217, 166, 78, 0.35);
}
.login_tab {
  flex: 1;
  padding: 0.5cqw 0;
  font: 600 max(14px, 1cqw) var(--font_title);
  letter-spacing: 0.05em;
  color: var(--text_soft);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.login_tab:hover, .login_tab:focus-visible { color: var(--gold_light); outline: none; }
.login_tab.active { color: var(--gold_light); border-bottom-color: var(--gold); cursor: default; }
.login_form { display: flex; flex-direction: column; gap: 0.7cqw; text-align: left; }
.login_field { display: flex; flex-direction: column; gap: 0.25cqw; }
.login_label { font: 600 max(12px, 0.8cqw) var(--font_title); letter-spacing: 0.05em; color: var(--text_soft); }
.login_input {
  width: 100%;
  padding: 0.5cqw 0.7cqw;
  font: 500 max(15px, 1.05cqw) var(--font_body);
  color: var(--gold_light);
  background: rgba(8, 10, 12, 0.7);
  border: 1px solid rgba(217, 166, 78, 0.4);
  border-radius: 4px;
  caret-color: var(--gold_light);
  outline: none;
}
.login_input:focus { border-color: rgba(243, 212, 143, 0.75); box-shadow: 0 0 10px rgba(255, 200, 97, 0.2) inset; }
.login_input:disabled { opacity: 0.6; }
.login_hint { font-size: max(13px, 0.85cqw); color: var(--text_soft); line-height: 1.35; }
.login_text { margin: 0; font-size: max(15px, 1cqw); line-height: 1.45; }
.login_text b { color: var(--gold_light); word-break: break-all; }
.login_form .login_submit { margin-top: 0.3cqw; align-self: center; min-width: 50%; }
.login_buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 0.3cqw; }
.login_buttons .login_submit { margin-top: 0; min-width: 0; }
.login_message {
  min-height: 1.4em;
  margin-top: 0.8cqw;
  font-size: max(14px, 0.95cqw);
  line-height: 1.4;
}
.login_message.bad { color: #f0a08a; }
.login_message.good { color: #9fe0a8; }
.login_message.info { color: var(--text_soft); }

/* Character selection: account line + Log out (server step 1) */
.account_bar {
  position: absolute;
  top: 0.8cqw;
  right: 1cqw;
  display: flex;
  align-items: center;
  gap: 0.7cqw;
  pointer-events: auto;
  font: 500 max(12px, 0.85cqw) var(--font_body);
  color: var(--text_soft);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}
.account_bar .ui_button { min-width: 0; padding: 0.35cqw 0.9cqw; font-size: max(12px, 0.85cqw); }
.login_link {
  align-self: center;
  margin-top: 0.1cqw;
  padding: 0.2cqw 0.4cqw;
  font: 500 max(13px, 0.85cqw) var(--font_body);
  color: var(--text_soft);
  background: none;
  border: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.login_link:hover, .login_link:focus-visible { color: var(--gold_light); outline: none; }
.login_link:disabled { opacity: 0.5; cursor: default; }

/* ===== Server step 2: character on the server ===== */
.class_info_hint.good { color: #9fe0a8; }
.class_info_hint.neutral { color: var(--text_soft); font-weight: 600; }
/* A message over the whole game: loading, "Logged in elsewhere", no server */
.server_notice {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  background: rgba(5, 4, 3, 0.72);
  animation: fade_in 0.15s ease;
}
.server_notice_box { max-width: min(560px, 92vw); }
/* The line at the top while saving does not work */
.save_status {
  position: fixed;
  left: 50%;
  top: 8px;
  z-index: 450;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 6px 14px;
  font: 600 14px var(--font_body);
  color: #ffd9c8;
  background: rgba(40, 18, 12, 0.94);
  border: 1px solid var(--danger);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  display: none;
}
.save_status.visible { display: block; }
/* Server step 4a: "Contacting the server..." (not a problem, only a wait) */
.save_status.info { color: #f3e6c4; border-color: var(--gold, #c9a24a); background: rgba(28, 22, 12, 0.94); }

/* Server step 3: server time at the top of the ☰ menu */
.server_time_box {
  margin: 2px 0 14px;
  padding: 8px 10px;
  text-align: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(142, 90, 42, 0.55);
  border-radius: 4px;
  line-height: 1.45;
}
.server_time_clock { font-weight: bold; color: #f1d58a; font-variant-numeric: tabular-nums; }
.server_time_reset { font-size: 0.9em; opacity: 0.85; font-variant-numeric: tabular-nums; }
.server_time_core { margin-top: 4px; font-size: 0.85em; color: #9fd28a; }
.server_time_core.bad { color: #ff9a7a; }

/* Server step 12: player letters (write, reply, block) */
.mail_tools { display: flex; flex-wrap: wrap; gap: 8px; }
.mail_tool_btn { padding: 4px 12px; font-size: 14px; }
.mail_line.player_text { white-space: pre-wrap; overflow-wrap: anywhere; }
.mail_from_link {
  padding: 0; border: none; background: none; cursor: pointer;
  font: inherit; color: var(--gold_light); text-decoration: underline dotted;
}
.mail_from_link:hover { filter: brightness(1.25); }
.mail_compose { display: flex; flex-direction: column; gap: 6px; }
.mail_field { display: grid; grid-template-columns: 70px 1fr; align-items: start; gap: 8px; color: #cfd5da; font-size: 14px; }
.mail_field > span { padding-top: 6px; }
.mail_input { height: 32px; font-size: 15px; padding: 0 8px; }
.mail_textarea { min-height: 120px; resize: vertical; font-size: 15px; line-height: 1.35; padding: 6px 8px; }
.mail_count { align-self: flex-end; color: #95a0a8; font-size: 12px; }
.mail_count.full { color: #ff9a7a; }
.mail_blocked_list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
.mail_blocked_row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 4px 8px; background: rgba(20, 24, 30, 0.7);
  border: 1px solid rgba(142, 90, 42, 0.45); border-radius: 4px;
}
.mail_blocked_row .ui_button { padding: 2px 10px; font-size: 13px; }
.mail_blocked_name { color: #dfe3e6; font-weight: 600; }

/* Server step 13: clans on the server - Requests button, join request
   list, Clan Finder rows with Request / Withdraw, my open requests */
.ui_button.clan_requests_button {
  font-size: 0.85cqw; padding: 0 0.6cqw; min-width: 0;
  display: flex; align-items: center; justify-content: center;
}
.ui_button.clan_requests_button.has_new { color: #ffe6a8; box-shadow: 0 0 0.6cqw rgba(255, 200, 97, 0.65); }
.ui_button.clan_small_button { font-size: 0.85cqw; padding: 0.3cqw 0.7cqw; min-width: 0; }
.clan_popup .ui_button.clan_small_button { font-size: 13px; padding: 4px 10px; }
.clan_request_list { display: flex; flex-direction: column; gap: 6px; max-height: 45vh; overflow: auto; }
.clan_request_row {
  display: flex; align-items: center; gap: 8px; font-size: 15px;
  padding: 4px 6px; border-bottom: 1px solid rgba(142, 90, 42, 0.25);
}
.clan_request_name { flex: 1 1 auto; display: inline-flex; align-items: center; gap: 4px; color: var(--gold_light); }
.clan_request_info { color: #c4cbd2; font-size: 13px; }
.clan_request_date { color: #8d9399; font-size: 13px; }
.clan_finder_result { align-items: center; gap: 0.6cqw; }
.clan_finder_name { flex: 1 1 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gold_light); }
.clan_finder_leader { flex: 1 1 35%; display: inline-flex; align-items: center; gap: 0.25cqw; color: #c4cbd2; overflow: hidden; white-space: nowrap; }
.clan_finder_count { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: #c4cbd2; }
.clan_finder_results { max-height: 13cqw; overflow-y: auto; }
.clan_my_requests { display: flex; flex-direction: column; gap: 0.2cqw; }
.clan_my_requests_title { font: 600 0.95cqw var(--font_title); color: var(--gold_light); }

/* ===== Server step 15: launch preparation ===== */
/* Maintenance line at the top (planned / ON for developers) */
.maintenance_banner {
  position: fixed;
  left: 50%;
  bottom: 8px;
  z-index: 440;
  display: none;
  transform: translateX(-50%);
  max-width: 92vw;
  padding: 6px 14px;
  font: 600 14px var(--font_body);
  color: #ffe7b0;
  background: rgba(46, 32, 8, 0.94);
  border: 1px solid #d9a441;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  text-align: center;
}
.maintenance_banner.visible { display: block; }
.maintenance_banner.on { color: #ffd9c8; background: rgba(48, 16, 10, 0.94); border-color: #e07a5f; }
/* Login screen: maintenance line, age + Terms checkbox, legal links */
.login_notice {
  display: none;
  margin: -0.4cqw 0 0.8cqw;
  padding: 0.45cqw 0.7cqw;
  font: 600 max(13px, 0.85cqw) var(--font_body);
  line-height: 1.4;
  color: #ffe7b0;
  background: rgba(70, 48, 10, 0.55);
  border: 1px solid #d9a441;
  border-radius: 4px;
  text-align: left;
}
.login_notice.visible { display: block; }
.login_agree {
  display: flex;
  align-items: flex-start;
  gap: 0.5cqw;
  margin: 0.2cqw 0 0.3cqw;
  font: 500 max(13px, 0.85cqw) var(--font_body);
  line-height: 1.35;
  color: var(--text_soft);
  text-align: left;
  cursor: pointer;
}
.login_agree input { margin-top: 0.15em; width: 1.05em; height: 1.05em; accent-color: var(--gold); flex: none; }
.login_agree a, .login_legal a { color: var(--gold_light); text-underline-offset: 3px; }
.login_legal {
  margin-top: 0.7cqw;
  font: 500 max(11px, 0.72cqw) var(--font_body);
  color: var(--text_soft);
}
/* ☰ menu -> Terms & privacy */
.legal_links_box { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 14px; text-align: center; }
.legal_link { color: var(--gold_light); font: 600 16px var(--font_body); text-underline-offset: 3px; }
/* ☰ menu -> Delete account */
.delete_account_popup { max-width: min(560px, 94vw); }
.delete_account_box { text-align: left; }
.delete_account_box .delete_account_warning { color: #f0a08a; font-weight: 700; }
.delete_account_list { margin: 6px 0 12px 18px; padding: 0; font: 500 14px var(--font_body); line-height: 1.45; color: var(--text_soft); }
.delete_account_list li { margin: 3px 0; }
.delete_account_field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.delete_account_box .delete_account_message { min-height: 1.4em; margin: 4px 0 0; color: #f0a08a; font-size: 14px; }
.ui_button.danger_button { color: #ffd9c8; border-color: #b0503a; background: linear-gradient(180deg, #6a2418, #431209); }
.ui_button.danger_button:hover:not(:disabled) { border-color: #e07a5f; filter: brightness(1.12); }

/* ===== Server step 15b: e-mail confirmation bar, welcome gift ===== */
.email_bar {
  position: fixed;
  left: 50%;
  top: 6px;
  z-index: 445;
  display: none;
  align-items: center;
  gap: 10px;
  transform: translateX(-50%);
  max-width: 92vw;
  padding: 5px 8px 5px 14px;
  font: 600 14px var(--font_body);
  color: #fff0c4;
  background: rgba(46, 36, 8, 0.95);
  border: 1px solid #d9a441;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}
.email_bar.visible { display: flex; }
.email_bar.late { color: #ffd9c8; background: rgba(48, 16, 10, 0.95); border-color: #e07a5f; }
.email_bar_text { line-height: 1.35; }
.email_bar_button {
  flex: none;
  padding: 3px 10px;
  font: 600 13px var(--font_body);
  color: #2a1c05;
  background: #e8bb5c;
  border: 1px solid #f6d68c;
  border-radius: 3px;
  cursor: pointer;
}
.email_bar_button:disabled { opacity: 0.6; cursor: default; }
.email_bar_close {
  flex: none;
  width: 24px;
  height: 24px;
  font: 700 13px var(--font_body);
  color: #fff0c4;
  background: transparent;
  border: 1px solid rgba(255, 240, 196, 0.35);
  border-radius: 3px;
  cursor: pointer;
}
.mail_money_slot { cursor: default; }
.mail_claim_note {
  margin: 6px 0 2px;
  padding: 5px 8px;
  font-size: 13px;
  color: #ffe7b0;
  background: rgba(70, 48, 10, 0.45);
  border: 1px solid rgba(217, 164, 65, 0.6);
  border-radius: 4px;
}

/* ===== Pre-beta step 15c: the clan description ===== */
/* CLAN INFO button: the CLAN WARS shape in the RANKING banner's blue */
.clan_wars_button.clan_info_button {
  background:
    radial-gradient(ellipse at 50% 35%, rgba(120, 170, 255, 0.35), transparent 65%),
    linear-gradient(180deg, #1f3c86 0%, #142a63 55%, #0b1840 100%);
}
.clan_wars_button.clan_info_button .cw_text { text-shadow: 0 1px 0 #061030, 0 0 0.6cqw rgba(140, 180, 255, 0.55); }
.clan_wars_button.clan_info_button:hover, .clan_wars_button.clan_info_button:focus-visible {
  box-shadow:
    inset 0 0 0 0.2cqw #3a1606,
    inset 0 0 0 0.3cqw rgba(255, 215, 130, 0.85),
    inset 0 0.25cqw 0.9cqw rgba(140, 180, 255, 0.35),
    0 0 0 0.12cqw #2a1205,
    0 0 1.4cqw rgba(120, 160, 255, 0.55);
}
/* The About popup's text (plain text, line breaks kept) */
.clan_about_text {
  max-height: 40vh; overflow-y: auto;
  padding: 10px 12px;
  font-size: 16px; line-height: 1.45; color: var(--parchment);
  background: rgba(10, 12, 15, 0.55);
  border: 1px solid rgba(142, 90, 42, 0.45); border-radius: 4px;
  white-space: pre-line; overflow-wrap: anywhere; text-align: left;
}
.clan_about_text.empty { color: #8d9399; font-style: italic; }

/* The text box (founding a clan + the Edit popup) */
.clan_desc_edit { display: flex; flex-direction: column; gap: 4px; }
.clan_desc_input {
  width: 100%; resize: vertical; padding: 6px 8px;
  font-size: 15px; line-height: 1.35;
}
.clan_desc_edit.compact .clan_desc_input { font-size: 0.95cqw; padding: 0.4cqw 0.8cqw; min-height: 4.5cqw; }
.clan_desc_count { align-self: flex-end; font-size: 13px; color: #8d9399; font-variant-numeric: tabular-nums; }
.clan_desc_edit.compact .clan_desc_count { font-size: 0.8cqw; }
.clan_desc_count.bad { color: #ff8a6a; }

/* Clan Finder: the first line of the description under each clan */
.clan_finder_item + .clan_finder_item { border-top: 1px solid rgba(142, 90, 42, 0.2); }
.clan_finder_desc {
  margin: -0.15cqw 0 0.3cqw; padding-right: 6cqw;
  font-size: 0.85cqw; font-style: italic; color: #aab2ba;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.clan_finder_results { max-height: 16cqw; }
.clan_tt_lines { white-space: pre-line; max-width: 340px; font-weight: 500; }

/* ===== Pre-beta step 15d: the Support window (☰ -> Support…) ===== */
.support_popup { max-width: min(600px, 94vw); width: min(600px, 94vw); }
.support_box { text-align: left; display: flex; flex-direction: column; gap: 8px; }
.support_box .support_intro { margin: 0 0 4px; font-size: 15px; }
.support_field { display: flex; flex-direction: column; gap: 3px; }
.support_label { font: 600 13px var(--font_body); color: var(--gold_light); letter-spacing: 0.02em; }
.support_input {
  box-sizing: border-box; width: 100%;
  padding: 6px 8px;
  font: 400 15px var(--font_body); line-height: 1.35;
  color: var(--parchment); caret-color: var(--gold_light);
  background: #15110d;
  border: 1px solid rgba(142, 90, 42, 0.8); border-radius: 4px;
  user-select: text; -webkit-user-select: text;
}
.support_input:focus { outline: none; border-color: var(--gold_light); box-shadow: 0 0 6px rgba(255, 200, 97, 0.35); }
.support_input::placeholder { color: #8d8270; font-style: italic; }
.support_select { cursor: pointer; }
.support_select option { background: #15110d; color: var(--parchment); }
.support_message { resize: vertical; min-height: 120px; max-height: 40vh; }
.support_count { align-self: flex-end; font-size: 13px; color: #8d9399; font-variant-numeric: tabular-nums; }
.support_count.bad { color: #ff8a6a; }
.support_hint { margin: 0; font-size: 14px; color: #e8c987; }
.support_note { margin: 0; font-size: 13px; line-height: 1.4; color: #9aa1a8; }
.support_message_line { min-height: 1.3em; margin: 2px 0 0; font-size: 14px; color: #f0a08a; }
.support_list { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; padding-right: 4px; }
.support_ticket { padding: 7px 10px; border: 1px solid rgba(142, 90, 42, 0.45); border-radius: 4px; background: rgba(0, 0, 0, 0.18); }
.support_ticket.answered { border-color: rgba(120, 180, 110, 0.6); }
.support_ticket.closed { opacity: 0.7; }
.support_ticket_top { display: flex; gap: 8px; align-items: baseline; }
.support_ticket_id { color: #9aa1a8; font-size: 13px; font-variant-numeric: tabular-nums; }
.support_ticket_subject { color: var(--parchment); font-weight: 600; overflow-wrap: anywhere; }
.support_ticket_meta { font-size: 13px; color: #9aa1a8; margin-top: 2px; }
.login_support { margin-top: 0.4cqw; text-align: center; font-size: max(12px, 0.8cqw); color: #9aa1a8; user-select: text; -webkit-user-select: text; }

/* ===== Step 15e-pre: login / registration on the desert tent camp picture =====
   Only the login screen (.login_stage) changes. The website's look: Cinzel +
   Alegreya, warm dark-brown glass panel, gold frame, gold NOMAD logo, the
   gold/bronze "Play now" plate with pointed ends for the main button. */
.login_stage .login_dim {
  /* a soft vignette instead of the old heavy darkening: the picture shows */
  background:
    radial-gradient(ellipse 34% 62% at 50% 50%, rgba(10, 6, 2, 0.42), rgba(10, 6, 2, 0) 100%),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(8, 5, 2, 0.5) 100%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.login_stage .login_panel {
  width: 26cqw;
  max-height: 96%;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 1.2cqw 2cqw 1.1cqw;
  color: #eadfc6;
  background:
    radial-gradient(ellipse 90% 40% at 50% 0%, rgba(255, 190, 90, 0.10), rgba(255, 190, 90, 0) 70%),
    linear-gradient(180deg, rgba(30, 21, 12, 0.86), rgba(16, 11, 6, 0.9));
  backdrop-filter: blur(6px) saturate(1.1);
  -webkit-backdrop-filter: blur(6px) saturate(1.1);
  border: 1px solid #c9a24a;
  border-radius: 8px;
  box-shadow:
    0 0 0 3px rgba(12, 8, 4, 0.85),
    0 0 0 4px rgba(154, 116, 40, 0.9),
    0 0 30px rgba(240, 180, 70, 0.18),
    0 20px 60px rgba(0, 0, 0, 0.65);
}
.login_stage .login_title { margin: 0 0 0.7cqw; line-height: 0; }
.login_stage .login_logo {
  display: block;
  width: 78%;
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 12px rgba(240, 180, 70, 0.25));
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}
.login_stage .login_subtitle { color: #f3d98c; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.login_stage .login_tabs { border-bottom-color: rgba(201, 162, 74, 0.4); }
.login_stage .login_tab { color: #b9a988; }
.login_stage .login_tab:hover, .login_stage .login_tab:focus-visible { color: #f3d98c; }
.login_stage .login_tab.active { color: #f3d98c; border-bottom-color: #d9b45a; }
.login_stage .login_label { color: #c9b48a; }
.login_stage .login_input {
  color: #f6e7c1;
  background: rgba(10, 7, 4, 0.72);
  border-color: rgba(201, 162, 74, 0.45);
}
.login_stage .login_input:focus { border-color: #e7bf5c; box-shadow: 0 0 0 1px rgba(231, 191, 92, 0.35), 0 0 12px rgba(255, 200, 97, 0.18) inset; }
.login_stage .login_hint, .login_stage .login_agree, .login_stage .login_legal { color: #c2b08c; }
.login_stage .login_support { color: #a8987a; }

/* Main button (Log in, Create account, Send reset link, ...): the website's
   gold "Play now" plate - gold frame, bronze inside, pointed ends */
.login_stage .ui_button.primary {
  --tip: 14px;
  position: relative;
  isolation: isolate;
  min-width: 56%;
  padding: 0.75em 2.2em;
  font: 700 max(14px, 0.95cqw) var(--font_title);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f8de96;
  text-shadow: 0 1px 0 #2a1604, 0 0 10px rgba(255, 200, 90, 0.35);
  background: none;
  border: none;
  border-radius: 0;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 10px rgba(240, 180, 70, 0.22));
  transition: transform 0.15s ease, filter 0.15s ease;
}
.login_stage .ui_button.primary::before,
.login_stage .ui_button.primary::after {
  content: "";
  position: absolute;
  z-index: -1;
  clip-path: polygon(0 50%, var(--tip) 0, calc(100% - var(--tip)) 0, 100% 50%, calc(100% - var(--tip)) 100%, var(--tip) 100%);
}
.login_stage .ui_button.primary::before {
  inset: 0;
  background: linear-gradient(180deg, #fff0b5 0%, #e7bf5c 30%, #9c6d22 55%, #e2b85a 80%, #fbe39c 100%);
}
.login_stage .ui_button.primary::after {
  inset: 2px;
  --tip: 13px;
  background:
    radial-gradient(ellipse 70% 120% at 50% 0%, rgba(255, 200, 110, 0.38), rgba(255, 200, 110, 0) 60%),
    linear-gradient(180deg, #8a5418 0%, #5c3410 48%, #3a1f07 52%, #4d2b0b 100%);
}
.login_stage .ui_button.primary:hover,
.login_stage .ui_button.primary:focus-visible {
  color: #fff3c9;
  background: none;
  transform: translateY(-1px);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 16px rgba(255, 196, 80, 0.45));
}
.login_stage .ui_button.primary:hover::after,
.login_stage .ui_button.primary:focus-visible::after {
  background:
    radial-gradient(ellipse 70% 120% at 50% 0%, rgba(255, 210, 120, 0.5), rgba(255, 210, 120, 0) 62%),
    linear-gradient(180deg, #9a6020 0%, #6a3c12 48%, #44250a 52%, #5a330e 100%);
}
.login_stage .ui_button.primary:disabled,
.login_stage .ui_button.primary:disabled:hover { background: none; transform: none; opacity: 0.6; }
.login_stage .login_buttons .ui_button.primary { min-width: 0; }
/* Other buttons on this screen (Back to Log in, Cancel, Send again): the
   website's ghost button - thin bronze frame on dark glass */
.login_stage .ui_button:not(.primary) {
  color: #f3d98c;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #9a7428;
  border-radius: 6px;
  font: 700 max(13px, 0.85cqw) var(--font_title);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.login_stage .ui_button:not(.primary):hover,
.login_stage .ui_button:not(.primary):focus-visible { color: #fff3c9; background: rgba(60, 40, 10, 0.5); border-color: #d9b45a; }
.login_stage .login_legal a { white-space: nowrap; }
