:root {
  --blue: #087bd6;
  --deep: #082f55;
  --ink: #14324d;
  --muted: #628097;
  --cream: #fffdf7;
  --line: #cadde9;
  --yellow: #ffc928;
  --green: #62c63d;
  --location-accent: #72c63d;
  color-scheme: light;
  font-family: Inter, ui-rounded, "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { width: 100%; height: 100%; min-height: 100%; margin: 0; overflow: hidden; background: #071e35; }
body { position: fixed; inset: 0; width: 100%; height: 100%; min-height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; background: #071e35; color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(16,143,235,.35); outline-offset: 2px; }
#app { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; max-height: 100dvh; min-height: 0; overflow: clip; contain: strict; background: #071e35; }
.home-screen, .game-screen { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; }
#app[data-screen="home"] .game-screen, #app[data-screen="game"] .home-screen { visibility: hidden; pointer-events: none; }
.atlas-cell { display: block; background-image: var(--atlas); background-repeat: no-repeat; background-size: var(--atlas-size); background-position: var(--atlas-x) var(--atlas-y); }
.ui-icon { display: block; width: 1em; height: 1em; overflow: visible; fill: none; color: currentColor; }
.icon-slot { display: inline-grid; place-items: center; flex: 0 0 auto; }

/* Home */
.home-screen { isolation: isolate; overflow: hidden; background: #2f8f51; }
.home-backdrop { position: absolute; inset: -3%; z-index: -3; background: url('/assets/v1.6/maps/arrival-plaza.webp') 50% 52% / cover no-repeat; transform: scale(1.03); filter: saturate(1.08) contrast(1.03); }
.home-vignette { position: absolute; inset: 0; z-index: -2; background: linear-gradient(90deg,rgba(2,31,52,.74) 0%,rgba(2,42,60,.22) 45%,rgba(2,28,51,.2) 100%),linear-gradient(0deg,rgba(1,20,38,.65),transparent 42%); }
.home-topbar { position: absolute; z-index: 3; top: max(22px,env(safe-area-inset-top)); left: max(28px,env(safe-area-inset-left)); right: max(28px,env(safe-area-inset-right)); display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: white; text-shadow: 0 3px 10px rgba(0,25,48,.32); }
.brand-mark { display: grid; place-items: center; width: 49px; height: 49px; border: 3px solid white; border-radius: 16px; background: linear-gradient(145deg,#17a8f2,#0757b2); box-shadow: 0 8px 22px rgba(0,30,60,.3); color: #ffda3a; font-size: 26px; }
.brand-mark .ui-icon { width: 30px; height: 30px; }
.brand b { display: block; font-size: clamp(24px,3vw,39px); font-weight: 1000; letter-spacing: -2.5px; line-height: .9; }
.brand b span { color: #ffcf27; }
.brand small { display: block; margin-top: 5px; font-size: 8px; font-weight: 900; letter-spacing: 2px; }
.home-resources { display: flex; gap: 8px; }
.home-resources span { display: flex; align-items: center; gap: 5px; padding: 11px 15px; border: 1px solid rgba(255,255,255,.8); border-radius: 16px; background: rgba(255,253,247,.91); box-shadow: 0 8px 25px rgba(0,31,58,.2); color: #17466e; font-size: 12px; backdrop-filter: blur(12px); }
.home-resources .ui-icon { width: 18px; height: 18px; }
.home-resources span:first-child { color: #c28700; }

.hero-card { position: absolute; z-index: 2; left: max(5vw,env(safe-area-inset-left)); top: 50%; width: min(430px,42vw); padding: 24px; transform: translateY(-46%); border: 1px solid rgba(255,255,255,.85); border-radius: 28px; background: rgba(255,253,247,.93); box-shadow: 0 26px 75px rgba(0,28,50,.4); backdrop-filter: blur(16px); }
.hero-card-head { display: flex; align-items: center; gap: 14px; }
.avatar-ring { position: relative; flex: 0 0 76px; height: 76px; overflow: hidden; border: 4px solid #80ccff; border-radius: 22px; background: #e6f6ff; box-shadow: inset 0 0 0 2px white; }
.hero-card-head small { display: block; color: var(--blue); font-size: 8px; font-weight: 950; letter-spacing: 1.4px; }
.hero-card-head strong { display: block; margin: 1px 0; font-size: 27px; letter-spacing: -.8px; }
.hero-card-head em { color: #627f95; font-size: 10px; font-style: normal; font-weight: 700; }
.xp-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; margin: 15px 0; }
.xp-row > span { height: 10px; overflow: hidden; border-radius: 8px; background: #d3e2eb; }
.xp-row i { display: block; width: 58%; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#08a5ff,#086bce); }
.xp-row b { color: #41627b; font-size: 9px; }
.hero-card > p { margin: 0 0 17px; color: #4d6c82; font-size: 11px; line-height: 1.5; }
.name-field { display: grid; grid-template-columns: 102px 1fr; align-items: center; gap: 8px; color: #59748a; font-size: 10px; font-weight: 850; }
.name-field input { width: 100%; height: 42px; padding: 0 13px; border: 1px solid #bfd5e3; border-radius: 12px; background: white; color: var(--ink); font-weight: 850; }
.skin-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 11px 0; }
.skin-picker button { display: grid; grid-template-columns: 35px 1fr; align-items: center; gap: 6px; min-height: 45px; padding: 4px 8px; overflow: hidden; border: 1px solid #c8dbe7; border-radius: 13px; background: white; color: #577389; text-align: left; font-size: 8px; font-weight: 900; }
.skin-picker button.is-active { border: 2px solid var(--blue); background: #e9f6ff; color: #075ea8; }
.trainer-mini { width: 34px; height: 38px; background-image: url('/assets/v1.4/trainers/trainer-male-walk-8dir-6f.png'); background-repeat: no-repeat; background-size: 600% 800%; background-position: 0 0; }
.trainer-mini.female { background-image: url('/assets/v1.4/trainers/trainer-female-walk-8dir-6f.png'); }
.primary-cta { display: flex; align-items: center; justify-content: center; gap: 18px; width: 100%; min-height: 54px; border: 0; border-bottom: 4px solid #064c96; border-radius: 15px; background: linear-gradient(180deg,#149cf3,#0872c9); color: white; box-shadow: 0 10px 24px rgba(4,111,195,.28); font-size: 12px; font-weight: 1000; letter-spacing: .6px; }
.primary-cta span { font-size: 20px; }
.primary-cta .ui-icon { width: 20px; height: 20px; }
.foundation-status { display: flex; align-items: center; gap: 9px; margin-top: 13px; padding-top: 12px; border-top: 1px solid #d8e4eb; }
.foundation-status > i { width: 9px; height: 9px; border-radius: 50%; background: #5dca3d; box-shadow: 0 0 0 4px #daf4d2; }
.foundation-status b, .foundation-status small { display: block; }
.foundation-status b { font-size: 9px; }
.foundation-status small { margin-top: 2px; color: #6d8496; font-size: 8px; }

.home-showcase { position: absolute; z-index: 1; right: 6vw; top: 14%; bottom: 4%; width: min(47vw,690px); pointer-events: none; }
.trainer-showcase { position: absolute; left: 6%; bottom: 0; width: min(27vw,390px); aspect-ratio: 3/4; background: url('/assets/v1.4/trainers/trainer-male-walk-8dir-6f.png') 0 0 / 600% 800% no-repeat; filter: drop-shadow(0 22px 14px rgba(0,23,42,.35)); }
.home-showcase > span { position: absolute; right: 2%; top: 12%; min-width: 180px; padding: 12px 15px; border: 1px solid rgba(255,255,255,.7); border-radius: 17px; background: rgba(4,47,78,.76); color: white; backdrop-filter: blur(10px); }
.home-showcase small, .home-showcase b, .home-showcase em { display: block; }
.home-showcase small { color: #8fe9ff; font-size: 7px; font-weight: 950; letter-spacing: 1px; }
.home-showcase b { margin: 3px 0; font-size: 20px; }
.home-showcase em { color: #d8effa; font-size: 9px; font-style: normal; }
.prototype-note { position: absolute; z-index: 3; left: 50%; bottom: max(10px,env(safe-area-inset-bottom)); transform: translateX(-50%); color: rgba(255,255,255,.78); font-size: 7px; font-weight: 800; letter-spacing: .8px; text-shadow: 0 2px 7px #001c34; }

/* World */
.game-screen { contain: strict; isolation: isolate; overflow: hidden; background: #76b84b; }
#gameCanvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; max-height: none; touch-action: none; }
.world-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg,rgba(3,25,44,.27),transparent 18%,transparent 76%,rgba(2,27,47,.18)); }
.world-topbar { position: absolute; z-index: 15; top: max(16px,env(safe-area-inset-top)); left: max(18px,env(safe-area-inset-left)); right: max(18px,env(safe-area-inset-right)); display: grid; grid-template-columns: minmax(190px,1fr) auto minmax(190px,1fr); align-items: start; gap: 12px; pointer-events: none; }
.player-chip, .world-location, .instance-chip { border: 1px solid rgba(255,255,255,.85); background: rgba(255,253,247,.92); box-shadow: 0 12px 34px rgba(0,30,55,.25); backdrop-filter: blur(12px); pointer-events: auto; }
.player-chip { justify-self: start; display: flex; align-items: center; gap: 9px; min-width: 205px; min-height: 55px; padding: 7px 11px 7px 7px; border-radius: 17px; }
.player-chip-avatar { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 13px; background: linear-gradient(145deg,#1a9bf0,#075cad); color: white; font-weight: 1000; }
.player-chip b, .player-chip small { display: block; }
.player-chip b { font-size: 11px; }
.player-chip small { margin-top: 3px; color: #648095; font-size: 8px; }
#connectionDot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #e7a72e; }
#connectionDot.is-online { background: #58c638; box-shadow: 0 0 0 3px rgba(88,198,56,.18); }
.world-location { display: grid; grid-template-columns: 32px 1fr 14px; align-items: center; gap: 8px; min-width: 235px; min-height: 55px; padding: 7px 12px; border-radius: 17px; color: var(--ink); text-align: left; }
.location-pin { display: grid; place-items: center; width: 32px; height: 38px; border-radius: 11px; background: color-mix(in srgb,var(--location-accent) 17%,white); color: var(--location-accent); font-size: 21px; }
.location-pin .ui-icon { width: 22px; height: 22px; }
.world-location small, .world-location b { display: block; }
.world-location small { color: var(--location-accent); font-size: 7px; font-weight: 950; letter-spacing: 1.1px; }
.world-location b { margin-top: 2px; font-size: 13px; }
.world-location > i { color: #7890a2; font-style: normal; }
.world-location > i .ui-icon { width: 14px; height: 14px; }
.instance-chip { justify-self: end; display: flex; align-items: center; gap: 8px; min-width: 210px; min-height: 55px; padding: 8px 12px; border-radius: 17px; }
.signal-bars { color: var(--blue); font-size: 23px; }
.signal-bars .ui-icon { width: 23px; height: 23px; }
.instance-chip b, .instance-chip small { display: block; }
.instance-chip b { font-size: 10px; }
.instance-chip small { margin-top: 2px; color: #648095; font-size: 7px; }

.world-rail { position: absolute; z-index: 18; left: max(18px,env(safe-area-inset-left)); top: 50%; display: grid; gap: 5px; width: 72px; padding: 7px; transform: translateY(-47%); border: 1px solid rgba(255,255,255,.84); border-radius: 22px; background: rgba(5,49,78,.9); box-shadow: 0 18px 45px rgba(0,25,47,.35); backdrop-filter: blur(12px); }
.world-rail button { position: relative; display: grid; place-items: center; align-content: center; gap: 2px; min-height: 54px; border: 0; border-radius: 15px; background: transparent; color: #dceef8; }
.world-rail button:hover, .world-rail button.is-active { background: linear-gradient(145deg,#169cf1,#0870c6); color: white; }
.world-rail button span { font-size: 22px; line-height: 1; }
.world-rail button span .ui-icon { width: 22px; height: 22px; }
.world-rail button b { font-size: 7px; }
.world-rail button > i { position: absolute; top: 5px; right: 5px; display: grid; place-items: center; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: #ef4f45; color: white; font-size: 7px; font-style: normal; }
.movement-zone { display: none; }
.joystick { position: fixed; z-index: 30; display: none; width: 94px; height: 94px; transform: translate(-50%,-50%); border: 2px solid rgba(255,255,255,.72); border-radius: 50%; background: rgba(5,47,77,.38); box-shadow: inset 0 0 0 12px rgba(255,255,255,.06); pointer-events: none; }
.joystick > span { position: absolute; inset: 23px; border: 1px dashed rgba(255,255,255,.3); border-radius: 50%; }
.joystick > i { position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; transform: translate(-50%,-50%); border: 2px solid rgba(255,255,255,.82); border-radius: 50%; background: linear-gradient(145deg,#1da6f2,#0768bb); box-shadow: 0 8px 19px rgba(0,27,49,.33); }
.mobile-actions { display: none; }
.context-action { position: absolute; z-index: 19; right: max(22px,env(safe-area-inset-right)); bottom: max(24px,env(safe-area-inset-bottom)); display: grid; grid-template-columns: 45px auto; align-items: center; gap: 8px; min-width: 150px; min-height: 58px; padding: 6px 13px 6px 6px; transform: translateY(12px) scale(.96); border: 2px solid rgba(255,255,255,.86); border-radius: 20px; background: rgba(7,52,84,.91); color: white; box-shadow: 0 14px 35px rgba(0,26,49,.32); opacity: 0; pointer-events: none; transition: opacity .18s,transform .18s; backdrop-filter: blur(10px); }
.context-action.is-ready { transform: none; border-color: #ffe15a; opacity: 1; pointer-events: auto; animation: actionPulse 1.7s ease-in-out infinite; }
.context-action > span { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 15px; background: linear-gradient(145deg,#ffd846,#edae16); color: #6b4300; font-size: 22px; font-weight: 1000; }
.context-action > span .ui-icon { width: 25px; height: 25px; }
.context-action b, .context-action small { display: block; text-align: left; }
.context-action b { font-size: 10px; }
.context-action small { max-width: 110px; overflow: hidden; color: #c7e4f4; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
@keyframes actionPulse { 50% { transform: translateY(-3px); box-shadow: 0 17px 38px rgba(0,26,49,.43),0 0 0 5px rgba(255,218,50,.14); } }
.quick-hint { position: absolute; z-index: 12; left: 50%; bottom: 18px; padding: 7px 12px; transform: translateX(-50%); border-radius: 10px; background: rgba(3,39,66,.66); color: #e6f5fc; font-size: 8px; backdrop-filter: blur(8px); }
.loot-feed { position: absolute; z-index: 16; left: 106px; bottom: 24px; display: grid; grid-template-columns: 36px auto; align-items: center; gap: 8px; min-width: 245px; padding: 9px 12px; transform: translateY(20px); border: 1px solid rgba(255,255,255,.65); border-radius: 15px; background: rgba(4,45,73,.75); color: white; opacity: .72; transition: .24s; backdrop-filter: blur(10px); }
.loot-feed.is-active { transform: none; border-color: #ffe162; background: rgba(4,45,73,.94); opacity: 1; }
.loot-feed > span { grid-row: 1/3; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: #f8c82b; color: #634500; font-size: 19px; }
.loot-feed > span .ui-icon, .loot-item-icon { width: 25px; height: 25px; }
.loot-feed b, .loot-feed small { display: block; }
.loot-feed b { font-size: 9px; }
.loot-feed small { color: #c7dfeb; font-size: 7px; }

/* Panels */
.side-panel, .editor-panel, .chat-panel { position: absolute; z-index: 40; border: 1px solid rgba(255,255,255,.9); background: rgba(255,253,248,.97); box-shadow: 0 26px 70px rgba(0,25,47,.4); backdrop-filter: blur(17px); }
.side-panel { top: 86px; right: 18px; bottom: 18px; width: min(480px,calc(100vw - 120px)); padding: 25px; overflow: hidden auto; transform: translateX(calc(100% + 35px)); border-radius: 26px; transition: transform .25s cubic-bezier(.2,.82,.24,1); }
.side-panel.is-open { transform: none; }
.panel-close { position: sticky; z-index: 4; top: 0; float: right; width: 36px; height: 36px; border: 0; border-radius: 11px; background: #e9f4fa; color: #365f7c; font-size: 22px; }
.panel-close .ui-icon, .editor-head button .ui-icon, .chat-head button .ui-icon, .starter-close .ui-icon { width: 18px; height: 18px; margin: auto; }
.sheet-handle { display: none; }
.panel-eyebrow { color: var(--location-accent); font-size: 8px; font-weight: 1000; letter-spacing: 1.4px; }
.panel-title { margin: 4px 42px 5px 0; font-size: 28px; letter-spacing: -.8px; }
.panel-lead { margin: 0 0 18px; color: #57758b; font-size: 11px; line-height: 1.5; }

.region-grid { display: grid; gap: 12px; }
.region-card { overflow: hidden; border: 1px solid #c9dce7; border-radius: 19px; background: white; box-shadow: 0 7px 18px rgba(12,62,94,.08); }
.region-card.is-current { border: 2px solid var(--region-accent); }
.region-preview { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 136px; padding: 13px; overflow: hidden; background-position: center; background-size: cover; color: white; }
.region-preview span { position: absolute; top: 10px; left: 10px; padding: 5px 7px; border-radius: 8px; background: var(--region-accent); font-size: 7px; font-weight: 1000; letter-spacing: .8px; }
.region-preview b { font-size: 20px; text-shadow: 0 2px 8px #001f36; }
.region-preview small { font-size: 8px; }
.region-card > p { min-height: 35px; margin: 10px 12px 5px; color: #58758a; font-size: 9px; line-height: 1.4; }
.region-drops { display: flex; align-items: center; gap: 7px; margin: 5px 12px 10px; }
.region-drops > i { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; background: #fff5cb; color: #b37c00; font-style: normal; }
.region-drops > i .ui-icon { width: 17px; height: 17px; }
.region-card > button span .ui-icon { width: 15px; height: 15px; }
.region-drops b, .region-drops small { display: block; }
.region-drops b { font-size: 8px; }
.region-drops small { color: #668096; font-size: 7px; }
.region-card > button { display: flex; justify-content: space-between; align-items: center; width: calc(100% - 20px); min-height: 39px; margin: 0 10px 10px; padding: 0 13px; border: 0; border-bottom: 3px solid color-mix(in srgb,var(--region-accent) 70%,#17466e); border-radius: 11px; background: var(--region-accent); color: white; font-size: 9px; font-weight: 1000; }
.region-card > button:disabled { border-bottom-color: #9eb0bd; background: #c8d5dc; color: #657d8e; cursor: default; }

.collection-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 9px; }
.creature-card { position: relative; display: grid; grid-template-columns: 82px 1fr; align-items: center; min-height: 101px; padding: 8px; overflow: hidden; border: 1px solid #cbdde8; border-radius: 17px; background: #f6fbfe; }
.creature-card.is-lead { border: 2px solid #eebc1d; background: #fff9df; }
.creature-card.is-locked { filter: grayscale(1); opacity: .52; }
.creature-portrait { width: 78px; height: 78px; border-radius: 14px; background-color: white; }
.creature-card b, .creature-card small, .creature-card .mini-stat { display: block; }
.creature-card b { font-size: 11px; }
.creature-card small { margin-top: 3px; color: #617e93; font-size: 8px; }
.creature-card .mini-stat { margin-top: 6px; color: #8aa0b0; font-size: 6px; font-style: normal; }
.creature-card > em { position: absolute; top: 6px; right: 6px; padding: 4px 6px; border-radius: 7px; background: #f2c425; color: #634900; font-size: 6px; font-style: normal; font-weight: 1000; }

.team-stack { display: grid; gap: 9px; }
.team-card { display: grid; grid-template-columns: 31px 82px 1fr 20px; align-items: center; gap: 8px; width: 100%; min-height: 96px; padding: 8px; border: 1px solid #c8dce7; border-radius: 18px; background: white; color: var(--ink); text-align: left; }
.team-card.is-lead { border: 2px solid var(--location-accent); background: color-mix(in srgb,var(--location-accent) 7%,white); }
.team-card.is-empty { border-style: dashed; color: #8aa0af; }
.team-index { color: #91a8b7; font-size: 9px; font-weight: 1000; }
.team-portrait { width: 78px; height: 78px; border-radius: 14px; background-color: #f1f7fa; }
.team-card small, .team-card b, .team-card em { display: block; }
.team-card small { color: var(--location-accent); font-size: 7px; font-weight: 1000; letter-spacing: .7px; }
.team-card b { margin: 2px 0; font-size: 14px; }
.team-card em { color: #658095; font-size: 8px; font-style: normal; }

.inventory-grid { display: grid; gap: 8px; }
.inventory-card { position: relative; display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 10px; min-height: 76px; padding: 9px; border: 1px solid #d0dfe8; border-left: 4px solid #8eabbc; border-radius: 15px; background: white; }
.inventory-card.rarity-uncommon { border-left-color: #20a9d1; }
.inventory-card.rarity-rare { border-left-color: #a563d7; }
.inventory-card.rarity-epic { border-left-color: #efb51f; }
.item-icon, .item-glyph { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px; background-color: #eaf5fb; }
.item-icon { padding: 4px; overflow: visible; }
.type-icon { display: inline-block; width: 1.15em; height: 1.15em; margin-right: .2em; vertical-align: -.22em; }
.item-glyph { background: linear-gradient(145deg,#edf8fc,#d4ebf5); color: var(--blue); font-size: 27px; font-style: normal; }
.inventory-card b, .inventory-card small { display: block; }
.inventory-card b { font-size: 10px; }
.inventory-card small { margin-top: 4px; color: #6c8497; font-size: 8px; line-height: 1.3; }
.inventory-card > em { padding: 5px 8px; border-radius: 9px; background: #edf5f9; color: #365e79; font-size: 10px; font-style: normal; font-weight: 1000; }
.discovery-score { display: grid; grid-template-columns: 62px 1fr; align-items: center; margin-bottom: 13px; padding: 13px; border-radius: 18px; background: linear-gradient(135deg,#0b7dd2,#13a6e4); color: white; }
.discovery-score > span { grid-row: 1/3; font-size: 36px; }
.discovery-score > span .ui-icon { width: 42px; height: 42px; }
.discovery-score strong { font-size: 29px; line-height: 1; }
.discovery-score small { color: #d3f2ff; font-size: 8px; }
.discovery-list { display: grid; gap: 8px; }
.discovery-list article { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 9px; padding: 11px; border: 1px solid #d2e0e8; border-radius: 14px; background: white; }
.discovery-list article > i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: #e8f1f6; color: #8097a7; font-style: normal; font-weight: 1000; }
.discovery-list article.is-done > i { background: #dcf5d5; color: #43a528; }
.discovery-list article > i .ui-icon { width: 18px; height: 18px; }
.center-card i .ui-icon { display: inline-block; width: 1.15em; height: 1.15em; margin-right: .25em; vertical-align: -.22em; }
.discovery-list b, .discovery-list small { display: block; }
.discovery-list b { font-size: 10px; }
.discovery-list small { margin-top: 3px; color: #6e8698; font-size: 7px; }
.discovery-list article.quest-feature { border-color: #f2cf57; background: linear-gradient(135deg,#fffbed,#fff); }
.binding-list { display: grid; gap: 8px; }
.binding-row { display: grid; grid-template-columns: minmax(130px,1fr) auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid #cfdee7; border-radius: 14px; background: white; }
.binding-row > span b, .binding-row > span small { display: block; }
.binding-row > span b { font-size: 9px; }
.binding-row > span small { margin-top: 3px; color: #728a9b; font-size: 6px; }
.binding-row > div { display: flex; gap: 5px; }
.binding-row button { min-width: 70px; min-height: 34px; padding: 0 8px; border: 1px solid #bcd2df; border-bottom: 3px solid #8ba9ba; border-radius: 10px; background: #edf7fc; color: #245e82; font-size: 8px; font-weight: 1000; }
.binding-row button.is-listening { border-color: #e9b622; background: #fff4b8; color: #7a5200; animation: bindingListen .8s ease-in-out infinite alternate; }
@keyframes bindingListen { to { box-shadow: 0 0 0 4px rgba(244,197,47,.2); } }
.settings-reset { width: 100%; min-height: 39px; margin-top: 10px; border: 1px solid #bcd3e0; border-radius: 12px; background: #eef7fb; color: #38647f; font-size: 7px; font-weight: 1000; }
.battle-setting { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 9px; margin-top: 12px; padding: 12px; border: 1px solid #c9dce7; border-radius: 15px; background: #f7fbfd; }
.battle-setting input { width: 22px; height: 22px; margin: auto; accent-color: #54bd35; }
.battle-setting b, .battle-setting small { display: block; }
.battle-setting b { font-size: 10px; }
.battle-setting small { margin-top: 3px; color: #688297; font-size: 7px; line-height: 1.4; }
.settings-footnote { margin: 10px 2px 0; color: #70889a; font-size: 7px; line-height: 1.5; }

.editor-panel { top: 86px; right: 18px; width: min(390px,calc(100vw - 36px)); max-height: calc(100% - 104px); padding: 20px; overflow: hidden auto; transform: translateX(calc(100% + 35px)); border-radius: 24px; transition: transform .23s; }
.editor-panel.is-open { transform: none; }
.editor-head, .chat-head, .battle-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.editor-head small, .chat-head small, .battle-status small { display: block; color: var(--blue); font-size: 7px; font-weight: 1000; letter-spacing: 1.2px; }
.editor-head b, .chat-head b { font-size: 17px; }
.editor-head button, .chat-head button { width: 34px; height: 34px; border: 0; border-radius: 10px; background: #e8f3f9; color: #41647c; font-size: 20px; }
.editor-panel > p { margin: 11px 0; color: #607b90; font-size: 10px; line-height: 1.45; }
.editor-modes, .editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.editor-modes button, .editor-actions button { min-height: 38px; border: 1px solid #c9dce7; border-radius: 10px; background: white; color: #426983; font-size: 9px; font-weight: 900; }
.editor-modes button { display: flex; align-items: center; justify-content: center; gap: 6px; }
.editor-modes button i .ui-icon { width: 15px; height: 15px; }
.editor-modes button.is-active { border-color: var(--blue); background: var(--blue); color: white; }
.object-catalog { display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; margin: 10px 0; }
.object-catalog button { min-width: 0; padding: 4px; border: 1px solid #cbdde8; border-radius: 12px; background: #f9fcfe; }
.object-catalog button.is-active { border: 2px solid var(--blue); background: #e8f6ff; }
.object-thumb { width: 100%; aspect-ratio: 1; border-radius: 8px; background-color: white; }
.object-catalog small { display: block; height: 17px; overflow: hidden; color: #496a80; font-size: 6px; font-weight: 850; }
.editor-toggle { display: flex; align-items: center; gap: 8px; padding: 9px; border-radius: 10px; background: #edf6fb; font-size: 9px; font-weight: 800; }
.editor-actions { margin-top: 9px; }
.editor-tip { display: block; margin-top: 9px; color: #6c8394; font-size: 8px; }

.chat-panel { left: 104px; bottom: 20px; width: min(430px,calc(100vw - 130px)); height: min(500px,calc(100% - 115px)); padding: 17px; transform: translateY(calc(100% + 35px)); border-radius: 24px; transition: transform .23s; }
.chat-panel.is-open { transform: none; }
.chat-tabs { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin: 13px 0 9px; }
.chat-tabs button { min-height: 34px; border: 0; border-radius: 9px; background: #eaf3f8; color: #5c788d; font-size: 8px; font-weight: 900; }
.chat-tabs button.is-active { background: var(--blue); color: white; }
.chat-log { height: calc(100% - 112px); overflow-y: auto; }
.chat-message { display: grid; grid-template-columns: 30px 1fr; gap: 8px; margin: 8px 0; }
.chat-message > i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: #dff1fc; color: var(--blue); font-size: 10px; font-style: normal; font-weight: 1000; }
.chat-message b { display: block; font-size: 9px; }
.chat-message p { margin: 2px 0 0; color: #4d6d84; font-size: 9px; line-height: 1.35; }
#chatForm { display: grid; grid-template-columns: 1fr 42px; gap: 7px; }
#chatForm input { min-width: 0; height: 41px; padding: 0 12px; border: 1px solid #c7dbe6; border-radius: 11px; background: white; font-size: 10px; }
#chatForm button { border: 0; border-radius: 11px; background: var(--blue); color: white; }
#chatForm button .ui-icon { width: 20px; height: 20px; margin: auto; }

/* Battle */
.battle-hud { position: absolute; z-index: 35; left: 50%; bottom: max(18px,env(safe-area-inset-bottom)); width: min(790px,calc(100vw - 38px)); padding: 13px; transform: translate(-50%,calc(100% + 45px)); border: 1px solid rgba(255,255,255,.88); border-radius: 23px; background: rgba(255,253,248,.96); box-shadow: 0 22px 60px rgba(0,20,42,.43); transition: transform .28s cubic-bezier(.2,.84,.22,1); backdrop-filter: blur(14px); }
.battle-hud.is-open { transform: translate(-50%,0); }
.battle-status b { display: block; max-width: 580px; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.battle-controls { display: flex; gap: 6px; }
#autoBattle { min-width: 76px; height: 34px; border: 1px solid #b8d0df; border-radius: 10px; background: #dbe8ef; color: #617889; font-size: 8px; font-weight: 1000; }
#autoBattle.is-active { border-color: #5ab838; background: #5fc63b; color: white; }
#cancelBattle { min-width: 64px; height: 34px; border: 1px solid #e4b6b2; border-radius: 10px; background: #fff0ef; color: #aa453e; font-size: 7px; font-weight: 1000; }
#cancelBattle:disabled { opacity: .45; cursor: default; }
.battle-skills { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin-top: 9px; }
.battle-skills.is-hidden { display: none; }
.battle-skills button { position: relative; display: grid; grid-template-columns: 43px 1fr auto; align-items: center; gap: 8px; min-height: 57px; padding: 6px 9px 6px 6px; overflow: hidden; border: 1px solid #c7dae6; border-bottom: 3px solid #8daabd; border-radius: 14px; background: #f8fbfd; color: var(--ink); text-align: left; }
.battle-skills button.is-queued { border-color: #10a5eb; background: #e6f7ff; box-shadow: inset 0 0 0 1px #10a5eb; }
.battle-skills button:disabled { filter: grayscale(.45); opacity: .65; cursor: wait; }
.skill-icon { width: 43px; height: 43px; border-radius: 50%; background-color: white; }
.battle-skills b, .battle-skills small { display: block; }
.battle-skills b { font-size: 9px; }
.battle-skills small { margin-top: 3px; color: #6e8597; font-size: 7px; }
.battle-skills em { padding: 4px 6px; border-radius: 7px; background: #e7f0f5; color: #45677e; font-size: 6px; font-style: normal; font-weight: 1000; }
.battle-skills .is-queued em { background: #0d93df; color: white; }
.capture-panel { display: none; grid-template-columns: minmax(170px,1fr) minmax(190px,1.25fr) 82px; align-items: center; gap: 10px; min-height: 88px; margin-top: 9px; padding: 9px; border: 1px solid #b9d9e9; border-radius: 17px; background: linear-gradient(135deg,#eaf8ff,#fff8e4); }
.capture-panel.is-open { display: grid; }
.capture-copy small, .capture-copy b { display: block; }
.capture-copy small { color: #087bc9; font-size: 7px; font-weight: 1000; letter-spacing: .8px; }
.capture-copy b { margin-top: 4px; font-size: 10px; line-height: 1.35; }
.capture-balls { display: flex; gap: 6px; min-width: 0; overflow-x: auto; }
.capture-balls > button { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 5px; min-width: 126px; min-height: 48px; padding: 4px 7px 4px 4px; border: 1px solid #bdd2dd; border-radius: 13px; background: rgba(255,255,255,.82); color: #31566e; text-align: left; }
.capture-balls > button.is-selected { border: 2px solid #0d91dc; background: #e5f6ff; color: #075d9b; }
.capture-ball-icon { width: 34px; height: 34px; }
.capture-balls b, .capture-balls small { display: block; }
.capture-balls b { overflow: hidden; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.capture-balls small { font-size: 7px; font-weight: 1000; }
.capture-empty { color: #9b554e; font-size: 8px; line-height: 1.35; }
.capture-throw { position: relative; display: grid; place-items: center; align-content: center; justify-self: end; width: 76px; height: 76px; padding: 2px; transform: translate(var(--throw-x,0),var(--throw-y,0)) rotate(var(--throw-rotate,0)); border: 2px solid #fff; border-radius: 24px; background: linear-gradient(145deg,#ffffff,#dff2fb); box-shadow: 0 8px 20px rgba(10,72,106,.22); color: #17445f; touch-action: none; transition: transform .16s ease,box-shadow .16s; user-select: none; }
.capture-throw.is-aiming { z-index: 4; transition: none; box-shadow: 0 15px 28px rgba(6,67,103,.34); }
.capture-throw:disabled { filter: grayscale(.8); opacity: .48; cursor: default; }
.capture-throw-icon { width: 49px; height: 49px; pointer-events: none; }
.capture-throw em { margin-top: -5px; font-size: 5px; font-style: normal; font-weight: 1000; pointer-events: none; }
#battleHint { margin: 7px 0 0; color: #698196; font-size: 8px; text-align: center; }
.is-battling .context-action, .is-battling .mobile-actions, .is-battling .loot-feed { opacity: 0; pointer-events: none; }

.mobile-dock { display: none; }
.loading-screen { position: fixed; z-index: 100; inset: 0; display: grid; place-content: center; justify-items: center; background: radial-gradient(circle at 50% 44%,#18a4e9,#0753a5 70%); color: white; opacity: 0; pointer-events: none; transition: opacity .22s; }
.loading-screen.is-open { opacity: 1; pointer-events: auto; }
.loading-screen b { margin-top: 17px; font-size: 19px; }
.loading-screen small { margin-top: 5px; color: #cceeff; font-size: 9px; }
.loading-orbit { position: relative; width: 68px; height: 68px; border: 5px solid rgba(255,255,255,.24); border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; }
.loading-orbit i { position: absolute; inset: 17px; border-radius: 10px; background: #ffd23b; transform: rotate(45deg); }
@keyframes spin { to { transform: rotate(1turn); } }
.toast { position: fixed; z-index: 130; left: 50%; top: max(20px,env(safe-area-inset-top)); max-width: min(520px,calc(100vw - 24px)); padding: 11px 16px; transform: translate(-50%,-28px); border: 1px solid rgba(255,255,255,.7); border-radius: 13px; background: rgba(3,38,65,.92); color: white; box-shadow: 0 13px 35px rgba(0,21,42,.32); font-size: 10px; font-weight: 850; opacity: 0; pointer-events: none; transition: .2s; }
.toast.is-open { transform: translate(-50%,0); opacity: 1; }

/* Dedicated phone HUD */
@media (max-width: 800px), (pointer: coarse) {
  .home-topbar { top: max(10px,env(safe-area-inset-top)); left: max(11px,env(safe-area-inset-left)); right: max(11px,env(safe-area-inset-right)); }
  .brand-mark { width: 37px; height: 37px; border-radius: 12px; font-size: 19px; }
  .brand b { font-size: 23px; letter-spacing: -1.6px; }
  .brand small, .home-resources span:nth-child(n+2) { display: none; }
  .home-resources span { padding: 8px 10px; border-radius: 12px; font-size: 9px; }
  .home-backdrop { background-position: 58% center; }
  .home-vignette { background: linear-gradient(0deg,rgba(2,25,45,.9) 0%,rgba(2,36,60,.28) 65%,rgba(3,38,63,.25)); }
  .home-showcase { left: 9%; right: 2%; top: 11%; bottom: 38%; width: auto; }
  .trainer-showcase { left: 4%; width: min(49vw,250px); }
  .home-showcase > span { display: none; }
  .hero-card { left: max(10px,env(safe-area-inset-left)); right: max(10px,env(safe-area-inset-right)); top: auto; bottom: max(18px,calc(env(safe-area-inset-bottom) + 8px)); width: auto; padding: 15px; transform: none; border-radius: 22px; }
  .hero-card-head { gap: 9px; }
  .avatar-ring { flex-basis: 56px; height: 56px; border-radius: 17px; border-width: 3px; }
  .hero-card-head strong { font-size: 20px; }
  .hero-card > p, .xp-row, .foundation-status, .prototype-note { display: none; }
  .name-field { grid-template-columns: 80px 1fr; margin-top: 9px; }
  .name-field input { height: 37px; }
  .skin-picker { margin: 8px 0; }
  .skin-picker button { min-height: 38px; grid-template-columns: 28px 1fr; font-size: 7px; }
  .trainer-mini { width: 27px; height: 31px; }
  .primary-cta { min-height: 47px; border-bottom-width: 3px; }

  .world-topbar { top: max(7px,env(safe-area-inset-top)); left: max(7px,env(safe-area-inset-left)); right: max(7px,env(safe-area-inset-right)); display: grid; grid-template-columns: 1fr auto; gap: 6px; }
  .player-chip { min-width: 0; min-height: 47px; padding: 5px 8px 5px 5px; border-radius: 14px; }
  .player-chip-avatar { width: 35px; height: 35px; border-radius: 11px; }
  .player-chip b { max-width: 42vw; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .player-chip small { font-size: 6px; }
  .world-location { display: none; }
  .instance-chip { min-width: 0; min-height: 47px; padding: 6px 8px; border-radius: 14px; }
  .signal-bars { font-size: 18px; }
  .instance-chip b { font-size: 7px; }
  .instance-chip small { max-width: 118px; overflow: hidden; font-size: 5px; text-overflow: ellipsis; white-space: nowrap; }
  .world-rail { display: none; }
  .movement-zone { position: absolute; z-index: 8; left: 0; bottom: calc(74px + env(safe-area-inset-bottom)); display: block; width: 58%; height: 62%; touch-action: none; }
  .quick-hint { display: none; }
  .mobile-actions { position: absolute; z-index: 18; right: max(15px,env(safe-area-inset-right)); bottom: calc(158px + env(safe-area-inset-bottom)); display: grid; gap: 8px; }
  .round-quick { display: grid; place-items: center; width: 43px; height: 43px; border: 2px solid rgba(255,255,255,.78); border-radius: 15px; background: rgba(4,52,85,.83); color: white; box-shadow: 0 9px 22px rgba(0,28,50,.28); font-size: 18px; backdrop-filter: blur(8px); }
  .round-quick .ui-icon { width: 21px; height: 21px; }
  .context-action { right: max(13px,env(safe-area-inset-right)); bottom: calc(82px + env(safe-area-inset-bottom)); grid-template-columns: 52px minmax(0,1fr); width: min(190px,calc(100vw - 98px)); min-width: 0; min-height: 66px; padding: 5px 10px 5px 5px; border-radius: 22px; }
  .context-action > span { width: 52px; height: 52px; border-radius: 18px; }
  .context-action b, .context-action small { display: block; min-width: 0; }
  .context-action b { font-size: 10px; }
  .context-action small { max-width: 112px; font-size: 6px; }
  .loot-feed { left: max(8px,env(safe-area-inset-left)); right: 92px; bottom: calc(82px + env(safe-area-inset-bottom)); min-width: 0; padding: 7px 9px; border-radius: 13px; transform: translateY(16px); }
  .loot-feed > span { width: 32px; height: 32px; border-radius: 10px; }
  .loot-feed b { font-size: 8px; }
  .loot-feed small { font-size: 6px; }
  .mobile-dock { position: absolute; z-index: 23; left: max(7px,env(safe-area-inset-left)); right: max(7px,env(safe-area-inset-right)); bottom: max(6px,env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5,1fr); height: 67px; padding: 5px; border: 1px solid rgba(255,255,255,.9); border-radius: 22px; background: rgba(255,253,248,.95); box-shadow: 0 13px 35px rgba(0,27,49,.34); backdrop-filter: blur(14px); }
  .mobile-dock button { display: grid; place-items: center; align-content: center; gap: 2px; min-width: 0; border: 0; border-radius: 15px; background: transparent; color: #315d7d; }
  .mobile-dock button.is-active { background: #e4f3fc; color: var(--blue); }
  .mobile-dock span { font-size: 20px; line-height: 1; }
  .mobile-dock span .ui-icon { width: 20px; height: 20px; }
  .mobile-dock b { font-size: 6px; text-transform: uppercase; }
  .side-panel, .editor-panel, .chat-panel { inset: auto max(7px,env(safe-area-inset-right)) calc(79px + env(safe-area-inset-bottom)) max(7px,env(safe-area-inset-left)); width: auto; max-height: min(72%,610px); padding: 9px 15px 17px; transform: translateY(calc(100% + 105px)); border-radius: 23px; }
  .side-panel.is-open, .editor-panel.is-open, .chat-panel.is-open { transform: none; }
  .sheet-handle { display: block; width: 42px; height: 4px; margin: 2px auto 7px; border-radius: 3px; background: #c4d4de; }
  .panel-close { position: absolute; top: 12px; right: 12px; float: none; }
  .panel-title { font-size: 24px; }
  .panel-lead { font-size: 9px; }
  .region-grid { grid-template-columns: 1fr; }
  .region-preview { height: 118px; }
  .collection-grid { grid-template-columns: repeat(2,1fr); }
  .creature-card { grid-template-columns: 62px 1fr; min-height: 80px; padding: 6px; }
  .creature-portrait { width: 59px; height: 59px; }
  .creature-card b { font-size: 9px; }
  .creature-card small { font-size: 6px; }
  .creature-card .mini-stat { display: none; }
  .team-card { grid-template-columns: 24px 66px 1fr 14px; min-height: 80px; }
  .team-portrait { width: 62px; height: 62px; }
  .inventory-card { grid-template-columns: 50px 1fr auto; min-height: 68px; }
  .item-icon, .item-glyph { width: 47px; height: 47px; }
  .object-catalog { grid-template-columns: repeat(6,1fr); max-height: 190px; overflow-y: auto; }
  .chat-panel { height: min(67%,520px); }
  .chat-log { height: calc(100% - 116px); }
  .battle-hud { bottom: calc(79px + env(safe-area-inset-bottom)); width: calc(100vw - 14px); padding: 9px; border-radius: 20px; }
  .battle-status b { max-width: 63vw; font-size: 10px; }
  .battle-skills { gap: 5px; }
  .battle-skills button { grid-template-columns: 37px 1fr; min-height: 49px; padding: 5px; }
  .skill-icon { width: 37px; height: 37px; }
  .battle-skills b { font-size: 7px; }
  .battle-skills small { font-size: 5px; }
  .battle-skills em { display: none; }
  .capture-panel { grid-template-columns: 1fr 72px; min-height: 82px; gap: 6px; padding: 6px; }
  .capture-copy { grid-column: 1/2; }
  .capture-copy small { font-size: 5px; }
  .capture-copy b { font-size: 8px; }
  .capture-balls { grid-column: 1/2; }
  .capture-balls > button { grid-template-columns: 28px 1fr auto; min-width: 108px; min-height: 40px; }
  .capture-ball-icon { width: 28px; height: 28px; }
  .capture-throw { grid-column: 2; grid-row: 1/3; width: 66px; height: 66px; border-radius: 21px; }
  .capture-throw-icon { width: 43px; height: 43px; }
  #battleHint { font-size: 6px; }
}

@media (max-width: 370px), (max-width: 800px) and (max-height: 640px), (pointer: coarse) and (max-height: 640px) {
  .home-showcase { display: none; }
  .hero-card { bottom: max(9px,env(safe-area-inset-bottom)); }
  .hero-card-head, .skin-picker { margin-bottom: 4px; }
  .skin-picker button { min-height: 34px; }
  .mobile-dock { height: 59px; }
  .context-action { bottom: calc(72px + env(safe-area-inset-bottom)); width: min(174px,calc(100vw - 90px)); min-width: 0; min-height: 58px; }
  .context-action > span { width: 46px; height: 46px; }
  .mobile-actions { bottom: calc(139px + env(safe-area-inset-bottom)); }
  .side-panel, .editor-panel, .chat-panel, .battle-hud { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .loot-feed { bottom: calc(71px + env(safe-area-inset-bottom)); }
}

/* Compact desktop HUD for ultrawide or browser windows with little vertical space. */
@media (min-width: 801px) and (max-height: 650px) and (pointer: fine) {
  .world-topbar { top: 7px; left: 125px; right: 8px; grid-template-columns: minmax(180px,1fr) auto minmax(180px,1fr); gap: 7px; }
  .player-chip, .world-location, .instance-chip { min-height: 44px; border-radius: 14px; }
  .player-chip { min-width: 184px; padding: 4px 8px 4px 4px; }
  .player-chip-avatar { width: 34px; height: 34px; border-radius: 10px; }
  .world-location { min-width: 214px; padding: 4px 9px; }
  .location-pin { width: 29px; height: 32px; }
  .instance-chip { min-width: 190px; padding: 5px 9px; }
  .world-rail { left: 8px; top: 50%; grid-template-columns: repeat(2,1fr); gap: 3px; width: 108px; padding: 5px; transform: translateY(-50%); border-radius: 17px; }
  .world-rail button { min-height: 39px; border-radius: 11px; }
  .world-rail button span { font-size: 17px; }
  .world-rail button b { font-size: 5px; }
  .world-rail button > i { top: 2px; right: 2px; min-width: 12px; height: 12px; font-size: 5px; }
  .side-panel { top: 58px; right: 8px; bottom: 8px; width: min(455px,calc(100vw - 140px)); padding: 17px; border-radius: 20px; }
  .editor-panel { top: 58px; right: 8px; max-height: calc(100% - 66px); padding: 14px; border-radius: 19px; }
  .chat-panel { left: 124px; top: 58px; bottom: 8px; width: min(420px,calc(100vw - 140px)); height: auto; padding: 13px; border-radius: 20px; }
  .chat-log { height: calc(100% - 112px); }
  .battle-hud { left: 124px; right: 8px; bottom: 8px; width: auto; padding: 9px; transform: translateY(calc(100% + 42px)); border-radius: 18px; }
  .battle-hud.is-open { transform: none; }
  .battle-status { min-height: 29px; }
  .battle-skills button { min-height: 45px; }
  #battleHint { display: none; }
  .context-action { right: 8px; bottom: 8px; min-width: 132px; min-height: 49px; border-radius: 16px; }
  .context-action > span { width: 37px; height: 37px; border-radius: 12px; }
  .quick-hint { bottom: 7px; }
  .loot-feed { left: 124px; bottom: 8px; }
  .home-topbar { top: 8px; left: 14px; right: 14px; }
  .brand-mark { width: 39px; height: 39px; border-radius: 12px; }
  .brand b { font-size: 25px; }
  .hero-card { left: 5vw; top: 57px; bottom: 8px; width: min(390px,40vw); padding: 13px; transform: none; overflow: auto; border-radius: 20px; }
  .hero-card > p, .foundation-status, .prototype-note { display: none; }
  .avatar-ring { flex-basis: 55px; height: 55px; border-radius: 16px; }
  .hero-card-head strong { font-size: 20px; }
  .xp-row { margin: 7px 0; }
  .name-field input { height: 35px; }
  .skin-picker { margin: 7px 0; }
  .skin-picker button { min-height: 37px; }
  .primary-cta { min-height: 42px; }
}

@media (min-width: 1450px) {
  .hero-card { left: 6vw; width: 470px; padding: 28px; }
  .world-rail { left: 24px; }
  .side-panel { width: 520px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Pokémon Trainer Hub v1.4 */
.home-backdrop { background-image: url('/assets/v1.6/maps/arrival-plaza.webp'); background-position: 50% 62%; }
.pikachu-avatar { position: absolute; inset: -6px; background: url('/assets/v1.2/pokemon/static/025.png') center / contain no-repeat; image-rendering: auto; }
.pikachu-showcase { position: absolute; right: 2%; bottom: 1%; width: min(20vw,270px); aspect-ratio: 1; background: url('/assets/v1.2/pokemon/static/025.png') center / contain no-repeat; filter: drop-shadow(0 18px 12px rgba(0,22,45,.35)); }
.pokemon-portrait { display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle,#fff 38%,#eaf6fc 100%); }
.pokemon-portrait img { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.creature-card.is-locked { filter: none; opacity: .68; }
.creature-card.is-owned { border-color: #78c553; background: #f3ffef; }
.creature-card > em { background: #66c944; color: #174d0b; }
.creature-card.is-lead > em { background: #f2c425; color: #634900; }
.pokedex-grid .creature-card { grid-template-columns: 72px 1fr; min-height: 92px; }
.pokedex-grid .creature-portrait { width: 68px; height: 68px; }
.team-card:not(.is-empty) { display: block; padding: 7px; }
.team-card-main { display: grid; grid-template-columns: 31px 82px 1fr; align-items: center; gap: 8px; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.team-remove { display: block; min-height: 29px; margin: 5px 0 0 auto; padding: 0 10px; border: 1px solid #c7dce8; border-radius: 9px; background: #eef6fa; color: #4f7187; font-size: 7px; font-weight: 900; }
.kit-preview { display: block; max-width: 260px; margin-top: 4px; overflow: hidden; color: #8a9fac; font-size: 6px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.panel-primary { width: 100%; min-height: 44px; margin-top: 12px; border: 0; border-bottom: 3px solid #07569f; border-radius: 13px; background: linear-gradient(#149cf3,#0872c9); color: white; font-size: 9px; font-weight: 1000; }
.center-list { display: grid; gap: 9px; }
.center-card { display: grid; grid-template-columns: 84px 1fr; gap: 10px; padding: 9px; border: 1px solid #cbdde8; border-radius: 17px; background: white; }
.center-card.is-lead { border: 2px solid var(--location-accent); background: color-mix(in srgb,var(--location-accent) 7%,white); }
.center-portrait { grid-row: 1/3; width: 80px; height: 80px; border-radius: 15px; }
.center-card small, .center-card b, .center-card em, .center-card i { display: block; }
.center-card small { color: var(--location-accent); font-size: 7px; font-weight: 1000; }
.center-card b { margin: 2px 0; font-size: 14px; }
.center-card em { color: #607d91; font-size: 8px; font-style: normal; }
.center-card i { margin-top: 5px; color: #849aa9; font-size: 6px; font-style: normal; line-height: 1.35; }
.center-actions { grid-column: 1/-1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.center-actions button { min-height: 31px; padding: 0 10px; border: 1px solid #bcd6e5; border-radius: 9px; background: #eaf6fd; color: #146da9; font-size: 7px; font-weight: 1000; }
.center-actions button:disabled { opacity: .45; cursor: default; }
.center-actions button.danger { border-color: #efc0bc; background: #fff0ef; color: #b63d35; }
.empty-center { padding: 25px; border: 2px dashed #bdd5e3; border-radius: 18px; background: #f6fbfe; text-align: center; }
.empty-center b { font-size: 16px; }
.empty-center p { color: #678398; font-size: 9px; line-height: 1.5; }
.object-thumb.direct { display: grid; place-items: center; overflow: hidden; }
.object-thumb.direct img { width: 100%; height: 100%; object-fit: contain; }
.battle-skills button.skill-kind-passive { border-color: #d0c0e8; background: #f5effc; cursor: default; }

.starter-dialog { position: fixed; z-index: 120; inset: 0; display: grid; place-items: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity .22s; }
.starter-dialog.is-open { opacity: 1; pointer-events: auto; }
.starter-backdrop { position: absolute; inset: 0; background: rgba(2,25,45,.72); backdrop-filter: blur(8px); }
.starter-card { position: relative; width: min(980px,calc(100vw - 28px)); max-height: min(780px,calc(100vh - 28px)); padding: 28px; overflow: auto; border: 1px solid rgba(255,255,255,.95); border-radius: 28px; background: rgba(255,253,248,.98); box-shadow: 0 35px 90px rgba(0,18,35,.55); }
.starter-card h2 { margin: 4px 45px 6px 0; font-size: clamp(25px,4vw,39px); }
.starter-card > p { margin: 0 0 18px; color: #5f7a8e; font-size: 11px; }
.starter-card > small { display: block; margin-top: 14px; color: #698399; font-size: 8px; text-align: center; }
.starter-close { position: absolute; top: 18px; right: 18px; width: 38px; height: 38px; border: 0; border-radius: 12px; background: #e7f2f8; color: #365e79; font-size: 23px; }
.starter-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.starter-option { display: grid; grid-template-rows: 180px auto; gap: 8px; min-width: 0; padding: 12px; border: 2px solid #cae0ea; border-bottom-width: 5px; border-radius: 21px; background: linear-gradient(#fff,#edf8fd); color: var(--ink); text-align: left; }
.starter-option:hover { transform: translateY(-3px); border-color: var(--blue); box-shadow: 0 12px 27px rgba(7,91,145,.17); }
.starter-grass { --starter-color:#5fb947; }
.starter-fire { --starter-color:#ee6c35; }
.starter-water { --starter-color:#2b9ed6; }
.starter-option { border-bottom-color: var(--starter-color); }
.starter-portrait { width: 100%; height: 180px; border-radius: 16px; }
.starter-option small, .starter-option b, .starter-option em, .starter-option i { display: block; }
.starter-option small { color: var(--starter-color); font-size: 8px; font-weight: 1000; }
.starter-option b { margin: 3px 0; font-size: 21px; }
.starter-option em { color: #5c778b; font-size: 8px; font-style: normal; }
.starter-option i { margin-top: 7px; color: #8095a4; font-size: 7px; font-style: normal; line-height: 1.4; }

@media (max-width: 800px), (pointer: coarse) {
  .pikachu-showcase { right: 0; width: min(34vw,190px); }
  .mobile-dock { grid-template-columns: repeat(7,1fr); }
  .mobile-dock span { font-size: 17px; }
  .mobile-dock b { font-size: 5px; }
  .pokedex-grid { grid-template-columns: repeat(2,1fr); }
  .pokedex-grid .creature-card { grid-template-columns: 53px 1fr; min-height: 68px; }
  .pokedex-grid .creature-portrait { width: 50px; height: 50px; }
  .team-card-main { grid-template-columns: 24px 66px 1fr; }
  .center-card { grid-template-columns: 67px 1fr; }
  .center-portrait { width: 64px; height: 64px; }
  .starter-dialog { padding: 7px; }
  .starter-card { width: 100%; max-height: calc(100vh - 14px); padding: 20px 14px; border-radius: 23px; }
  .starter-card > p { font-size: 9px; }
  .starter-options { grid-template-columns: 1fr; }
  .starter-option { grid-template-columns: 108px 1fr; grid-template-rows: auto; align-items: center; min-height: 124px; }
  .starter-portrait { width: 106px; height: 106px; }
  .starter-option b { font-size: 17px; }
}

@media (max-width: 420px) {
  .binding-row { grid-template-columns: 1fr; }
  .binding-row > div { width: 100%; }
  .binding-row button { flex: 1; }
  .mobile-dock b { font-size: 4.5px; }
}

/* Unified Account Edition v2.0 — password, Telegram/VK identities and immutable onboarding. */
.gate-screen {
  position: absolute;
  inset: 0;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 80px 18px 24px;
  overflow: hidden;
  background: #166248;
}
#app[data-screen="gate"] .auth-screen,
#app[data-screen="gate"] .home-screen,
#app[data-screen="gate"] .game-screen,
#app[data-screen="auth"] .gate-screen,
#app[data-screen="home"] .gate-screen,
#app[data-screen="game"] .gate-screen {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
#app[data-screen="gate"] .gate-screen {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}
.gate-card { width: min(460px,calc(100vw - 28px)); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 0 0 15px; padding: 4px; border-radius: 14px; background: #e8f2f7; }
.auth-tabs button { min-height: 40px; border: 0; border-radius: 11px; background: transparent; color: #688397; font-size: 11px; font-weight: 1000; }
.auth-tabs button.is-active { background: white; color: #087bd2; box-shadow: 0 5px 14px rgba(12,77,117,.13); }
.account-form { display: none; gap: 11px; }
.account-form.is-active { display: grid; }
.auth-field { display: grid; gap: 5px; color: #31556d; font-size: 11px; font-weight: 900; }
.auth-field input { box-sizing: border-box; width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #bfd6e4; border-radius: 13px; outline: 0; background: white; color: #153a55; font-size: 14px; font-weight: 700; transition: border-color .16s,box-shadow .16s; }
.auth-field input:focus { border-color: #118bdd; box-shadow: 0 0 0 3px rgba(17,139,221,.13); }
.auth-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-caption { color: #31556d; font-size: 11px; font-weight: 900; }
.register-skin-picker { margin: 0; }
.account-form .primary-cta, .gate-card .primary-cta { margin-top: 2px; }
.form-error { display: none; min-height: 18px; padding: 8px 10px; border-radius: 10px; background: #fff0ef; color: #b63e37; font-size: 10px; font-weight: 800; line-height: 1.35; text-align: center; }
.form-error:not(:empty) { display: block; }
.auth-card:has(#registerForm.is-active) { width: min(590px,calc(100vw - 28px)); }
button.is-busy { opacity: .65; pointer-events: none; }

@media (max-width: 800px), (pointer: coarse) {
  .gate-screen { padding: 70px 7px 7px; }
  .auth-field-grid { grid-template-columns: 1fr; }
  .auth-card:has(#registerForm.is-active) { max-height: calc(100% - 72px); overflow-y: auto; }
}

/* First Journey v1.6: every interactive window is clipped inside the world. */
.auth-screen, .home-screen, .game-screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
#app[data-screen="auth"] .home-screen,
#app[data-screen="auth"] .game-screen,
#app[data-screen="home"] .auth-screen,
#app[data-screen="home"] .game-screen,
#app[data-screen="game"] .auth-screen,
#app[data-screen="game"] .home-screen {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
#app[data-screen="auth"] .auth-screen,
#app[data-screen="home"] .home-screen,
#app[data-screen="game"] .game-screen {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}
.game-screen { position: absolute; inset: 0; contain: strict; isolation: isolate; overflow: clip; background: #183c32; }
#gameCanvas { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; min-width: 100% !important; min-height: 100% !important; }

/* Local social authentication. */
.auth-screen { isolation: isolate; display: grid; place-items: center; padding: 80px 18px 24px; background: #166248; }
.auth-backdrop { position: absolute; inset: -3%; z-index: -3; background: url('/assets/v1.6/maps/arrival-plaza.webp') 50% 54% / cover no-repeat; filter: saturate(1.08) contrast(1.03); transform: scale(1.03); }
.auth-vignette { position: absolute; inset: 0; z-index: -2; background: radial-gradient(circle at 66% 44%,rgba(6,53,72,.1),rgba(2,25,45,.76) 78%),linear-gradient(90deg,rgba(2,27,47,.76),rgba(2,32,49,.28)); }
.auth-brand { position: absolute; top: max(22px,env(safe-area-inset-top)); left: max(28px,env(safe-area-inset-left)); }
.auth-card { width: min(470px,calc(100vw - 28px)); padding: 28px; border: 1px solid rgba(255,255,255,.9); border-radius: 28px; background: rgba(255,253,248,.96); box-shadow: 0 30px 90px rgba(0,20,36,.5); backdrop-filter: blur(18px); }
.auth-step { display: block; color: var(--blue); font-size: 8px; font-weight: 1000; letter-spacing: 1.4px; }
.auth-card h1 { margin: 5px 0 8px; font-size: clamp(28px,5vw,42px); letter-spacing: -1.4px; }
.auth-card > p { margin: 0 0 19px; color: #58758a; font-size: 11px; line-height: 1.55; }
.auth-providers { display: grid; gap: 9px; }
.auth-provider { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 11px; min-height: 62px; padding: 7px 12px 7px 7px; border: 1px solid #c8dce8; border-bottom-width: 4px; border-radius: 16px; background: white; color: var(--ink); text-align: left; }
.auth-provider > i { display: grid; place-items: center; width: 47px; height: 47px; border-radius: 13px; background: #e7f4fc; color: #0878d3; font-size: 12px; font-style: normal; font-weight: 1000; }
.auth-provider b, .auth-provider small { display: block; }
.auth-provider b { font-size: 10px; }
.auth-provider small { margin-top: 3px; color: #71899a; font-size: 7px; }
.provider-vk { border-bottom-color: #2787f5; }
.provider-vk > i { background: #2787f5; color: white; }
.provider-telegram { border-bottom-color: #2aabee; }
.provider-telegram > i { background: #2aabee; color: white; font-size: 20px; }
.provider-local { border-bottom-color: #72c744; }
.provider-local > i { background: #e9f8df; color: #3f9223; }
.auth-security { display: block; margin-top: 14px; color: #7890a1; font-size: 7px; line-height: 1.45; text-align: center; }
.auth-admin-link { display: block; margin-top: 8px; color: #477087; font-size: 7px; font-weight: 850; text-align: center; }
.account-chip { display: flex; align-items: center; gap: 8px; min-height: 49px; padding: 6px 11px 6px 6px; border: 1px solid rgba(255,255,255,.82); border-radius: 16px; background: rgba(255,253,248,.92); color: var(--ink); box-shadow: 0 8px 25px rgba(0,31,58,.2); text-align: left; backdrop-filter: blur(12px); }
.account-chip > i { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 11px; background: #e4f3fc; color: var(--blue); font-size: 8px; font-style: normal; font-weight: 1000; }
.account-chip b, .account-chip small { display: block; }
.account-chip b { font-size: 8px; }
.account-chip small { color: #7890a2; font-size: 6px; }
.trainer-avatar-preview { position: absolute; inset: 0; background: url('/assets/v1.4/trainers/trainer-male-walk-8dir-6f.png') 0 0 / 600% 800% no-repeat; }
body[data-skin-preview="female"] .trainer-avatar-preview { background-image: url('/assets/v1.4/trainers/trainer-female-walk-8dir-6f.png'); }

/* Window contract: visibility changes, world size never does. */
.hud-window { position: absolute !important; box-sizing: border-box; max-width: calc(100% - 16px); max-height: calc(100% - 16px); visibility: hidden; opacity: 0; pointer-events: none; transform: scale(.975) !important; transform-origin: center; transition: opacity .18s,transform .18s !important; }
.hud-window.is-open { visibility: visible; opacity: 1; pointer-events: auto; transform: none !important; }
.side-panel { top: 86px; right: 18px; bottom: 18px; left: auto; width: min(480px,calc(100% - 128px)); }
.editor-panel { top: 86px; right: 18px; bottom: auto; left: auto; width: min(420px,calc(100% - 128px)); max-height: calc(100% - 104px); }

/* Movable, resizable, per-player chat. */
.chat-panel { --chat-opacity:.94; --chat-font-size:11px; z-index: 48; left: 104px; top: 82px; bottom: auto; width: 440px; height: 450px; min-width: 320px; min-height: 260px; display: grid; grid-template-rows: auto auto auto minmax(0,1fr) auto; padding: 14px; overflow: hidden; border-radius: 22px; background: rgba(255,253,248,var(--chat-opacity)); font-size: var(--chat-font-size); backdrop-filter: blur(17px); }
.chat-panel.chat-no-blur { backdrop-filter: none; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 43px; cursor: grab; touch-action: none; user-select: none; }
.chat-panel.is-adjusting .chat-head { cursor: grabbing; }
.chat-head small, .chat-head b { display: block; }
.chat-head small { color: var(--blue); font-size: .63em; font-weight: 1000; letter-spacing: .9px; }
.chat-head b { margin-top: 2px; font-size: 1.3em; }
.chat-head-actions { display: flex; gap: 5px; }
.chat-head-actions button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: #e8f3f9; color: #3d637d; }
.chat-head-actions .ui-icon { width: 17px; height: 17px; }
.chat-config { display: none; grid-template-columns: 1fr 1fr; gap: 7px 12px; margin: 5px 0 8px; padding: 10px; border: 1px solid #c9dce8; border-radius: 13px; background: rgba(239,248,253,.92); }
.chat-config.is-open { display: grid; }
.chat-config > label { color: #58758a; font-size: .72em; font-weight: 850; }
.chat-config label > span { display: flex; justify-content: space-between; gap: 7px; }
.chat-config input[type="range"] { width: 100%; margin-top: 5px; accent-color: var(--blue); }
.chat-config .chat-check { display: flex; align-items: center; gap: 6px; }
.chat-config .chat-check > span { display: block; }
.chat-config > button { grid-column: 1/-1; min-height: 28px; border: 1px solid #bdd5e3; border-radius: 8px; background: white; color: #41718f; font-size: .65em; font-weight: 1000; }
.chat-tabs { margin: 3px 0 8px; }
.chat-log { min-height: 0; height: auto; overflow: hidden auto; }
.chat-message { font-size: 1em; }
.chat-message b { display: inline; font-size: .82em; }
.chat-message p { font-size: .82em; }
.chat-message time { display: inline; margin-left: 6px; color: #91a4b1; font-size: .72em; font-weight: 700; }
.chat-panel[data-timestamps="hide"] .chat-message time { display: none; }
#chatForm { align-self: end; }
.chat-resize { position: absolute; right: 3px; bottom: 3px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 0 0 14px 0; background: linear-gradient(135deg,transparent 47%,#7fa6bd 49%,#7fa6bd 57%,transparent 59%,transparent 68%,#7fa6bd 70%,#7fa6bd 78%,transparent 80%); cursor: nwse-resize; touch-action: none; }

/* Compact battle console in the world HUD, never below the canvas. */
.battle-panel { z-index: 46; top: 86px; right: 18px; bottom: auto; left: auto; width: min(410px,calc(100% - 128px)); max-height: calc(100% - 104px); padding: 12px; overflow: hidden auto; border: 1px solid rgba(255,255,255,.9); border-radius: 21px; background: rgba(255,253,248,.96); box-shadow: 0 24px 64px rgba(0,20,42,.45); backdrop-filter: blur(15px); }
.battle-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; }
.battle-status small, .battle-status b { display: block; }
.battle-status small { color: var(--blue); font-size: 6px; font-weight: 1000; letter-spacing: .9px; }
.battle-status b { max-width: 220px; margin-top: 2px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.battle-controls { display: flex; gap: 5px; }
.battle-controls button { min-height: 31px; padding: 0 9px; border: 1px solid #c4d9e5; border-radius: 9px; background: #eff7fb; color: #527389; font-size: 6px; font-weight: 1000; }
.battle-controls #cancelBattle { border-color: #efc0bc; background: #fff1f0; color: #b7443d; }
.battle-controls .is-active { border-color: #62c63d; background: #62c63d; color: white; }
.battle-health { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 9px 0; }
.battle-health article { padding: 7px; border: 1px solid #cbdde7; border-radius: 11px; background: #f6fbfd; }
.battle-health article > span { display: flex; justify-content: space-between; gap: 5px; }
.battle-health b { max-width: 105px; overflow: hidden; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.battle-health small { color: #6e8799; font-size: 6px; }
.battle-health article > i { display: block; height: 7px; margin-top: 5px; overflow: hidden; border-radius: 5px; background: #d7e4ea; }
.battle-health em { display: block; width: 0; height: 100%; border-radius: inherit; background: #62c637; transition: width .2s; }
.enemy-health em { background: #ef694e; }
.battle-skills { grid-template-columns: repeat(2,1fr); gap: 6px; }
.battle-skills button { grid-template-columns: 35px 1fr; min-height: 47px; padding: 5px; }
.skill-icon { width: 35px; height: 35px; }
.battle-decision { display: none; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 6px; padding: 8px; border: 1px solid #efd070; border-radius: 12px; background: #fff8dc; }
.battle-decision.is-open { display: grid; }
.battle-decision small, .battle-decision b { display: block; }
.battle-decision small { color: #aa7300; font-size: 5px; font-weight: 1000; }
.battle-decision b { margin-top: 2px; font-size: 7px; }
.battle-decision button { min-height: 34px; padding: 0 9px; border: 0; border-radius: 9px; background: #147fd4; color: white; font-size: 6px; font-weight: 1000; }
.battle-decision #beginCapture { background: #e14e43; }
.battle-decision button:disabled { background: #aebdc6; opacity: .72; cursor: default; }
.capture-panel { grid-template-columns: minmax(0,1fr) 67px; min-height: 82px; padding: 7px; }
.capture-balls { max-width: 100%; overflow-x: auto; }
.capture-balls > button { min-width: 104px; }
.capture-throw { width: 62px; height: 62px; }
#battleHint { margin: 7px 2px 0; font-size: 6px; }

/* Dialogue and starter selection are overlays of game-screen, not pages below it. */
.dialogue-layer, .starter-dialog { position: absolute; z-index: 70; inset: 0; width: 100%; height: 100%; display: grid; place-items: end center; padding: 18px 18px 22px 112px; overflow: hidden; visibility: hidden; opacity: 0; pointer-events: none; transition: opacity .18s; }
.dialogue-layer.is-open, .starter-dialog.is-open { visibility: visible; opacity: 1; pointer-events: auto; }
.dialogue-shade, .starter-backdrop { position: absolute; inset: 0; background: linear-gradient(180deg,rgba(2,25,45,.08),rgba(2,25,45,.72)); backdrop-filter: blur(2px); }
.dialogue-card { position: relative; display: grid; grid-template-columns: 92px minmax(0,1fr) auto; align-items: center; gap: 14px; width: min(960px,100%); min-height: 152px; padding: 14px; border: 1px solid rgba(255,255,255,.95); border-radius: 23px; background: rgba(255,253,248,.98); box-shadow: 0 25px 75px rgba(0,18,35,.52); }
.dialogue-portrait { display: grid; place-items: center; width: 92px; height: 116px; overflow: hidden; border-radius: 17px; background: radial-gradient(circle,#dff5ff,#72c9ef); }
.dialogue-portrait > i { width: 78px; height: 106px; background: url('/assets/v1.4/trainers/trainer-female-walk-8dir-6f.png') 0 0 / 600% 800% no-repeat; }
.dialogue-copy small { color: var(--blue); font-size: 6px; font-weight: 1000; letter-spacing: .9px; }
.dialogue-copy h2 { margin: 3px 0 6px; font-size: 20px; }
.dialogue-copy p { min-height: 43px; margin: 0; color: #496b82; font-size: 11px; line-height: 1.5; }
.dialogue-actions { display: grid; gap: 6px; }
.dialogue-actions button { min-width: 92px; min-height: 40px; border: 1px solid #c6dae6; border-radius: 11px; background: #eef6fa; color: #55768c; font-size: 7px; font-weight: 1000; }
.dialogue-actions #dialogueNext { border: 0; border-bottom: 3px solid #07549e; background: #1189df; color: white; }
.starter-dialog { place-items: center; padding: 18px 18px 18px 112px; }
.starter-card { width: min(980px,100%); max-height: calc(100% - 10px); }

/* Quest-chain cards used by the training zone. */
.quest-chain { display: grid; gap: 9px; }
.quest-card { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 9px; padding: 10px; border: 1px solid #cadde8; border-radius: 15px; background: white; opacity: .62; }
.quest-card.is-active { border: 2px solid var(--location-accent); background: color-mix(in srgb,var(--location-accent) 7%,white); opacity: 1; }
.quest-card.is-done { border-color: #83ce66; background: #f1fdec; opacity: 1; }
.quest-card > i { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: #eaf4f9; color: #54778e; font-size: 11px; font-style: normal; font-weight: 1000; }
.quest-card.is-done > i { background: #68c94a; color: white; }
.quest-card b, .quest-card small, .quest-card em { display: block; }
.quest-card b { font-size: 10px; }
.quest-card small { margin-top: 3px; color: #5e7b90; font-size: 8px; line-height: 1.4; }
.quest-card em { margin-top: 6px; color: var(--location-accent); font-size: 7px; font-style: normal; font-weight: 1000; }

@media (max-width: 800px), (pointer: coarse) {
  .auth-screen { padding: 70px 7px 7px; }
  .auth-brand { top: max(10px,env(safe-area-inset-top)); left: max(12px,env(safe-area-inset-left)); }
  .auth-card { max-height: calc(100% - 72px); padding: 18px 14px; overflow: auto; border-radius: 22px; }
  .home-topbar { top: max(8px,env(safe-area-inset-top)); }
  .account-chip span { display: none; }
  .hud-window { max-width: none; max-height: none; }
  .side-panel, .editor-panel, .chat-panel, .battle-panel {
    inset: max(61px,calc(env(safe-area-inset-top) + 55px)) max(7px,env(safe-area-inset-right)) calc(79px + env(safe-area-inset-bottom)) max(7px,env(safe-area-inset-left));
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    border-radius: 21px;
  }
  .chat-panel { display: grid; padding: 10px 12px 13px; }
  .chat-head { cursor: default; }
  .chat-head small { font-size: 5px; }
  .chat-config { grid-template-columns: 1fr; max-height: 44%; overflow-y: auto; }
  .chat-config > button { grid-column: 1; }
  .chat-resize { display: none; }
  .battle-panel { left: auto; width: min(390px,calc(100% - 14px)); overflow-y: auto; }
  .battle-decision { grid-template-columns: 1fr 1fr; }
  .battle-decision > span { grid-column: 1/-1; }
  .dialogue-layer, .starter-dialog { padding: 7px 7px calc(79px + env(safe-area-inset-bottom)); }
  .dialogue-card { grid-template-columns: 67px minmax(0,1fr); gap: 9px; width: 100%; min-height: 132px; padding: 9px; border-radius: 19px; }
  .dialogue-portrait { width: 67px; height: 88px; }
  .dialogue-portrait > i { width: 60px; height: 82px; }
  .dialogue-copy h2 { font-size: 16px; }
  .dialogue-copy p { font-size: 9px; }
  .dialogue-actions { grid-column: 1/-1; grid-template-columns: 1fr 1fr; }
  .dialogue-actions button { min-height: 36px; }
  .starter-card { width: 100%; max-height: 100%; }
}

@media (min-width: 801px) and (max-height: 650px) and (pointer: fine) {
  .auth-card { max-height: calc(100% - 72px); padding: 16px; overflow-y: auto; }
  .auth-provider { min-height: 49px; }
  .auth-provider > i { width: 39px; height: 39px; }
  .side-panel, .editor-panel, .chat-panel, .battle-panel { top: 58px; bottom: 8px; max-height: calc(100% - 66px); }
  .chat-panel { left: 124px; bottom: 8px; height: auto; }
  .battle-panel { right: 8px; left: auto; width: min(390px,calc(100% - 140px)); }
  .dialogue-layer { padding: 8px 8px 8px 124px; }
  .dialogue-card { min-height: 125px; }
  .starter-dialog { padding: 8px 8px 8px 124px; }
}

@media (max-height: 540px) {
  .battle-health { display: none; }
  .battle-panel { overflow-y: auto; }
  .dialogue-card { min-height: 110px; }
  .dialogue-portrait { height: 80px; }
}

/* Living Guides v1.7 — one modern white UI system on desktop and mobile. */
:root {
  --panel-bg: rgba(255,255,255,.975);
  --panel-border: #c9e0ee;
  --panel-shadow: 0 24px 68px rgba(5,31,54,.34);
  --panel-radius: 24px;
  --text-main: #143b5d;
  --text-muted: #55758b;
  font-family: "Segoe UI Variable", "Segoe UI", Inter, ui-rounded, system-ui, sans-serif;
  font-size: 16px;
}
button, input, select, textarea { font-family: inherit; }
.art-icon, .panel-art-icon, .quest-art-icon { display: block; object-fit: contain; user-select: none; pointer-events: none; }
.auth-step { font-size: 10px; }
.auth-card > p { font-size: 14px; }
.auth-provider b { font-size: 14px; }
.auth-provider small { font-size: 11px; }
.auth-security, .auth-admin-link { font-size: 10px; }
.hero-card-head small { font-size: 10px; }
.hero-card-head em { font-size: 12px; }
.hero-card > p { font-size: 14px; }
.name-field { font-size: 12px; }
.name-field input { font-size: 15px; }
.skin-picker button { font-size: 11px; }
.player-chip b { font-size: 13px; }
.player-chip small { font-size: 10px; }
.world-location small { font-size: 9px; }
.world-location b { font-size: 15px; }
.instance-chip b { font-size: 12px; }
.instance-chip small { font-size: 9px; }
.world-rail { width: 82px; padding: 8px; gap: 4px; border-color: rgba(255,255,255,.9); border-radius: 24px; background: rgba(9,54,84,.91); }
.world-rail button { min-height: 59px; gap: 1px; border-radius: 17px; }
.world-rail button span { display: grid; place-items: center; width: 38px; height: 38px; }
.world-rail button .art-icon { width: 38px; height: 38px; filter: drop-shadow(0 3px 5px rgba(0,24,45,.25)); }
.world-rail button b { font-size: 8px; font-weight: 850; letter-spacing: .1px; }
.mobile-dock .art-icon, .round-quick .art-icon { width: 32px; height: 32px; filter: drop-shadow(0 3px 4px rgba(0,27,50,.2)); }
.round-quick .art-icon { width: 38px; height: 38px; }

.hud-window, .side-panel, .editor-panel, .chat-panel, .battle-panel {
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  background: var(--panel-bg);
  color: var(--text-main);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(18px) saturate(1.08);
}
.side-panel { padding: 27px; }
.panel-eyebrow { font-size: 10px; letter-spacing: 1.2px; }
.panel-title { margin-top: 5px; font-size: clamp(27px,2.4vw,34px); line-height: 1.08; }
.panel-lead { color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.panel-close { width: 40px; height: 40px; border: 1px solid #d3e5ef; border-radius: 13px; background: #f1f8fc; }
.region-card > p, .region-drops small, .creature-card small, .team-card small, .inventory-card small, .center-card small { font-size: 11px; }
.region-drops b, .creature-card b, .team-card b, .inventory-card b, .center-card b { font-size: 13px; }

.chat-panel { --chat-font-size:14px; padding: 16px; border-radius: var(--panel-radius); background: rgba(255,255,255,var(--chat-opacity)); }
.chat-head small { font-size: .7em; }
.chat-head b { font-size: 1.42em; color: var(--text-main); }
.chat-head-actions button { width: 38px; height: 38px; border: 1px solid #d5e5ee; border-radius: 12px; background: #f2f8fb; }
.chat-tabs button { min-height: 38px; font-size: .78em; }
.chat-message b { font-size: .92em; }
.chat-message p { margin-top: 4px; color: #46677d; font-size: .92em; line-height: 1.45; }
.chat-message time { font-size: .74em; }
#chatForm input { min-height: 44px; font-size: .92em; }

.battle-panel { padding: 15px; }
.battle-status small { font-size: 8px; }
.battle-status b { max-width: 245px; font-size: 14px; }
.battle-controls button { min-height: 36px; padding: 0 12px; font-size: 8px; }
.battle-health article { padding: 9px; }
.battle-health b { max-width: 140px; font-size: 10px; }
.battle-health small { font-size: 9px; }
.battle-skills button { min-height: 56px; }
.battle-skills button b { font-size: 10px; }
.battle-skills button small, .battle-skills button em { font-size: 7px; }
.battle-decision small { font-size: 7px; }
.battle-decision b { font-size: 10px; line-height: 1.35; }
.battle-decision button { min-height: 38px; font-size: 8px; }
#battleHint { font-size: 9px; line-height: 1.4; }

.dialogue-layer { padding: 18px 22px 25px 118px; }
.dialogue-shade { background: linear-gradient(180deg,rgba(4,26,44,.12),rgba(4,24,42,.7)); backdrop-filter: blur(2px) saturate(.9); }
.dialogue-card {
  grid-template-columns: 158px minmax(0,1fr) 112px;
  grid-template-rows: minmax(168px,auto) auto;
  align-items: stretch;
  gap: 0 20px;
  width: min(1120px,100%);
  min-height: 224px;
  padding: 16px 18px 14px;
  border: 1px solid rgba(255,255,255,.98);
  border-top: 4px solid #1596e8;
  border-radius: 27px;
  background: rgba(255,255,255,.985);
  box-shadow: 0 28px 86px rgba(0,18,34,.5);
}
.dialogue-portrait { position: relative; grid-row: 1 / 3; width: 158px; height: 198px; align-self: end; overflow: hidden; border: 1px solid #cbe4f2; border-radius: 21px; background: linear-gradient(160deg,#e8f7ff,#d7edfb); }
.dialogue-portrait > i { width: 100%; height: 100%; background-repeat: no-repeat; }
.dialogue-portrait > span { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 6px 5px; border-radius: 9px; background: rgba(9,70,108,.84); color: white; font-size: 8px; font-weight: 900; letter-spacing: .6px; text-align: center; backdrop-filter: blur(6px); }
.dialogue-copy { min-width: 0; padding: 7px 0 4px; }
.dialogue-copy > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.dialogue-copy > header > span { min-width: 0; }
.dialogue-copy small { font-size: 9px; letter-spacing: 1px; }
.dialogue-copy h2 { margin: 4px 0 13px; color: #0a78ca; font-size: clamp(22px,2.3vw,30px); line-height: 1; }
.dialogue-copy p { min-height: 78px; margin: 0; color: #254d69; font-size: clamp(16px,1.45vw,19px); font-weight: 560; line-height: 1.52; }
.dialogue-hint { display: block; margin-top: 12px; color: #7893a5 !important; font-size: 10px !important; font-weight: 700 !important; letter-spacing: 0 !important; }
#dialogueSound { display: flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 9px; border: 1px solid #cce0ec; border-radius: 11px; background: #f2f8fc; color: #36718f; }
#dialogueSound i, #dialogueSound .ui-icon { width: 15px; height: 15px; }
#dialogueSound b { font-size: 8px; }
#dialogueSound.is-muted { opacity: .48; }
.dialogue-listener { display: flex; align-items: end; justify-content: center; overflow: hidden; opacity: .42; pointer-events: none; }
.dialogue-listener > i { width: 100px; height: 150px; background-repeat: no-repeat; background-size: 600% 800%; background-position: 0 0; filter: saturate(.78); }
.dialogue-actions { grid-column: 2 / 4; grid-row: 2; display: flex; justify-content: flex-end; align-items: end; gap: 8px; padding-top: 8px; }
.dialogue-actions button { min-width: 118px; min-height: 43px; padding: 0 14px; border-radius: 12px; font-size: 9px; }
.dialogue-actions #dialogueNext { min-width: 168px; border-bottom-width: 3px; background: linear-gradient(180deg,#1aa2f1,#0875cb); }

.journey-transition { position: absolute; z-index: 82; inset: 0; display: grid; grid-template-columns: minmax(230px,38vw) minmax(280px,460px); place-content: center; align-items: center; gap: clamp(16px,5vw,74px); padding: 24px; overflow: hidden; visibility: hidden; opacity: 0; pointer-events: none; transition: opacity .25s; }
.journey-transition.is-open { visibility: visible; opacity: 1; pointer-events: auto; }
.journey-transition-shade { position: absolute; inset: 0; z-index: -2; background: radial-gradient(circle at 38% 54%,rgba(47,194,255,.38),rgba(4,25,49,.94) 68%); backdrop-filter: blur(7px); }
.journey-portal { width: min(36vw,390px); aspect-ratio: 362 / 543; justify-self: end; background: url('/assets/v1.7/effects/journey-portal.webp') 0 0 / 400% 200% no-repeat; filter: drop-shadow(0 0 28px rgba(82,218,255,.72)); animation: portalFloat 1.05s ease-in-out infinite alternate; }
.journey-copy { color: white; text-shadow: 0 3px 14px rgba(0,18,36,.65); }
.journey-copy small { color: #78e8ff; font-size: 11px; font-weight: 950; letter-spacing: 1.8px; }
.journey-copy h2 { max-width: 430px; margin: 8px 0 12px; font-size: clamp(32px,4.6vw,58px); line-height: .98; letter-spacing: -1.8px; }
.journey-copy p { max-width: 400px; margin: 0; color: #dff7ff; font-size: 15px; line-height: 1.55; }
.journey-copy > i { display: block; width: 86px; height: 4px; margin-top: 22px; overflow: hidden; border-radius: 3px; background: rgba(255,255,255,.24); }
.journey-copy > i::after { content: ""; display: block; width: 34px; height: 100%; border-radius: inherit; background: #70e4ff; animation: journeyProgress 1s linear infinite; }
@keyframes portalFloat { to { transform: translateY(-10px) scale(1.025); } }
@keyframes journeyProgress { from { transform: translateX(-38px); } to { transform: translateX(90px); } }

.quest-prologue { display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 10px; margin: 0 0 10px; padding: 11px; border: 1px solid #d2e2eb; border-radius: 16px; background: #f5fafd; }
.quest-prologue.is-done { border-color: #8bd36d; background: #f2fceb; }
.quest-prologue > i { display: grid; place-items: center; width: 38px; height: 38px; font-style: normal; }
.quest-prologue .quest-art-icon { width: 38px; height: 38px; }
.quest-prologue b { display: block; font-size: 12px; }
.quest-prologue small { display: block; margin-top: 3px; color: #5b788c; font-size: 10px; line-height: 1.4; }
.professor-quest-chain .quest-card { grid-template-columns: 48px minmax(0,1fr); padding: 13px; }
.professor-quest-chain .quest-card > i { width: 44px; height: 44px; background: #eef7fc; }
.professor-quest-chain .quest-card > i .quest-art-icon { width: 44px; height: 44px; }
.professor-quest-chain .quest-card b { font-size: 13px; }
.professor-quest-chain .quest-card small { font-size: 10px; line-height: 1.5; }
.professor-quest-chain .quest-card strong { display: block; margin-top: 8px; color: #0878ca; font-size: 9px; letter-spacing: .4px; }
.quest-subtasks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quest-subtasks em { margin: 0; padding: 5px 7px; border-radius: 8px; background: #eef4f7; color: #6a8292; font-size: 9px; }
.quest-subtasks em.is-done { background: #e1f7d8; color: #3c8b28; }
.panel-art-icon { width: 44px; height: 44px; }

@media (max-width: 800px), (pointer: coarse) {
  :root { font-size: 16px; }
  .world-rail { display: none; }
  .mobile-dock { border-color: var(--panel-border); background: rgba(255,255,255,.97); box-shadow: 0 -12px 35px rgba(4,31,54,.22); }
  .mobile-dock button { color: #52728a; }
  .mobile-dock button.is-active { color: #0879d1; }
  .mobile-dock b { font-size: 8px; }
  .mobile-dock .art-icon { width: 31px; height: 31px; }
  .side-panel, .editor-panel, .chat-panel, .battle-panel { border-radius: 22px; background: rgba(255,255,255,.985); }
  .side-panel { padding: 20px 17px; }
  .panel-eyebrow { font-size: 9px; }
  .panel-lead { font-size: 13px; }
  .chat-panel { --chat-font-size:14px; padding: 13px; }
  .auth-card > p { font-size: 13px; }
  .auth-provider b { font-size: 13px; }
  .auth-provider small { font-size: 10px; }
  .hero-card-head small { font-size: 9px; }
  .name-field { font-size: 11px; }
  .skin-picker button { font-size: 10px; }
  .player-chip b { max-width: 44vw; font-size: 11px; }
  .player-chip small { font-size: 8px; }
  .instance-chip b { font-size: 9px; }
  .instance-chip small { max-width: 125px; font-size: 8px; }
  .battle-panel { width: min(430px,calc(100% - 14px)); padding: 13px; }
  .dialogue-layer { padding: 7px 7px calc(82px + env(safe-area-inset-bottom)); }
  .dialogue-card { grid-template-columns: 92px minmax(0,1fr); grid-template-rows: minmax(142px,auto) auto; gap: 0 11px; width: 100%; min-height: 205px; max-height: calc(100dvh - 96px - env(safe-area-inset-bottom)); padding: 10px 11px; overflow: auto; border-radius: 22px; }
  .dialogue-portrait { grid-row: 1; width: 92px; height: 132px; align-self: start; border-radius: 16px; }
  .dialogue-portrait > span { left: 4px; right: 4px; bottom: 4px; padding: 4px 2px; font-size: 6px; }
  .dialogue-copy { padding-top: 3px; }
  .dialogue-copy h2 { margin-bottom: 8px; font-size: 21px; }
  .dialogue-copy p { min-height: 60px; font-size: 14px; line-height: 1.48; }
  .dialogue-copy small { font-size: 7px; }
  .dialogue-hint { margin-top: 7px; font-size: 8px !important; }
  #dialogueSound b { display: none; }
  #dialogueSound { min-width: 32px; padding: 0 8px; }
  .dialogue-listener { display: none; }
  .dialogue-actions { grid-column: 1 / 3; grid-row: 2; display: grid; grid-template-columns: .7fr 1.3fr; gap: 7px; padding-top: 8px; }
  .dialogue-actions button, .dialogue-actions #dialogueNext { min-width: 0; min-height: 40px; }
  .journey-transition { grid-template-columns: 1fr; grid-template-rows: minmax(210px,48vh) auto; gap: 2px; place-content: center; padding: 14px 18px calc(78px + env(safe-area-inset-bottom)); text-align: center; }
  .journey-portal { width: min(58vw,260px); align-self: end; justify-self: center; }
  .journey-copy h2 { margin-inline: auto; font-size: clamp(30px,10vw,45px); }
  .journey-copy p { margin-inline: auto; font-size: 13px; }
  .journey-copy > i { margin: 17px auto 0; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .dialogue-card { grid-template-columns: 112px minmax(0,1fr) 78px; grid-template-rows: minmax(112px,auto) auto; min-height: 150px; }
  .dialogue-portrait { width: 112px; height: 134px; }
  .dialogue-copy p { min-height: 42px; font-size: 14px; }
  .dialogue-listener > i { width: 70px; height: 105px; }
  .dialogue-actions { grid-column: 2 / 4; }
}
