/* Scapelike Idle — OSRS-flavored UI. Palette: dark brown panels #3e3529/#494034,
   parchment #d8ccb4, gold #ff981f, hitsplat red #c02316. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Topbar (~48px) + footer (~52px) + the layout's 14px padding top and bottom.
   * Only used to bound the centre column against the viewport. */
  --page-chrome: 130px;
  --panel: #3e3529;
  --panel2: #494034;
  --edge: #5a4e3c;
  --edge-dark: #2b251c;
  --parchment: #d8ccb4;
  --gold: #ff981f;
  --red: #c02316;
  --green: #35b839;
  --purple: #b44cff;
  --dim: #9a8f7a;
}

html, body { height: 100%; }
body {
  font-family: 'VT323', monospace;
  font-size: 19px;
  background: #262119;
  background-image: radial-gradient(1200px 500px at 50% -150px, #383024, #262119 70%);
  background-attachment: fixed;
  color: var(--parchment);
  letter-spacing: 0.3px;
}

img { max-width: 100%; image-rendering: pixelated; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  font-family: inherit; font-size: 17px; cursor: pointer;
  background: var(--panel2); color: var(--parchment);
  border: 2px solid var(--edge); padding: 4px 12px;
}
button:hover { border-color: var(--gold); color: var(--gold); }
input {
  font-family: inherit; font-size: 18px;
  background: #241f17; color: var(--parchment);
  border: 2px solid var(--edge); padding: 6px 8px; width: 100%;
}
input:focus { outline: none; border-color: var(--gold); }

/* ------------------------------------------------------------- top bar --- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: linear-gradient(#4a4034, #3e3529);
  border-bottom: 3px solid var(--edge-dark);
  box-shadow: 0 2px 0 var(--edge) inset;
  padding: 8px 18px;
}
.logo { font-size: 26px; color: var(--gold); text-shadow: 2px 2px 0 #000; }
.topbar nav { display: flex; gap: 18px; font-size: 20px; }
.topbar nav a.here { color: #fff; border-bottom: 2px solid var(--gold); }
.userbox { margin-left: auto; display: flex; gap: 12px; align-items: center; color: var(--dim); }
.userbox #who { color: var(--parchment); }

/* -------------------------------------------------------------- layout --- */
.game-layout {
  display: grid;
  grid-template-columns: 290px 1fr 270px;
  gap: 14px;
  padding: 14px;
  max-width: 1400px;
  margin: 0 auto;
}
@media (max-width: 1000px) { .game-layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 3px solid var(--edge-dark);
  box-shadow: 0 0 0 2px var(--edge) inset;
  padding: 12px;
}
.panel h2 {
  font-size: 21px; color: var(--gold); margin-bottom: 8px;
  text-shadow: 1px 1px 0 #000;
}

/* ----------------------------------------------------------- boss list --- */
#boss-list { max-height: calc(100vh - 220px); overflow-y: auto; }
.tier-label { color: var(--dim); margin: 10px 0 4px; border-bottom: 1px solid var(--edge); font-size: 17px; }
.boss-row {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 6px; margin: 2px 0; cursor: pointer;
  border: 2px solid transparent;
}
.boss-row:hover { background: var(--panel2); border-color: var(--edge); }
.boss-row.active { background: #55461f; border-color: var(--gold); }
.boss-row img { width: 34px; height: 34px; object-fit: contain; flex: none; }
.boss-row .bname { flex: 1; line-height: 1.05; }
.boss-row .bkc { color: var(--gold); font-size: 16px; }
.boss-row.locked { cursor: not-allowed; opacity: 0.55; }
.boss-row.locked img { filter: grayscale(1) brightness(0.6); }
.boss-row.locked .block { font-size: 14px; color: var(--dim); max-width: 120px; text-align: right; line-height: 1; }

/* --------------------------------------------------------------- stage --- */
/* Anchoring the centre column to the viewport is what lets the chat below use
 * `flex: 1` at all. Without it the grid row's height is DERIVED from its
 * contents, so the chat growing simply makes room for itself — circular, and
 * the reason the panel used to run away down the page. The left panel already
 * anchors itself the same way (#boss-list, above). */
#stage {
  display: flex; flex-direction: column; gap: 10px;
  /* A DEFINITE height, not max-height. `flex: 1` on the chat below grows into
   * free space, and a max-height only caps — the grid row would still be sized
   * from its contents, leaving no free space and pinning the chat at its floor
   * on every screen. This is the line that makes the chat scale with the
   * window. */
  height: calc(100vh - var(--page-chrome));
  height: calc(100dvh - var(--page-chrome));
}
/*
 * Nothing above the chat may be squeezed to make room for it. A flex item's
 * default flex-shrink is 1, so once #stage is height-bounded the arena's
 * `height: 380px` becomes a mere suggestion — it was collapsing to 69px on a
 * 1080p screen as the chat filled. The :not() keeps this independent of source
 * order, rather than relying on a later rule to win.
 */
#stage > *:not(#chatbox) { flex: none; }
#arena {
  position: relative;
  height: 380px;
  background: radial-gradient(ellipse at 50% 65%, #51462f 0%, #3a3226 45%, #2b251c 100%);
  border: 3px solid var(--edge-dark);
  box-shadow: 0 0 0 2px var(--edge) inset, 0 0 60px rgba(0,0,0,.5) inset;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
#boss-wrap {
  position: relative; z-index: 2;
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(-6px); }
  50%      { transform: translateY(6px); }
}
#boss-img {
  max-height: 280px; max-width: 420px;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.6));
}
#boss-img.lunge { animation: lunge 0.15s ease-out; }
@keyframes lunge {
  0%   { transform: translate(0, 0); }
  35%  { transform: translate(-10px, 6px) scale(1.05); }
  70%  { transform: translate(4px, -2px); }
  100% { transform: translate(0, 0); }
}
#boss-shadow {
  position: absolute; bottom: 26px; left: 50%; z-index: 1;
  width: 180px; height: 26px; margin-left: -90px;
  background: radial-gradient(ellipse, rgba(0,0,0,.55), transparent 70%);
  animation: shadowpulse 2.2s ease-in-out infinite;
}
@keyframes shadowpulse {
  0%, 100% { transform: scaleX(0.85); opacity: .7; }
  50%      { transform: scaleX(1.05); opacity: 1; }
}
#loot-beam {
  position: absolute; bottom: 10%; left: 50%; z-index: 0;
  width: 110px; height: 92%; margin-left: -55px;
  background: linear-gradient(to top, rgba(180,76,255,.6), rgba(180,76,255,.25) 55%, transparent);
  filter: blur(3px);
  opacity: 0; transition: opacity .4s;
  pointer-events: none;
}
#loot-beam.show { opacity: 1; animation: beamflicker 0.9s ease-in-out infinite; }
@keyframes beamflicker { 0%,100% { filter: blur(3px) brightness(1); } 50% { filter: blur(4px) brightness(1.35); } }

#hitsplats { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.hitsplat {
  position: absolute;
  width: 44px; height: 44px;
  background: var(--red);
  border-radius: 8px;
  box-shadow: 0 0 0 2px #7e150c inset, 2px 2px 4px rgba(0,0,0,.5);
  color: #fff; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  animation: splat 0.8s ease-out forwards;
}
@keyframes splat {
  0%   { transform: scale(0.3); opacity: 0; }
  12%  { transform: scale(1.2); opacity: 1; }
  28%  { transform: scale(1); }
  75%  { opacity: 1; }
  100% { transform: translateY(-26px) scale(0.9); opacity: 0; }
}

#boss-title { text-align: center; font-size: 30px; color: #fff; text-shadow: 2px 2px 0 #000; }
#boss-title .style-tag { font-size: 17px; color: var(--dim); }

.killbar {
  height: 24px;
  background: #241f17;
  border: 2px solid var(--edge);
  box-shadow: 0 0 0 1px #000 inset;
  position: relative;
}
#killbar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(#ffb051, var(--gold) 45%, #c96e00);
}
.killbar .kb-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff; text-shadow: 1px 1px 0 #000;
}

/* --------------------------------------------------------------- stats --- */
#stats .stat-line { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dotted var(--edge); }
#stats .stat-line b { color: var(--gold); font-weight: normal; }
.powergrid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 8px 0; text-align: center; }
.powergrid .pcell { background: var(--panel2); border: 2px solid var(--edge); padding: 5px 2px; }
.powergrid .pcell .pv { font-size: 24px; color: var(--gold); }
.powergrid .pcell .pl { font-size: 14px; color: var(--dim); }
#next-unlock { margin-top: 10px; color: var(--dim); font-size: 17px; line-height: 1.3; }
#next-unlock b { color: var(--parchment); }

/* ------------------------------------------------------------- chatbox --- */
/* The chat and drop feed live in the CENTRE column under the KC bar, in a
 * fixed window of --chat-lines lines with the history scrollable above it.
 *
 * It used to be `flex: 1` against a parent with no height of its own, so there
 * was nothing to fill and nothing to overflow: the panel simply grew downwards
 * for every message and the scrollbar never appeared. Sizing the viewport in
 * LINES rather than pixels keeps it to the same number of messages after the
 * font size changes on small screens. */
#chatbox {
  display: flex; flex-direction: column;
  /* DESKTOP: take whatever height the arena leaves, with a floor so a short
   * laptop window cannot squeeze the chat to nothing. This works only because
   * #stage is bounded above; on its own it is the runaway-growth bug.
   *
   * The basis is 0, NOT auto. With `auto` a flex item's base size is its
   * CONTENT, so every message made the box want to be bigger, and the overflow
   * that created got taken out of the arena above. Basis 0 means the height
   * comes from the space available and nothing else — message count cannot
   * influence the layout at all. */
  flex: 1 1 0;
  min-height: 210px;
  /*
   * ...and a ceiling, so a tall monitor gets a generous chat rather than an
   * absurd one. 16 lines of #chat-inner's 18px/1.3 type (23.4px each), plus its
   * 8px padding top and bottom, plus 53px for the input row and borders — that
   * last figure measured by `npm run layout`, which also asserts the resulting
   * line count. `em` is deliberately not used here: on #chatbox it would
   * resolve against this element's inherited font-size, not the 18px set on
   * #chat-inner below, and would silently give the wrong number of lines.
   */
  --chat-max-lines: 16;
  max-height: calc(var(--chat-max-lines) * 23.4px + 16px + 53px);
  background: #2f2a20;
  border: 3px solid var(--edge-dark);
  box-shadow: 0 0 0 2px var(--edge) inset;
}
#chat-inner {
  --chat-pad: 8px;
  flex: 1 1 auto;
  /* Required, not decorative: a flex item's automatic minimum is its content,
   * so without this it refuses to shrink and never scrolls. */
  min-height: 0;
  /* `scroll` rather than `auto` keeps the bar present, so the text never
   * reflows sideways the moment the panel first overflows. */
  overflow-y: scroll;
  padding: var(--chat-pad) 12px; font-size: 18px; line-height: 1.3;
  /* Long words and pasted URLs wrap instead of forcing a sideways scroll. */
  overflow-wrap: anywhere;
  /* Firefox; the WebKit equivalent is below. */
  scrollbar-width: thin;
  scrollbar-color: var(--edge) #241f18;
}
#chat-inner::-webkit-scrollbar { width: 12px; }
#chat-inner::-webkit-scrollbar-track { background: #241f18; }
#chat-inner::-webkit-scrollbar-thumb {
  background: var(--edge);
  border: 2px solid #241f18;
}
#chat-inner::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* SINGLE COLUMN (phones and narrow tablets). Deliberately the opposite rule:
 * here the page is one long scroll, so "fill the viewport" means nothing — and
 * a tall scrollable panel sitting mid-page captures the touch drags that were
 * meant to scroll the page, which is how a widget becomes a wall. Fixed, and
 * shorter than desktop: something you scroll past rather than get stuck in.
 * Sized in LINES so the smaller type at 700px shows the same six messages
 * rather than a different number. */
@media (max-width: 1000px) {
  #stage { height: auto; max-height: none; }
  #chatbox { --chat-lines: 6; flex: none; min-height: 0; }
  #chat-inner {
    flex: none;
    /* 1.3em == the line-height, and the padding is added back because
     * box-sizing is border-box globally — without that term it eats a line. */
    height: calc(var(--chat-lines) * 1.3em + var(--chat-pad) * 2);
  }
}
#chat-inner .line { color: var(--parchment); }
#chat-inner .line.drop { color: var(--gold); }
#chat-inner .line.rare { color: var(--purple); }
#chat-inner .line.pet { color: var(--green); }
#chat-inner .line.sys { color: var(--dim); }

/* -------------------------------------------------------------- toasts --- */
#toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; gap: 12px; align-items: center;
  min-width: 260px; max-width: 340px;
  background: var(--panel);
  border: 2px solid var(--gold);
  box-shadow: 0 4px 14px rgba(0,0,0,.6);
  padding: 8px 12px;
  animation: toastin .3s ease-out;
}
.toast.out { opacity: 0; transform: translateX(30px); transition: all .4s; }
@keyframes toastin { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; } }
.toast img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.toast .tname { color: #fff; }
.toast .trate { font-size: 15px; color: var(--dim); }
.toast.rare { border-color: var(--purple); box-shadow: 0 0 16px rgba(180,76,255,.55); }
.toast.rare .tname { color: var(--purple); }
.toast.pet { border-color: var(--green); box-shadow: 0 0 16px rgba(53,184,57,.5); }
.toast.pet .tname { color: var(--green); }

/* --------------------------------------------------------------- shake --- */
body.shake { animation: shake 0.4s; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-5px, 3px); }
  40% { transform: translate(5px, -3px); }
  60% { transform: translate(-4px, -2px); }
  80% { transform: translate(3px, 2px); }
}

/* --------------------------------------------------------------- modal --- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--panel);
  border: 3px solid var(--gold);
  box-shadow: 0 0 40px rgba(0,0,0,.8);
  max-width: 480px; width: 92%;
  padding: 20px;
  max-height: 80vh; overflow-y: auto;
}
.modal-box h2 { color: var(--gold); font-size: 26px; margin-bottom: 10px; text-shadow: 2px 2px 0 #000; }
.away-drops { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.away-drop { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--edge); padding: 4px 8px; }
.away-drop img { width: 30px; height: 30px; object-fit: contain; }
.away-drop .qty { margin-left: auto; color: var(--gold); }

/* --------------------------------------------------------------- login --- */
.login-wrap { max-width: 760px; margin: 60px auto; padding: 0 16px; }
.login-title { text-align: center; font-size: 44px; color: var(--gold); text-shadow: 3px 3px 0 #000; margin-bottom: 6px; }
.login-sub { text-align: center; color: var(--dim); margin-bottom: 28px; }
.login-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .login-cols { grid-template-columns: 1fr; } }
.login-cols form { display: flex; flex-direction: column; gap: 10px; }
.err { color: #ff6b5e; min-height: 22px; }

/* ------------------------------------------------------ collection log --- */
.cl-wrap { max-width: 1100px; margin: 0 auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.cl-boss { }
.cl-head {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel2);
  border-bottom: 2px solid var(--edge);
  padding: 6px 10px; margin-bottom: 8px;
}
.cl-head img { width: 34px; height: 34px; object-fit: contain; }
.cl-head .cl-title { font-size: 22px; color: var(--gold); }
.cl-head .cl-count { margin-left: auto; color: var(--dim); }
.cl-boss.complete .cl-title { color: var(--green); }
.cl-boss.complete .cl-head { border-color: var(--green); }
.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 8px; }
.cl-cell {
  position: relative;
  background: #2c261d;
  border: 2px solid var(--edge);
  aspect-ratio: 1; padding: 8px;
  display: flex; align-items: center; justify-content: center;
}
.cl-cell img { max-height: 44px; filter: grayscale(1) brightness(0.45); }
.cl-cell.owned { border-color: var(--gold); }
.cl-cell.owned img { filter: none; }
.cl-cell .qty {
  position: absolute; top: 1px; right: 3px;
  font-size: 14px; color: #ffff00; text-shadow: 1px 1px 0 #000;
}

/* --------------------------------------------------------- leaderboard --- */
.board-wrap { max-width: 900px; margin: 0 auto; padding: 14px; }
table.board { width: 100%; border-collapse: collapse; }
table.board th, table.board td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--edge); }
table.board th { background: var(--panel2); color: var(--gold); cursor: pointer; user-select: none; }
table.board th:hover { color: #fff; }
table.board th .arrow { font-size: 14px; }
table.board tr:hover td { background: rgba(255,152,31,.06); }
table.board td.num { color: var(--gold); }
.board-note { color: var(--dim); margin-top: 8px; font-size: 16px; }

/* --------------------------------------------------------------- pick --- */
.nothing { text-align: center; color: var(--dim); padding: 60px 0; font-size: 24px; }

/* -------------------------------------------------------- quests & notes --- */
.toast.quest { border-color: #e8c04a; box-shadow: 0 0 16px rgba(232,192,74,.55); }
.toast.quest .tname { color: #e8c04a; }
#chat-inner .line.quest { color: #e8c04a; }
.quests-wrap, .notes-wrap { max-width: 900px; margin: 0 auto; padding: 14px; }
.quests-note { color: var(--dim); margin-bottom: 12px; }
.q-card {
  background: var(--panel2); border: 2px solid var(--edge);
  padding: 10px 12px; margin-bottom: 12px;
}
.q-card.ready { border-color: #e8c04a; box-shadow: 0 0 12px rgba(232,192,74,.35); }
.q-card.completed { opacity: .75; border-color: var(--green); }
.q-card.locked { opacity: .6; }
.q-head { display: flex; justify-content: space-between; align-items: baseline; }
.q-name { font-size: 22px; color: var(--gold); }
.q-state { color: var(--dim); font-size: 16px; }
.q-card.ready .q-state { color: #e8c04a; }
.q-card.completed .q-state { color: var(--green); }
.q-flavor { color: var(--parchment); font-style: italic; margin: 4px 0 8px; }
.q-lvl { color: #ff6b5e; font-size: 16px; margin-bottom: 6px; }
.q-lvl.done { color: var(--green); }
.q-req { margin: 6px 0; }
.q-req-label { font-size: 16px; }
.q-req.done .q-req-label { color: var(--green); }
.q-bar { height: 10px; background: #241f17; border: 1px solid var(--edge); }
.q-bar div { height: 100%; background: linear-gradient(#ffb051, var(--gold)); }
.q-req.done .q-bar div { background: linear-gradient(#4fd151, #2f9e33); }
.q-rewards { color: var(--dim); font-size: 16px; margin-top: 6px; }
.q-btn { margin-top: 8px; }
.q-btn.ready { border-color: #e8c04a; color: #e8c04a; animation: fightpulse 1.6s ease-in-out infinite; }
.note { margin-bottom: 16px; }
.note-head { font-size: 24px; color: var(--gold); border-bottom: 1px solid var(--edge); margin-bottom: 6px; }
.note-date { color: var(--dim); font-size: 16px; margin-left: 8px; }
.note ul { margin-left: 22px; line-height: 1.45; }

/* --------------------------------------------------------- board & misc --- */
.board-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.board-tabs button.on { border-color: var(--gold); color: var(--gold); background: #55461f; }
.cl-master { color: var(--green); font-size: 15px; margin-left: 10px; }
.site-footer {
  text-align: center; color: var(--dim); font-size: 15px;
  padding: 14px 0 18px; opacity: .8;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* --------------------------------------------------- v1.2: notifications --- */
#notif-stack {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 150; display: flex; flex-direction: column; gap: 8px;
  width: min(420px, calc(100vw - 20px));
  pointer-events: none;
}
.notif-banner {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(#4a4034, #322b20);
  border: 2px solid #e8c04a;
  box-shadow: 0 6px 24px rgba(0,0,0,.7), 0 0 18px rgba(232,192,74,.35);
  padding: 10px 14px;
  animation: nbin .35s ease-out;
}
.notif-banner.out { opacity: 0; transform: translateY(-16px); transition: all .45s; }
@keyframes nbin { from { opacity: 0; transform: translateY(-22px) scale(.96); } to { opacity: 1; } }
.notif-banner img { width: 40px; height: 40px; object-fit: contain; }
.nb-title { color: #e8c04a; font-size: 20px; text-shadow: 1px 1px 0 #000; }
.nb-body { color: var(--parchment); font-size: 16px; }

/* ------------------------------------------------------- v1.2: economy --- */
.qmark {
  width: 22px; height: 22px; padding: 0; margin-left: 4px;
  border-radius: 50%; font-size: 14px; line-height: 1;
  color: var(--dim); border-color: var(--edge);
  vertical-align: middle;
}
.store-head { margin-top: 16px; }
#gp-line { font-size: 20px; margin: 4px 0; }
#gp-line b { color: #ffd700; }
.boost-line { color: var(--parchment); padding: 2px 0; }
.boost-timer { color: var(--gold); margin-left: 6px; }
#store-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.pot-card { background: #2c261d; border: 2px solid var(--edge); padding: 8px; text-align: center; }
.pot-name { color: var(--gold); line-height: 1.1; }
.pot-fx { font-size: 14px; color: var(--dim); margin: 4px 0 6px; }
.pot-buy { width: 100%; padding: 8px 2px; }
.bank-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
  border-bottom: 2px solid var(--edge); padding-bottom: 8px;
}
.bank-tabs { display: flex; gap: 8px; }
.bank-tabs button { padding: 8px 16px; font-size: 18px; }
.bank-tabs button.on { border-color: var(--gold); color: var(--gold); background: #55461f; }
#gp-line { font-size: 22px; }
#gp-line b { color: #ffd700; }
#bank-hint { margin-bottom: 10px; }
.inv-item { grid-template-rows: auto auto auto auto; }
.ii-sell { font-size: 14px; color: #ffd700; grid-column: 2; }
.dupes-tag { color: #ffd700; }
.ii-sellbtn {
  grid-column: 1 / -1;
  margin-top: 6px; padding: 8px 4px; font-size: 15px;
  border-color: #8a7430; color: #ffd700; background: #3a3220;
}
.ii-sellbtn:hover { border-color: #ffd700; }
#sell-mode.on { border-color: #ffd700; color: #ffd700; background: #55461f; }
.inv-item.tagged { border-color: #ffd700; box-shadow: 0 0 10px rgba(255,215,0,.35); }
.inv-item.tagged-last { border-color: var(--red); box-shadow: 0 0 10px rgba(192,35,22,.45); }
.tag-badge {
  grid-column: 1 / -1;
  font-size: 13px; letter-spacing: 1px;
  color: #ffd700; text-shadow: 1px 1px 0 #000;
}
.inv-item.tagged-last .tag-badge { color: #ff8b7e; }
#sell-bar {
  position: fixed; left: 12px; right: 12px; bottom: 14px; z-index: 85;
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(#4a4034, #322b20);
  border: 2px solid #ffd700;
  box-shadow: 0 6px 24px rgba(0,0,0,.7);
  padding: 10px 16px;
  max-width: 640px; margin: 0 auto;
}
#sell-bar-info { flex: 1; font-size: 18px; }
#sell-bar-info b { color: #ffd700; }
#sell-bar-go { border-color: #ffd700; color: #ffd700; padding: 8px 22px; font-size: 18px; }
#sell-bar-go:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 700px) {
  #sell-bar { bottom: calc(74px + env(safe-area-inset-bottom)); }
}
#bank-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
#bank-toolbar select {
  font-family: inherit; font-size: 16px; padding: 8px;
  background: #241f17; color: var(--parchment); border: 2px solid var(--edge);
  flex: 1; min-width: 120px;
}
#bank-toolbar button { flex: 1; min-width: 130px; }
.inv-item { min-height: 52px; }
.inv-item.ghost { opacity: .45; }
.inv-item.ghost img { filter: grayscale(1) brightness(.6); }
.sheet-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.sheet-head img { width: 52px; height: 52px; object-fit: contain; }
.sheet-name { font-size: 24px; color: var(--gold); }
.sheet-rows { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin-bottom: 12px; }
.sheet-rows div:nth-child(odd) { color: var(--dim); }
.sheet-btn { display: block; width: 100%; margin-top: 8px; padding: 11px 0; font-size: 18px; }
.sheet-btn.warn { border-color: var(--red); color: #ff8b7e; }

/* ------------------------------------------------------- v1.2: account --- */
.account-wrap { max-width: 900px; margin: 0 auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.account-wrap .stat-line b { color: var(--gold); font-weight: normal; }
.nf-row { display: block; padding: 6px 0; font-size: 18px; }
.nf-row input[type=checkbox] { width: 18px; height: 18px; }
#nf-save { margin-top: 8px; margin-right: 10px; }
#pw-form { display: flex; flex-direction: column; gap: 10px; max-width: 380px; }

/* --------------------------------------------------------- v1.2: guide --- */
.guide h3 { color: var(--gold); margin: 14px 0 4px; font-size: 21px; }
.guide p { line-height: 1.5; margin-bottom: 6px; }
.guide .g-code {
  background: #241f17; border: 1px solid var(--edge);
  padding: 8px 12px; font-size: 16px; color: #b6aaff;
  overflow-x: auto;
}
.site-footer a { color: var(--dim); text-decoration: underline; }
.site-footer a:hover { color: var(--gold); }

/* -------------------------------------------------------------- mobile --- */
a, button, .boss-row, .cl-cell, .inv-item, .slot-cell { touch-action: manipulation; }
#mobile-tabs { display: none; }
#touch-tip {
  display: none; position: fixed; z-index: 200;
  transform: translateY(-100%);
  background: #241f17; color: var(--parchment);
  border: 2px solid var(--gold);
  padding: 6px 10px; font-size: 16px; line-height: 1.25;
  box-shadow: 0 4px 14px rgba(0,0,0,.6);
  pointer-events: none;
}

@media (max-width: 700px) {
  /* Compact sticky header; nav moves to the bottom tab bar. */
  .topbar { position: sticky; top: 0; z-index: 60; gap: 10px; padding: 7px 12px; }
  .topbar nav { display: none; }
  .logo { font-size: 20px; white-space: nowrap; }
  .userbox { gap: 8px; font-size: 15px; }
  .userbox #who { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .userbox button { padding: 6px 10px; font-size: 15px; }

  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  #mobile-tabs {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: linear-gradient(#4a4034, #322b20);
    border-top: 3px solid var(--edge-dark);
    box-shadow: 0 1px 0 var(--edge) inset;
    padding-bottom: env(safe-area-inset-bottom);
  }
  #mobile-tabs a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 0 7px; color: var(--dim); text-decoration: none;
  }
  #mobile-tabs a.here { color: var(--gold); background: rgba(255, 152, 31, 0.09); }
  #mobile-tabs a:active { background: rgba(255, 152, 31, 0.16); }
  .mt-ico { font-size: 19px; line-height: 1; }
  .mt-label { font-size: 12px; letter-spacing: 0.5px; }

  /* Game screen: arena first, stats second, monster list last. */
  .game-layout { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
  #stage { order: 0; }
  #stats { order: 1; }
  #boss-list { order: 2; max-height: 340px; }
  #arena { height: 280px; }
  #boss-img { max-height: 185px; max-width: 82vw; }
  #boss-shadow { width: 140px; margin-left: -70px; bottom: 20px; }
  #hpbar { width: min(240px, 68vw); }
  #boss-title { font-size: 24px; }
  #fight-btn { font-size: 23px; padding: 10px 20px; }
  #fight-info { font-size: 15px; }
  #flee-btn { padding: 6px 12px; }
  .hitsplat { width: 38px; height: 38px; font-size: 22px; }
  .xp-float { font-size: 19px; }
  .boss-row { padding: 9px 8px; }
  .boss-row .block { max-width: 105px; font-size: 13px; }
  #train-styles button { padding: 9px 2px; }
  /* Phones: the feed sits under the KC bar in the single-column stack. The
   * height is inherited from the line-count rule, so shrinking the type here
   * makes the panel shorter rather than showing more messages than desktop. */
  #chat-inner { font-size: 16px; }

  /* Toasts: full-width strip floating above the tab bar. */
  #toasts {
    left: 10px; right: 10px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    align-items: stretch;
  }
  .toast { min-width: 0; max-width: none; }

  /* Other pages */
  .equip-layout, .quests-wrap, .notes-wrap, .board-wrap { padding: 10px; gap: 10px; }
  .cl-wrap { padding: 10px; gap: 10px; }
  .cl-grid { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; }
  .cl-head .cl-master { display: block; margin-left: 0; }
  #slots-grid { gap: 6px; }
  .inv-items { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
  .q-btn { width: 100%; padding: 11px 0; font-size: 19px; }
  table.board { min-width: 540px; }
  table.board th, table.board td { padding: 8px 8px; font-size: 17px; }
  .board-tabs button { flex: 1; padding: 9px 4px; }
  .login-wrap { margin: 24px auto; }
  .modal-box { max-height: 76vh; }
}
.hidden { display: none !important; }
.dim-note { color: var(--dim); font-size: 16px; }

/* -------------------------------------------------------------- combat --- */
#boss-img.dying {
  animation: die 0.42s ease-in forwards;
}
@keyframes die {
  0%   { transform: none; filter: none; opacity: 1; }
  40%  { transform: rotate(7deg) translateY(6px); filter: grayscale(.6) brightness(1.6); }
  100% { transform: rotate(14deg) translateY(22px) scale(0.92); filter: grayscale(1) brightness(0.4); opacity: 0.05; }
}
#boss-img.spawn { animation: spawnin 0.35s ease-out; }
@keyframes spawnin {
  0%   { transform: scale(0.75); opacity: 0; filter: brightness(2); }
  100% { transform: scale(1); opacity: 1; filter: none; }
}
#arena.under-attack::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  box-shadow: 0 0 60px 18px rgba(192, 35, 22, 0.55) inset;
  animation: vignette 0.45s ease-out forwards;
}
@keyframes vignette { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
#arena.under-attack #boss-wrap { animation: bob 2.2s ease-in-out infinite, jab 0.25s ease-out; }
@keyframes jab { 40% { margin-top: 10px; } }

#hpbar {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 260px; height: 20px; z-index: 5;
  background: #7e150c;
  border: 2px solid #000;
  box-shadow: 0 2px 6px rgba(0,0,0,.6);
}
#hp-fill {
  height: 100%; width: 100%;
  background: linear-gradient(#4fd151, #2f9e33);
}
#hpbar span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff; text-shadow: 1px 1px 0 #000;
}

#fight-overlay {
  position: absolute; inset: 0; z-index: 6;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 28px; gap: 10px;
  background: linear-gradient(rgba(20,16,10,0), rgba(20,16,10,.55) 75%);
}
#fight-btn {
  font-size: 28px; padding: 10px 30px;
  background: linear-gradient(#5d4f2e, #443a22);
  border: 3px solid var(--gold);
  color: var(--gold);
  text-shadow: 2px 2px 0 #000;
  box-shadow: 0 4px 16px rgba(0,0,0,.6), 0 0 18px rgba(255,152,31,.25);
  animation: fightpulse 1.6s ease-in-out infinite;
}
#fight-btn:hover:not(:disabled) { color: #fff; border-color: #fff; }
#fight-btn:disabled { animation: none; opacity: .65; cursor: not-allowed; border-color: var(--edge); color: var(--dim); }
@keyframes fightpulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
#fight-info { font-size: 17px; color: var(--parchment); text-shadow: 1px 1px 0 #000; text-align: center; padding: 0 12px; }

#flee-btn {
  position: absolute; top: 12px; right: 12px; z-index: 6;
  font-size: 15px; padding: 3px 10px;
  opacity: .75;
}
#flee-btn:hover { opacity: 1; }

#pet-img {
  position: absolute; bottom: 30px; left: 26px; z-index: 2;
  width: 52px; height: 52px; object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.6));
  animation: bob 1.8s ease-in-out infinite;
}

.boss-row.fighting .bname { color: var(--gold); }
.boss-row .swords { font-size: 14px; }
.pg-head { margin-top: 10px; color: var(--dim); font-size: 16px; border-bottom: 1px solid var(--edge); }

/* -------------------------------------------------------------- skills --- */
.hitsplat.miss { background: #3c58b0; box-shadow: 0 0 0 2px #24356e inset, 2px 2px 4px rgba(0,0,0,.5); }
.skill-line { display: flex; justify-content: space-between; padding: 4px 0 2px; }
.skill-line b { color: var(--gold); font-weight: normal; font-size: 21px; }
.xpbar {
  position: relative; height: 14px; margin-bottom: 6px;
  background: #241f17; border: 1px solid var(--edge);
}
.xpbar div { height: 100%; width: 0%; background: linear-gradient(#8a7bff, #5b48d6); }
.xpbar span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; text-shadow: 1px 1px 0 #000; letter-spacing: 0;
}
#train-styles { display: flex; gap: 6px; margin: 6px 0; }
#train-styles button { flex: 1; font-size: 15px; padding: 4px 2px; }
#train-styles button.on { border-color: var(--gold); color: var(--gold); background: #55461f; }
.xp-float {
  position: absolute; left: 50%; top: 34%; z-index: 7;
  transform: translateX(-50%);
  color: #b6aaff; font-size: 22px; text-shadow: 2px 2px 0 #000;
  pointer-events: none;
  animation: xpfloat 1.4s ease-out forwards;
}
@keyframes xpfloat {
  0%   { opacity: 0; margin-top: 0; }
  15%  { opacity: 1; }
  100% { opacity: 0; margin-top: -70px; }
}

/* ----------------------------------------------------------- equipment --- */
.equip-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 14px;
  padding: 14px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 900px) { .equip-layout { grid-template-columns: 1fr; } }
#slots-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
.slot-cell {
  background: #2c261d;
  border: 2px solid var(--edge);
  min-height: 96px;
  padding: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 2px; text-align: center;
}
.slot-cell.filled { border-color: var(--gold); cursor: pointer; }
.slot-cell.filled:hover { border-color: #fff; }
.slot-cell .slot-name { font-size: 13px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }
.slot-cell img { width: 34px; height: 34px; object-fit: contain; }
.slot-cell .slot-item { font-size: 14px; line-height: 1.05; color: var(--parchment); }
.slot-cell .slot-pow { font-size: 13px; color: var(--gold); }
.slot-cell .slot-empty { color: #57503f; margin-top: 16px; }
#equip-summary { margin-top: 12px; line-height: 1.45; border-top: 1px solid var(--edge); padding-top: 10px; }
#equip-summary b { color: var(--gold); font-weight: normal; }
.bank-note { color: var(--dim); font-size: 16px; margin-bottom: 10px; }
.inv-group { margin-bottom: 14px; }
.inv-head { color: var(--gold); border-bottom: 1px solid var(--edge); margin-bottom: 6px; text-transform: uppercase; font-size: 15px; letter-spacing: 1px; }
.inv-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.inv-item {
  display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; column-gap: 8px;
  align-items: center;
  background: #2c261d; border: 2px solid var(--edge);
  padding: 6px 8px; cursor: pointer;
}
.inv-item img { grid-row: span 2; width: 34px; height: 34px; object-fit: contain; }
.inv-item:hover { border-color: var(--gold); }
.inv-item.equipped { border-color: var(--green); cursor: default; }
.inv-item .ii-name { font-size: 15px; line-height: 1.05; }
.inv-item .ii-pow { font-size: 13px; color: var(--dim); }
.inv-item .eqtag { color: var(--green); }

/* ------------------------------------------------- v1.2.4: clarity & UX --- */
/* Skeleton: never show fake level-1 zeros before the first payload lands. */
body.loading #stats .stat-line b,
body.loading .skill-line b { color: var(--dim); opacity: .5; }
body.loading #boss-rows { opacity: .35; }
.bank-nudge { color: #ffd700; font-size: 15px; }
.style-proj { display: block; font-size: 12px; color: var(--dim); letter-spacing: 0; }
#train-styles button.on .style-proj { color: var(--gold); }
.away-upgrades {
  margin-top: 10px; padding: 8px 10px;
  background: #55461f; border: 2px solid var(--gold);
  line-height: 1.4;
}
.away-gear-link { font-size: 17px; }
.ui-dialog .modal-box { max-width: 420px; }
.ui-dialog-body { line-height: 1.45; margin-bottom: 14px; }
.ui-dialog-btns { display: flex; gap: 10px; }
.ui-dialog-btns button { flex: 1; padding: 10px 0; font-size: 18px; }
.ui-dialog-btns .ui-ok { border-color: var(--gold); color: var(--gold); }
.ui-dialog-btns .ui-ok.warn { border-color: var(--red); color: #ff8b7e; }
.up-dot { color: #ffd700; font-size: 12px; vertical-align: super; margin-left: 3px; animation: fightpulse 2s ease-in-out infinite; }
#mobile-tabs .up-dot { position: absolute; margin-left: 16px; margin-top: -2px; }
#mobile-tabs a { position: relative; }

/* Staging test-server banner — impossible to mistake for live. */
#staging-badge {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  z-index: 300; pointer-events: none;
  background: #7e150c; color: #ffd0c9; border: 2px solid #ff6b5e; border-top: none;
  padding: 2px 14px 3px; font-size: 15px; letter-spacing: 1px;
}

/* ---------------------------------------------- v1.3.0: attack types & forge */
.weak-tag { margin-left: 6px; font-size: 14px; letter-spacing: 1px; }
#train-styles { display: flex; gap: 6px; flex-wrap: wrap; }
#train-styles button { min-width: 30%; }
.lanes span { margin-right: 8px; white-space: nowrap; }
.lane-weak { color: #7fd47f; }
.lane-normal { color: var(--dim); }
.lane-stiff { color: #e07070; }

#forge-slots { display: flex; gap: 10px; margin: 10px 0; }
.forge-slot {
  flex: 1; min-height: 84px; border: 2px dashed var(--dim); border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 6px; color: var(--dim); font-size: 15px;
}
.forge-slot.filled { border-style: solid; border-color: var(--gold); color: var(--parchment); cursor: pointer; }
.forge-slot img { width: 40px; height: 40px; object-fit: contain; }
.fs-name { font-size: 14px; text-align: center; }
#forge-actions { display: flex; gap: 8px; margin-bottom: 8px; }
#forge-go { background: #55461f; border-color: var(--gold); color: var(--gold); }
#forge-go:disabled { opacity: 0.5; }
#forge-result { padding: 8px 10px; border-radius: 6px; margin-bottom: 8px; background: var(--panel2); }
#forge-result.forge-ok { border-left: 3px solid #7fd47f; }
#forge-result.forge-hint { border-left: 3px solid var(--gold); }
#forge-result.forge-cold { border-left: 3px solid var(--dim); color: var(--dim); }
#forge-picker { display: flex; flex-wrap: wrap; gap: 4px; max-height: 180px; overflow-y: auto; }
.forge-pick { position: relative; width: 44px; height: 44px; padding: 2px; }
.forge-pick img { width: 100%; height: 100%; object-fit: contain; }
.forge-pick.on { border-color: var(--gold); background: #55461f; }
.forge-pick.mat { border-color: #8a6ad4; }
.fp-qty {
  position: absolute; right: 1px; bottom: 0; font-size: 12px; color: var(--gold);
  text-shadow: 1px 1px 0 #000;
}
.recipe-card {
  display: flex; align-items: center; gap: 10px; background: var(--panel2);
  border-radius: 6px; padding: 8px; margin-top: 8px;
}
.recipe-card img { width: 40px; height: 40px; object-fit: contain; }
.rc-body { flex: 1; }
.rc-name { font-size: 17px; }
.rc-parts { font-size: 14px; }
.rc-parts .ok { color: #7fd47f; }
.rc-parts .missing { color: #e07070; }
.rumor-card { background: var(--panel2); border-radius: 6px; padding: 8px 10px; margin-top: 8px; color: var(--dim); }

/* ------------------------------------------------- v1.3.1: bank/forge cleanup */
.inv-count { color: var(--dim); font-size: 13px; letter-spacing: 0; text-transform: none; }
#forge-search {
  width: 100%; margin-bottom: 8px; padding: 6px 10px; font-size: 16px;
  background: var(--panel2); border: 1px solid var(--edge); border-radius: 6px;
}
.forge-pick {
  width: 72px; height: 72px; padding: 3px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.forge-pick img { width: 32px; height: 32px; object-fit: contain; flex: none; }
.fp-name {
  font-size: 11px; line-height: 1.1; color: var(--dim); max-width: 100%;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  text-align: center; letter-spacing: 0;
}
.forge-pick.on .fp-name { color: var(--gold); }

/* --------------------------------------------- v1.3.1: compact bank rework */
.bank-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.bank-card {
  position: relative; width: 104px; padding: 8px 4px 6px;
  background: var(--panel2); border: 1px solid var(--edge); border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer; text-align: center;
}
.bank-card:hover { border-color: var(--gold); }
.bank-card img { width: 36px; height: 36px; object-fit: contain; }
.bank-card.equipped { border-color: var(--gold); background: #4a3f22; }
.bank-card.ghost { opacity: .45; }
.bank-card.ghost img { filter: grayscale(1) brightness(.6); }
.bank-card.tagged { border-color: #c25b5b; }
.bank-card.tagged-last { border-color: #e03d3d; background: #4a2424; }
.bc-name {
  font-size: 13px; line-height: 1.15; max-width: 100%; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.bc-sub { font-size: 12px; color: var(--dim); max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bc-qty {
  position: absolute; top: 2px; right: 4px; font-size: 12px; color: var(--gold);
  text-shadow: 1px 1px 0 #000;
}
.bc-worn { position: absolute; top: 2px; left: 4px; font-size: 13px; color: var(--gold); }
.bank-card .tag-badge {
  position: absolute; top: 22px; left: 0; right: 0; font-size: 11px;
  background: #e03d3dcc; color: #fff; padding: 1px 0; letter-spacing: 1px;
}
#item-sheet .modal-box { max-width: 440px; width: min(440px, 92vw); }
#item-sheet .sheet-head img { width: 64px; height: 64px; }
.sheet-worn { color: var(--gold); font-size: 14px; }

/* -------------------------------------- v1.3.1: docked item panel (no popup) */
.equip-layout { grid-template-columns: 340px 1fr 330px; }
@media (max-width: 1200px) { .equip-layout { grid-template-columns: 280px 1fr 300px; } }
#item-panel { position: sticky; top: 14px; max-height: calc(100vh - 28px); overflow-y: auto; }
.ip-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ip-head h2 { margin-bottom: 0; }
#ip-close { padding: 2px 10px; }
.bank-card.selected { border-color: #fff; box-shadow: 0 0 0 1px #fff inset; }
#item-panel .sheet-btn { display: block; width: 100%; margin-top: 6px; }
@media (max-width: 900px) {
  /* HOTFIX v2.0.1: this appended block comes LATER in the cascade than the
   * original 900px single-column rule, so the 1200px three-column rule was
   * winning on phones and forcing ~580px of fixed columns onto a 375px
   * screen — the whole gear tab overflowed sideways. Single column must be
   * re-declared HERE, after the 1200px override. */
  .equip-layout { grid-template-columns: 1fr; }
  /* Phones: the panel is a bottom drawer that slides up on selection. */
  #item-panel {
    display: none; position: fixed; left: 8px; right: 8px;
    bottom: calc(66px + env(safe-area-inset-bottom)); top: auto;
    max-height: 60vh; overflow-y: auto; z-index: 60; margin: 0;
    box-shadow: 0 -6px 24px #000c; border: 1px solid var(--edge);
  }
  #item-panel.open { display: block; }
  /* Finger-sized close target for the drawer. */
  #ip-close { padding: 8px 16px; font-size: 18px; }
}

/* --------------------------------------------- v1.3.1: two-part forge rework */
#forge-slots { align-items: stretch; }
.forge-op { align-self: center; font-size: 26px; color: var(--dim); flex: none; padding: 0 2px; }
.forge-slot.result { border-style: solid; border-color: var(--edge); font-size: 30px; color: var(--dim); }
.forge-slot.result.known { border-color: var(--gold); color: var(--parchment); font-size: 15px; }
.forge-progress { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.fp-bar { flex: 1; height: 10px; background: #221d15; border-radius: 5px; overflow: hidden; border: 1px solid var(--edge); }
.fp-bar div { height: 100%; background: var(--gold); }
.forge-progress span { color: var(--dim); font-size: 14px; white-space: nowrap; }
.rumor-card { display: flex; align-items: center; gap: 12px; }
.rum-pair { display: flex; align-items: center; gap: 6px; flex: none; }
.rum-pair img { width: 30px; height: 30px; object-fit: contain; }
.rum-q {
  width: 30px; height: 30px; border: 1px dashed var(--dim); border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
.forge-undisc { margin-top: 10px; }

/* v1.3.1: per-type accuracy strip on the item card */
.att-strip span { margin-right: 8px; white-space: nowrap; color: var(--dim); }
.att-strip .as-best { color: var(--gold); }
.att-strip .as-zero { opacity: .4; }

/* ---------------------------------------------- v1.3.1: themed SVG icons */
.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em; fill: currentColor; }
.ic-dim { color: var(--dim); }
.bank-tabs button .ic, #forge-go .ic { margin-right: 4px; }
#mobile-tabs a .ic { width: 20px; height: 20px; display: block; margin: 0 auto 2px; }
.att-strip .ic, .style-proj + .ic { vertical-align: -0.1em; }
#train-styles button .ic { margin-right: 2px; }
.weak-tag .ic { width: 0.85em; height: 0.85em; margin-left: 2px; color: #7fd47f; }
.bc-worn .ic, .sheet-worn .ic { color: var(--gold); }
.logo .ic-logo { color: var(--gold); width: 22px; height: 22px; vertical-align: -0.2em; }
.inv-head .ic { width: 0.9em; height: 0.9em; }

/* ----------------------------------------------------------- v2.0.2 hotfix */
/* Any content wider than the screen used to widen iOS Safari's layout
 * viewport, un-anchoring position:fixed bars (mobile tab bar drifting on the
 * Shop pane et al). Clip the axis at the root so no pane can ever do that. */
html, body { overflow-x: hidden; overflow-x: clip; }
.bank-tabs { flex-wrap: wrap; }
.pot-card, .forge-slot { min-width: 0; }
.fs-name, .rc-parts, .pot-name { overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .bank-tabs button { padding: 8px 10px; font-size: 17px; }
}

/* ------------------------------------------------------- v2.2.0: chat --- */
/* The type-here strip: part of the same frame, never scrolls away. */
#chat-form {
  display: flex; gap: 6px; flex: none;
  padding: 6px; border-top: 2px solid var(--edge);
  background: #272219;
}
#chat-input {
  flex: 1; font-size: 17px; padding: 5px 9px;
  background: #1d1913; border-width: 1px;
}
#chat-send { flex: none; padding: 5px 14px; font-size: 16px; }
/* Server announcements: the rarest thing in the game, so they read like an
 * event rather than a line of talk. No name, no crown, nothing clickable. */
#chat-inner .line.announce {
  color: var(--gold);
  background: rgba(255, 152, 31, .09);
  border-left: 3px solid var(--gold);
  padding: 2px 6px;
  margin: 3px 0;
}
#chat-inner .line.said { color: var(--parchment); }
#chat-inner .line.said .who { color: #7fd0ff; }
#chat-inner .line.said.mine .who { color: var(--gold); }
#chat-inner .line.said .who.modable { cursor: pointer; text-decoration: underline dotted; }
#chat-inner .line.said .who.modable:hover { color: var(--red); }
.ui-input { margin-bottom: 10px; }

/* --------------------------------------------- v2.3.0: staff crowns --- */
/* A crown's colour is its meaning, so these two opt out of currentColor. */
.crown { display: inline-flex; margin-right: 4px; vertical-align: -0.1em; }
.crown .ic { width: 0.95em; height: 0.95em; }
.crown-admin .ic { fill: #ffd200; filter: drop-shadow(0 0 2px rgba(255,210,0,.5)); }
.crown-mod .ic { fill: #d9dde3; filter: drop-shadow(0 0 2px rgba(217,221,227,.4)); }
#chat-clear { flex: none; padding: 5px 12px; font-size: 16px; border-color: var(--red); color: #ff8b7e; }
.ui-choices { display: flex; flex-direction: column; gap: 2px; }
