/* The dashboard fills exactly one screen: no page scroll. Everything sizes
   with the window's height (type, art, gaps), and panels clip rather than
   grow. On narrow screens the three panels become tabs, one at a time. */

body.one-screen {
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.one-screen .shell { flex: 1; min-height: 0; }
body.one-screen .sidebar {
  position: static;
  height: auto;
  min-height: 0;
  scrollbar-width: none; /* still scrolls with the wheel when the window is very short */
}
body.one-screen .sidebar::-webkit-scrollbar { display: none; }

.dash {
  --gap: clamp(8px, 1.6vh, 20px);
  --dash-cell: clamp(9px, 3vh, 34px); /* inventory cell size for item art */
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--gap);
  padding: var(--gap);
  font-size: clamp(12px, 1.75vh, 17px);
  line-height: 1.35;
  font-variant-numeric: lining-nums tabular-nums;
}
.dash-tabs { display: none; }

.panel-box {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: calc(var(--gap) * 0.6);
  padding: calc(var(--gap) * 1.1);
  background-color: var(--stone-raised);
  background-image: var(--stone-surface);
  background-size: var(--stone-surface-size);
  border: 1px solid #4f463a;
  border-radius: var(--radius);
  box-shadow: var(--frame-raised);
}
/* Headings are for screen readers (and the small-screen tabs) only. */
.panel-box p { margin: 0; }
.dash .dim { color: var(--text-dim); }
.dash .small { font-size: 0.85em; }
.dash .boosted { color: var(--q-magic); }
.more { margin-top: auto; font-size: 0.85em; }

/* ---- Character ---- */

/* The game's character screen: framed boxes on dark stone, the name and
   class centred over a gilt rule, the level in its own box. */
.who { display: flex; flex-direction: column; gap: calc(var(--gap) * 0.5); }
.who-plate {
  text-align: center;
  padding: 0.35em 0.5em 0.45em;
  background: linear-gradient(#0e0d0c, #171513);
  border: 1px solid #4f473b;
  box-shadow: inset 0 0 0 1px #000, inset 0 0 18px rgb(0 0 0 / 0.8);
}
.who-name {
  font-family: var(--font-display);
  font-size: 2em;
  line-height: 1.1;
  color: var(--q-unique);
  overflow-wrap: anywhere;
  text-shadow: 0 1px 0 #000, 0 0 12px rgb(201 180 124 / 0.25);
}
.who-name.hardcore { color: var(--q-red); text-shadow: 0 1px 0 #000, 0 0 12px rgb(255 90 90 / 0.25); }
.who-name.dead { color: var(--q-socketed); text-decoration: line-through; text-decoration-color: var(--q-red); text-shadow: none; }
/* A gilt rule between the name and class, fading out at the ends. */
.who .who-class {
  margin-top: 0.3em;
  padding-top: 0.3em;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  color: var(--text);
  border-image: linear-gradient(to right, transparent, #8a7443 25%, #8a7443 75%, transparent) 1;
  border-top: 1px solid;
}

.who-row { display: flex; align-items: stretch; gap: calc(var(--gap) * 0.6); }
.who-level {
  display: flex;
  align-items: baseline;
  gap: 0.45em;
  padding: 0.15em 0.7em;
  background: #0e0d0c;
  border: 1px solid #4f473b;
  box-shadow: inset 0 0 10px rgb(0 0 0 / 0.8);
}
.who-label { font-family: var(--font-display); color: var(--text-dim); }
.who-number { font-family: var(--font-display); font-size: 1.7em; line-height: 1.15; color: var(--q-unique); }

/* The level-up button, sized with the dashboard's type. */
.dash-level-up { flex: 1; justify-content: center; gap: 0.5em; padding: 0.2em 0.9em 0.2em 0.25em; font-size: 1.05em; }
.dash-level-up .level-up-plus { width: 1.6em; height: 1.6em; font-size: 1.35em; }

.who-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 0.85em; }
.who-tags li { padding: 0 0.55em; color: var(--text-dim); border: 1px solid var(--line); border-radius: 999px; }
.who-tags li.hardcore { color: var(--q-red); border-color: rgb(255 90 90 / 0.45); }

.attrs { border-collapse: collapse; width: 100%; }
.attrs th { text-align: left; font-family: var(--font-display); font-weight: 400; padding: 0.12em 0.6em 0.12em 0; }
.attrs td { padding: 0.12em 0.6em 0.12em 0; }
.attrs td:nth-child(2) { width: 4.2em; }
/* Values in little framed boxes, like the game's. */
.stat-box {
  display: block;
  padding: 0 0.4em;
  font-size: 1.15em;
  text-align: center;
  background: #0e0d0c;
  border: 1px solid #3f382f;
  box-shadow: inset 0 0 6px rgb(0 0 0 / 0.8);
}
.stat-box.boosted { color: var(--q-magic); }
/* Life and mana, set a little apart from the attributes. */
.attrs .pool-life > * { padding-top: 0.7em; }
/* Defense, apart again; a range ("812-870") stays on one line. */
.attrs .defense > * { padding-top: 0.7em; }
.attrs .defense .stat-box { white-space: nowrap; }
.points { display: flex; flex-wrap: wrap; gap: 0.2em 1em; font-size: 0.9em; }
.points .owed { color: var(--q-crafted); }

.res { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.res-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.35em 0.2em;
  background: var(--tooltip);
  border: 1px solid #3b3b3b;
  border-top: 2px solid var(--res);
}
.res-fire { --res: #e4572e; }
.res-cold { --res: #6fa8dc; }
.res-lightning { --res: #f1c232; }
.res-poison { --res: #6aa84f; }
.res-value { font-size: 1.35em; }
.res-cell.low .res-value { color: var(--q-red); }
.res-cell.capped .res-value { color: var(--q-set); }
.res-label { font-size: 0.8em; color: var(--text-dim); }

/* ---- Inventory: the game's inventory screen ---- */

/* The screen keeps its shape (10 by 11.6 inventory cells) and fills the
   panel as far as both width and height allow. */
.screen-wrap {
  flex: 1;
  min-height: 0;
  container-type: size;
  display: grid;
  align-items: start;
  justify-items: center;
}
.inv-screen {
  position: relative;
  width: min(100cqw, calc(100cqh * 10 / 11.6));
  aspect-ratio: 10 / 11.6;
}
.screen-note { text-align: center; }

/* Under the screen: moving the picked item. */
.move-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; margin: 12px 0 0; }
.move-bar select { width: auto; max-width: 100%; min-width: 0; }

/* Equipment spots: recessed stone, as in game. */
/* One cell that can't grow: the art's own size never stretches the box. */
.equip-slot, .bag-item {
  position: absolute;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  overflow: hidden;
  padding: 2px; /* fixed: a % here is of the whole screen's width */
  text-decoration: none;
  background: #0f0e10;
  border: 1px solid #3a3733;
  box-shadow: inset 0 0 10px rgb(0 0 0 / 0.95);
  --qc: var(--q-normal);
}
button.equip-slot, button.bag-item { font: inherit; color: inherit; cursor: pointer; }
.equip-slot[data-quality="unique"], .bag-item[data-quality="unique"] { --qc: var(--q-unique); }
.equip-slot[data-quality="set"], .bag-item[data-quality="set"] { --qc: var(--q-set); }
.equip-slot[data-quality="rare"], .bag-item[data-quality="rare"] { --qc: var(--q-rare); }
.equip-slot[data-quality="magic"], .bag-item[data-quality="magic"] { --qc: var(--q-magic); }
.equip-slot[data-quality="crafted"], .bag-item[data-quality="crafted"] { --qc: var(--q-crafted); }
.equip-slot:hover, .equip-slot:focus-visible, .bag-item:hover, .bag-item:focus-visible { border-color: var(--qc); outline: none; }
.equip-slot .footprint, .bag-item .footprint { width: 100%; height: 100%; min-width: 0; min-height: 0; background: none; }
.equip-slot.empty { border-color: #2c2a27; }
.equip-slot .slot-label { font-size: 0.7em; color: #4f4a43; text-align: center; }
/* The item picked to move. */
.equip-slot[aria-pressed="true"], .bag-item[aria-pressed="true"] { border-color: var(--qc); box-shadow: inset 0 0 10px rgb(0 0 0 / 0.95), 0 0 0 2px var(--qc); z-index: 1; }
/* Items the character can't use: red, like the game. */
.equip-slot.unusable, .bag-item.unusable { background: rgb(120 20 20 / 0.55); }

/* The I / II weapon set tabs above the weapon and off-hand. */
.weapon-tabs { position: absolute; display: flex; gap: 2px; }
.weapon-tab {
  flex: 1;
  padding: 0;
  font: inherit;
  font-family: var(--font-display);
  font-size: 0.75em;
  line-height: 1;
  color: var(--text-dim);
  background: linear-gradient(#1d1a17, #0f0e0d);
  border: 1px solid #2e2c2a;
  box-shadow: var(--bevel);
  cursor: pointer;
}
.weapon-tab[aria-pressed="true"] { color: var(--q-unique); border-color: #5a554e; box-shadow: inset 0 -2px 0 var(--q-unique); }

/* The inventory: a 10 by 4 grid, items over their cells. */
.bag {
  position: absolute;
  margin: 0;
  padding: 0;
  list-style: none;
  background-color: #0b0b0d;
  background-image:
    linear-gradient(to right, #3a3229 1px, transparent 1px),
    linear-gradient(to bottom, #3a3229 1px, transparent 1px),
    radial-gradient(ellipse at 50% 45%, rgb(255 240 210 / 0.035), transparent 50%, rgb(0 0 0 / 0.55));
  background-size: 10% 25%;
  border: 1px solid #5a4c38;
  box-shadow: inset 0 0 12px rgb(0 0 0 / 0.9), 0 1px 0 rgb(255 240 210 / 0.05);
}
.bag-item { background: rgb(30 45 85 / 0.3); border-color: rgb(90 110 160 / 0.35); padding: 1px; }

.grid-count {
  position: absolute;
  right: 3px;
  bottom: 0;
  font-size: 0.75em;
  font-weight: 700;
  color: var(--q-normal);
  text-shadow: 0 1px 2px #000, 0 0 3px #000;
}

/* Quests: a tick per difficulty done */
.quests table { border-collapse: collapse; font-size: 0.9em; }
.quests th, .quests td { padding: 0.05em 0.7em 0.05em 0; text-align: left; font-weight: 400; }
.quests thead th { color: var(--text-dim); font-size: 0.85em; text-align: center; }
.quests td { text-align: center; }
.quests .done { color: var(--q-set); }
.quests .todo { color: var(--text-dim); }
.cant-use ul { margin: 0; padding: 0; list-style: none; font-size: 0.9em; color: var(--q-red); }
.cant-use li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Gear adds ---- */

.speeds { border-collapse: collapse; width: 100%; }
.speeds th { text-align: left; font-weight: 400; padding: 0.15em 0.6em 0.15em 0; }
.speeds td { padding: 0.15em 0.6em 0.15em 0; white-space: nowrap; }
.speeds .num { text-align: right; }
/* Every stat the gear gives, in magic blue like a tooltip's. */
.all-stats { margin: 0; padding: 0; list-style: none; color: var(--q-magic); }
.all-stats li { padding: 0.1em 0; }
.sets { display: flex; flex-wrap: wrap; gap: 0.2em 1em; color: var(--q-set); font-size: 0.9em; }
.warn { color: var(--q-crafted); }

/* As many skills as fit, in two columns; the rest are on the leveling page. */
.skills {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 1.2em;
}
.skills li { display: flex; justify-content: space-between; gap: 0.5em; break-inside: avoid; padding: 0.08em 0; }
.skill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-pts { white-space: nowrap; }

/* ---- The guide, across the bottom: where you are, what's next, items ---- */

.guide-band {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 0.2em var(--gap);
  align-items: start;
  padding: calc(var(--gap) * 0.7) calc(var(--gap) * 1.1);
  background: var(--tooltip);
  border: 1px solid #3b3b3b;
  border-left: 3px solid var(--q-red);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 5.4em;
}
.guide-band p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide-name { font-family: var(--font-display); }
.guide-name a { color: var(--q-unique); text-decoration: none; }
.guide-name a:hover { text-decoration: underline; }
.guide-k { font-family: var(--font-display); color: var(--text-dim); }
.next-now.respec { color: var(--q-crafted); }
.guide-items { white-space: normal !important; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.guide-items .item-name { display: inline; font-size: 1em; }
.guide-items .ready { color: var(--q-set); }

/* The guide's stages from level 1 to 99, the current one lit, you marked. */
.guide-bar { position: relative; height: 0.5em; margin-top: 0.35em; background: #0e0d0c; border: 1px solid #3b3b3b; }
.guide-bar-stage { position: absolute; top: 0; bottom: 0; border-left: 1px solid #5a4c38; }
.guide-bar-stage[data-n="0"] { background: rgb(201 180 124 / 0.12); }
.guide-bar-stage[data-n="1"] { background: rgb(201 180 124 / 0.05); }
.guide-bar-stage.current { background: rgb(201 180 124 / 0.4); }
.guide-bar-respec { position: absolute; top: -3px; bottom: -3px; border-left: 2px dashed var(--q-crafted); }
.guide-bar-you {
  position: absolute;
  top: 50%;
  width: 0.7em;
  height: 0.7em;
  transform: translate(-50%, -50%);
  background: var(--q-unique);
  border: 1px solid #000;
  border-radius: 50%;
}

.dash-empty { grid-column: 1 / -1; align-self: center; justify-self: center; text-align: center; }
.dash-empty p { margin: 0 0 16px; }

/* ---- Narrow screens: one panel at a time ---- */

@media (max-width: 900px) {
  .dash { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .dash-tabs { display: flex; gap: 4px; }
  .dash-tabs button {
    flex: 1;
    padding: 0.5em;
    font: inherit;
    color: var(--text-dim);
    background: var(--stone-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
  }
  .dash-tabs button[aria-selected="true"] { color: var(--stone); background: var(--q-unique); border-color: var(--q-unique); }
  .panel-box:not(.current) { display: none; }
  .guide-band { grid-template-columns: minmax(0, 1fr); max-height: 4em; }
  .guide-band .guide-where > .dim, .guide-band .guide-bar, .guide-items, .guide-next > .dim { display: none; }
  .dash { --dash-cell: clamp(9px, 3.4vh, 34px); }
}
.cant-use .item-name { display: inline; font-size: 1em; }

/* Phones: the menu row is empty until opened, so the dashboard takes the
   second, full-height row of the page. */
@media (max-width: 560px) {
  body.one-screen .dash { grid-row: 2; }
}

/* A two-handed weapon fills the off-hand too, greyed, as in game. */
.equip-slot.both-hands { opacity: 0.35; filter: grayscale(0.6); }

/* ---- Adding an item from a screenshot ---- */

.add-dialog {
  width: min(40rem, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  color: var(--text);
  background: var(--stone-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.add-dialog::backdrop { background: rgb(0 0 0 / 0.65); }
.add-dialog .dialog-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 20px 10px;
  background: var(--stone-raised);
  border-bottom: 1px solid var(--line);
}
.add-dialog .dialog-head h2 { margin: 0; font-size: var(--step-2); }
.add-dialog-body { padding: 16px 20px 20px; }
.add-places { margin: 12px 0 4px; padding: 0; border: 0; }
.add-places legend { margin-bottom: 6px; padding: 0; font-family: var(--font-display); }
.add-place { display: flex; align-items: baseline; gap: 10px; margin: 0; padding: 4px 0; font-weight: 400; cursor: pointer; }
.add-place input { width: auto; flex: none; box-shadow: none; }
.add-dialog .dim { color: var(--text-dim); }
.add-dialog .small { font-size: 0.85em; }
