/* Citadel of the Zephyrs: page layout and colors. */

:root {
  --bg: #0b0b0f;
  --panel: #15141b;
  --line: #2a2833;
  --text: #d9d4c7;
  --dim: #8a8595;
  --gold: #e0b44c;
  --hp: #c8443c;
  --xp: #5b8fd9;
  --good: #7fc06b;
  --hurt: #e36a5f;
  --loot: #e8c35a;
  --warn: #e39a4f;
  --level: #c79bff;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 "Segoe UI", system-ui, sans-serif;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-rows: minmax(0, 1fr) 170px;
  grid-template-areas: "view side" "log side";
  overflow: hidden;
}

/* Map area */
#viewWrap { grid-area: view; position: relative; overflow: hidden; }
#view { position: absolute; left: 0; top: 0; display: block; }

/* Side panel */
#side {
  grid-area: side;
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 14px 16px;
  overflow-y: auto;
}
#side h1 {
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 10px;
}
.who { font-size: 20px; font-weight: 600; }
.sub { color: var(--dim); margin-bottom: 8px; }
.bar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); margin-top: 6px; }
.bar { height: 8px; background: #26242d; border-radius: 4px; overflow: hidden; }
.fill { height: 100%; }
.fill.hp { background: var(--hp); }
.fill.hp.low { background: #ff5a3c; animation: pulse 0.8s infinite alternate; }
.fill.xp { background: var(--xp); }
@keyframes pulse { from { opacity: 1; } to { opacity: .45; } }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 12px 0 4px; }
.stats span { color: var(--dim); display: inline-block; width: 40px; font-size: 12px; }
.section {
  margin: 14px 0 4px;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
}
.equip { margin: 2px 0; }
.equip span { color: var(--dim); display: inline-block; width: 62px; font-size: 12px; }
.equip i { color: var(--dim); }
.keys { font-size: 12px; color: var(--dim); line-height: 1.6; }
.keys b { color: var(--text); font-weight: 600; }

/* Message log */
#log {
  grid-area: log;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 8px 14px;
  font: 13px/1.5 Consolas, Menlo, monospace;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.msg.old { opacity: .45; }
.msg.hit { color: #ece5d2; }
.msg.good { color: var(--good); }
.msg.hurt { color: var(--hurt); }
.msg.loot { color: var(--loot); }
.msg.warn { color: var(--warn); }
.msg.miss { color: var(--dim); }
.msg.level { color: var(--level); font-weight: bold; }

/* Pop-up panels */
#overlay {
  /* spans the map and the message log (left column, both rows) */
  grid-column: 1;
  grid-row: 1 / 3;
  position: relative;
  z-index: 10;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 8, .7);
}
#overlay.hidden { display: none; }
#overlay.banner { background: none; align-items: flex-start; padding-top: 16px; pointer-events: none; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 22px;
  min-width: 340px;
  max-width: 560px;
  max-height: 85%;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.panel.small { min-width: 0; padding: 8px 14px; }
.panel h2 { margin: 0 0 10px; font-size: 18px; color: var(--gold); }
.panel p { margin: 6px 0; }
.row { padding: 4px 6px; border-radius: 4px; cursor: pointer; }
.row:hover { background: #22212a; }
.key { display: inline-block; min-width: 18px; color: var(--gold); font-family: Consolas, Menlo, monospace; }
.glyph { font-family: Consolas, Menlo, monospace; font-weight: bold; }
.tag {
  font-size: 11px;
  color: var(--good);
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 4px;
}
.dim, .hint { color: var(--dim); font-size: 12px; }
.panel .hint { margin-top: 12px; margin-bottom: 0; }
.help { border-collapse: collapse; margin-top: 8px; }
.help td { padding: 3px 14px 3px 0; vertical-align: top; }
.help td:first-child { color: var(--gold); white-space: nowrap; font-family: Consolas, Menlo, monospace; font-size: 13px; }
/* Side panel: class, ability, effects */
.cls { font-weight: 600; }
.rel { color: var(--dim); font-size: 12px; font-style: italic; margin-bottom: 4px; }
.small { font-size: 12px; }
.passive { color: var(--dim); margin-top: 4px; line-height: 1.4; }
.ability b { color: var(--gold); margin-right: 4px; }
.ready { color: var(--good); font-size: 12px; margin-left: 4px; }
.cooling { color: var(--dim); font-size: 12px; margin-left: 4px; }
.buff { font-size: 12px; color: var(--good); }
.stats em { font-style: normal; font-size: 11px; }
.stats em.up { color: var(--good); }
.stats em.down { color: var(--hurt); }
.equip b { font-weight: 500; }
.misc { font-size: 12px; color: var(--dim); margin-top: 2px; }
.good { color: var(--good); }

/* Mana, spells, floor twists, hover box */
.fill.mp { background: #8a6cff; }
.fill.cp { background: #5fb8d0; }
.fill.boss { background: #ffd84a; }
.fill.cp.rattled { background: #d8b850; }
.fill.cp.shaken { background: #ff8a3a; }
.twist { font-size: 12px; color: var(--warn); margin: -2px 0 6px; }
.twist b { color: var(--warn); }
.spells { margin-top: 8px; }
.row.unaffordable { opacity: .45; }
.msg.twist { color: var(--warn); font-style: italic; }
#hover {
  position: absolute;
  left: 10px;
  top: 10px;
  max-width: 70%;
  background: rgba(21, 20, 27, .92);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  pointer-events: none;
  display: none;
  max-width: min(70%, 420px);
  line-height: 1.45;
}
#hover .mh { font-size: 13px; }
#hover .blurb { font-style: italic; color: #cfc8b8; margin: 3px 0; }
#hover .hr { border-top: 1px solid var(--line); margin: 4px 0; }

/* Message colors for rarity and allies */
.msg.ally { color: #9fd49f; }
.msg.magic { color: #6aa7ff; } /* spells */
.msg.uncommon { color: #5fd35f; }
.msg.rare { color: #4f9bff; }
.msg.epic { color: #b46bff; }
.msg.legendary { color: #ff9a1f; font-weight: bold; }
.msg.mythic { color: #ff4a4a; font-weight: bold; }

/* Item details */
.rarity { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin: -6px 0 6px; }
ul.bonuses { margin: 4px 0 8px; padding-left: 18px; color: var(--good); }
.indent { margin-left: 26px; }

/* Wide panels: succession and the mantle */
.panel.wide { max-width: 900px; width: 92%; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 8px; }
.card {
  position: relative;
  background: #1c1b23;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 12px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card:hover { border-color: var(--gold); background: #221f28; }
.card .num {
  position: absolute; top: 8px; right: 10px;
  font: bold 16px Consolas, Menlo, monospace; color: var(--gold);
}
.cname { font-size: 17px; font-weight: 600; padding-right: 20px; }
.cstats { font: 12px Consolas, Menlo, monospace; color: var(--dim); margin-top: 4px; }
.tag.new { color: #ff8c1a; }
.tag.caster { color: #8fb8ff; }
.spell-grid { display: grid; grid-auto-flow: column; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.opt {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
  background: #1c1b23;
}
.opt:hover { border-color: #5a5566; }
.opt.sel { border-color: var(--gold); background: #2a2416; }
.opt .dim { display: block; margin-top: 4px; }
.bearer { padding: 6px 10px; border-left: 3px solid var(--line); background: #1a1920; border-radius: 4px; }
.bearer.current { border-left-color: var(--good); }
.arrow { color: var(--dim); text-align: center; width: 30px; line-height: 1.2; }

/* Pixel-art pictures in the panels (kept blocky when scaled up) */
img.icon, img.mini, img.big, img.portrait { image-rendering: pixelated; }
img.icon { width: 32px; height: 32px; vertical-align: middle; margin: -6px 4px -6px 0; }
img.mini { width: 32px; height: 32px; vertical-align: middle; margin-right: 6px; }
img.big { width: 64px; height: 64px; }
img.right { float: right; margin: 0 0 8px 12px; }
img.portrait { width: 64px; height: 64px; flex: none; background: #22212a; border-radius: 6px; }
.chead { display: flex; gap: 10px; align-items: center; }
.bearer img.mini { float: left; margin: 2px 8px 0 0; }
.bearer::after { content: ""; display: block; clear: both; }

/* Level-up cards, returning bearers, options, help pages */
.card.perk { min-height: 96px; }
.card.perk:not(.r-common) { border-color: var(--rc); border-width: 2px; padding: 11px 11px 9px; }
.card.perk .rarity { margin: 0; }
.card.perk.glow { box-shadow: 0 0 16px color-mix(in srgb, var(--rc) 70%, transparent); }
.card.perk:hover { border-color: var(--gold); }
.card.returning { border-color: #3f6b45; background: #1b231c; }
.tag.back { color: var(--good); align-self: flex-start; margin: 2px 0 0; }
.panel.options-panel, .panel.help-panel { max-width: 640px; }
.options-panel .help td:first-child { font-family: "Segoe UI", system-ui, sans-serif; color: var(--text); padding-top: 6px; }
.help-panel ul { margin: 4px 0 8px; padding-left: 18px; }
.help-panel ul li { margin-bottom: 4px; }

/* Gear comparison */
.cmp { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 6px 0; padding: 6px 8px; background: #1d1c25; border-radius: 6px; font-size: 12px; }
.cmp .cmp-h { flex-basis: 100%; color: var(--dim); }
.cmp .up { color: var(--good); }
.cmp .down { color: var(--hurt); }
/* Several comparisons (rings: 2, or 4 for the Multitasker) sit side by side, two to a row. */
.cmp-list.two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0; }
.cmp-list.two .cmp { margin: 0; align-content: flex-start; }
/* The item menu and the inventory grow as tall as they need (up to the whole map area)
   instead of scrolling. */
.panel.item-panel, .panel.inv { max-height: calc(100% - 12px); }
.panel.item-panel.wide-cmp { max-width: 760px; width: 92%; }

/* Town buildings */
.shop .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel.shop { max-height: calc(100% - 12px); }
/* Buying and selling: always the full height, so pointing at an item (which changes the details
   box below) never resizes the window and shifts the rows under the mouse. */
.panel.shop.trade { height: calc(100% - 12px); display: flex; flex-direction: column; }
.panel.shop.trade .cols { flex: 1 0 auto; }
.panel.shop.trade .inv-info.shop-info { min-height: 150px; }
/* The hovered item's details: stuck to the bottom of the shop window, so it's always in view. */
.inv-info.shop-info {
  position: sticky; bottom: 0; z-index: 1; max-width: none; margin-top: 10px;
  border: 1px solid var(--line); box-shadow: 0 -8px 14px rgba(0, 0, 0, .45);
}
.row.trade { display: flex; align-items: center; gap: 4px; }
.row.trade .price { margin-left: auto; color: var(--gold); font-size: 12px; white-space: nowrap; padding-left: 8px; }
.row.trade .price.poor { color: var(--hurt); }
.row.trade .trade-name { display: flex; flex-direction: column; min-width: 0; }
.cmp-mini { font-size: 11px; line-height: 1.3; }
.cmp-mini .up { color: var(--good); }
.cmp-mini .down { color: var(--hurt); }
/* Challenge ratings (js/cr-table.js), next to a monster's numbers. */
.cr-hard { color: var(--hurt); }
.cr-fair { color: var(--gold); }
.cr-easy { color: var(--dim); }
/* The overall verdict on a piece of gear (js/stattips.js score). */
.cmp-v { font-weight: bold; }
.cmp-v.up { color: var(--good); }
.cmp-v.down { color: var(--hurt); }
.cmp-v.same { color: var(--dim); }
div.cmp-v { margin: 1px 0 3px; }
.shop .bearer { margin-bottom: 6px; }

/* Inventory: character picture with body slots, item grid, outfits */
/* Three columns when there's room (character | bag | class), so the panel grows wider rather than taller. */
/* Layout: the character (with outfits under it) on the left; the bag, then the class card;
   item details run under both, wide enough for ring comparisons side by side. On narrower
   screens the class card drops to the bottom. */
.panel.inv { max-width: 1080px; width: 98%; }
.panel.inv h2 .dim { font-size: 12px; font-weight: normal; }
.inv-top {
  display: grid; gap: 10px 18px; align-items: start;
  grid-template-columns: auto 428px minmax(220px, 300px);
  grid-template-areas: "doll bag class" "doll below below";
}
.doll-wrap { grid-area: doll; }
.bag-wrap { grid-area: bag; }
.inv-class { grid-area: class; }
.inv-below { grid-area: below; min-width: 0; }
.inv-class .class-card { width: auto; margin-top: 0; }
.doll-wrap .outfits { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 248px; }
.doll-wrap .outfit { min-width: 0; }
.doll-wrap .outfit .obtns { flex-wrap: wrap; gap: 0 8px; }
.inv-below .inv-info { max-width: none; margin-top: 0; }
@media (max-width: 1339px) {
  .inv-top { grid-template-columns: auto 428px; grid-template-areas: "doll bag" "doll below" "class class"; }
}
.doll {
  display: grid;
  grid-template-columns: 50px 136px 50px;
  grid-template-rows: repeat(5, 50px);
  gap: 6px;
  grid-template-areas:
    "helmet hero amulet"
    "cloak hero armor"
    "weapon hero shield"
    "bracers hero gloves"
    "ring1 boots ring2";
}
.doll-hero {
  grid-area: hero;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: radial-gradient(circle, #2a2833 0%, #1a1920 70%);
}
.doll-hero img { width: 128px; height: 128px; image-rendering: pixelated; pointer-events: none; }
.doll-extra { display: flex; gap: 6px; flex-wrap: wrap; width: 248px; }
.class-card {
  width: 248px; margin-top: 10px; padding: 8px 10px; background: #1a1920; border-radius: 6px;
  font-size: 12px; line-height: 1.45; display: flex; flex-direction: column; gap: 4px;
}
.class-card .cc-head b { font-size: 14px; }
.class-card .ready, .class-card .cooling { margin-left: 2px; }
.cc-opts { margin: 0; padding-left: 16px; }
.slot, .cell {
  position: relative;
  width: 50px;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #1a1920;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot.full, .cell.full { cursor: grab; background: #24222c; }
.slot.full:hover, .cell.full:hover { background: #2c2a35; }
.slot img, .cell img { width: 32px; height: 32px; image-rendering: pixelated; pointer-events: none; }
.slot .lbl { font-size: 9px; color: #5f5a6b; text-transform: uppercase; letter-spacing: .04em; }
.slot .k, .cell .k {
  position: absolute; left: 3px; top: 0;
  font: 10px Consolas, Menlo, monospace; color: var(--gold); opacity: .75; pointer-events: none;
}
.cell .n {
  position: absolute; right: 3px; bottom: 1px;
  font: bold 11px Consolas, Menlo, monospace; color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000; pointer-events: none;
}
.glyph.big { font-size: 22px; }
.glyph.huge { font-size: 72px; color: #ffe08a; }
.over { outline: 2px solid var(--gold); outline-offset: 1px; }
.bag { display: grid; grid-template-columns: repeat(8, 50px); gap: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; font-size: 12px; }
.chip { padding: 1px 9px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--dim); }
.chip:hover { border-color: #5a5566; color: var(--text); }
.chip.on { color: var(--gold); border-color: var(--gold); }
.inv-info { min-height: 78px; margin-top: 8px; padding: 6px 10px; background: #1a1920; border-radius: 6px; font-size: 12px; max-width: 428px; }
.floorzone {
  margin-top: 6px; padding: 5px; text-align: center; font-size: 11px; color: var(--dim);
  border: 1px dashed var(--line); border-radius: 6px; max-width: 428px;
}
.outfits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.outfit {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
  background: #1c1b23; cursor: pointer; font-size: 12px;
}
.outfit:hover { border-color: #5a5566; }
.outfit.on { border-color: var(--good); background: #1b231c; }
.outfit .oname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.outfit .oicons { min-height: 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 1px; margin: 2px 0; }
.outfit .oicons img { width: 24px; height: 24px; image-rendering: pixelated; }
.outfit .obtns { display: flex; gap: 8px; }
.outfit .obtns span { color: var(--dim); text-decoration: underline; cursor: pointer; }
.outfit .obtns span:hover { color: var(--gold); }

button {
  margin-top: 12px;
  background: var(--gold);
  color: #1a1408;
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  font: 600 14px "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }

/* The naturalist's notebook (bestiary): tile grid on the left, details box on the right. No scrolling. */
.panel.bestiary { max-width: 1040px; width: 98%; max-height: calc(100% - 12px); overflow: visible; padding: 14px 18px; }
.panel.bestiary h2 { margin-bottom: 8px; }
.panel.bestiary h2 .dim { font-size: 12px; font-weight: normal; }
.bes-body { display: flex; gap: 16px; align-items: flex-start; }
.bes-left { flex: none; }
.bes-left .section { margin: 8px 0 4px; }
.bes-grid { display: grid; grid-template-columns: repeat(12, 44px); gap: 4px; }
.bes-tile {
  width: 44px; height: 44px; box-sizing: border-box; border: 2px solid var(--line); border-radius: 6px;
  background: #24222c; display: flex; align-items: center; justify-content: center; cursor: default;
}
.bes-tile:hover, .bes-tile.sel { background: #2c2a35; outline: 2px solid var(--gold); outline-offset: 1px; }
.bes-tile img { width: 36px; height: 36px; image-rendering: pixelated; pointer-events: none; }
.bes-tile .bes-glyph { font: bold 22px Consolas, Menlo, monospace; pointer-events: none; }
.bes-tile.unmet { background: #0f0e13; }
.bes-tile .bes-q { color: #4a4656; font: bold 18px Consolas, Menlo, monospace; pointer-events: none; }
.inv-info.bes-info { flex: 1; min-width: 0; max-width: none; margin-top: 0; min-height: 300px; font-size: 13px; line-height: 1.4; }
.bes-info .mh { font-size: 15px; margin-bottom: 4px; }
.bes-info .blurb { font-style: italic; color: var(--dim); margin: 6px 0; }
.bes-info .bes-record { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 12px; }

/* Pop-ups with choices (openDialog) and the effects layer over the map */
.panel.dialog { max-width: 520px; }
.panel.dialog .row.off { opacity: .45; cursor: default; }
#fx { position: absolute; left: 0; top: 0; pointer-events: none; }
.bes-tab { min-height: 300px; }

/* The Glutton's larder: one row of corpse squares under the bag */
.larder-head { margin-top: 6px; }
.bag.larder .cell.locked { opacity: .4; font-size: 10px; display: flex; align-items: center; justify-content: center; color: #9a9080; }
