/* Custom game cursor. Kept at the top and marked !important so this patch
   does not depend on the existing cursor declarations elsewhere in the file. */
html,
body,
body *,
body *::before,
body *::after {
  cursor: url('/assets/ui/pointer.gif') 0 0, auto !important;
}

:root {
  color-scheme: dark;
  --bg: #070a0c;
  --surface: #0c1114;
  --panel: #10171b;
  --panel-2: #151e23;
  --line: rgba(255,255,255,.105);
  --line-strong: rgba(255,255,255,.19);
  --text: #eef2f2;
  --muted: #849297;
  --gold: #d7a950;
  --gold-2: #f0ca75;
  --danger: #d76a64;
  --good: #67b99a;
  --teal: #73bdb5;
  --teal-dark: #376963;
  --gold-soft: #e1bd6a;
  --paper: #eef2f2;
  --font-display: "Cinzel", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #050708; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.hidden { display: none !important; }

#client-stage {
  width: 100%; height: 100%; display: grid; place-items: center; padding: 2vh 2vw;
  background:
    radial-gradient(circle at 16% 10%, rgba(105,85,46,.16), transparent 29%),
    radial-gradient(circle at 84% 86%, rgba(31,73,77,.16), transparent 31%),
    linear-gradient(135deg, #070a0b, #030506 70%);
}
.game-surface {
  position: relative;
  width: min(96vw, calc(94vh * 16 / 9));
  aspect-ratio: 16 / 9;
  max-height: 94vh;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(227,192,116,.22);
  border-radius: clamp(8px, .85vw, 18px);
  box-shadow: 0 2.2vw 7vw rgba(0,0,0,.58), inset 0 0 0 1px rgba(255,255,255,.025);
  isolation: isolate;
}
.game-surface::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 20;
  box-shadow: inset 0 0 3vw rgba(0,0,0,.42);
}
.surface-view { position: absolute; inset: 0; }

/* loader */
.loading-view {
  display: grid; place-items: center; z-index: 50;
  background:
    radial-gradient(circle at 50% 34%, rgba(203,160,73,.16), transparent 26%),
    linear-gradient(180deg, #0a0f12, #07090b);
}
.loading-center { width: 35%; min-width: 250px; text-align: center; }
.loading-logo { width: clamp(80px, 9vw, 160px); aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 1.3vw 2.4vw rgba(0,0,0,.55)); }
.loading-kicker { margin: .2em 0 0; color: var(--gold); text-transform: uppercase; letter-spacing: .28em; font-weight: 800; font-size: clamp(7px, .62vw, 12px); }
.loading-center h1 { margin: .35em 0 1.2em; font-family: Georgia, serif; font-size: clamp(20px, 2.1vw, 40px); font-weight: 500; }
.loading-track { height: clamp(5px, .45vw, 9px); overflow: hidden; border: 1px solid rgba(255,255,255,.12); background: #050708; border-radius: 999px; }
.loading-track i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #967238, #e2bd68); box-shadow: 0 0 1vw rgba(226,189,104,.48); transition: width .18s ease; }
.loading-meta { display: flex; justify-content: space-between; gap: 1em; margin-top: .7em; color: var(--muted); font-size: clamp(7px, .63vw, 12px); }
.loading-meta b { color: #d7dedd; font-variant-numeric: tabular-nums; }

/* auth / recreated homepage */
.auth-view {
  display: grid; grid-template-columns: 1.2fr .8fr;
  background:
    linear-gradient(90deg, rgba(7,10,12,.1), rgba(7,10,12,.65)),
    radial-gradient(circle at 18% 20%, rgba(113,86,45,.24), transparent 33%),
    linear-gradient(145deg, #11181c 0%, #0c1114 47%, #080b0d 100%);
}
.auth-home-copy { position: relative; padding: 6.8% 7.5%; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.auth-home-copy::after { content: ""; position: absolute; width: 58%; aspect-ratio: 1; right: -12%; bottom: -39%; border: 1px solid rgba(216,176,91,.13); border-radius: 50%; box-shadow: 0 0 0 2.4vw rgba(216,176,91,.018), 0 0 0 5vw rgba(216,176,91,.012); }
.brand-lockup { display: flex; align-items: center; gap: 1vw; margin-bottom: 7%; }
.brand-lockup img { width: 4.5vw; min-width: 42px; max-width: 78px; }
.brand-lockup div { display: flex; flex-direction: column; line-height: .95; }
.brand-lockup strong { font-family: Georgia, serif; font-size: clamp(18px, 1.65vw, 33px); letter-spacing: .02em; }
.brand-lockup span { color: var(--gold); text-transform: uppercase; font-size: clamp(8px, .72vw, 13px); font-weight: 800; letter-spacing: .35em; margin-top: .5em; }
.auth-home-copy h1 { margin: .22em 0 .25em; font-family: Georgia, serif; font-size: clamp(34px, 4.25vw, 80px); line-height: .97; font-weight: 500; letter-spacing: -.035em; }
.auth-home-copy h1 em { color: var(--gold-2); font-style: normal; }
.auth-lead { width: 78%; max-width: 760px; margin: .75em 0 0; color: #aab5b7; font-size: clamp(10px, 1vw, 18px); line-height: 1.65; }
.feature-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6vw; width: 78%; margin-top: 5.5%; }
.feature-row div { padding: 1vw 1.05vw; border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: .55vw; }
.feature-row b, .feature-row span { display: block; }
.feature-row b { color: #e7c270; font-family: Georgia, serif; font-size: clamp(14px, 1.35vw, 26px); }
.feature-row span { color: var(--muted); font-size: clamp(7px, .62vw, 11px); margin-top: .25em; }
.auth-panel { display: grid; place-items: center; padding: 9%; border-left: 1px solid var(--line); background: rgba(4,7,8,.36); backdrop-filter: blur(10px); }
.auth-card { width: 100%; max-width: 540px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: .25vw; border: 1px solid var(--line); border-radius: .55vw; background: rgba(0,0,0,.25); }
.auth-tabs button { border: 0; border-radius: .4vw; padding: .7vw .8vw; background: transparent; color: var(--muted); cursor: url('/assets/ui/hand.gif') 0 0, pointer; font-size: clamp(8px, .72vw, 13px); font-weight: 800; }
.auth-tabs button.active { color: #fff; background: #202b31; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.auth-form { margin-top: 9%; }
.form-heading span { color: #9d8353; text-transform: uppercase; letter-spacing: .14em; font-size: clamp(7px, .58vw, 11px); font-weight: 800; }
.form-heading h2 { margin: .25em 0 1.1em; font-family: Georgia, serif; font-size: clamp(20px, 1.9vw, 36px); font-weight: 500; }
.auth-form > label:not(.checkbox-label) { display: grid; gap: .45em; color: #b5c0c2; font-size: clamp(7px, .62vw, 12px); font-weight: 700; margin-bottom: 1.05em; }
.auth-form input[type="text"], .auth-form input[type="email"], .auth-form input[type="password"] {
  width: 100%; border: 1px solid var(--line); border-radius: .45vw; padding: .78vw .85vw; outline: none; background: #0b1013; color: #fff; font-size: clamp(8px, .72vw, 14px);
}
.auth-form input:focus { border-color: rgba(215,169,80,.64); box-shadow: 0 0 0 .12vw rgba(215,169,80,.09); }
.checkbox-label { display: flex; align-items: flex-start; gap: .6em; margin: .8em 0 1.15em; color: var(--muted); font-size: clamp(7px, .6vw, 11px); line-height: 1.4; }
.checkbox-label input { margin: .12em 0 0; accent-color: #c49b4c; }
.primary-button { width: 100%; margin-top: .7em; border: 1px solid #bd9140; border-radius: .45vw; padding: .78vw 1vw; cursor: url('/assets/ui/hand.gif') 0 0, pointer; background: linear-gradient(180deg,#d2aa58,#ae7f35); color: #171005; font-weight: 900; font-size: clamp(8px, .72vw, 14px); box-shadow: inset 0 1px rgba(255,255,255,.24); }
.primary-button:hover { filter: brightness(1.08); }
.primary-button:disabled { cursor: wait; opacity: .55; }
.captcha-slot { margin: .6em 0; min-height: 65px; }
.external-auth { margin-top: 1.2em; text-align: center; }
.external-auth > span { display: block; color: #657277; font-size: clamp(7px, .56vw, 10px); margin-bottom: .6em; }
.external-auth a { display: block; padding: .7vw; border: 1px solid var(--line); border-radius: .45vw; color: #dbe2e2; text-decoration: none; background: rgba(255,255,255,.035); font-size: clamp(8px, .68vw, 13px); font-weight: 700; }
.build-line { margin-top: 1.3em; text-align: center; color: #657277; font-size: clamp(6px, .55vw, 10px); }

/* in-game shell */
.app-view { display: grid; grid-template-rows: 8.5% 91.5%; background: #0a0e10; }
.game-topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 1.2%; border-bottom: 1px solid var(--line); background: linear-gradient(180deg,#11181c,#0c1215); }
.mini-brand { display: flex; align-items: center; gap: .55vw; }
.mini-brand img { width: 2.55vw; max-width: 52px; min-width: 52px; }
.mini-brand div { display: flex; flex-direction: column; line-height: .96; }
.mini-brand strong { font-family: Georgia, serif; font-size: clamp(15px, 1vw, 18px); font-weight: 600; }
.mini-brand span { color: #ad8b4d; letter-spacing: .2em; text-transform: uppercase; font-size: clamp(7px, .42vw, 8px); font-weight: 800; margin-top: .4em; }
.commander-strip { display: flex; align-items: center; gap: .55vw; }
.currency { height: 2.2vw; min-height: 25px; max-height: 42px; display: flex; align-items: center; gap: .4vw; padding: 0 .62vw; border: 1px solid var(--line); border-radius: 999px; background: #0a0f11; }
.currency img { width: 1.1vw; min-width: 13px; max-width: 21px; }
.currency b { font-size: clamp(10px, .65vw, 12px); font-variant-numeric: tabular-nums; }
button.currency { color: var(--paper); font: inherit; cursor: url('/assets/ui/hand.gif') 0 0, pointer; }
button.currency:hover, button.currency:focus-visible { border-color: #6f5a8c; background: #11131a; outline: none; }
button.soulstone-store-button { box-shadow: inset 0 0 0 1px rgba(197,154,255,.04); }
.commander-button { height: 2.35vw; min-height: 27px; max-height: 45px; display: flex; align-items: center; gap: .45vw; padding: 0 .7vw 0 .25vw; border: 1px solid var(--line); border-radius: 999px; background: #11181b; cursor: url('/assets/ui/pointer.gif') 0 0, default; }
.commander-button > span { width: 1.75vw; min-width: 21px; max-width: 34px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: #27353b; color: #e6c06d; font-family: Georgia,serif; font-size: clamp(8px, .75vw, 14px); }
.commander-button b { font-size: clamp(10px, .65vw, 12px); }
.game-layout { min-height: 0; display: grid; grid-template-columns: 10% 90%; }
.game-menu { min-width: 0; display: flex; flex-direction: column; padding: 0; border-right: 1px solid var(--line); background: linear-gradient(180deg,#0f1518,#0a0e10); }
.menu-heading { padding: .25vw .5vw .9vw; border-bottom: 1px solid var(--line); margin-bottom: .7vw; }
.menu-heading small, .menu-heading strong { display: block; }
.menu-heading small { color: #7c898d; text-transform: uppercase; font-size: clamp(5px, .47vw, 9px); letter-spacing: .14em; }
.menu-heading strong { margin-top: .2em; font-family: Georgia,serif; font-size: clamp(10px, 1vw, 19px); font-weight: 500; }
.game-menu nav { display: grid; gap: .25vw; }
.menu-entry, .menu-utility { width: 100%; border: 1px solid transparent; border-radius: .43vw; background: transparent; color: #91a0a4; }
.menu-entry { display: grid; grid-template-columns: 1.35vw 1fr auto; align-items: center; gap: .55vw; padding: .67vw .65vw; text-align: left; font-size: clamp(10px, .66vw, 13px); }
.menu-entry > span { color: #75868a; text-align: center; font-size: 1.06em; }
.menu-entry b { font-weight: 700; }
.menu-entry i { min-width: 1.4em; text-align: center; color: #6f7c7f; font-size: .82em; font-style: normal; }
.menu-entry.active { color: #f3f4ef; border-color: rgba(217,173,82,.24); background: linear-gradient(90deg,rgba(206,160,68,.16),rgba(206,160,68,.045)); }
.menu-entry.active > span, .menu-entry.active i { color: #ddb65f; }
.menu-entry:disabled { opacity: .42; cursor: not-allowed; }
.menu-spacer { flex: 1; }
.menu-utility { display: flex; gap: .6vw; align-items: center; padding: .55vw .65vw; cursor: url('/assets/ui/hand.gif') 0 0, pointer; text-align: left; font-size: clamp(6px, .58vw, 11px); }
.menu-utility:hover { color: #fff; background: rgba(255,255,255,.04); }
.menu-utility.danger:hover { color: #ef9892; background: rgba(215,106,100,.06); }
.menu-version { padding: .6vw .65vw 0; color: #4f5b5f; font-size: clamp(5px, .45vw, 8px); }
.menu-fullscreen { margin-top: .25vw; border-top-color: rgba(255,255,255,.07); border-radius: 0; font-size: clamp(9px, .58vw, 11px); }
.menu-fullscreen span { width: 1.35vw; min-width: 14px; color: #75868a; text-align: center; font-size: 1.15em; }
.menu-fullscreen b { font-weight: 700; }
.menu-fullscreen.on { color: #f1d58f; background: rgba(206,160,68,.07); }
.menu-fullscreen.on span { color: #ddb65f; }

.content-view { min-width: 0; min-height: 0; position: relative; overflow: hidden; background: radial-gradient(circle at 95% 0%,rgba(52,75,77,.11),transparent 35%), #0b1012; }
.route-panel { width: 100%; height: 100%; min-width: 0; min-height: 0; }
.army-route { display: grid; grid-template-rows: auto auto minmax(0,1fr); padding: 1.2vw 1.35vw 1.15vw; }
.route-scroll { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: #3d494d transparent; }
.route-page { min-height: 100%; padding: 1.2vw 1.35vw 1.5vw; }
.army-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 1vw; padding-bottom: .9vw; border-bottom: 1px solid var(--line); }
.army-toolbar h1 { margin: .08em 0; font-family: Georgia,serif; font-size: clamp(22px, 2.2vw, 42px); font-weight: 500; }
.army-toolbar p { margin: 0; color: var(--muted); font-size: clamp(7px, .61vw, 12px); }
.toolbar-actions { display: flex; gap: .55vw; align-items: center; }
.search-control { height: 2.1vw; min-height: 25px; max-height: 40px; display: flex; align-items: center; gap: .35vw; width: 12vw; min-width: 130px; padding: 0 .6vw; border: 1px solid var(--line); border-radius: .42vw; background: #090d0f; }
.search-control span { color: #7c898d; }
.search-control input { min-width: 0; width: 100%; border: 0; outline: none; background: transparent; color: #e6ecec; font-size: clamp(7px, .59vw, 11px); }
.sort-control { height: 2.1vw; min-height: 25px; max-height: 40px; display: flex; align-items: center; gap: .45vw; padding: 0 .55vw; border: 1px solid var(--line); border-radius: .42vw; background: #090d0f; color: #7f8c90; font-size: clamp(6px, .55vw, 10px); }
.sort-control select { border: 0; outline: none; background: #090d0f; color: #dce2e2; font-size: clamp(7px, .59vw, 11px); }
.army-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .55vw;
  margin: .65vw 0 .75vw;
}
.stat-box {
  min-width: 0;
  border: 1px solid #2d3b41;
  background: #11191d;
  padding: .62vw .72vw;
  display: flex;
  align-items: center;
  gap: .55vw;
}
.stat-box .stat-icon {
  width: 2.05vw;
  min-width: 24px;
  max-width: 38px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #1d2b2f;
  color: var(--teal);
  font-size: clamp(10px, 1vw, 19px);
}
.stat-box b {
  display: block;
  overflow: hidden;
  color: var(--paper);
  font: 700 clamp(8px, .82vw, 15px) var(--font-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stat-box small {
  display: block;
  overflow: hidden;
  margin-top: .12em;
  color: var(--muted);
  font-size: clamp(5px, .43vw, 8px);
  text-transform: uppercase;
  letter-spacing: .06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stat-box.lone-tower-home-level .stat-icon,
.stat-box.lone-tower-home-level b { color: var(--gold-soft); }

.army-content { min-height: 0; display: grid; grid-template-columns: minmax(0,1fr); position: relative; overflow: hidden; }
.hero-grid {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 .25vw .6vw 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: max-content;
  gap: .62vw;
  align-content: start;
  align-items: start;
  scrollbar-width: thin;
  scrollbar-color: #3d494d transparent;
}
.hero-card {
  border: 1px solid #2e3b41;
  background: #121a1e;
  overflow: hidden;
  position: relative;
  height: max-content;
  min-height: max-content;
  align-self: start;
  transition: .18s;
}
.hero-card:hover {
  border-color: #527078;
  transform: translateY(-2px);
}
.hero-portrait {
  height: 210px;
  background: #1b272c;
  position: relative;
  overflow: hidden;
}
.hero-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.78) contrast(1.05);
}
.hero-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 45%, #121a1e);
}
.class-chip {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 2;
  color: #fff;
  background: color-mix(in srgb, var(--element-color, #718085) 78%, #071012);
  border: 1px solid var(--element-color, #718085);
  box-shadow: 0 3px 12px rgba(0,0,0,.38);
  padding: 5px 8px;
  text-transform: uppercase;
  font-size: .56rem;
  letter-spacing: .1em;
  font-weight: 800;
}
.hero-card-body { padding: 11px; }
.hero-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.hero-name-row h3 {
  min-width: 0;
  overflow: hidden;
  margin: 0;
  font: 700 1rem var(--font-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.power {
  color: var(--gold-soft);
  font-size: .7rem;
  font-weight: 800;
  white-space: nowrap;
}
.mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 8px 0;
}
.mini-stat {
  background: #0c1215;
  border: 1px solid #263238;
  padding: 6px;
  display: flex;
  justify-content: space-between;
  gap: 5px;
  font-size: .7rem;
  color: var(--muted);
}
.mini-stat b { color: var(--paper); }
.level-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 7px 0 3px;
}
.level-line b {
  font: 700 .68rem var(--font-display);
  color: var(--gold-soft);
  white-space: nowrap;
}
.xp-track {
  height: 5px;
  flex: 1;
  background: #273238;
  overflow: hidden;
}
.xp-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal-dark), var(--teal));
}
.xp-label {
  color: var(--muted);
  font-size: .54rem;
  white-space: nowrap;
}
.xp-stat-allocation {
  flex: 0 0 auto;
  min-width: 28px;
  min-height: 12px;
  height: 12px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid #866d39;
  border-radius: 3px;
  background: #40351f;
  color: var(--gold-soft);
  cursor: url('/assets/ui/hand.gif') 0 0, pointer;
}
.xp-stat-allocation b { font-size: .62rem; line-height: 10px; }
.xp-stat-allocation small { font-size: .45rem; line-height: 10px; font-weight: 900; }
.xp-stat-allocation:hover { border-color: var(--gold-soft); filter: brightness(1.12); }
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  margin: 6px 0;
}
.stat-chip {
  text-align: center;
  background: #0b1114;
  border: 1px solid #27343a;
  padding: 3px 2px;
}
.stat-chip b {
  display: block;
  color: var(--paper);
  font-size: .65rem;
}
.stat-chip small {
  color: var(--muted);
  font-size: .48rem;
}
.skill-pips {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  align-items: stretch;
  min-height: 42px;
}
.skill-pip {
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid #35454b;
  background: #1b292e;
  display: grid;
  place-items: center;
  color: var(--teal);
  cursor: help;
}
.skill-pip.passive {
  color: var(--gold-soft);
  border-color: #655735;
}
.skill-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px dashed #35454b;
  color: var(--muted);
  font-size: .58rem;
}
.skill-image {
  display: block;
  width: min(100%, 42px);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  image-rendering: auto;
}
.empty-army { grid-column: 1/-1; margin: 4vw auto; max-width: 28vw; text-align: center; color: var(--muted); }
.empty-army strong { display: block; color: #dce2e2; font-family: Georgia,serif; font-size: clamp(15px, 1.4vw, 26px); margin-bottom: .35em; }
.empty-army span { font-size: clamp(7px, .6vw, 11px); line-height: 1.5; }


/* Quests + Tavern: ported from the original client and fitted inside the 16:9 surface. */
.page-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:1vw; margin-bottom:1.15vw; }
.page-heading h1 { margin:.08em 0; font:500 clamp(22px,2.2vw,42px) var(--font-display); letter-spacing:-.02em; }
.page-heading p { margin:0; max-width:42vw; color:var(--muted); font-size:clamp(7px,.61vw,12px); line-height:1.45; }
.route-loading, .route-error { min-height:100%; display:grid; place-items:center; align-content:center; gap:.65vw; color:var(--muted); text-align:center; font-size:clamp(8px,.68vw,13px); }
.route-error b { color:var(--paper); font:700 clamp(15px,1.2vw,23px) var(--font-display); }
.route-error span { max-width:34vw; }
.route-error button { margin-top:.4vw; }
.currency-inline { display:inline-flex; align-items:center; gap:.28em; white-space:nowrap; }
.currency-inline img { width:8px; height:8px; object-fit:contain; }
.currency-inline b { color:inherit; font:inherit; }
.currency-inline small { display:none; }
.secondary { min-height:34px; padding:7px 12px; border:1px solid #526168; background:#172126; color:#dce4e4; cursor: url('/assets/ui/hand.gif') 0 0, pointer; font-size:.68rem; font-weight:800; }
.secondary:hover:not(:disabled) { border-color:#71858d; filter:brightness(1.1); }
.secondary:disabled { opacity:.4; cursor:not-allowed; }
.button-row { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-top:12px; }
.modal-copy { margin:.3em 0 .9em; color:var(--muted); line-height:1.5; }
.modal-button-row { justify-content:flex-end; }
.confirm-cost { display:inline-flex; padding:8px 10px; border:1px solid rgba(207,170,94,.3); background:rgba(207,170,94,.08); color:var(--gold-soft); }

/* Council / Quests */
.council-shell { display:grid; gap:1.1vw; }
.council-section { display:grid; gap:.7vw; }
.council-section-head { display:flex; align-items:flex-end; justify-content:space-between; gap:1vw; }
.council-section-head h2 { margin:.15vw 0 .2vw; font:700 clamp(13px,1.05vw,20px) var(--font-display); }
.council-section-head p { margin:0; color:var(--muted); max-width:48vw; font-size:clamp(6px,.54vw,10px); line-height:1.45; }
.council-section-head > strong { color:var(--gold-soft); font:700 clamp(9px,.8vw,15px) var(--font-display); }
.company-path-track { height:7px; border:1px solid rgba(199,164,92,.25); background:#10171a; overflow:hidden; }
.company-path-track i { display:block; height:100%; background:linear-gradient(90deg,#7d5e2e,#d2ae63); }
.company-path-steps { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.42vw; }
.company-step { min-height:64px; display:grid; grid-template-columns:auto 1fr auto; gap:.42vw; align-items:start; border:1px solid rgba(255,255,255,.08); background:rgba(11,17,20,.78); padding:.5vw; }
.company-step.current { border-color:rgba(207,170,94,.65); box-shadow:inset 0 0 0 1px rgba(207,170,94,.12); }
.company-step.claimed { opacity:.72; border-color:rgba(95,166,127,.35); }
.company-step-number { color:var(--gold-soft); font:800 clamp(6px,.5vw,9px) var(--font-display); }
.company-step b,.company-step small { display:block; }
.company-step b { font-size:clamp(7px,.58vw,11px); }
.company-step small { margin-top:.15vw; color:var(--muted); font-size:clamp(5px,.46vw,9px); line-height:1.35; }
.company-step-state { color:var(--muted); font-size:clamp(5px,.43vw,8px); text-transform:uppercase; letter-spacing:.08em; white-space:nowrap; }
.company-step.current .company-step-state { color:var(--gold-soft); }
.company-step.available .company-step-state { color:var(--teal); }
.company-step-current-actions { display:flex; flex-direction:column; align-items:flex-end; gap:.32vw; min-width:0; }
.company-step-rewards { margin-top:.32vw !important; }
.company-path-claim { min-height:26px; padding:4px 6px; white-space:nowrap; font-size:clamp(5px,.44vw,8px); }
.company-path-claim:disabled { background:#343a3d !important; border-color:#535b5f !important; color:#92999c !important; box-shadow:none !important; opacity:1; cursor:not-allowed; }
.council-featured-card,.council-order-card { position:relative; border:1px solid rgba(207,170,94,.26); background:linear-gradient(145deg,rgba(31,39,41,.95),rgba(14,20,23,.95)); padding:.8vw; }
.council-featured-card.imperial { border-color:rgba(155,103,191,.45); }
.council-featured-card h3,.council-order-card h3 { margin:.2vw 0 .32vw; font:700 clamp(9px,.76vw,14px) var(--font-display); }
.council-featured-card p,.council-order-card p { margin:0 0 .55vw; color:var(--muted); font-size:clamp(6px,.5vw,9px); line-height:1.45; }
.council-card-foot { display:flex; justify-content:space-between; align-items:center; gap:.7vw; margin-top:.7vw; }
.council-order-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.6vw; }
.council-order-card.complete { border-color:rgba(95,166,127,.55); }
.council-order-card.claimed { opacity:.68; }
.council-order-seal { position:absolute; top:.5vw; right:.6vw; color:var(--gold-soft); opacity:.75; }
.council-rewards { display:flex; gap:.35vw; flex-wrap:wrap; margin:.48vw 0 0; }
.council-rewards > span { display:inline-flex; align-items:center; gap:.22vw; padding:.28vw .42vw; border:1px solid rgba(207,170,94,.22); background:rgba(0,0,0,.18); color:var(--paper); font-size:clamp(5px,.48vw,9px); }
.council-reward-item { text-transform:capitalize; }
.council-complete-banner { padding:.7vw; border:1px solid rgba(95,166,127,.4); background:rgba(47,96,69,.16); display:flex; gap:.5vw; align-items:center; font-size:clamp(6px,.52vw,10px); }
.council-complete-banner span { color:var(--muted); }
.quest-progress { margin:.55vw 0 .45vw; }
.quest-progress > div:first-child { display:flex; justify-content:space-between; gap:.6vw; color:var(--paper); font-size:clamp(6px,.5vw,9px); }
.quest-progress > div:first-child span { color:var(--teal); }
.quest-progress-track { height:7px; margin-top:.3vw; overflow:hidden; border:1px solid #334247; background:#080d0f; }
.quest-progress-track i { display:block; height:100%; background:linear-gradient(90deg,#397b75,#72cabf); box-shadow:0 0 14px rgba(94,194,183,.35); }

/* Tavern */
.tavern-stage { border:1px solid #40392e; background:radial-gradient(circle at 50% -10%,rgba(216,166,77,.13),transparent 45%),#13191b; padding:1vw; }
.tavern-intro { display:flex; justify-content:space-between; gap:1vw; align-items:center; margin-bottom:.8vw; padding-bottom:.75vw; border-bottom:1px solid #38342b; }
.tavern-intro h2 { margin:0 0 .18vw; font:700 clamp(12px,.95vw,18px) var(--font-display); }
.tavern-intro p { margin:0; color:var(--muted); font-size:clamp(6px,.5vw,9px); }
.tavern-reroll-actions { display:flex; gap:.4vw; flex-wrap:wrap; justify-content:flex-end; }
.candidate-reveal { position:relative; min-height:250px; }
.candidate-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:.55vw; }
.candidate-card { position:relative; overflow:hidden; border:1px solid #354147; background:#11181c; }
.candidate-card:hover { border-color:var(--gold); }
.candidate-card .hero-portrait { height:clamp(154px,11vw,210px); }
.candidate-card .hero-card-body { padding:.58vw; }
.candidate-card .hero-name-row h3 { font-size:clamp(7px,.7vw,13px); }
.candidate-card .mini-stat { padding:.3vw; font-size:clamp(5px,.47vw,9px); }
.candidate-card .level-line { gap:.3vw; }
.candidate-card .primary { width:100%; min-height:31px; margin-top:.55vw; padding:.4vw; font-size:clamp(5px,.5vw,9px); }
.probability-note { margin-top:.7vw; color:#738085; font-size:clamp(5px,.49vw,9px); text-align:center; }
.candidate-tip-popover { position:absolute; z-index:12; left:.45vw; right:.45vw; top:.45vw; display:grid; gap:.2vw; padding:.5vw .55vw; border:1px solid #8a733d; border-radius:4px; background:rgba(9,14,16,.96); color:var(--paper); box-shadow:0 10px 28px rgba(0,0,0,.55); opacity:0; visibility:hidden; transform:translateY(-4px); transition:opacity .14s ease,transform .14s ease,visibility .14s ease; pointer-events:none; }
.candidate-tip-popover b { color:var(--gold-soft); font-size:clamp(5px,.46vw,9px); text-transform:uppercase; letter-spacing:.09em; }
.candidate-tip-popover span { font-size:clamp(5px,.52vw,10px); line-height:1.4; }
.candidate-card:hover .candidate-tip-popover,.candidate-card:focus-visible .candidate-tip-popover { opacity:1; visibility:visible; transform:translateY(0); }

/* Recruitment contract modal */
.recruitment-contract-modal { width:min(760px,94%); max-width:760px; max-height:88%; overflow-y:auto; }
.recruitment-contract-head { display:grid; grid-template-columns:120px minmax(0,1fr); gap:14px; align-items:stretch; margin:8px 0 12px; }
.recruitment-contract-head > img { width:120px; aspect-ratio:1; object-fit:cover; border:1px solid #44545a; background:#0b1114; }
.recruitment-contract-identity { min-width:0; display:flex; flex-direction:column; }
.recruitment-contract-head h2 { margin:2px 0 5px; }
.recruitment-contract-head p { margin:0; color:var(--muted); font-size:.66rem; }
.recruitment-lore-tip { margin-top:auto; padding:8px 10px; border-left:3px solid #8a733d; background:#11191c; }
.recruitment-lore-tip b { display:block; margin-bottom:3px; color:var(--gold-soft); font-size:.54rem; letter-spacing:.09em; text-transform:uppercase; }
.recruitment-lore-tip p { color:#c6d0d1; font-size:.62rem; line-height:1.4; }
.recruitment-contract-section { margin:9px 0 0; padding:9px; border:1px solid #2f3d42; background:#0b1215; }
.recruitment-contract-section > .eyebrow { display:block; margin-bottom:6px; }
.recruitment-stats { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:5px; }
.recruitment-stat-box { min-width:0; display:grid; grid-template-columns:1fr auto; align-items:center; gap:6px; padding:6px 7px; border:1px solid #344248; background:#10181b; }
.recruitment-stat-box small { overflow:hidden; color:var(--muted); font-size:.5rem; letter-spacing:.07em; text-overflow:ellipsis; text-transform:uppercase; white-space:nowrap; }
.recruitment-stat-box b { color:var(--gold-soft); font-size:.7rem; }
.recruitment-skills { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:5px; }
.recruitment-skill { min-width:0; display:flex; align-items:center; gap:5px; border:1px solid #344248; background:#0d1417; padding:5px; }
.recruitment-skill img { width:30px; height:30px; object-fit:cover; flex:0 0 30px; }
.recruitment-skill span { min-width:0; }
.recruitment-skill b,.recruitment-skill small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.recruitment-skill b { font-size:.52rem; }
.recruitment-skill small { margin-top:2px; color:var(--muted); font-size:.44rem; text-transform:uppercase; }
.recruitment-contract-actions { position:sticky; bottom:-1px; z-index:2; display:flex; justify-content:space-between; gap:10px; margin-top:12px; padding-top:8px; background:linear-gradient(transparent,#10171a 18%); }
.recruitment-contract-actions button { min-width:120px; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 1.2vw;
  background: rgba(3, 6, 7, .82);
  backdrop-filter: blur(5px);
}
.modal {
  position: relative;
  width: min(560px, 92%);
  max-height: 88%;
  overflow: auto;
  padding: clamp(16px, 1.45vw, 28px);
  border: 1px solid #3d4b51;
  background: #121a1e;
  box-shadow: 0 1.3vw 4vw rgba(0,0,0,.55);
}
.modal h2 { margin: .2em 0 .45em; font-family: var(--font-display); font-size: clamp(18px, 1.6vw, 30px); }
.modal-close {
  position: absolute;
  right: 14px;
  top: 13px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.3rem;
  cursor: url('/assets/ui/hand.gif') 0 0, pointer;
}
.stat-allocation-modal { max-width: 520px; }
.stat-allocation-compact-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 8px;
  padding: 7px 9px;
  border: 1px solid #344248;
  background: #0c1316;
}
.stat-allocation-compact-summary b { color: var(--gold-soft); font: 800 .9rem var(--font-display); }
.stat-allocation-compact-summary small { color: var(--muted); font-size: .58rem; }
.stat-allocation-bars { display: grid; gap: 5px; }
.stat-allocation-row {
  display: grid;
  grid-template-columns: minmax(76px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 5px 7px;
  border: 1px solid #2b393f;
  background: #0c1316;
}
.stat-allocation-name { min-width: 0; display: grid; gap: 2px; }
.stat-allocation-name b { font-size: .72rem; letter-spacing: .02em; }
.stat-allocation-name small { color: var(--muted); font-size: .55rem; line-height: 1.25; }
.stat-allocation-value {
  display: grid;
  grid-template-columns: 28px 12px 28px;
  align-items: center;
  justify-items: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.stat-allocation-value i { font-style: normal; transition: opacity .12s ease; }
.stat-allocation-value strong { color: var(--gold-soft); }
.stat-allocation-controls,
.stat-allocation-actions { display: flex; align-items: center; }
.stat-allocation-controls { justify-content: flex-end; gap: 4px; }
.stat-allocation-controls span {
  width: 30px;
  text-align: center;
  color: var(--muted);
  font-size: .65rem;
  font-variant-numeric: tabular-nums;
}
.stat-allocation-controls button {
  width: 30px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--teal-dark);
  background: #102725;
  color: var(--teal);
  font-weight: 900;
  cursor: url('/assets/ui/hand.gif') 0 0, pointer;
  box-shadow: inset 0 0 0 1px rgba(90,176,167,.08);
}
.stat-allocation-controls button:hover:not(:disabled) { border-color: var(--teal); background: #163431; color: #d9fffa; }
.stat-allocation-controls button:disabled { opacity: .35; color: var(--teal-dark); cursor: not-allowed; }
.stat-allocation-actions { justify-content: flex-end; gap: 8px; margin-top: 9px; }
.primary, .ghost {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #3d4b51;
  background: #111b1f;
  color: var(--paper);
  cursor: url('/assets/ui/hand.gif') 0 0, pointer;
  font-size: .68rem;
  font-weight: 800;
}
.primary { border-color: #866d39; background: #40351f; color: var(--gold-soft); }
.primary:hover:not(:disabled), .ghost:hover:not(:disabled) { filter: brightness(1.12); }
.primary:disabled { opacity: .4; cursor: not-allowed; }

.toast-root { position: absolute; z-index: 90; right: 1.2vw; bottom: 1.1vw; display: grid; gap: .45vw; width: min(28vw, 420px); pointer-events: none; }
.toast { padding: .65vw .8vw; border: 1px solid var(--line-strong); border-radius: .45vw; background: rgba(17,24,28,.96); box-shadow: 0 .8vw 2vw rgba(0,0,0,.32); color: #dce4e4; font-size: clamp(7px,.6vw,11px); line-height: 1.4; animation: toast-in .16s ease-out; }
.toast.error { border-color: rgba(215,106,100,.4); }
.toast.success { border-color: rgba(103,185,154,.42); }
@keyframes toast-in { from { opacity: 0; transform: translateY(.35vw); } }

.mobile-experience-gate {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(5,8,10,.965);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.mobile-experience-gate[hidden],
.mobile-experience-card[hidden] { display: none !important; }
.mobile-experience-card {
  width: min(430px, 92vw);
  padding: 24px;
  border: 1px solid rgba(215,169,80,.34);
  background: linear-gradient(155deg, rgba(20,29,33,.98), rgba(8,13,16,.98));
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
  text-align: center;
}
.mobile-experience-card .eyebrow { margin: 8px 0 3px; color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.mobile-experience-card h2 { margin: 0 0 8px; font: 700 22px/1.15 var(--font-display); }
.mobile-experience-card > p:not(.eyebrow) { margin: 0 auto; max-width: 34em; color: #aab6b9; font-size: 13px; line-height: 1.5; }
.mobile-experience-card > small { display: block; margin-top: 11px; color: #77868b; font-size: 10px; line-height: 1.45; }
.mobile-orientation-icon { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 76px; min-height: 48px; color: var(--gold-soft); font-size: 34px; line-height: 1; }
.mobile-orientation-icon span { font-size: 23px; }
.mobile-orientation-icon.fullscreen { font-size: 38px; }
.mobile-experience-actions { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.mobile-experience-actions button { min-height: 38px; }

@media (max-width: 850px), (pointer: coarse) {
  #client-stage {
    --mobile-top-clearance: max(16px, env(safe-area-inset-top));
    --mobile-bottom-clearance: max(4px, env(safe-area-inset-bottom));
    height: 100dvh;
    height: 100svh;
    min-height: 100dvh;
    min-height: 100svh;
    place-items: start center;
    padding: var(--mobile-top-clearance) env(safe-area-inset-right) var(--mobile-bottom-clearance) env(safe-area-inset-left);
  }
  .game-surface {
    width: min(100%, calc((100dvh - var(--mobile-top-clearance) - var(--mobile-bottom-clearance)) * 16 / 9));
    width: min(100%, calc((100svh - var(--mobile-top-clearance) - var(--mobile-bottom-clearance)) * 16 / 9));
    max-width: 100%;
    max-height: calc(100dvh - var(--mobile-top-clearance) - var(--mobile-bottom-clearance));
    max-height: calc(100svh - var(--mobile-top-clearance) - var(--mobile-bottom-clearance));
    border: 0;
    border-radius: 0;
  }
  .game-menu { padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* client2 v5: denser hero stats + recruitment range */
.stat-chip { display:grid; align-content:center; gap:0; padding:2px 2px; }
.stat-chip b { line-height:.82; }
.stat-chip small { display:block; line-height:.82; margin-top:1px; }
.recruitment-contract-meta { display:grid; gap:8px; }
.recruitment-range-visuals { display:flex; gap:10px; align-items:start; }
.recruitment-range-visual { display:grid; grid-template-columns:auto 50px; gap:6px; align-items:center; }
.recruitment-range-visual > small { color:var(--muted); font-size:.48rem; text-transform:uppercase; letter-spacing:.08em; }
.recruitment-range-grid { width:50px; aspect-ratio:1; display:grid; grid-template-columns:repeat(7,1fr); gap:1px; }
.recruitment-range-cell { display:block; background:#1a2428; border:1px solid #2d3a3e; }
.recruitment-range-cell.active { background:#1f5a54; border-color:#4e958c; }
.recruitment-range-visual.attack .recruitment-range-cell.active { background:#633936; border-color:#a25c55; }
.recruitment-range-cell.origin { background:#b28e47 !important; border-color:#e1bd6a !important; }

/* shared route controls */
.capacity-pill { display:flex; align-items:center; min-height:30px; padding:5px 10px; border:1px solid #405057; background:#11191d; color:#bdc6c8; font-size:.62rem; font-weight:800; white-space:nowrap; }
.capacity-pill.full { border-color:#7f4a47; color:#e59089; }
.section-heading { display:flex; align-items:end; justify-content:space-between; gap:12px; margin-bottom:9px; }
.section-heading h2 { margin:2px 0 0; font:700 clamp(13px,1vw,19px) var(--font-display); }
.section-heading > small { color:var(--muted); font-size:.55rem; }
.secondary,.danger-button { min-height:34px; padding:7px 12px; cursor: url('/assets/ui/hand.gif') 0 0, pointer; font-size:.68rem; font-weight:800; }
.secondary { border:1px solid #526168; background:#172126; color:#dce4e4; }
.secondary:hover:not(:disabled) { border-color:#71858d; filter:brightness(1.1); }
.secondary:disabled { opacity:.4; cursor:not-allowed; }
.danger-button { border:1px solid #704542; background:#2a1717; color:#e79993; }
.danger-button:hover:not(:disabled) { border-color:#a96059; background:#3a1d1c; }
.modal-copy { color:var(--muted); line-height:1.55; font-size:.68rem; }
.modal-button-row { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:7px; margin-top:13px; }
.modal-form { display:grid; gap:10px; margin-top:12px; }
.modal-form label,.workshop-card label,.atrium-card label { display:grid; gap:4px; color:#aab7ba; font-size:.58rem; font-weight:700; }
.modal-form input,.workshop-card select,.atrium-card select,.market-controls input,.market-controls select { min-width:0; border:1px solid #39484e; background:#0a1013; color:var(--paper); padding:7px 8px; outline:none; }

/* Armory */
.armory-picker { margin-bottom:10px; padding:9px; border:1px solid #2d393e; background:#0f1619; }
.armory-hero-picker { display:flex; gap:6px; overflow-x:auto; padding-top:6px; scrollbar-width:thin; }
.armory-hero-token { flex:0 0 150px; min-width:0; display:flex; align-items:center; gap:7px; padding:5px; border:1px solid #354248; background:#11191c; color:var(--paper); text-align:left; cursor: url('/assets/ui/hand.gif') 0 0, pointer; }
.armory-hero-token.selected { border-color:#987b40; box-shadow:inset 0 0 0 1px rgba(224,185,101,.18); background:#1c1c18; }
.armory-hero-token img { width:36px; height:36px; object-fit:cover; border:1px solid #3c4b51; }
.armory-hero-token span { min-width:0; }
.armory-hero-token b,.armory-hero-token small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.armory-hero-token b { font-size:.63rem; }
.armory-hero-token small { margin-top:2px; color:var(--muted); font-size:.48rem; }
.armory-workspace { display:grid; grid-template-columns:minmax(280px,36%) minmax(0,64%); gap:10px; align-items:start; }
.armory-selected-hero,.armory-inventory { min-width:0; border:1px solid #313f44; background:#10171a; padding:10px; }
.armory-selected-head { display:grid; grid-template-columns:82px minmax(0,1fr); gap:9px; align-items:center; margin-bottom:9px; }
.armory-selected-head img { width:82px; aspect-ratio:1; object-fit:cover; border:1px solid #405057; }
.armory-selected-head h2 { margin:2px 0; font:700 1rem var(--font-display); }
.armory-selected-head p { margin:0; color:var(--muted); font-size:.56rem; }
.equipment-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px; }
.equipment-slot { min-width:0; min-height:70px; display:grid; grid-template-columns:34px minmax(0,1fr); grid-template-rows:auto auto 1fr; column-gap:6px; align-items:center; padding:6px; border:1px solid #35444a; background:#0c1316; color:var(--paper); text-align:left; }
.equipment-slot:not(:disabled) { cursor: url('/assets/ui/hand.gif') 0 0, pointer; }
.equipment-slot > small { grid-column:1/-1; color:#849397; font-size:.47rem; text-transform:uppercase; letter-spacing:.08em; }
.equipment-slot > span { grid-row:2/4; width:32px; height:32px; display:grid; place-items:center; }
.equipment-slot > b { overflow:hidden; font-size:.56rem; text-overflow:ellipsis; white-space:nowrap; }
.equipment-slot > em { overflow:hidden; color:var(--muted); font-size:.43rem; font-style:normal; text-overflow:ellipsis; white-space:nowrap; }
.equipment-slot.empty { opacity:.58; }
.equipment-empty-icon { color:#506064; font-size:1.1rem; }
.inventory-card-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; max-height:52vh; overflow-y:auto; padding-right:2px; scrollbar-width:thin; }
.inventory-item-card { position:relative; min-width:0; min-height:64px; display:grid; grid-template-columns:38px minmax(0,1fr); align-items:center; gap:6px; padding:6px; border:1px solid #344248; background:#0c1316; color:var(--paper); text-align:left; cursor: url('/assets/ui/hand.gif') 0 0, pointer; }
.inventory-item-card:hover,.inventory-item-card.selected { border-color:#8d7440; background:#171916; }
.inventory-item-card.market-listed { opacity:.72; }
.inventory-item-card > i { position:absolute; right:4px; top:4px; padding:2px 4px; background:#563a1d; color:#e9c26b; font-size:.4rem; font-style:normal; }
.inventory-item-icon { width:36px; height:36px; display:grid; place-items:center; }
.inventory-item-copy { min-width:0; }
.inventory-item-copy b,.inventory-item-copy small,.inventory-item-copy em { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.inventory-item-copy b { font-size:.56rem; }
.inventory-item-copy small { margin-top:2px; color:#879397; font-size:.44rem; }
.inventory-item-copy em { margin-top:3px; color:#b4c0c1; font-size:.41rem; font-style:normal; }
.item-sprite { width:32px; height:32px; display:inline-block; background-image:var(--item-sheet); background-position:var(--item-x) var(--item-y); background-repeat:no-repeat; image-rendering:pixelated; }
.loot-gold-icon-image { width:30px; height:30px; object-fit:contain; }
.tool-item-icon { font-size:1.2rem; }
.item-detail-head { display:grid; grid-template-columns:54px minmax(0,1fr); gap:10px; align-items:center; margin:8px 0 12px; }
.item-detail-head > span { width:54px; height:54px; display:grid; place-items:center; border:1px solid #3c4a50; background:#0b1114; }
.item-detail-head h2 { margin:0 0 3px; }
.item-detail-head p { margin:0; color:var(--muted); font-size:.58rem; }
.item-detail-effects { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px; }
.item-detail-effects span { padding:6px; border:1px solid #304047; background:#0b1215; color:#c7d0d1; font-size:.56rem; }
.market-listed-note { color:#d0a558; font-size:.61rem; }

/* Market */
.market-tabs { display:flex; align-items:center; gap:5px; margin-bottom:7px; }
.market-tabs > button:not(.secondary) { min-height:32px; padding:6px 12px; border:1px solid #3c494e; background:#11191c; color:#9ca9ac; cursor: url('/assets/ui/hand.gif') 0 0, pointer; font-size:.61rem; font-weight:800; }
.market-tabs > button.active { border-color:#8b713a; color:var(--gold-soft); background:#282217; }
.market-tabs .secondary { margin-left:auto; }
.market-controls { display:grid; grid-template-columns:minmax(180px,1fr) 135px auto; align-items:end; gap:6px; margin-bottom:8px; padding:7px; border:1px solid #2e3b40; background:#0d1417; }
.market-controls label { display:grid; gap:3px; color:var(--muted); font-size:.49rem; font-weight:700; }
.market-controls > span { align-self:center; color:var(--muted); font-size:.52rem; text-align:right; }
.market-table-wrap { overflow:auto; border:1px solid #344248; }
.market-table,.leaderboard-table { width:100%; border-collapse:collapse; font-size:.57rem; }
.market-table th,.market-table td,.leaderboard-table th,.leaderboard-table td { padding:7px; border-bottom:1px solid #29363b; text-align:left; vertical-align:middle; }
.market-table th,.leaderboard-table th { position:sticky; top:0; z-index:1; background:#151e22; color:#9eaaad; font-size:.48rem; text-transform:uppercase; letter-spacing:.07em; }
.market-asset { min-width:180px; display:grid; grid-template-columns:38px minmax(0,1fr); gap:7px; align-items:center; }
.market-asset > span { width:36px; height:36px; display:grid; place-items:center; }
.market-asset b,.market-asset small,.market-asset em { display:block; }
.market-asset small,.market-asset em { margin-top:2px; color:var(--muted); font-size:.44rem; font-style:normal; }
.currency-inline { display:inline-flex; align-items:center; gap:3px; white-space:nowrap; }
.currency-inline img { width:8px; height:8px; object-fit:contain; }
.currency-inline small { display:none; }

/* Blacksmith */
.workshop-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.workshop-card { min-width:0; padding:10px; border:1px solid #3b403a; background:radial-gradient(circle at 50% 0%,rgba(183,117,54,.08),transparent 45%),#111719; }
.workshop-card h2 { margin:2px 0 5px; font:700 .95rem var(--font-display); }
.workshop-card p { min-height:34px; margin:0 0 8px; color:var(--muted); font-size:.54rem; line-height:1.45; }
.workshop-card > label { margin:5px 0; }
.workshop-card select { width:100%; }
.check-row { display:flex !important; grid-template-columns:none !important; align-items:center; gap:6px !important; margin:7px 0 !important; }
.check-row input { accent-color:#b48a43; }
.workshop-selected { min-height:43px; display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:4px; margin-bottom:6px; padding:5px; border:1px solid #2f3b3f; background:#0b1114; }
.workshop-selected .inventory-item-card { min-height:40px; grid-template-columns:30px minmax(0,1fr); padding:4px; }
.workshop-selected .inventory-item-icon { width:28px; height:28px; }
.workshop-selected .inventory-item-copy em { display:none; }
.workshop-selected > small { grid-column:1/-1; place-self:center; color:var(--muted); }
.workshop-pool { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; max-height:150px; overflow:auto; margin-top:7px; }
.workshop-token { min-width:0; display:grid; grid-template-columns:32px minmax(0,1fr); align-items:center; gap:5px; padding:4px; border:1px solid #354249; background:#0b1215; color:var(--paper); text-align:left; cursor: url('/assets/ui/hand.gif') 0 0, pointer; }
.workshop-token.selected { border-color:#9b7d40; background:#222017; }
.workshop-token > span:first-child { width:30px; height:30px; display:grid; place-items:center; }
.workshop-token b,.workshop-token small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.workshop-token b { font-size:.51rem; }
.workshop-token small { margin-top:2px; color:var(--muted); font-size:.42rem; }
.workshop-empty { color:var(--muted); font-size:.52rem; }

/* Atrium */
.atrium-grid { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(240px,.8fr); gap:9px; align-items:start; }
.atrium-card { min-width:0; padding:10px; border:1px solid #344248; background:#10171a; }
.atrium-card h2 { margin:2px 0 6px; font:700 .95rem var(--font-display); }
.atrium-card p { color:var(--muted); font-size:.55rem; line-height:1.45; }
.atrium-appearance { grid-row:span 2; }
.atrium-hero-list { display:flex; gap:5px; overflow-x:auto; margin:7px 0; padding-bottom:3px; }
.atrium-hero-list .armory-hero-token { flex-basis:135px; }
.atrium-preview { display:grid; grid-template-columns:90px minmax(0,1fr); gap:10px; align-items:center; padding:8px; border:1px solid #344248; background:#0b1215; }
.atrium-preview > img { width:90px; aspect-ratio:1; object-fit:cover; }
.atrium-preview h3 { margin:0 0 7px; font:.85rem var(--font-display); }
.atrium-preview input[type="color"] { width:100%; height:30px; border:1px solid #3d4c52; background:#0a1013; }
.atrium-preview .primary { margin-top:6px; }
.atrium-masks { display:grid; gap:5px; margin-top:7px; }
.atrium-mask-row { display:grid; grid-template-columns:minmax(90px,1fr) 120px 90px; align-items:center; gap:6px; padding:5px; border:1px solid #2e3b40; background:#0c1316; }
.atrium-mask-row b,.atrium-mask-row small { display:block; }
.atrium-mask-row b { font-size:.56rem; }
.atrium-mask-row small { margin-top:2px; color:var(--muted); font-size:.43rem; }
.atrium-mask-row select { width:100%; }
.atrium-selected-summary { display:flex; justify-content:space-between; gap:8px; padding:7px; margin:7px 0; border:1px solid #304047; background:#0b1215; font-size:.56rem; }
.atrium-selected-summary span { color:var(--muted); }

/* Leaderboard */
.leaderboard-panel { border:1px solid #344248; background:#10171a; padding:9px; }
.leaderboard-tabs { display:flex; gap:4px; flex-wrap:wrap; margin-bottom:9px; }
.leaderboard-tabs button { min-height:31px; padding:6px 10px; border:1px solid #3c494e; background:#11191c; color:#98a5a8; cursor: url('/assets/ui/hand.gif') 0 0, pointer; font-size:.55rem; font-weight:800; }
.leaderboard-tabs button.active { border-color:#8d723b; background:#282217; color:var(--gold-soft); }
.leaderboard-scroll { max-height:58vh; overflow:auto; border:1px solid #2e3b40; }
.leaderboard-table tr.current-player td { background:rgba(190,148,65,.09); }
.leaderboard-separator td { color:var(--gold-soft); font-weight:800; background:#171712; }

@media (max-width: 1000px) {
  .armory-workspace { grid-template-columns:1fr; }
  .inventory-card-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .workshop-grid,.atrium-grid { grid-template-columns:1fr; }
  .atrium-appearance { grid-row:auto; }
}

/* client2 v6: exact original surfaces + Tavern contract polish */
.stat-chip { gap: 0; padding-block: 1px; }
.stat-chip b { line-height: .72; }
.stat-chip small { margin-top: 0; line-height: .72; }

.candidate-card .recruit-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .48vw;
}
.recruit-button-price {
  display: inline-flex;
  align-items: center;
  gap: .2vw;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}
.recruit-button-price img {
  width: .72vw;
  min-width: 11px;
  max-width: 15px;
  height: auto;
  object-fit: contain;
}
.recruit-button-price b { font: inherit; }

.recruitment-contract-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px 14px;
}
.recruitment-contract-meta > p { grid-column: 1; grid-row: 1; }
.recruitment-range-visuals {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  justify-content: flex-end;
  margin-left: auto;
}

.legacy-route {
  position: relative;
  overflow: hidden;
  background: #0b1013;
}
.legacy-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0b1013;
}

/* Battle remains inside the right content pane; client2 menu/topbar stay visible. */
@media (max-width: 850px) {
  .recruitment-contract-meta { grid-template-columns: 1fr; }
  .recruitment-contract-meta > p,
  .recruitment-range-visuals { grid-column: 1; }
  .recruitment-range-visuals { grid-row: 2; justify-self: end; }
}


/* client2 v7: compact five-up roster, fidelity fixes, and persistent chat. */
.hero-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .55vw;
}
.hero-grid .army-hero-card {
  position: relative;
  overflow: hidden;
  border: 1px solid #354147;
  background: #11181c;
  transform: none;
}
.hero-grid .army-hero-card:hover { border-color: var(--gold); transform: none; }
.hero-grid .army-hero-card .hero-portrait { height: clamp(154px, 11vw, 210px); }
.hero-grid .army-hero-card .hero-card-body { padding: .58vw; }
.hero-grid .army-hero-card .hero-name-row h3 { font-size: clamp(7px, .7vw, 13px); }
.hero-grid .army-hero-card .mini-stat { padding: .3vw; font-size: clamp(8px, .47vw, 9px); }
.hero-grid .army-hero-card .level-line { gap: .3vw; }

.stat-chip b,
.stat-chip small {
  font-size: .5rem;
  line-height: 1.5;
}
.stat-chip small { margin-top: 0; }
.candidate-card .mini-stat { font-size: clamp(8px, .47vw, 9px); }
.class-chip { font-size: .45rem; }
.candidate-card .recruit-button { font-size: clamp(9px, .5vw, 9px); }
.tavern-intro p { font-size: clamp(7px, .5vw, 9px); }
#route-quests .primary,
#route-quests .ghost { font-size: .5rem; }

/* Battle uses the same 10% / 90% client2 grid as every other route. */
.app-view.battle-route-active { grid-template-rows: 8.5% 91.5%; }
.app-view.battle-route-active .game-topbar { display: flex; }
.app-view.battle-route-active .game-menu { display: flex; }
.app-view.battle-route-active .game-layout {
  height: auto;
  min-height: 0;
}
.app-view.battle-route-active .content-view,
.app-view.battle-route-active #route-legacy { width: 100%; height: 100%; }

/* On phones, let Battle consume the exact height left after the top bar, then
   derive its width from a 16:9 frame. This avoids scaling the battlefield from
   the wider 90% content track and keeps heroes/HUD proportions consistent. */
@media (max-width: 850px), (pointer: coarse) {
  #game-surface:not([data-fullscreen-mode="battle"]) .app-view.battle-route-active {
    grid-template-rows: 8.5% minmax(0, 1fr);
    width: 100%;
  }
  #game-surface:not([data-fullscreen-mode="battle"]) .app-view.battle-route-active .game-topbar {
    min-height: 0;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  #game-surface:not([data-fullscreen-mode="battle"]) .app-view.battle-route-active .game-layout,
  #game-surface:not([data-fullscreen-mode="battle"]) .app-view.battle-route-active .content-view,
  #game-surface:not([data-fullscreen-mode="battle"]) .app-view.battle-route-active #route-legacy {
    min-height: 0;
  }
  #game-surface:not([data-fullscreen-mode="battle"]) .app-view.battle-route-active #route-legacy {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    overflow: hidden;
    background: #050708;
    container-type: size;
  }
  #game-surface:not([data-fullscreen-mode="battle"]) .app-view.battle-route-active .legacy-frame {
    flex: 0 0 auto;
    width: auto;
    height: 100%;
    max-width: none;
    max-height: 100%;
    aspect-ratio: 16 / 9;
    margin: 0;
  }
}

/* Persistent chat: always bottom-left inside the 16:9 surface. */
.client2-chat {
  position: absolute;
  z-index: 240;
  left: 8px;
  bottom: 8px;
  width: clamp(245px, 23vw, 336px);
  height: clamp(170px, 18vw, 258px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(78, 96, 104, .76);
  border-radius: 5px;
  background: rgba(9, 15, 18, .86);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .42);
  backdrop-filter: blur(4px);
  overflow: hidden;
}
.game-chat-tabs {
  min-height: 23px;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid rgba(47, 59, 64, .82);
  background: rgba(11, 19, 23, .82);
}
.game-chat-tabs button[data-chat-channel] {
  flex: 1 1 0;
  min-width: 0;
  min-height: 22px;
  padding: 1px 4px;
  border: 0;
  border-right: 1px solid rgba(47, 59, 64, .82);
  border-radius: 0;
  background: rgba(13, 21, 25, .56);
  color: #829096;
  font-size: .52rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.game-chat-tabs button[data-chat-channel].active { background: rgba(24,35,41,.8); color: var(--gold-soft); }
.game-chat-tabs button[data-chat-channel][hidden] { display: none; }
.game-chat-minimize {
  width: 23px;
  min-width: 23px;
  min-height: 22px;
  padding: 0;
  flex: 0 0 23px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: rgba(20,32,37,.68);
  color: var(--paper);
  font-size: .7rem;
}
.game-chat-body { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0,1fr) auto; }
.game-chat-log { min-height: 0; overflow-y: auto; padding: 0; scrollbar-width: thin; }
.game-chat-line { display:block; padding:2px 3px; border-bottom:1px solid rgba(64,78,84,.28); color:#aeb9bc; font-size:.54rem; line-height:1.3; overflow-wrap:anywhere; }
.game-chat-channel-label { color:#7f9ea8; }
.game-chat-line > b { color:#dfe7e9; font:inherit; font-weight:800; }
.game-chat-message { color:inherit; }
.game-chat-line.own { color:#d7e0e2; }
.game-chat-line.whisper, .game-chat-line.whisper .game-chat-channel-label, .game-chat-line.whisper > b, .game-chat-line.whisper .game-chat-message { color:#c99bea; }
.game-chat-line.room { background:rgba(68,112,105,.065); }
.game-chat-line.system { background:rgba(190,153,78,.055); }
.game-chat-line.system > b { color:var(--gold-soft); }
.game-chat-line.system.error > b, .game-chat-line.system.error .game-chat-message { color:#e99a90; }
.game-chat-empty { padding:8px 6px; color:#69777c; font-size:.54rem; text-align:center; }
.game-chat-form { display:grid; grid-template-columns:minmax(0,1fr) 28px; gap:2px; padding:0; border-top:1px solid rgba(53,66,73,.8); background:rgba(10,17,20,.62); }
.game-chat-form input { min-width:0; height:24px; padding:2px 5px; border:1px solid rgba(59,74,80,.86); border-radius:0; background:rgba(5,10,12,.72); color:var(--paper); font-size:.54rem; }
.game-chat-form button { width:28px; min-width:28px; height:24px; min-height:24px; padding:0; border:1px solid rgba(75,103,108,.88); border-radius:0; background:rgba(23,48,54,.78); color:#99d8d8; }
.game-chat-minimized-preview { display:none; min-width:0; height:24px; overflow:hidden; }
.client2-chat.minimized {
  width: clamp(245px, 23vw, 336px);
  height: 47px;
}
.client2-chat.minimized .game-chat-tabs button[data-chat-channel] { display:none; }
.client2-chat.minimized .game-chat-body { display:none; }
.client2-chat.minimized .game-chat-minimized-preview { display:block; }
.client2-chat.minimized .game-chat-minimized-preview .game-chat-line,
.client2-chat.minimized .game-chat-minimized-preview .game-chat-empty {
  height:24px;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  padding:4px 6px;
  border-bottom:0;
  text-align:left;
}


/* client2 v8: compact page rhythm, utility typography, and two-message minimized chat. */
.route-page {
  padding: 10px clamp(15px, 1vw, 15px) 60px;
}
.page-heading {
  margin-bottom: 5px;
  align-items: flex-end;
}
.utility-card { border-radius: 0 !important; }

/* Quests now follows the same dense utility-page visual language as Blacksmith / Atrium / Guild. */
#route-quests .route-page { font-size: clamp(7px, .5vw, 10px); }
#route-quests .page-heading h1 { font-size: clamp(18px, 1.45vw, 26px); }
#route-quests .page-heading p { font-size: clamp(7px, .5vw, 10px); line-height: 1.35; }
#route-quests .council-shell { gap: 8px; }
#route-quests .council-section {
  gap: 7px;
  padding: 10px;
  border: 1px solid #4a4335;
  border-radius: 0;
  background: linear-gradient(145deg, rgba(36,39,39,.96), rgba(17,21,22,.96));
}
#route-quests .council-section-head { align-items: center; gap: 10px; }
#route-quests .council-section-head h2 { margin: 0 0 2px; font-size: clamp(12px, .86vw, 16px); }
#route-quests .council-section-head p,
#route-quests .council-featured-card p,
#route-quests .council-order-card p { font-size: clamp(7px, .48vw, 9px); line-height: 1.35; }
#route-quests .council-section-head > strong { font-size: clamp(8px, .58vw, 11px); }
#route-quests .company-path-steps { gap: 5px; }
#route-quests .company-step { min-height: 56px; padding: 6px; gap: 5px; border-radius: 0; }
#route-quests .company-step-number,
#route-quests .company-step b,
#route-quests .company-step small,
#route-quests .company-step-state,
#route-quests .quest-progress > div:first-child,
#route-quests .council-rewards > span,
#route-quests .council-complete-banner { font-size: clamp(7px, .46vw, 9px); }
#route-quests .council-featured-card,
#route-quests .council-order-card { padding: 8px; border-radius: 0; background: #111819; }
#route-quests .council-featured-card h3,
#route-quests .council-order-card h3 { margin: 0 0 3px; font-size: clamp(9px, .62vw, 12px); }
#route-quests :is(.primary,.ghost,.secondary) { font-size: .5rem; min-height: 28px; padding: 4px 7px; }

/* Minimized chat keeps two latest messages visible. */
.game-chat-minimized-preview { height: 48px; }
.client2-chat.minimized { height: 71px; }
.client2-chat.minimized .game-chat-minimized-preview .game-chat-line,
.client2-chat.minimized .game-chat-minimized-preview .game-chat-empty {
  height: 24px;
  border-bottom: 1px solid rgba(64,78,84,.28);
}
.client2-chat.minimized .game-chat-minimized-preview .game-chat-line:last-child,
.client2-chat.minimized .game-chat-minimized-preview .game-chat-empty:last-child { border-bottom: 0; }


/* client2 v9: unified headings, account dropdown, Army chat clearance, compact Battle chat. */
.game-topbar { position: relative; z-index: 260; }
.commander-button { cursor: url('/assets/ui/hand.gif') 0 0, pointer; }
.commander-button:hover,
.commander-button[aria-expanded="true"] { border-color: rgba(215,169,80,.42); background: #172126; }
.commander-chevron { color: var(--muted); font-size: .55rem; font-style: normal; transition: transform .16s ease; }
.commander-button[aria-expanded="true"] .commander-chevron { transform: rotate(180deg); }

.commander-menu {
  position: absolute;
  z-index: 320;
  top: calc(100% - 1px);
  right: 1.2%;
  width: clamp(235px, 19vw, 315px);
  max-height: min(72vh, 520px);
  overflow-y: auto;
  padding: 7px;
  border: 1px solid #314044;
  border-radius: 6px;
  background: rgba(9,14,17,.985);
  box-shadow: 0 16px 42px rgba(0,0,0,.5);
}
.commander-friends-section { display: grid; gap: 6px; }
.commander-menu-heading { display: flex; align-items: center; justify-content: space-between; padding: 1px 3px; }
.commander-menu-heading b { font-size: .62rem; }
.commander-menu-heading small { color: var(--muted); font-size: .5rem; }
.commander-friend-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px; }
.commander-friend-form input { min-width: 0; height: 27px; padding: 0 7px; border: 1px solid #34454b; border-radius: 0; outline: none; background: #0b1215; color: var(--paper); font-size: .55rem; }
.commander-friend-form button { min-height: 27px; padding: 0 8px; border: 1px solid #3f595e; border-radius: 0; background: #132126; color: #c8dcde; font-size: .52rem; font-weight: 800; cursor: url('/assets/ui/hand.gif') 0 0, pointer; }
.commander-friends-list { display: grid; gap: 3px; }
.commander-friend-row { display: grid; grid-template-columns: 27px minmax(0,1fr) auto; gap: 6px; align-items: center; min-height: 34px; padding: 3px; }
.commander-friend-row:hover { background: rgba(90,176,167,.055); }
.commander-friend-avatar { position: relative; width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid #3c5056; border-radius: 50%; background: #172428; color: #d5eeee; font-size: .58rem; font-weight: 800; }
.commander-presence { position: absolute; right: -1px; bottom: 0; width: 8px; height: 8px; border: 2px solid #0b1114; border-radius: 50%; background: #657177; }
.commander-presence.available { background: #61c875; }
.commander-presence.in_lobby { background: #d4a84d; }
.commander-presence.in_battle { background: #d25c4d; }
.commander-friend-copy { min-width: 0; display: grid; gap: 1px; }
.commander-friend-copy b,
.commander-friend-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.commander-friend-copy b { color: var(--paper); font-size: .56rem; }
.commander-friend-copy small { color: var(--muted); font-size: .47rem; }
.commander-friend-remove { width: 24px; height: 24px; padding: 0; border: 1px solid #3a4549; border-radius: 0; background: transparent; color: #8e9a9e; cursor: url('/assets/ui/hand.gif') 0 0, pointer; }
.commander-friend-remove:hover { color: #ef9892; border-color: #7c4743; }
.commander-menu-empty { margin: 5px 3px 7px; color: var(--muted); font-size: .52rem; }
.commander-menu-setting { width: 100%; min-height: 31px; margin-top: 6px; padding: 0 8px; display: flex; align-items: center; gap: 7px; border: 0; border-top: 1px solid #2a373c; border-radius: 0; background: transparent; color: var(--paper); cursor: url('/assets/ui/hand.gif') 0 0, pointer; text-align: left; }
.commander-menu-setting:hover { background: #111a1e; }
.commander-menu-setting span { color: var(--teal); }
.commander-menu-setting b { font-size: .58rem; }

.client-settings-modal { max-width: 520px; }
.client-settings-account { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; padding-bottom: 9px; border-bottom: 1px solid #2c3a3f; }
.client-settings-account > span { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #405258; border-radius: 50%; background: #18262b; color: var(--gold-soft); font: 800 .8rem var(--font-display); }
.client-settings-account b,
.client-settings-account small { display: block; }
.client-settings-account b { font-size: .68rem; }
.client-settings-account small { margin-top: 2px; color: var(--muted); font-size: .52rem; }
.client-setting-row { min-height: 42px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid #27343a; }
.client-setting-row b,
.client-setting-row small { display: block; }
.client-setting-row b { font-size: .61rem; }
.client-setting-row small { margin-top: 2px; color: var(--muted); font-size: .49rem; line-height: 1.3; }
.client-setting-row select { min-width: 110px; height: 29px; border: 1px solid #3b4b51; border-radius: 0; background: #0b1215; color: var(--paper); font-size: .54rem; }
.client-setting-toggle { min-width: 48px; height: 25px; padding: 0 7px; border: 1px solid #42545a; border-radius: 0; background: #10191d; color: #819095; font-size: .51rem; cursor: url('/assets/ui/hand.gif') 0 0, pointer; }
.client-setting-toggle.on { border-color: #467b73; background: #17322f; color: #9ce1d3; }
.client-settings-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.client-settings-actions .danger-button { min-height: 30px; }

/* Army / Quests / Tavern H1 now matches the compact original utility pages. */
.army-toolbar h1,
#route-quests .page-heading h1,
#route-tavern .page-heading h1 {
  margin: 4px 0;
  font-family: var(--font-display);
  font-size: clamp(18px, 1.45vw, 26px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
}
/* Keep enough scroll runway to lift the final Army cards clear of persistent chat. */
#route-army .hero-grid { padding-bottom: 150px; }

/* Keep chat at the same 854px-battle-derived width on every route. */
.client2-chat,
.client2-chat.minimized { width: 307px; }

/* During a live Battle, JS positions this overlay geometrically inside #combat-field. */
.client2-chat.combat-contained {
  position: absolute;
  margin: 0;
  max-width: none;
  max-height: none;
  border-radius: 4px;
}
.client2-chat.combat-contained.minimized .game-chat-tabs { min-height: 14px; height: 14px; }
.client2-chat.combat-contained.minimized .game-chat-minimize { width: 18px; min-width: 18px; min-height: 13px; height: 13px; flex-basis: 18px; font-size: .55rem; }
.client2-chat.combat-contained.minimized .game-chat-minimized-preview { height: 38px; }
.client2-chat.combat-contained.minimized .game-chat-minimized-preview .game-chat-line,
.client2-chat.combat-contained.minimized .game-chat-minimized-preview .game-chat-empty {
  height: 19px;
  padding: 2px 4px;
  font-size: .48rem;
  line-height: 14px;
}

/* client2 v10: menu containment, notifications, compact editable chat. */
.game-menu nav {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}
.game-menu nav > button,
.menu-entry {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.menu-entry {
  grid-template-columns: minmax(0, 1.15vw) minmax(0, 1fr) auto;
  gap: .3vw;
  padding: .65vw .5vw;
  font-size: clamp(10px, .66vw, 13px);
  overflow: hidden;
}
.menu-entry > span,
.menu-entry > b,
.menu-entry > i { min-width: 0; }
.menu-entry > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-entry > i { max-width: 1.65em; overflow: hidden; }

.commander-notifications {
  width: 100%;
  min-height: 32px;
  margin: 0 0 7px;
  padding: 0 8px;
  display: grid;
  grid-template-columns: 22px minmax(0,1fr) auto;
  align-items: center;
  gap: 7px;
  border: 0;
  border-bottom: 1px solid #2a373c;
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  text-align: left;
  cursor: url('/assets/ui/hand.gif') 0 0, pointer;
}
.commander-notifications:hover { background: #111a1e; }
.commander-notifications > span { color: var(--gold-soft); text-align: center; }
.commander-notifications > b { font-size: .58rem; }
.commander-notifications > i {
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #9f4e43;
  color: #fff4ed;
  font: 800 .46rem/1 var(--font-body);
  font-style: normal;
}
.commander-notifications > i[hidden] { display: none; }
.commander-notifications.has-unread { background: rgba(208,160,69,.055); }
.notification-modal { max-width: 540px; }
.notification-list { display: grid; gap: 5px; max-height: min(58vh, 470px); overflow-y: auto; margin: 8px 0; }
.notification-row { display: grid; grid-template-columns: 68px minmax(0,1fr); gap: 8px; align-items: start; padding: 7px; border: 1px solid #2f3c41; background: #0e1518; }
.notification-row.unread { border-color: rgba(214,170,78,.6); background: rgba(214,170,78,.05); }
.notification-icon { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid #425158; border-radius: 50%; color: var(--gold-soft); font-size: .58rem; }
.notification-row b { color: var(--paper); font-size: .59rem; }
.notification-row p { margin: 2px 0; color: var(--muted); font-size: .5rem; line-height: 1.3; }
.notification-row small { color: #6f7c80; font-size: .45rem; }
.notification-action { min-height: 25px; margin-top: 5px; padding: 2px 7px; font-size: .49rem; }
.notification-friend-actions { display: flex; gap: 4px; }
.notification-empty { padding: 12px; text-align: center; color: var(--muted); }
.notification-empty h3 { margin: 0 0 4px; color: var(--paper); font-size: .68rem; }
.notification-empty p { margin: 0; font-size: .51rem; }

.game-chat-line {
  padding: 0;
  font-size: .5rem;
  line-height: 1.22;
}
.game-chat-minimize { margin-left: auto; }
.client2-chat.minimized {
  height: 54px;
  min-height: 54px;
  overflow: hidden;
}
.client2-chat.minimized .game-chat-tabs {
  position: absolute;
  z-index: 4;
  top: 0;
  right: 0;
  width: 20px;
  height: 18px;
  min-height: 18px;
  border: 0;
  background: transparent;
}
.client2-chat.minimized .game-chat-tabs button[data-chat-channel] { display: none; }
.client2-chat.minimized .game-chat-minimize {
  width: 20px;
  min-width: 20px;
  height: 18px;
  min-height: 18px;
  flex-basis: 20px;
  background: rgba(20,32,37,.88);
  font-size: .58rem;
}
.client2-chat.minimized .game-chat-minimized-preview {
  display: block;
  flex: 0 0 28px;
  width: 100%;
  height: 28px;
  padding-right: 20px;
  overflow: hidden;
}
.client2-chat.minimized .game-chat-minimized-preview .game-chat-line,
.client2-chat.minimized .game-chat-minimized-preview .game-chat-empty {
  height: 14px;
  padding: 0 3px;
  border: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: .46rem;
  line-height: 14px;
  text-align: left;
}
.client2-chat.minimized .game-chat-body {
  display: block;
  flex: 0 0 24px;
  min-height: 24px;
}
.client2-chat.minimized .game-chat-log { display: none; }
.client2-chat.minimized .game-chat-form { display: grid; height: 24px; }
.client2-chat.minimized .game-chat-form input,
.client2-chat.minimized .game-chat-form button { height: 24px; min-height: 24px; }
.client2-chat.combat-contained.minimized .game-chat-tabs {
  position: absolute;
  width: 20px;
  height: 18px;
  min-height: 18px;
}
.client2-chat.combat-contained.minimized .game-chat-minimize {
  width: 20px;
  min-width: 20px;
  height: 18px;
  min-height: 18px;
  flex-basis: 20px;
}
.client2-chat.combat-contained.minimized .game-chat-minimized-preview {
  height: 28px;
  flex-basis: 28px;
}
.client2-chat.combat-contained.minimized .game-chat-minimized-preview .game-chat-line,
.client2-chat.combat-contained.minimized .game-chat-minimized-preview .game-chat-empty {
  height: 14px;
  padding: 0 3px;
  font-size: .45rem;
  line-height: 14px;
}

/* Fullscreen Battle: maximize the Battle content while keeping client2 Chat in the fullscreen subtree. */
#game-surface:fullscreen,
#game-surface:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  border: 0 !important;
  border-radius: 0 !important;
}
#game-surface:fullscreen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active,
#game-surface:-webkit-full-screen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active {
  grid-template-rows: 1fr !important;
}
#game-surface:fullscreen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active .game-topbar,
#game-surface:fullscreen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active .game-menu,
#game-surface:-webkit-full-screen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active .game-topbar,
#game-surface:-webkit-full-screen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active .game-menu {
  display: none !important;
}
#game-surface:fullscreen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active .game-layout,
#game-surface:-webkit-full-screen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active .game-layout {
  grid-template-columns: 1fr !important;
  width: 100% !important;
  height: 100% !important;
}
#game-surface:fullscreen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active .content-view,
#game-surface:fullscreen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active #route-legacy,
#game-surface:fullscreen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active .legacy-frame,
#game-surface:-webkit-full-screen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active .content-view,
#game-surface:-webkit-full-screen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active #route-legacy,
#game-surface:-webkit-full-screen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active .legacy-frame {
  width: 100% !important;
  height: 100% !important;
}

#game-surface[data-fullscreen-mode="battle"] .app-view.battle-route-active {
  grid-template-rows: 1fr !important;
}
#game-surface[data-fullscreen-mode="battle"] .app-view.battle-route-active .game-topbar,
#game-surface[data-fullscreen-mode="battle"] .app-view.battle-route-active .game-menu {
  display: none !important;
}
#game-surface[data-fullscreen-mode="battle"] .app-view.battle-route-active .game-layout {
  grid-template-columns: 1fr !important;
  width: 100% !important;
  height: 100% !important;
}
#game-surface[data-fullscreen-mode="battle"] .app-view.battle-route-active .content-view,
#game-surface[data-fullscreen-mode="battle"] .app-view.battle-route-active #route-legacy,
#game-surface[data-fullscreen-mode="battle"] .app-view.battle-route-active .legacy-frame {
  width: 100% !important;
  height: 100% !important;
}


/* client2 v11: translucent persistent combat HUDs, bottom-anchored chat, fullscreen Battle fixes. */
.game-chat-form input { padding: 2px 2px; }
.client2-chat {
  background: rgba(9, 15, 18, .55);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}
.client2-chat.minimized {
  height: 54px;
  min-height: 54px;
}
.client2-chat.minimized .game-chat-body {
  flex: 0 0 18px;
  min-height: 18px;
  height: 18px;
}
.client2-chat.minimized .game-chat-form {
  height: 18px;
  min-height: 18px;
}
.client2-chat.minimized .game-chat-form input,
.client2-chat.minimized .game-chat-form button {
  height: 18px;
  min-height: 18px;
}
.client2-chat.minimized .game-chat-form button {
  line-height: 16px;
}

/* Live Battle frame must own the full content track; the original 854px shell track caused fullscreen to start mid-screen. */
#game-surface:fullscreen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active .legacy-frame,
#game-surface:-webkit-full-screen:not([data-fullscreen-mode="window"]) .app-view.battle-route-active .legacy-frame {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
}
.client2-chat .game-chat-tabs { background: rgba(11, 19, 23, .55); }
.client2-chat .game-chat-form { background: rgba(10, 17, 20, .55); }


/* Mobile Battle is height-driven, not width-driven. The available vertical
   space determines a true 16:9 iframe width; any spare room stays as a
   right-side gutter instead of stretching/rescaling the battlefield. */
@media (max-width: 850px), (pointer: coarse) {
  #game-surface .app-view.battle-route-active #route-legacy {
    display: flex !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    overflow: hidden !important;
    container-type: size;
  }

  #game-surface .app-view.battle-route-active .legacy-frame {
    position: relative !important;
    inset: auto !important;
    flex: 0 0 auto !important;
    width: auto !important;
    height: 100% !important;
    max-width: none !important;
    max-height: 100% !important;
    aspect-ratio: 16 / 9 !important;
    margin: 0 !important;
  }

  @supports (width: 1cqh) {
    #game-surface .app-view.battle-route-active .legacy-frame {
      width: calc(100cqh * 16 / 9) !important;
      height: 100cqh !important;
    }
  }
}

/* Blacksmith workspace: collapsible operations left, Armory-style player inventory right. */
.blacksmith-workspace { grid-column:1/-1; min-width:0; display:grid; grid-template-columns:minmax(0,1fr) minmax(236px,256px); gap:14px; align-items:start; }
.blacksmith-options { min-width:0; display:grid; gap:8px; }
.blacksmith-operation { min-width:0; border:1px solid #3b403a; background:radial-gradient(circle at 50% 0%,rgba(183,117,54,.07),transparent 44%),#111719; }
.blacksmith-operation.expanded { border-color:#75623f; }
.blacksmith-operation-toggle { width:100%; min-height:48px; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:center; padding:9px 12px; border:0; background:#101719; color:var(--paper); text-align:left; cursor: url('/assets/ui/hand.gif') 0 0, pointer; }
.blacksmith-operation.expanded .blacksmith-operation-toggle { border-bottom:1px solid #3a413d; background:#171b19; }
.blacksmith-operation-toggle:hover,.blacksmith-operation-toggle:focus-visible { background:#1a201e; }
.blacksmith-operation-toggle span { min-width:0; display:grid; gap:2px; }
.blacksmith-operation-toggle b { font:700 .82rem var(--font-display); color:#ded4bb; }
.blacksmith-operation-toggle small { color:var(--muted); font-size:.52rem; line-height:1.25; }
.blacksmith-operation-toggle i { width:26px; height:26px; display:grid; place-items:center; border:1px solid #4a4d43; color:var(--gold-soft); font:normal 700 1rem/1 var(--font-display); }
.blacksmith-operation-body { padding:12px; }
.blacksmith-operation-body > p { margin:0 0 10px; color:var(--muted); font-size:.55rem; line-height:1.45; }
.blacksmith-operation-body .utility-slots,.blacksmith-operation-body .forge-slots { margin:10px 0; }
.blacksmith-operation-body > label { margin:7px 0; }
.blacksmith-operation-body select { width:100%; }
.blacksmith-operation-body .utility-result { margin-top:10px; }
.blacksmith-inventory { width:min(100%,256px); min-width:0; justify-self:start; position:sticky; top:0; padding:12px; }
.blacksmith-inventory .stored-items-header { margin-bottom:8px; }
.blacksmith-inventory .stored-items-header h2 { margin:2px 0 1px; font:700 .82rem var(--font-display); }
.blacksmith-inventory-grid-shell { width:206px; max-width:100%; height:262px; max-height:min(262px,58vh); overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; padding:4px; border:1px solid #26343a; background:rgba(6,10,12,.55); }
.blacksmith-inventory-grid { grid-template-columns:repeat(5,34px)!important; grid-auto-rows:34px; gap:4px; width:max-content; max-width:none; }
.blacksmith-inventory-item { transition:opacity .12s ease,border-color .12s ease,filter .12s ease,box-shadow .12s ease; }
.blacksmith-inventory-item.blacksmith-usable { cursor: url('/assets/ui/hand.gif') 0 0, pointer; opacity:1; }
.blacksmith-inventory-item.blacksmith-usable:hover,.blacksmith-inventory-item.blacksmith-usable:focus-visible { border-color:#b08b47; filter:brightness(1.12); }
.blacksmith-inventory-item.blacksmith-unavailable { cursor:not-allowed; opacity:.34; filter:saturate(.45); }
.blacksmith-inventory-item.blacksmith-selected { opacity:1; border-color:#d2aa59!important; box-shadow:inset 0 0 0 1px rgba(210,170,89,.55),0 0 8px rgba(210,170,89,.18)!important; }
.blacksmith-inventory-item.dragging { opacity:.55; }
.blacksmith-inventory-note { display:block; margin-top:8px; color:var(--muted); font-size:.49rem; line-height:1.35; }
@media (max-width:620px) { .blacksmith-workspace { grid-template-columns:1fr; } .blacksmith-inventory { position:static; width:100%; } .blacksmith-inventory-grid-shell { width:100%; } }


/* Player trading: friend action + secure two-party trade modal. */
.commander-friend-row { grid-template-columns: 27px minmax(0,1fr) auto auto; }
.commander-friend-trade { min-width:46px; height:24px; padding:0 7px; border:1px solid #3f6665; border-radius:0; background:#102224; color:#8ed4cc; font-size:.48rem; font-weight:800; cursor: url('/assets/ui/hand.gif') 0 0, pointer; }
.commander-friend-trade:hover:not(:disabled) { border-color:#70aaa5; background:#173034; color:#c5f3ed; }
.commander-friend-trade:disabled { opacity:.38; cursor:not-allowed; }
.trade-modal { width:min(930px,96%); max-height:92%; overflow:auto; }
.trade-modal-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom:12px; }
.trade-modal-head h2 { margin:.15em 0 0; }
.trade-modal-grid { display:grid; grid-template-columns:minmax(280px,.95fr) minmax(360px,1.25fr); gap:14px; min-height:0; }
.trade-inventory-panel,.trade-offers-panel { min-width:0; }
.trade-inventory-panel { display:grid; grid-template-rows:auto minmax(0,1fr) auto; border:1px solid #33434a; background:#0c1316; }
.trade-panel-heading { min-height:35px; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:7px 9px; border-bottom:1px solid #2c3a40; }
.trade-panel-heading b { font-size:.62rem; }
.trade-panel-heading small { color:var(--muted); font-size:.49rem; }
.trade-inventory-list { max-height:355px; overflow:auto; display:grid; grid-template-columns:1fr 1fr; align-content:start; gap:5px; padding:7px; }
.trade-inventory-item { min-width:0; min-height:48px; display:grid; grid-template-columns:38px minmax(0,1fr); gap:6px; align-items:center; position:relative; padding:4px 6px; border:1px solid #34434a; border-radius:0; background:#10181c; color:var(--paper); text-align:left; cursor: url('/assets/ui/hand.gif') 0 0, pointer; }
.trade-inventory-item:hover:not(:disabled) { border-color:#5d827f; background:#142126; }
.trade-inventory-item.offered { border-color:#9e824a; box-shadow:inset 0 0 0 1px rgba(202,168,91,.24); }
.trade-inventory-item.disabled { opacity:.38; cursor:not-allowed; }
.trade-inventory-item > span:nth-child(2) { min-width:0; display:grid; gap:2px; }
.trade-inventory-item b,.trade-inventory-item small { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.trade-inventory-item b { font-size:.52rem; }
.trade-inventory-item small { color:var(--muted); font-size:.45rem; }
.trade-inventory-item > i { position:absolute; right:3px; top:3px; color:var(--gold-soft); font-size:.39rem; font-style:normal; }
.trade-item-icon { width:34px; height:34px; display:grid; place-items:center; }
.trade-gold-form { display:grid; grid-template-columns:minmax(130px,1fr) minmax(110px,.7fr) auto; gap:7px; align-items:end; padding:8px; border-top:1px solid #2d3b40; background:#10191d; }
.trade-gold-form > div { min-width:0; display:flex; align-items:center; gap:6px; }
.trade-gold-form img,.trade-offer-gold img { width:22px; height:22px; object-fit:contain; }
.trade-gold-form b,.trade-gold-form small { display:block; }
.trade-gold-form b { font-size:.56rem; }.trade-gold-form small { color:var(--muted); font-size:.43rem; }
.trade-gold-form label { display:grid; gap:3px; color:var(--muted); font-size:.45rem; }
.trade-gold-form input { min-width:0; height:28px; border:1px solid #3a4a50; background:#081013; color:var(--paper); padding:0 6px; }
.trade-gold-form button { min-height:28px; }
.trade-offers-panel { display:grid; gap:10px; }
.trade-offer-block { border:1px solid #39484e; background:#0e1518; }
.trade-offer-block.other { border-color:#4d4540; }
.trade-offer-slots { display:grid; grid-template-columns:repeat(5,minmax(54px,1fr)); gap:6px; padding:9px; }
.trade-offer-slot { min-width:0; height:78px; display:grid; place-items:center; align-content:center; gap:4px; padding:4px; border:1px dashed #46565c; border-radius:0; background:#0a1114; color:#7d8c91; text-align:center; }
.trade-offer-slot.empty span { font-size:1rem; }.trade-offer-slot.empty small { font-size:.42rem; }
.trade-offer-slot.filled { border-style:solid; cursor: url('/assets/ui/hand.gif') 0 0, pointer; color:var(--paper); }
.trade-offer-slot.filled > span { width:32px; height:32px; display:grid; place-items:center; }
.trade-offer-slot.filled b { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.44rem; }
.trade-offer-slot.drop-ready { border-style:solid; border-color:var(--teal); background:rgba(53,118,113,.16); }
.trade-offer-gold { display:flex; align-items:center; justify-content:flex-end; gap:6px; padding:0 9px 9px; color:var(--gold-soft); font-size:.55rem; }
.trade-confirm-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto; gap:8px; align-items:center; margin-top:13px; padding-top:10px; border-top:1px solid #334148; }
.trade-confirm-row small { color:var(--muted); font-size:.5rem; line-height:1.35; }
.trade-empty { color:var(--muted); font-size:.52rem; padding:10px; }
#game-surface.battle-result-over-chat .app-view {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  z-index: 260;
}
@media (max-width:720px) { .trade-modal-grid { grid-template-columns:1fr; } .trade-inventory-list { max-height:190px; } .trade-gold-form { grid-template-columns:1fr 1fr; } .trade-gold-form button { grid-column:1/-1; } .trade-offer-slots { grid-template-columns:repeat(5,minmax(42px,1fr)); } .trade-offer-slot { height:62px; } }

/* Chat item links: Ctrl+click an owned item to insert a verified clickable snapshot. */
.chat-item-link {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d9c27d;
  font: inherit;
  font-weight: 800;
  line-height: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  cursor: url('/assets/ui/hand.gif') 0 0, pointer;
}
.chat-item-link:hover,
.chat-item-link:focus-visible { color: #f2dda0; outline: none; }
.chat-item-link.uncommon { color: #8fc995; }
.chat-item-link.rare { color: #82b8df; }
.chat-item-link.epic { color: #bd9ae6; }
.chat-item-link.legendary { color: #e2b066; }
.chat-item-preview-modal { max-width: 460px; }
.chat-item-preview-head { display: flex; align-items: center; gap: 11px; padding-right: 26px; }
.chat-item-preview-head h2 { margin: 2px 0 1px; }
.chat-item-preview-head small { color: var(--muted); font-size: .55rem; }
.chat-item-preview-icon { width: 52px; height: 52px; flex: 0 0 52px; display: grid; place-items: center; border: 1px solid #46565c; background: #0b1114; }
.chat-item-preview-icon .item-sprite { transform: scale(1.25); }
.chat-item-preview-effects { display: flex; flex-wrap: wrap; gap: 5px; margin: 12px 0 4px; }
.chat-item-preview-effects span { padding: 4px 6px; border: 1px solid #34454b; background: #10191d; color: #cbd5d7; font-size: .54rem; }
.chat-item-preview-description { margin-top: 10px; padding-top: 9px; border-top: 1px solid #2b393e; }

/* Sep 15 compact utility / quest / guild pass. */
.page-heading h1,
.army-toolbar h1 {
  font-size: clamp(10px, .5vw, 10px);
}

#route-quests .company-step b,
#route-quests .council-featured-card h3,
#route-quests .council-order-card h3 {
  font-family: var(--font-display);
  font-size: clamp(11px, .62vw, 12px);
  font-weight: 700;
}
#route-quests .company-step small,
#route-quests .council-featured-card p,
#route-quests .council-order-card p,
#route-quests .council-section-head p {
  font-size: clamp(9px, .48vw, 9px);
}
#route-quests :is(.primary,.ghost,.secondary) {
  font-size: .6rem;
}
#route-quests .company-step-number,
#route-quests .company-step b,
#route-quests .company-step small,
#route-quests .company-step-state,
#route-quests .quest-progress > div:first-child,
#route-quests .council-rewards > span,
#route-quests .council-complete-banner {
  font-size: clamp(9px, .46vw, 9px);
}
/* Keep quest titles at the requested larger title size after the compact detail override. */
#route-quests .company-step b,
#route-quests .council-featured-card h3,
#route-quests .council-order-card h3 {
  font-size: clamp(11px, .62vw, 12px);
}

#game-surface .page-heading h1,
#route-army .army-toolbar h1 {
  font-size: clamp(10px, .5vw, 10px);
}

/* Sep 15 follow-up: typography, horizontal chat drag, and quest title font reset. */
#route-quests .page-heading p {
  font-size: clamp(9px, .5vw, 10px);
}
#game-surface .page-heading h1,
#route-army .army-toolbar h1 {
  font-size: clamp(15px, .5vw, 10px);
}
/* Restore the pre-pass Company Path title face across every quest title. */
#route-quests .company-step b,
#route-quests .council-featured-card h3,
#route-quests .council-order-card h3 {
  font-family: inherit;
  font-weight: 700;
}
.client2-chat [data-chat-drag-handle] {
  cursor: ew-resize;
  touch-action: none;
}
.stat-box small {
  font-size: clamp(7px, .43vw, 8px);
}
.stat-box b {
  font: 700 clamp(11px, .82vw, 15px) var(--font-display);
}

/* Sep 15 quest typography/alignment follow-up. */
.page-heading p {
  font-size: clamp(9px, .61vw, 12px);
}
.tavern-intro p {
  font-size: clamp(9px, .5vw, 9px);
}
#route-quests .company-step b,
#route-quests .council-featured-card h3,
#route-quests .council-order-card h3 {
  font-family: inherit;
  font-size: clamp(10px, .62vw, 12px);
  font-weight: 700;
}
#route-quests .company-step small,
#route-quests .council-featured-card > p,
#route-quests .council-order-card > p {
  font-size: clamp(8px, .46vw, 9px);
}
#route-quests :is(.primary,.ghost,.secondary) {
  min-height: 23px;
}
#route-quests .company-step {
  align-items: stretch;
}
#route-quests .company-step-current-actions {
  align-self: end;
  justify-self: end;
  justify-content: flex-end;
}
#route-quests .council-order-card {
  display: flex;
  flex-direction: column;
}
#route-quests .council-order-card .button-row {
  margin-top: auto;
  justify-content: flex-end;
  align-items: flex-end;
}
#route-quests .council-order-card [data-council-claim] { order: 2; }
#route-quests .council-order-card [data-council-replace] { order: 1; }
#route-quests .council-card-foot {
  margin-top: auto;
  align-items: flex-end;
}

/* Beta v1.2.23: quest status casing + real outer-chat horizontal dragging. */
#route-quests .company-step-state,
#route-quests .quest-progress > div:first-child span {
  text-transform: none;
  letter-spacing: normal;
}
.client2-chat .game-chat-minimized-preview,
.client2-chat .game-chat-body {
  cursor: ew-resize;
  user-select: none;
}
.client2-chat .game-chat-minimized-preview,
.client2-chat .game-chat-log { touch-action: none; }
.client2-chat .game-chat-form,
.client2-chat .game-chat-form :is(input, button, textarea, select, a) {
  cursor: url('/assets/ui/pointer.gif') 0 0, default;
  user-select: auto;
  touch-action: manipulation;
}
.client2-chat.dragging-x,
.client2-chat.dragging-x .game-chat-minimized-preview,
.client2-chat.dragging-x .game-chat-body { cursor: grabbing; }


/* Sep 15 v1.2.23 follow-up: modal/chat layering, Atrium controls, reliable chat drag. */
.modal-backdrop.modal-over-chat { z-index: 400; }
body #game-surface .client2-chat :is(.game-chat-minimized-preview, .game-chat-log) { touch-action: none; }
body #game-surface .client2-chat .game-chat-minimize { cursor: url('/assets/ui/hand.gif') 0 0, pointer; touch-action: manipulation; }

/* Sep 15 visible deployment / post-battle shell correction. */
#game-surface.battle-result-over-chat .game-menu .menu-spacer {
  display: block !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

/* v35 root battle-shell correction: only live combat may use the height-driven 16:9
   iframe. Deployment and result screens must use the exact visible content pane. */
#game-surface.battle-deployment-active .app-view.battle-route-active #route-legacy,
#game-surface.battle-result-over-chat .app-view.battle-route-active #route-legacy {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  container-type: normal !important;
}
#game-surface.battle-deployment-active .app-view.battle-route-active .legacy-frame,
#game-surface.battle-result-over-chat .app-view.battle-route-active .legacy-frame {
  position: relative !important;
  inset: auto !important;
  display: block !important;
  flex: none !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: auto !important;
  margin: 0 !important;
}

/* A battle result always restores the normal shell. These selectors intentionally
   override battle-only fullscreen hiding even if fullscreenMode changes a frame late. */
#game-surface.battle-result-over-chat .app-view.battle-route-active {
  grid-template-rows: 8.5% minmax(0, 1fr) !important;
}
#game-surface.battle-result-over-chat .app-view.battle-route-active .game-topbar,
#game-surface.battle-result-over-chat .app-view.battle-route-active .game-menu {
  display: flex !important;
}
#game-surface.battle-result-over-chat .app-view.battle-route-active .game-layout {
  grid-template-columns: 10% 90% !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}
#game-surface.battle-result-over-chat .game-menu .menu-spacer {
  display: block !important;
  visibility: visible !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
}

/* Result shell must win even against the stronger :fullscreen battle-only rules. */
#game-surface.battle-result-over-chat:fullscreen .app-view.battle-route-active,
#game-surface.battle-result-over-chat:-webkit-full-screen .app-view.battle-route-active {
  grid-template-rows: 8.5% minmax(0, 1fr) !important;
}
#game-surface.battle-result-over-chat:fullscreen .app-view.battle-route-active .game-topbar,
#game-surface.battle-result-over-chat:fullscreen .app-view.battle-route-active .game-menu,
#game-surface.battle-result-over-chat:-webkit-full-screen .app-view.battle-route-active .game-topbar,
#game-surface.battle-result-over-chat:-webkit-full-screen .app-view.battle-route-active .game-menu {
  display: flex !important;
}
#game-surface.battle-result-over-chat:fullscreen .app-view.battle-route-active .game-layout,
#game-surface.battle-result-over-chat:-webkit-full-screen .app-view.battle-route-active .game-layout {
  grid-template-columns: 10% 90% !important;
  width: 100% !important;
  height: 100% !important;
}
#game-surface.battle-result-over-chat:fullscreen .app-view.battle-route-active .legacy-frame,
#game-surface.battle-result-over-chat:-webkit-full-screen .app-view.battle-route-active .legacy-frame {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: auto !important;
}


/* v36 screenshot-verified shell fixes.
   Results must keep the absolute surface geometry; deployment fullscreen must
   use the embedded viewport itself, never a 100vw child inside an 854px track. */
#game-surface.battle-result-over-chat .app-view.battle-route-active {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}
#game-surface.battle-result-over-chat .app-view.battle-route-active .game-layout,
#game-surface.battle-result-over-chat .app-view.battle-route-active .content-view,
#game-surface.battle-result-over-chat .app-view.battle-route-active #route-legacy {
  min-height: 0 !important;
  height: 100% !important;
}


/* Soulstone Store in the Client 2 top bar. */
.soulstone-store-modal { width: min(700px, 94%); }
.soulstone-intro { color: var(--muted); line-height: 1.6; }
.soulstone-pack-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:12px; margin:22px 0; }
.soulstone-pack { border:1px solid #594777; background:radial-gradient(circle at 50% 8%,rgba(172,118,255,.17),transparent 45%),#0d1119; padding:22px; text-align:center; }
.soulstone-pack h3 { margin:10px 0 5px; font-family:var(--font-display); }
.soulstone-pack p,.payment-unavailable { color:var(--muted); font-size:.68rem; line-height:1.5; }
.soulstone-pack .primary { width:100%; }
.soulstone-purchase-notice { margin:18px 0 12px; padding:16px 18px; border:1px solid rgba(197,154,255,.32); background:rgba(38,29,55,.42); color:var(--muted); font-size:.68rem; line-height:1.55; }
.soulstone-purchase-notice h3 { margin:0 0 8px; color:var(--paper); font-family:var(--font-display); font-size:.9rem; }
.soulstone-purchase-notice p { margin:0 0 9px; }
.soulstone-purchase-notice ul { margin:8px 0 10px; padding-left:18px; }
.soulstone-purchase-notice li { margin:5px 0; }
.soulstone-purchase-notice b { color:#e1d4f2; }
.soulstone-rights-note { margin-bottom:0 !important; color:#bcb3c7; }
.soulstone-legal-links { display:flex; flex-wrap:wrap; gap:7px; align-items:center; margin:12px 0; font-size:.65rem; }
.soulstone-legal-links a { color:var(--teal); }
.soulstone-notice-accept { display:flex; align-items:flex-start; gap:10px; padding:11px 12px; border:1px solid #3d4b51; background:rgba(9,14,17,.68); color:var(--paper); font-size:.7rem; line-height:1.45; cursor: url('/assets/ui/hand.gif') 0 0, pointer; }
.soulstone-notice-accept input { flex:0 0 auto; margin:2px 0 0; width:16px; height:16px; accent-color:#a77de8; }
.soulstone-notice-accept:has(input:disabled) { opacity:.55; cursor:not-allowed; }
.payment-unavailable { border:1px solid #71433d; background:#211311; color:#e99487; padding:12px; }

/* Guildfall custom mouse cursors. Keep special states such as text, grab, wait
   and not-allowed intact while replacing the normal arrow and hand pointer. */
@media (pointer: fine) {
  html, body, body * {
    cursor: url('/assets/ui/pointer.gif') 0 0, default;
  }

  a,
  button:not(:disabled),
  [role='button']:not([aria-disabled='true']),
  summary,
  label[for],
  select:not(:disabled),
  input[type='button']:not(:disabled),
  input[type='submit']:not(:disabled),
  input[type='reset']:not(:disabled),
  input[type='checkbox']:not(:disabled),
  input[type='radio']:not(:disabled),
  input[type='range']:not(:disabled),
  [data-action],
  [onclick] {
    cursor: url('/assets/ui/hand.gif') 0 0, pointer;
  }

  input[type='text'],
  input[type='email'],
  input[type='password'],
  input[type='search'],
  input[type='number'],
  input[type='url'],
  input[type='tel'],
  textarea,
  [contenteditable='true'] {
    cursor: text;
  }
}




/* Sep 23: persistent commander-menu actions, including direct Logout. */
.commander-menu-footer {
  position: sticky;
  z-index: 4;
  bottom: -7px;
  display: grid;
  gap: 0;
  margin: 7px -7px -7px;
  padding: 6px 7px 7px;
  border-top: 1px solid #2a373c;
  background: rgba(9,14,17,.985);
  box-shadow: 0 -9px 16px rgba(0,0,0,.24);
}
.commander-menu-footer .commander-menu-setting {
  margin-top: 0;
  border-top: 0;
}
.commander-menu-footer .commander-menu-setting + .commander-menu-setting {
  border-top: 1px solid #2a373c;
}
.commander-menu-logout { color: #e7aaa5; }
.commander-menu-logout span { color: #dc7d75; }
.commander-menu-logout:hover { background: rgba(133,48,44,.28); }

/* Keep the chat composer pinned to the bottom even after fullscreen/resizing.
   Only the message list scrolls; the input never competes with its height. */
#game-surface .client2-chat:not(.minimized) .game-chat-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
#game-surface .client2-chat:not(.minimized) .game-chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
#game-surface .client2-chat:not(.minimized) .game-chat-form {
  flex: 0 0 auto;
  margin-top: auto;
  align-self: stretch;
}

/* Fullscreen Army portraits need more vertical room without cropping the art. */
#game-surface:fullscreen #route-army .hero-grid .army-hero-card .hero-portrait,
#game-surface:-webkit-full-screen #route-army .hero-grid .army-hero-card .hero-portrait {
  height: calc(clamp(154px, 11vw, 210px) + 50px);
}
