:root {
  --bg-0: #03070c;
  --bg-1: #07111d;
  --bg-2: #0b1a29;
  --panel-0: rgba(8, 18, 29, .96);
  --panel-1: rgba(13, 30, 45, .96);
  --panel-2: rgba(18, 39, 56, .94);
  --line: #26445b;
  --line-soft: rgba(114, 183, 222, .18);
  --line-bright: #5db2dc;
  --ice: #67d8ff;
  --frost: #c5f1ff;
  --blue: #2b84b6;
  --gold: #e3bd71;
  --gold-deep: #7b591e;
  --red: #ee6c7d;
  --green: #54d5a6;
  --violet: #b987ff;
  --text: #e5f3fb;
  --muted: #91abc0;
  --dim: #58738a;
  --shadow: rgba(0, 0, 0, .72);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Philosopher", Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg-0); color: var(--text); }
html { overscroll-behavior: none; }
body {
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: "Philosopher", Georgia, serif;
  font-size: 15px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(120% 75% at 50% -10%, rgba(36, 98, 140, .38) 0%, rgba(5, 11, 18, .12) 56%, transparent 75%),
    linear-gradient(180deg, #07111d 0%, #03070c 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  opacity: .18;
  background-image:
    linear-gradient(30deg, rgba(255,255,255,.025) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,.025) 87.5%),
    linear-gradient(150deg, rgba(255,255,255,.018) 12%, transparent 12.5%, transparent 87%, rgba(255,255,255,.018) 87.5%);
  background-size: 36px 62px;
}
button, input, textarea, select { font: inherit; }
button { -webkit-user-select: none; user-select: none; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

.snow { position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: .22; }
.snow::before, .snow::after {
  content: ""; position: absolute; inset: -80px;
  background-image:
    radial-gradient(circle at 20px 20px, rgba(221,247,255,.9) 0 1px, transparent 1.4px),
    radial-gradient(circle at 70px 85px, rgba(221,247,255,.6) 0 1.2px, transparent 1.7px),
    radial-gradient(circle at 120px 45px, rgba(221,247,255,.55) 0 1px, transparent 1.5px);
  background-size: 140px 130px;
  animation: snow-fall 34s linear infinite;
}
.snow-b::before { background-size: 210px 180px; animation-duration: 49s; opacity: .55; }
@keyframes snow-fall { to { transform: translate3d(-40px, 180px, 0); } }

.app-shell {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(3, 9, 15, .66), rgba(3, 7, 12, .95));
  overflow: clip;
}
@media (min-width: 620px) {
  body { padding: 18px 0; }
  .app-shell {
    max-width: 480px;
    min-height: calc(100dvh - 36px);
    border: 1px solid rgba(115, 192, 232, .28);
    border-radius: 24px;
    box-shadow: 0 28px 90px #000, inset 0 0 0 1px rgba(255,255,255,.03);
  }
  .drawer { left: calc(50% - 240px) !important; }
  .battle-dock { max-width: 478px !important; bottom: 18px !important; }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(8px + var(--safe-top)) 12px 9px;
  background:
    linear-gradient(180deg, rgba(16, 37, 55, .98), rgba(6, 16, 27, .98)),
    url('/static/assets/ui/panel.png');
  border-bottom: 1px solid var(--line-bright);
  box-shadow: 0 10px 28px rgba(0,0,0,.72), inset 0 -1px 0 rgba(255,255,255,.04);
}
.topbar::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(112, 219, 255, .65), transparent);
}
.menu-button {
  position: absolute; left: 12px; top: calc(9px + var(--safe-top));
  width: 42px; height: 42px; display: grid; align-content: center; gap: 5px; padding: 0 11px;
  border: 1px solid rgba(103,216,255,.48); border-radius: 10px;
  background: linear-gradient(145deg, rgba(29, 65, 88, .95), rgba(10, 27, 41, .95));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 4px 12px rgba(0,0,0,.48);
}
.menu-button span { display: block; height: 2px; border-radius: 2px; background: var(--frost); box-shadow: 0 0 8px rgba(103,216,255,.35); }
.menu-button:active { transform: translateY(1px) scale(.97); }
.hero-head { min-height: 42px; padding-left: 52px; padding-right: 166px; display: flex; flex-direction: column; justify-content: center; }
.hero-name { max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 700; letter-spacing: .055em; color: var(--frost); text-shadow: 0 1px 0 #000, 0 0 12px rgba(85,199,244,.2); }
.hero-meta { color: var(--muted); font-size: 11px; margin-top: 1px; }
.resource-strip { position: absolute; right: 12px; top: calc(10px + var(--safe-top)); display: flex; gap: 5px; }
.resource-pill { min-width: 45px; height: 38px; padding: 4px 6px; display: flex; align-items: center; justify-content: center; gap: 3px; border: 1px solid rgba(107,167,200,.25); border-radius: 9px; background: rgba(3, 11, 18, .62); box-shadow: inset 0 1px 0 rgba(255,255,255,.035); font-size: 11px; }
.resource-pill img { width: 19px; height: 19px; object-fit: contain; image-rendering: pixelated; }
.resource-pill b { max-width: 55px; overflow: hidden; text-overflow: ellipsis; }
.resource-pill:first-child b { color: var(--gold); }
.resource-pill:nth-child(2) b { color: var(--ice); }
.resource-pill.power b { color: var(--frost); }
.xp-track { position: relative; height: 15px; margin-top: 7px; overflow: hidden; border: 1px solid #24465f; border-radius: 4px; background: #02070b; box-shadow: inset 0 1px 6px #000; }
.xp-fill { width: 0; height: 100%; background: linear-gradient(90deg, #17597f, #2fa8d9 65%, #83e6ff); box-shadow: 0 0 10px rgba(78,204,255,.46); transition: width .35s ease; }
.xp-track span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 9px; font-weight: 700; letter-spacing: .03em; color: #eefbff; text-shadow: 0 1px 2px #000; }

.view { padding: 13px 12px calc(92px + var(--safe-bottom)); min-height: calc(100dvh - 80px); }
.screen-head { margin-bottom: 11px; }
.screen-head .eyebrow { margin: 0 0 2px; color: var(--gold); font-size: 10px; letter-spacing: .19em; }
.screen-head h1 { margin: 0; color: var(--frost); font-size: 22px; letter-spacing: .07em; text-transform: uppercase; }
.screen-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.panel {
  position: relative;
  margin-bottom: 11px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background:
    linear-gradient(160deg, rgba(24, 48, 66, .94), rgba(7, 17, 27, .97) 67%),
    url('/static/assets/ui/panel.png');
  box-shadow: 0 8px 22px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.045), inset 0 -1px 0 rgba(0,0,0,.52);
  overflow: hidden;
}
.panel::before { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: linear-gradient(115deg, rgba(255,255,255,.045), transparent 35%, transparent 70%, rgba(69,150,192,.035)); }
.panel > * { position: relative; z-index: 1; }
.panel.gold-panel { border-color: rgba(227,189,113,.47); background: linear-gradient(160deg, rgba(67,50,24,.92), rgba(17,15,12,.97) 70%); }
.panel.danger-panel { border-color: rgba(238,108,125,.48); background: linear-gradient(160deg, rgba(63,26,35,.94), rgba(16,9,14,.97) 70%); }
.panel-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 14px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--frost); }
.panel-title img { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; }
.panel-title small { margin-left: auto; font-size: 10px; font-weight: 400; color: var(--muted); letter-spacing: 0; text-transform: none; }
.panel-copy { color: var(--muted); font-size: 12px; }

.button {
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid #375e78;
  border-radius: 9px;
  color: var(--text);
  background: linear-gradient(180deg, #203e54, #102638);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 4px 10px rgba(0,0,0,.32);
  font-weight: 700;
  letter-spacing: .015em;
  cursor: pointer;
  transition: transform .12s ease, filter .14s ease, border-color .14s ease;
}
.button:hover { border-color: #5c9ec4; filter: brightness(1.06); }
.button:active { transform: translateY(1px) scale(.985); }
.button:disabled { opacity: .38; filter: grayscale(.45); cursor: default; }
.button.primary, .button.ice { border-color: rgba(103,216,255,.72); background: linear-gradient(180deg, #2b8db7, #155778); color: #f4fcff; }
.button.gold { border-color: rgba(227,189,113,.7); background: linear-gradient(180deg, #8f6b25, #523b13); color: #fff1c9; }
.button.red { border-color: rgba(238,108,125,.72); background: linear-gradient(180deg, #8c3549, #4c1825); }
.button.ghost { background: rgba(4,13,21,.5); box-shadow: none; }
.button.compact { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.button.tiny { min-height: 28px; padding: 4px 8px; font-size: 10px; }
.button.wide { width: 100%; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }
.button-row .button { flex: 1 1 120px; }

.battle-scene {
  position: relative;
  min-height: 390px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 13px 13px;
  border: 1px solid rgba(91,175,217,.46);
  border-radius: 16px;
  overflow: hidden;
  background-position: center;
  background-size: cover;
  box-shadow: 0 14px 32px rgba(0,0,0,.58), inset 0 0 48px rgba(0,0,0,.5);
}
.battle-scene::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(2,8,14,.18), rgba(2,8,14,.34) 43%, rgba(2,7,12,.91) 100%), radial-gradient(circle at 50% 42%, transparent 0 26%, rgba(1,6,10,.38) 75%); }
.battle-scene::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), inset 0 -60px 90px rgba(0,0,0,.66); pointer-events: none; }
.scene-top, .scene-center, .scene-bottom { position: relative; z-index: 1; }
.zone-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 80%; padding: 5px 9px; border: 1px solid rgba(143,216,246,.35); border-radius: 99px; background: rgba(2,11,18,.68); color: var(--frost); font-size: 11px; box-shadow: 0 3px 10px rgba(0,0,0,.44); }
.zone-chip b { color: var(--gold); }
.scene-center { display: flex; flex-direction: column; align-items: center; margin: 3px 0 10px; }
.enemy-frame { width: 210px; height: 210px; display: grid; place-items: center; position: relative; }
.enemy-frame::before { content: ""; position: absolute; width: 80%; height: 28%; bottom: 4px; border-radius: 50%; background: radial-gradient(ellipse, rgba(0,0,0,.72), transparent 68%); filter: blur(3px); }
.enemy-art { position: relative; width: 190px; height: 190px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 10px 16px rgba(0,0,0,.7)); transform-origin: 50% 80%; animation: enemy-breathe 3.6s ease-in-out infinite; }
.boss-scene .enemy-art { width: 206px; height: 206px; filter: drop-shadow(0 0 18px rgba(238,108,125,.27)) drop-shadow(0 12px 18px rgba(0,0,0,.75)); }
@keyframes enemy-breathe { 50% { transform: translateY(-3px) scale(1.015); } }
.enemy-title { margin-top: -3px; text-align: center; }
.enemy-title h2 { margin: 0; font-size: 21px; color: #f1fbff; text-shadow: 0 2px 3px #000; }
.enemy-title p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.hp-track, .meter { position: relative; height: 18px; overflow: hidden; border: 1px solid #36566c; border-radius: 5px; background: #02070b; box-shadow: inset 0 2px 6px #000; }
.hp-fill { height: 100%; background: linear-gradient(90deg, #792a3d, #d6536b 75%, #ff8697); transition: width .22s linear; }
.hero-hp .hp-fill { background: linear-gradient(90deg, #1b7259, #45c49a 75%, #7be0bd); }
.hp-track span, .meter span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; color: #f5fbff; text-shadow: 0 1px 2px #000; }
.combat-bars { display: grid; gap: 6px; }
.combat-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; color: var(--muted); font-size: 10px; }
.boss-timer { color: var(--red); font-weight: 700; }

.zone-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.zone-card { position: relative; min-height: 78px; padding: 9px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background-size: cover; background-position: center; text-align: left; color: var(--text); }
.zone-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(3,10,16,.91), rgba(3,10,16,.42)); }
.zone-card > * { position: relative; z-index: 1; }
.zone-card.current { border-color: var(--ice); box-shadow: 0 0 16px rgba(103,216,255,.18); }
.zone-card.locked { opacity: .38; filter: grayscale(.55); }
.zone-card b { display: block; color: var(--frost); font-size: 12px; }
.zone-card small { color: var(--muted); font-size: 9px; }

.log-list { display: grid; gap: 5px; max-height: 138px; overflow: hidden; }
.log-entry { padding: 5px 8px; border-left: 2px solid #315e79; background: rgba(3,11,18,.42); color: var(--muted); font-size: 11px; }
.log-entry:first-child { color: var(--text); border-left-color: var(--ice); }
.empty-state { padding: 18px 10px; text-align: center; color: var(--muted); font-size: 12px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.stat-card { padding: 9px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(4,13,21,.48); }
.stat-card span { display: block; color: var(--muted); font-size: 10px; }
.stat-card b { display: block; margin-top: 2px; color: var(--frost); font-size: 16px; }
.kv-list { display: grid; gap: 1px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.045); font-size: 12px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { text-align: right; }

.equipment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.equipment-slot { min-height: 119px; padding: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(145deg, rgba(22,45,63,.82), rgba(4,13,21,.82)); text-align: center; cursor: pointer; }
.equipment-slot.empty { opacity: .48; }
.equipment-slot img { width: 62px; height: 62px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 5px 7px rgba(0,0,0,.5)); }
.equipment-slot .slot-name { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.equipment-slot .item-name { font-size: 11px; font-weight: 700; line-height: 1.12; }
.item-list { display: grid; gap: 7px; }
.item-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 9px; align-items: center; min-height: 72px; padding: 7px 8px; border: 1px solid var(--line); border-left-width: 3px; border-radius: 10px; background: linear-gradient(145deg, rgba(20,40,57,.86), rgba(5,14,23,.88)); cursor: pointer; }
.item-row img { width: 54px; height: 54px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 4px 6px rgba(0,0,0,.55)); }
.item-main { min-width: 0; }
.item-main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.item-main small { display: block; color: var(--muted); margin-top: 3px; font-size: 9px; }
.item-power { min-width: 48px; text-align: right; }
.item-power b { display: block; color: var(--frost); font-size: 12px; }
.item-power em { font-style: normal; font-size: 9px; }
.delta-up { color: var(--green); }
.delta-down { color: var(--red); }
.rarity-common { border-left-color: #91a0aa; }
.rarity-uncommon { border-left-color: #58c780; }
.rarity-rare { border-left-color: #50aef2; }
.rarity-epic { border-left-color: #ac74eb; }
.rarity-legendary { border-left-color: #e0a23d; box-shadow: 0 0 15px rgba(224,162,61,.08); }
.rarity-mythic { border-left-color: #ff7272; box-shadow: 0 0 18px rgba(255,114,114,.12); }
.text-common { color: #c6d0d6; }
.text-uncommon { color: #73dc98; }
.text-rare { color: #6dc4ff; }
.text-epic { color: #c99cff; }
.text-legendary { color: #f0c05d; }
.text-mythic { color: #ff8b8b; }

.forge-tier-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.forge-tier-strip::-webkit-scrollbar { display: none; }
.tier-button { min-width: 60px; padding: 8px 6px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5,15,24,.7); color: var(--muted); text-align: center; }
.tier-button b { display: block; color: var(--text); }
.tier-button.active { border-color: var(--ice); background: rgba(27,75,102,.55); color: var(--frost); }
.tier-button:disabled { opacity: .3; }
.forge-slot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.forge-slot { min-height: 75px; padding: 7px 3px; display: grid; place-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5,15,24,.72); color: var(--muted); font-size: 9px; text-align: center; }
.forge-slot img { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.forge-slot.active { border-color: var(--ice); color: var(--frost); background: rgba(26,75,101,.5); }
.cost-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0; }
.cost-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 7px; border: 1px solid var(--line-soft); border-radius: 99px; background: rgba(3,11,18,.55); color: var(--muted); font-size: 10px; }
.cost-chip img { width: 16px; height: 16px; image-rendering: pixelated; }
.queue-list { display: grid; gap: 7px; }
.queue-job { padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(4,13,21,.5); }
.queue-job-head { display: flex; justify-content: space-between; font-size: 11px; }
.queue-job-head span { color: var(--muted); }
.progress { height: 9px; margin-top: 6px; overflow: hidden; border: 1px solid #29475b; border-radius: 99px; background: #02070b; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #1f6d95, #67d8ff); }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; padding: 7px 10px; border: 1px solid var(--line); border-radius: 99px; background: rgba(4,13,21,.55); color: var(--muted); font-size: 11px; }
.tab.active { border-color: var(--ice); color: var(--frost); background: rgba(28,80,108,.52); }
.skill-branch { display: grid; gap: 7px; margin-top: 10px; }
.skill-node { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(145deg, rgba(22,43,59,.75), rgba(5,14,22,.8)); }
.skill-node.locked { opacity: .45; }
.skill-node-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.skill-node h3 { margin: 0; font-size: 13px; color: var(--frost); }
.skill-node p { margin: 4px 0 7px; color: var(--muted); font-size: 10px; }
.pips { display: flex; gap: 4px; }
.pips i { width: 8px; height: 8px; border-radius: 50%; background: #253a49; }
.pips i.on { background: var(--ice); box-shadow: 0 0 7px rgba(103,216,255,.55); }

.offer-grid, .pet-grid, .profession-grid, .opponent-grid { display: grid; gap: 8px; }
.offer-card, .pet-card, .profession-card, .opponent-card { display: grid; grid-template-columns: 58px minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: rgba(5,15,24,.68); }
.offer-card img, .pet-card img { width: 54px; height: 54px; object-fit: contain; image-rendering: pixelated; }
.offer-card h3, .pet-card h3, .profession-card h3, .opponent-card h3 { margin: 0; font-size: 13px; color: var(--frost); }
.offer-card p, .pet-card p, .profession-card p, .opponent-card p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.profession-card { grid-template-columns: minmax(0,1fr) auto; }
.selected-card { border-color: var(--gold); background: linear-gradient(145deg, rgba(70,51,20,.68), rgba(15,13,9,.75)); }
.locked-card { opacity: .38; }

.quest-card { padding: 10px; margin-bottom: 7px; border: 1px solid var(--line); border-radius: 10px; background: rgba(5,15,24,.62); }
.quest-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.quest-head span { color: var(--muted); }
.quest-card.done { border-color: rgba(84,213,166,.45); }
.quest-card.claimed { opacity: .55; }

.rank-list { display: grid; gap: 6px; }
.rank-row { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 8px 9px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(4,13,21,.5); }
.rank-row.player { border-color: var(--ice); background: rgba(24,69,94,.45); }
.rank-num { color: var(--gold); font-size: 15px; font-weight: 700; text-align: center; }
.rank-name b { display: block; font-size: 12px; }
.rank-name small { color: var(--muted); font-size: 9px; }
.rank-power { text-align: right; color: var(--frost); font-size: 11px; }

.material-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.material-card { padding: 8px 4px; text-align: center; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(4,13,21,.45); }
.material-card img { width: 30px; height: 30px; margin: 0 auto 3px; object-fit: contain; image-rendering: pixelated; }
.material-card b { display: block; color: var(--frost); font-size: 12px; }
.material-card span { color: var(--muted); font-size: 8px; }

.text-input, .text-area, select {
  width: 100%; border: 1px solid #31536a; border-radius: 9px; background: rgba(2,8,13,.86); color: var(--text); padding: 10px 11px; outline: none; box-shadow: inset 0 2px 7px rgba(0,0,0,.5);
}
.text-input:focus, .text-area:focus, select:focus { border-color: var(--ice); box-shadow: 0 0 0 2px rgba(103,216,255,.1), inset 0 2px 7px rgba(0,0,0,.5); }
.text-area { min-height: 150px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.field-label { display: block; margin: 8px 0 5px; color: var(--muted); font-size: 11px; }

.battle-dock {
  position: fixed; z-index: 28; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 480px; min-height: 60px;
  padding: 8px 12px calc(8px + var(--safe-bottom));
  display: flex; align-items: center; gap: 9px;
  border-top: 1px solid rgba(103,216,255,.44);
  background: linear-gradient(180deg, rgba(11,27,41,.97), rgba(4,12,20,.99));
  box-shadow: 0 -8px 25px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.035);
}
.status-line { flex: 1; min-width: 0; color: var(--muted); font-size: 10px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.72); opacity: 0; pointer-events: none; transition: opacity .24s ease; backdrop-filter: blur(2px); }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; z-index: 61; left: 0; top: 0; bottom: 0; width: min(84vw, 330px);
  padding-top: var(--safe-top); display: flex; flex-direction: column;
  transform: translateX(-103%); transition: transform .26s cubic-bezier(.2,.7,.2,1);
  border-right: 1px solid rgba(103,216,255,.46);
  background: linear-gradient(180deg, rgba(13,31,47,.995), rgba(3,10,17,.995));
  box-shadow: 16px 0 55px rgba(0,0,0,.74), inset -1px 0 0 rgba(255,255,255,.025);
}
.drawer.open { transform: translateX(0); }
.drawer-hero { min-height: 92px; padding: 15px 14px 13px; display: grid; grid-template-columns: 58px minmax(0,1fr) 32px; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); background: radial-gradient(circle at 10% 10%, rgba(58,138,181,.22), transparent 48%); }
.drawer-emblem { width: 58px; height: 58px; padding: 4px; border: 1px solid rgba(227,189,113,.48); border-radius: 13px; background: rgba(2,8,13,.7); box-shadow: 0 6px 15px rgba(0,0,0,.55); }
.drawer-emblem img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.drawer-name { color: var(--frost); font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-meta { color: var(--muted); font-size: 10px; margin-top: 2px; }
.drawer-close, .modal-close { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: rgba(3,10,17,.7); color: var(--muted); font-size: 22px; line-height: 1; }
.drawer-nav { flex: 1; overflow-y: auto; padding: 7px 0; overscroll-behavior: contain; }
.nav-button { position: relative; width: 100%; min-height: 49px; padding: 7px 13px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 10px; align-items: center; border: 0; border-left: 3px solid transparent; background: transparent; color: var(--muted); text-align: left; }
.nav-button img { width: 30px; height: 30px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); }
.nav-button span { font-weight: 700; font-size: 13px; }
.nav-button small { color: var(--dim); font-size: 9px; }
.nav-button.active { border-left-color: var(--ice); color: var(--frost); background: linear-gradient(90deg, rgba(31,89,119,.55), rgba(15,44,62,.18)); }
.nav-button.locked { opacity: .45; }
.nav-badge { min-width: 21px; padding: 2px 6px; border-radius: 99px; background: var(--gold); color: #201505 !important; text-align: center; font-size: 9px !important; }
.drawer-foot { padding: 10px 14px calc(10px + var(--safe-bottom)); border-top: 1px solid var(--line); color: var(--dim); font-size: 9px; }

.modal { position: fixed; inset: 0; z-index: 90; padding: calc(16px + var(--safe-top)) 14px calc(16px + var(--safe-bottom)); display: grid; place-items: center; background: rgba(0,0,0,.82); backdrop-filter: blur(5px); }
.modal-card { position: relative; width: 100%; max-width: 430px; max-height: 92dvh; overflow-y: auto; padding: 18px; border: 1px solid rgba(103,216,255,.48); border-radius: 16px; background: linear-gradient(160deg, #132c40, #07111d 62%, #040a10); box-shadow: 0 24px 80px #000, inset 0 1px 0 rgba(255,255,255,.06); animation: modal-in .22s ease both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-close { position: absolute; right: 10px; top: 10px; z-index: 2; }
.brand-mark { width: 82px; height: 82px; margin: -2px auto 6px; padding: 5px; border: 1px solid rgba(227,189,113,.55); border-radius: 18px; background: rgba(2,8,13,.65); box-shadow: 0 9px 20px rgba(0,0,0,.55); }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.create-card { text-align: center; }
.create-card .eyebrow { margin: 0; color: var(--gold); font-size: 9px; letter-spacing: .2em; }
.create-card h1 { margin: 2px 0 5px; color: var(--frost); font-size: 31px; letter-spacing: .1em; }
.create-card .lead { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.create-card .field-label { text-align: left; }
.class-grid { display: grid; gap: 8px; margin: 11px 0 14px; text-align: left; }
.class-card { display: grid; grid-template-columns: 58px minmax(0,1fr); gap: 10px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 11px; background: rgba(4,13,21,.58); cursor: pointer; }
.class-card.selected { border-color: var(--ice); background: rgba(27,76,102,.48); box-shadow: 0 0 16px rgba(103,216,255,.1); }
.class-card img { width: 54px; height: 54px; object-fit: contain; image-rendering: pixelated; }
.class-card h3 { margin: 0; color: var(--frost); font-size: 14px; }
.class-card p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.detail-card { text-align: left; }
.detail-hero { display: grid; grid-template-columns: 94px minmax(0,1fr); gap: 12px; align-items: center; margin-bottom: 12px; }
.detail-hero img { width: 94px; height: 94px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 7px 9px rgba(0,0,0,.55)); }
.detail-hero h2 { margin: 0; padding-right: 28px; color: var(--frost); font-size: 18px; }
.detail-hero p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.detail-stats { display: grid; gap: 5px; margin: 10px 0; }
.detail-stat { display: flex; justify-content: space-between; padding: 6px 8px; border: 1px solid var(--line-soft); border-radius: 7px; background: rgba(3,10,17,.55); font-size: 11px; }
.detail-stat span { color: var(--muted); }

.toast { position: fixed; z-index: 120; left: 50%; bottom: calc(74px + var(--safe-bottom)); transform: translate(-50%, 12px); width: max-content; max-width: calc(100vw - 30px); padding: 9px 13px; border: 1px solid var(--line-bright); border-radius: 10px; background: rgba(12,31,47,.97); color: var(--text); box-shadow: 0 12px 35px rgba(0,0,0,.7); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; text-align: center; font-size: 11px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--red); }
.offline-banner { position: fixed; z-index: 119; top: calc(10px + var(--safe-top)); left: 50%; transform: translateX(-50%); width: min(92vw, 430px); padding: 10px 12px; border: 1px solid rgba(227,189,113,.58); border-radius: 11px; background: rgba(47,36,17,.98); color: #ffedbd; box-shadow: 0 12px 30px rgba(0,0,0,.66); font-size: 11px; text-align: center; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 9px; }
.badge.gold { border-color: rgba(227,189,113,.45); color: var(--gold); }
.badge.green { border-color: rgba(84,213,166,.4); color: var(--green); }
.badge.red { border-color: rgba(238,108,125,.4); color: var(--red); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.tiny { font-size: 10px; }
.center { text-align: center; }
.separator { height: 1px; margin: 10px 0; background: linear-gradient(90deg, transparent, var(--line), transparent); }

@media (max-width: 370px) {
  .hero-head { padding-right: 142px; }
  .resource-pill { min-width: 39px; padding: 4px; }
  .resource-pill img { width: 16px; height: 16px; }
  .equipment-grid { gap: 6px; }
  .equipment-slot { min-height: 108px; }
  .forge-slot-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .enemy-frame { width: 188px; height: 188px; }
  .enemy-art { width: 172px; height: 172px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
