/* UI THEME v2 (U-A) — minimal translucent style (owner chose it from docs/ui/ECLIPSE_ONLINE_UI_Design.pdf, Layout C).
   Loaded LAST in index.html: overrides the base styles and the pixel kit (uiKit.css), which stays only for the title
   screen buttons and confirm pop-ups. Fonts are served with the game (assets/fonts, OFL): Kanit = titles / numbers,
   Noto Sans Thai = body text (Latin falls back to Segoe UI). Rules: dark see-through panels over the world, 1 px cream
   lines, pale-gold highlight, item slots coloured by rarity, key hints bottom-right. */

@font-face { font-family: "Kanit"; src: url("../../assets/fonts/Kanit-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Kanit"; src: url("../../assets/fonts/Kanit-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Kanit"; src: url("../../assets/fonts/Kanit-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Kanit"; src: url("../../assets/fonts/Kanit-Bold.ttf") format("truetype"); font-weight: 700 900; font-display: swap; }
@font-face { font-family: "Noto Sans Thai"; src: url("../../assets/fonts/NotoSansThai.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  --font-title: "Kanit", "Segoe UI", sans-serif;
  --font-body: "Segoe UI", "Noto Sans Thai", sans-serif;
  --ink: #ece4d2; --ink-dim: #a69e8d; --ink-faint: rgba(236, 228, 210, 0.35);
  --hl: #e8d7a5; --line: rgba(236, 228, 210, 0.18); --line-strong: rgba(236, 228, 210, 0.32);
  --glass: rgba(6, 6, 10, 0.86); --glass-soft: rgba(255, 255, 255, 0.04);
  --r-common: rgba(236, 228, 210, 0.25); --r-rare: #4f9ae0; --r-epic: #a46be0; --r-legendary: #e7a13a; --r-mythic: #ff3030;
  --text: var(--ink); --muted: var(--ink-dim); --gold: #f0c860;
}

html, body { font-family: var(--font-body); color: var(--ink); }
h1, h2, h3, h4, .logo, .tt-name, .cc-name, .speaker .name, #loading .t, .death h1, .ending h1 { font-family: var(--font-title); font-weight: 600; }
.logo, #loading .t, .death h1, .ending h1 { font-weight: 500; }

/* ---------- overlays: the world stays visible ---------- */
.overlay { background: rgba(4, 4, 8, 0.45); }
.overlay.dark { background: rgba(4, 4, 8, 0.82); }

/* ---------- windows: glass, no ornate frame ---------- */
.panel, .dialogue {
  border: 0; border-image: none; border-top: 1px solid var(--line-strong);
  background: var(--glass); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); border-radius: 4px;
  image-rendering: auto; backdrop-filter: blur(3px);
}
.panel::before { display: none; }
.panel h2 { text-align: left; font-size: 19px; letter-spacing: 1px; text-transform: none; color: var(--ink); text-shadow: none;
  border-bottom: 1px solid var(--line-strong); padding-bottom: 8px; margin-bottom: 14px; }
.panel h2::after { display: none; }
h3 { color: var(--hl); font-size: 14px; letter-spacing: 1px; }
.panel.big { background: linear-gradient(90deg, rgba(6, 6, 10, 0.94), rgba(6, 6, 10, 0.86)); }

/* ---------- buttons: flat text buttons, gold line on focus ---------- */
button, button.primary, .menu-buttons button, .panel .close, .death button, .dialogue .opts button {
  font: 500 14px var(--font-title); letter-spacing: 0.5px; color: var(--ink);
  background: var(--glass-soft); border: 1px solid var(--line); border-image: none; border-radius: 3px;
  padding: 7px 16px; min-height: 0; text-shadow: none; box-shadow: none; filter: none; image-rendering: auto;
}
button:hover:not(:disabled), button.primary:hover:not(:disabled), .menu-buttons button:hover:not(:disabled), .panel .close:hover,
.death button:hover, .dialogue .opts button:hover:not(:disabled) {
  background: rgba(232, 215, 165, 0.12); border-color: var(--hl); color: #fff; box-shadow: none; filter: none;
}
button.primary { border-color: rgba(232, 215, 165, 0.55); background: rgba(232, 215, 165, 0.10); }
button.danger { border-color: rgba(230, 90, 90, 0.6); background: rgba(160, 30, 40, 0.25); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.4; filter: none; }
.menu-buttons button { width: 260px; padding: 10px; font-size: 15px; letter-spacing: 2px; }
.dialogue .opts button { margin: 3px 6px 3px 0; }

/* ---------- tabs: plain text, gold underline ---------- */
.tabs { background: transparent; border-bottom: 1px solid var(--line-strong); }
.tabs button { border: 0; background: transparent; color: var(--ink-dim); font-size: 14px; padding: 13px 18px; border-radius: 0; }
.tabs button.on { background: transparent; color: #fff; }
.tabs button.on::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--hl); box-shadow: none; }
.tabs button:hover:not(.on) { background: transparent; color: #fff; border: 0; }
.tabs .x { border-left: 0; }
.cats button.on, .slot-btns button.on { border-color: var(--hl); color: var(--hl); }

/* ---------- item slots: see-through, border = rarity (panels set the colour inline) ---------- */
.slot { width: 52px; height: 52px; border-width: 1px; background: var(--glass-soft); border-radius: 3px; }
.grid { grid-template-columns: repeat(auto-fill, 52px); gap: 5px; }
.slot img { width: 40px; height: 40px; }
.slot:hover, .slot.sel { background: rgba(232, 215, 165, 0.10); box-shadow: 0 0 0 1px var(--hl) inset; }
.slot .n { font-family: var(--font-title); font-size: 12px; }

/* ---------- cards, rows, boxes: one quiet style ---------- */
.detail, .eq-slot, .lo-slot, .know-card, .path-card, .skill-card, .owned, .summary div, .lo-picker {
  background: var(--glass-soft); border: 1px solid var(--line); border-radius: 3px;
}
.skill-card.on, .lo-slot.on, .lo-slot:hover, .path-card.unlocked, .owned.cur { border-color: var(--hl); background: rgba(232, 215, 165, 0.07); }
.stats div, .row, details { border-bottom-color: rgba(236, 228, 210, 0.08); }
.stats h4, .tt-head { color: var(--hl); }
summary { color: var(--ink); }
.mod, .tt-effect { color: #cdb8f0; }

/* ---------- dialogue: bottom strip ---------- */
.dialogue { border-radius: 0; border-top: 1px solid var(--line-strong); }
.speaker .name { color: var(--hl); font-size: 19px; }
.dialogue .line { font-size: 16px; }

/* ---------- tooltip ---------- */
.item-tip { background: rgba(8, 8, 12, 0.95); border: 1px solid var(--line-strong); border-radius: 3px; }

/* ---------- key hints (any window may add <div class="keys"><span><kbd>Esc</kbd>Back</span></div>) ---------- */
.keys { display: flex; gap: 18px; justify-content: flex-end; font-size: 12px; color: var(--ink-dim); padding: 8px 14px; }
kbd { display: inline-block; font: 600 10px var(--font-title); color: var(--ink); border: 1px solid var(--ink-dim); border-radius: 3px; padding: 0 5px; margin-right: 5px; }

/* ---------- loading + scrollbar ---------- */
#loading .t { text-shadow: none; letter-spacing: 12px; color: var(--ink); }
#loading .bar { background: rgba(255, 255, 255, 0.08); } #loading .bar i { background: var(--hl); }
::-webkit-scrollbar-thumb { background: rgba(236, 228, 210, 0.22); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- CHARACTER WINDOW (U-B, Layout C: ui/charWindow.js) — left side panel, the world stays visible ---------- */
.overlay.side { justify-content: flex-start; align-items: stretch; background: linear-gradient(90deg, rgba(4, 4, 8, 0.35), transparent 70%); }
.panel.cw { height: 100vh; max-height: none; width: min(1040px, 96vw); border-radius: 0; border-top: 0; padding: 0;
  background: linear-gradient(90deg, rgba(6, 6, 10, 0.95) 0%, rgba(6, 6, 10, 0.93) 88%, rgba(6, 6, 10, 0.7)); box-shadow: 18px 0 40px rgba(0, 0, 0, 0.35); }
.panel.cw.cw-narrow { width: min(500px, 96vw); }
.cw .content { padding: 12px 20px 8px; }
.cw-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line-strong); }
.cw-lvl { width: 54px; height: 54px; flex: none; background: center / contain no-repeat; display: flex; align-items: center; justify-content: center; }
.cw-lvl span { font: 600 20px var(--font-title); color: #fff; text-shadow: 0 1px 3px #000; }
.cw-who { flex: 1; min-width: 0; } .cw-who b { font: 600 16px var(--font-title); }
.cw-exp-t { font-size: 11px; color: var(--ink-dim); margin: 1px 0 4px; }
.cw-exp { height: 5px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden; }
.cw-exp i { display: block; height: 100%; background: linear-gradient(90deg, #8a3fb8, #c86fe8); }
.cw-pow { text-align: right; } .cw-pow .cap { font: 500 10px var(--font-title); letter-spacing: 2px; color: var(--ink-dim); }
.cw-pow b { font: 700 22px var(--font-title); color: var(--gold); }
.cw-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 11px 12px; font-size: 13px; }
.cw-tabs button img { width: 18px; height: 18px; opacity: 0.6; } .cw-tabs button.on img, .cw-tabs button:hover img { opacity: 1; }
.cw-top { display: flex; gap: 14px; align-items: stretch; }
.cw-stage { position: relative; width: 170px; height: 206px; flex: none; overflow: hidden; }
.cw-pedestal { position: absolute; left: 5px; bottom: 2px; width: 160px; opacity: 0.9; }
.cw-hero { position: absolute; left: -75px; bottom: 25px; width: 320px; height: 320px; image-rendering: pixelated; }
.cw-side { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.cw-gearrow { display: flex; gap: 6px; }
.cw-gear { width: 54px; height: 54px; }
.cw-empty { width: 30px !important; height: 30px !important; opacity: 0.28; }
.cw-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; margin-top: 6px; }
.cw-kv { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-dim); padding: 2px 0; }
.cw-kv b { margin-left: auto; color: var(--ink); font: 500 12px var(--font-title); } .cw-kv .lo-base { font-style: normal; }
.cw-si { width: 15px; height: 15px; flex: none; opacity: 0.75; }
.cw-more { margin: 8px 0 4px; border-bottom: 0; } .cw-more summary { font-size: 12px; color: var(--ink-dim); }
.cw-all { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; margin-top: 6px; }
.cw-more h4 { margin: 10px 0 4px; font-size: 11px; letter-spacing: 2px; color: var(--hl); }
.cw-bagbar { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); margin: 8px 0 8px; padding-bottom: 4px; }
.cw-filters { display: flex; gap: 2px; }
.cw-filters button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 4px 6px; margin: 0; }
.cw-filters button img { width: 20px; height: 20px; opacity: 0.45; display: block; }
.cw-filters button.on { border-bottom-color: var(--hl); background: transparent; } .cw-filters button.on img, .cw-filters button:hover img { opacity: 1; }
.cw-filters button:hover:not(:disabled) { background: transparent; border-color: transparent; border-bottom-color: var(--line-strong); }
.cw-picking { font-size: 13px; color: var(--ink-dim); } .cw-picking b { color: var(--hl); }
.cw-bagbar > button { padding: 3px 10px; font-size: 12px; margin: 0; }
.cw-gold { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font: 500 14px var(--font-title); color: var(--gold); }
.cw-gold img { width: 18px; height: 18px; }
.cw-bag { grid-template-columns: repeat(8, 52px); }
.cw-free { cursor: default; opacity: 0.5; } .cw-free:hover { box-shadow: none; background: var(--glass-soft); }
.cw-low { opacity: 0.45; }
.cw-detail { margin-top: 10px; min-height: 0; }
.cw .keys { padding: 10px 0 0; }

/* ---------- NPC SERVICE PANEL (U-C: ui/npcPanel.js) — shop / forge / storage / waystone, left side ---------- */
.panel.npc-panel { height: 100vh; max-height: none; width: min(560px, 96vw); min-width: 0; max-width: none; border-radius: 0; border-top: 0;
  padding: 0; display: flex; flex-direction: column;
  background: linear-gradient(90deg, rgba(6, 6, 10, 0.95) 0%, rgba(6, 6, 10, 0.92) 85%, rgba(6, 6, 10, 0.65)); box-shadow: 18px 0 40px rgba(0, 0, 0, 0.35); }
.np-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 12px; margin-right: 34px; border-bottom: 1px solid var(--line-strong); }
.np-ico { width: 34px; height: 34px; opacity: 0.9; }
.np-title { flex: 1; } .np-title b { font: 600 18px var(--font-title); } .np-sub { font-size: 12px; color: var(--ink-dim); }
.np-main { flex: 1; display: flex; gap: 14px; padding: 14px 22px; min-height: 0; }
.np-menu { width: 108px; flex: none; display: flex; flex-direction: column; gap: 2px; }
.np-menu button { text-align: left; border: 0; border-left: 2px solid transparent; border-radius: 0; background: transparent; color: var(--ink-dim); margin: 0; padding: 7px 10px; }
.np-menu button.on { color: #fff; background: rgba(255, 255, 255, 0.06); border-left-color: var(--hl); }
.np-menu button:hover:not(.on):not(:disabled) { background: rgba(255, 255, 255, 0.03); border-color: transparent; color: #fff; }
.np-body { flex: 1; overflow-y: auto; padding-right: 4px; }
.np-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid rgba(236, 228, 210, 0.07); }
.np-row:hover { background: rgba(255, 255, 255, 0.03); }
.np-slot { width: 46px; height: 46px; flex: none; cursor: default; } .np-slot img { width: 36px; height: 36px; }
.np-name { font: 500 14px var(--font-title); } .np-text { font-size: 12px; color: var(--ink-dim); margin-top: 2px; line-height: 1.45; }
.np-text .ok { color: #8fe0a0; } .np-text .bad { color: #ff8a8a; }
.np-right button { margin: 0; white-space: nowrap; padding: 5px 12px; }
.np-price { display: inline-flex; align-items: center; gap: 4px; font: 500 13px var(--font-title); color: var(--gold); }
.np-price img { width: 15px; height: 15px; } .np-price.bad { color: #ff8a8a; }
.np-here .np-name { color: var(--hl); }
.npc-panel .keys { border-top: 1px solid var(--line); padding: 10px 22px; }
.npc-panel .np-close { position: absolute; top: 18px; right: 14px; display: block; margin: 0; padding: 4px 10px; }
.np-row .grow { flex: 1; min-width: 0; } .np-right { margin-left: auto; }

/* ---------- U-E: ESC menu (left side panel), confirm pop-up, world map, death, title ---------- */
.panel.esc-menu { height: 100vh; max-height: none; width: min(360px, 96vw); min-width: 0; border-radius: 0; border-top: 0; padding: 0; text-align: left;
  display: flex; flex-direction: column; background: linear-gradient(90deg, rgba(6, 6, 10, 0.95) 0%, rgba(6, 6, 10, 0.9) 85%, rgba(6, 6, 10, 0.6)); }
.esc-menu .np-head { margin-right: 0; }
.esc-list { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; flex: 1; }
.esc-list button { display: flex; align-items: center; gap: 12px; text-align: left; border: 0; border-left: 2px solid transparent; border-radius: 0;
  background: transparent; padding: 11px 14px; margin: 0; font-size: 15px; letter-spacing: 1px; }
.esc-list button img { width: 20px; height: 20px; opacity: 0.6; }
.esc-list button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); border-left-color: var(--hl); border-top-color: transparent; border-right-color: transparent; border-bottom-color: transparent; }
.esc-list button:hover:not(:disabled) img { opacity: 1; }
.esc-list button.danger { color: #ff8a8a; border-left-color: #ff6060; }
.esc-save { padding: 0 30px 6px; } .esc-menu .keys { border-top: 1px solid var(--line); padding: 10px 22px; }
.panel.confirm { min-width: 380px; max-width: 520px; }
.confirm-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.confirm-btns button kbd { margin-right: 8px; }
.h2-ico { width: 20px; height: 20px; vertical-align: -3px; margin-right: 8px; opacity: 0.85; }
.panel.map canvas { border: 1px solid var(--line-strong); }
.death h1 { color: #ff6a6a; text-shadow: 0 0 24px rgba(160, 20, 30, 0.8); letter-spacing: 10px; }
.death p { color: var(--ink-dim); }
.logo { text-shadow: 0 0 24px rgba(160, 90, 255, 0.45); font-weight: 500; }
.tag { color: var(--ink-dim); }
.esc-list { overflow-y: auto; min-height: 0; } @media (max-height: 560px) { .esc-list button { padding: 7px 14px; font-size: 14px; } .esc-menu .np-head { padding: 12px 22px 8px; } }

/* ---------- TITLE SCREEN (owner's reference: dark shrine, burning runes, metal logo, text-only menu) ---------- */
.overlay.ts { background: #050405; overflow: hidden; }
.ts-bg { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 70% at 50% 40%, rgba(40, 38, 34, 0.55), transparent 70%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 9%, rgba(0, 0, 0, 0.35) 9% 10%, rgba(255, 255, 255, 0.015) 10% 19%),
    linear-gradient(180deg, #0d0c0b, #070606 70%, #0b0706); }
.ts-shaft { position: absolute; left: 30%; right: 30%; top: -10%; height: 85%;
  background: linear-gradient(180deg, rgba(200, 190, 160, 0.10), rgba(200, 190, 160, 0) 80%); filter: blur(30px); animation: ts-breathe 7s ease-in-out infinite; }
.ts-rune { position: absolute; top: 14%; width: min(22vw, 360px); aspect-ratio: 0.8; border-radius: 50%;
  border: 3px solid rgba(255, 110, 30, 0.75);
  box-shadow: 0 0 22px rgba(255, 90, 20, 0.7), inset 0 0 40px rgba(255, 80, 20, 0.35), 0 0 90px rgba(255, 60, 10, 0.25);
  background: radial-gradient(circle, rgba(120, 30, 10, 0.25), rgba(0, 0, 0, 0) 65%),
    conic-gradient(from 20deg, transparent 0 8%, rgba(255, 140, 50, 0.55) 8% 9%, transparent 9% 30%, rgba(255, 140, 50, 0.5) 30% 31%, transparent 31% 55%,
    rgba(255, 140, 50, 0.5) 55% 56%, transparent 56% 80%, rgba(255, 140, 50, 0.55) 80% 81%, transparent 81%);
  animation: ts-flicker 3.2s ease-in-out infinite; }
.ts-rune::after { content: ""; position: absolute; inset: 18%; border-radius: 50%; border: 2px dashed rgba(255, 150, 60, 0.55); animation: ts-spin 60s linear infinite; }
.ts-rune.l { left: -6vw; } .ts-rune.r { right: -6vw; animation-delay: -1.6s; }
.ts-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 18%;
  background: radial-gradient(ellipse 18% 60% at 27% 100%, rgba(255, 120, 30, 0.35), transparent 70%),
    radial-gradient(ellipse 18% 60% at 73% 100%, rgba(255, 120, 30, 0.35), transparent 70%); }
.ts-embers { position: absolute; inset: 0; width: 100%; height: 100%; }
.ts-wrap { position: relative; z-index: 1; height: 100%; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 12vh 0 7vh; text-align: center; }
.ts-logo { display: flex; flex-direction: column; align-items: center; line-height: 0.95; }
.ts-word { font: 500 clamp(54px, 8vw, 120px) Georgia, "Times New Roman", serif; letter-spacing: 6px; font-variant: small-caps;
  background: linear-gradient(180deg, #f2f2f4 0%, #a9adb6 38%, #5d6068 55%, #c9ccd2 70%, #8a6a58 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #000) drop-shadow(0 0 14px rgba(0, 0, 0, 0.9)); }
.ts-sub { font-size: clamp(30px, 4.2vw, 64px); letter-spacing: 0.5em; padding-left: 0.5em; }
.ts-seal { margin: 0.6vh 0 0.4vh; } .ts-seal .eclipse { width: clamp(46px, 5vw, 76px); height: clamp(46px, 5vw, 76px); margin: 0; display: block;
  box-shadow: 0 0 0 3px #c8a070, 0 0 0 6px #3a2a1a, 0 0 30px 8px rgba(160, 80, 255, 0.55), inset -6px -4px 16px rgba(160, 80, 255, 0.6); }
.ts-menu { display: flex; flex-direction: column; gap: 0.6vh; align-items: center; }
.ts-menu button { background: none; border: 0; padding: 4px 26px; margin: 0; position: relative;
  font: 400 clamp(20px, 2vw, 30px) Georgia, "Times New Roman", serif; font-variant: small-caps; letter-spacing: 1.5px; color: #bdb7ad;
  text-shadow: 0 2px 6px #000; transition: color 0.15s, text-shadow 0.15s; }
.ts-menu button:hover:not(:disabled) { background: none; border: 0; color: #fff4e0; text-shadow: 0 0 14px rgba(255, 150, 70, 0.75), 0 2px 6px #000; }
.ts-menu button:hover::before, .ts-menu button:hover::after { content: "◆"; position: absolute; top: 50%; transform: translateY(-50%); font-size: 0.45em; color: #ff9a50; }
.ts-menu button:hover::before { left: 4px; } .ts-menu button:hover::after { right: 4px; }
.ts-menu button:disabled { opacity: 0.35; cursor: default; }
/* ONLINE (N2): name box / connection line on the title screen */
.ts-net { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin: 0.4vh 0 1vh;
  font: 400 14px var(--font-body); color: #d8d0c4; text-shadow: 0 2px 6px #000; }
.ts-net input { width: 210px; padding: 7px 12px; background: rgba(8, 6, 14, 0.72); border: 1px solid rgba(240, 225, 200, 0.35); border-radius: 3px;
  color: #fff4e0; font: 500 15px var(--font-body); letter-spacing: 0.5px; outline: none; }
.ts-net input:focus { border-color: rgba(255, 170, 90, 0.8); box-shadow: 0 0 10px rgba(255, 140, 60, 0.35); }
.ts-net button { padding: 7px 16px; font-size: 13px; }
.ts-net.ok b { color: #fff4e0; } .ts-net.ok { color: #9dffb4; }
.ts-net.dev { color: #ffcf70; letter-spacing: 2px; font-size: 12px; }
.ts-net-err { flex-basis: 100%; text-align: center; color: #ff9a8a; font-size: 13px; }
.ts-foot { font-size: 11px; letter-spacing: 3px; color: rgba(190, 180, 165, 0.4); text-transform: uppercase; }
@keyframes ts-flicker { 0%, 100% { opacity: 0.85; } 45% { opacity: 1; } 60% { opacity: 0.7; } }
@keyframes ts-breathe { 50% { opacity: 0.6; } }
@keyframes ts-spin { to { transform: rotate(360deg); } }
/* title art (owner, assets/ui/title): painted background + logo image; drawn rune layers above stay as the fallback style */
.ts-art { background: #06040a url("../../assets/ui/title/bg.png") center 30% / cover no-repeat; }
.ts-shade { position: absolute; inset: 0; background:
  radial-gradient(ellipse 34% 30% at 50% 82%, rgba(4, 3, 8, 0.72), transparent 75%),
  linear-gradient(180deg, rgba(4, 3, 8, 0.25) 0%, transparent 25%, transparent 60%, rgba(4, 3, 8, 0.75) 100%); }
.ts-logo-img { width: min(46vw, 760px); height: auto; margin-top: -4vh; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.85)); animation: ts-rise 1.4s ease-out; }
@keyframes ts-rise { from { opacity: 0; transform: translateY(12px); } }
.ts-art ~ .ts-wrap { justify-content: flex-start; } .ts-art ~ .ts-wrap .ts-menu { margin-top: auto; margin-bottom: 4vh; }

/* ---------- LOADING SCREEN (index.html #loading, driven by main.js): the title art blurred + dimmed, the eclipse emblem turning
   slowly with a breathing glow, the logo, a gold progress bar with %, rotating tips; fades out when the game is ready ---------- */
#loading { justify-content: center; background: #050308; transition: opacity 0.6s ease; }
#loading.done { opacity: 0; pointer-events: none; }
.ld-bg { position: absolute; inset: -20px; background: url("../../assets/ui/title/bg.png") center 30% / cover no-repeat; filter: blur(6px) brightness(0.35) saturate(1.1); }
.ld-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 42%, rgba(5, 3, 8, 0) 20%, rgba(5, 3, 8, 0.85) 75%); }
.ld-center { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2vh; margin-top: -8vh; }
.ld-seal { width: min(22vh, 200px); aspect-ratio: 1; position: relative; }
.ld-seal img { width: 100%; height: 100%; animation: ld-turn 24s linear infinite, ld-glow 2.6s ease-in-out infinite; }
.ld-seal::before { content: ""; position: absolute; inset: 18%; border-radius: 50%; background: radial-gradient(circle, rgba(160, 90, 255, 0.35), transparent 70%); filter: blur(16px); animation: ld-glow 2.6s ease-in-out infinite; }
.ld-logo { width: min(34vw, 460px); height: auto; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.9)); }
.ld-bottom { position: absolute; left: 50%; bottom: 8vh; transform: translateX(-50%); width: min(560px, 80vw); text-align: center; }
.ld-row { display: flex; justify-content: space-between; margin-bottom: 8px; font: 500 12px var(--font-title); letter-spacing: 2px; text-transform: uppercase; color: var(--ink-dim); }
.ld-pct { color: var(--hl); }
#loading .ld-bottom .bar { width: 100%; height: 3px; margin: 0; background: rgba(255, 255, 255, 0.1); overflow: visible; border-radius: 2px; }
#loading .ld-bottom .bar i { position: relative; border-radius: 2px; background: linear-gradient(90deg, #8a5a20, #e8c070); box-shadow: 0 0 10px rgba(240, 190, 90, 0.6); }
#loading .ld-bottom .bar i::after { content: ""; position: absolute; right: -4px; top: 50%; width: 8px; height: 8px; transform: translateY(-50%) rotate(45deg); background: #fff2c8; box-shadow: 0 0 12px #ffd080; }
.ld-tip { margin-top: 18px; min-height: 2.6em; font-size: 13px; line-height: 1.5; color: var(--ink-dim); transition: opacity 0.4s; }
.ld-tip b { color: var(--hl); font-weight: 600; margin-right: 6px; letter-spacing: 1px; }
@keyframes ld-turn { to { transform: rotate(360deg); } }
@keyframes ld-glow { 0%, 100% { filter: drop-shadow(0 0 6px rgba(240, 180, 80, 0.4)); opacity: 0.92; } 50% { filter: drop-shadow(0 0 22px rgba(170, 100, 255, 0.75)); opacity: 1; } }

/* ---------- SKILL TREE (ui/skillTreeUI.js, Skills tab): grows upward, diamond nodes, ultimate crown ---------- */
.st-layout { display: grid; grid-template-columns: 200px 1fr 300px; gap: 16px; align-items: start; }
.st-left { text-align: center; padding-top: 6px; }
.st-lvl { width: 96px; height: 96px; margin: 0 auto 4px; } .st-lvl span { font-size: 30px; }
.st-cls { font: 600 16px var(--font-title); margin-bottom: 6px; }
.st-pts { font: 500 14px var(--font-title); color: var(--ink); } .st-pts b { color: var(--gold); font-size: 18px; }
.st-left h4 { margin: 16px 0 6px; font-size: 11px; letter-spacing: 2px; color: var(--hl); }
.st-left .cx-skill { text-align: left; }
.st-bar { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.st-key { position: relative; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 5px; padding: 2px; cursor: pointer; background: rgba(8, 8, 12, 0.85); }
.st-key img { width: 100%; height: 100%; border-radius: 3px; } .st-key kbd { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); margin: 0; background: #06060a; }
.st-key.on, .st-key:hover { border-color: var(--hl); }
.st-mid { display: flex; justify-content: center; overflow: auto; }
.st-tree { position: relative; flex: none;
  background: radial-gradient(ellipse 45% 55% at 50% 55%, rgba(120, 80, 200, 0.10), transparent 70%); }
.st-tree svg { position: absolute; inset: 0; }
.stl { fill: none; stroke: rgba(236, 228, 210, 0.16); stroke-width: 2; }
.stl.lit { stroke: rgba(232, 200, 120, 0.75); stroke-width: 2.5; filter: drop-shadow(0 0 4px rgba(240, 190, 90, 0.6)); }
.stn { position: absolute; width: 58px; height: 58px; margin: -29px 0 0 -29px; padding: 0; border: 0; background: none; cursor: pointer; }
.stn:hover:not(:disabled) { background: none; border: 0; }
.stn-d { position: absolute; inset: 4px; transform: rotate(45deg); border: 2px solid rgba(236, 228, 210, 0.5); background: rgba(10, 8, 16, 0.95);
  box-shadow: 0 0 0 3px rgba(6, 6, 10, 0.9); transition: box-shadow 0.15s, border-color 0.15s; }
.stn img { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%); border-radius: 4px; }
.stn-b { position: absolute; left: 50%; bottom: -16px; transform: translateX(-50%); white-space: nowrap; font: 600 10px var(--font-title);
  color: var(--ink); background: rgba(6, 6, 10, 0.92); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; }
.stn.locked img { filter: grayscale(1) brightness(0.45); } .stn.locked .stn-d { border-color: rgba(140, 130, 120, 0.35); } .stn.locked .stn-b { color: #c08060; }
.stn.slotted .stn-d { border-color: #e8c070; }
.stn.maxed .stn-d { box-shadow: 0 0 0 3px rgba(6, 6, 10, 0.9), 0 0 16px rgba(240, 190, 90, 0.7); }
.stn:hover .stn-d, .stn.sel .stn-d { border-color: #fff4d8; box-shadow: 0 0 0 3px rgba(6, 6, 10, 0.9), 0 0 18px rgba(255, 230, 170, 0.8); }
.stn.special .stn-d { border-color: rgba(176, 128, 240, 0.9); }
.stn.ultimate { width: 84px; height: 84px; margin: -42px 0 0 -42px; }
.stn.ultimate .stn-d { border: 3px solid #e7a13a; background: radial-gradient(circle, rgba(70, 30, 90, 0.95), rgba(10, 6, 16, 0.98));
  box-shadow: 0 0 0 4px rgba(6, 6, 10, 0.9), 0 0 24px rgba(231, 161, 58, 0.55); }
.stn.ultimate::before { content: "◆"; position: absolute; left: 50%; top: -18px; transform: translateX(-50%); color: #e7a13a; font-size: 14px; }
.stn.ultimate img { width: 48px; height: 48px; }
.st-right .skill-card { flex-direction: column; } .st-right .skill-card img { width: 56px; height: 56px; }
@media (max-width: 1100px) { .st-layout { grid-template-columns: 1fr; } }

/* ---------- CLASS SELECT (panels.classSelect): line tabs, base + Class 2 tree on the left, splash on the right ---------- */
.overlay.cs { background: #050308; overflow: hidden; align-items: stretch; justify-content: stretch; }
.cs-bg { position: absolute; inset: -20px; background: url("../../assets/ui/title/bg.png") center 30% / cover no-repeat; filter: blur(5px) brightness(0.32); }
.cs-bg::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 40% 60% at 72% 55%, color-mix(in srgb, var(--cc) 28%, transparent), transparent 70%),
    linear-gradient(90deg, rgba(5, 3, 8, 0.9) 0%, rgba(5, 3, 8, 0.4) 45%, rgba(5, 3, 8, 0.1) 100%); }
.cs-splash { position: absolute; right: 3vw; bottom: 0; height: 92vh; max-width: 48vw; object-fit: contain; object-position: bottom right;
  filter: drop-shadow(0 0 30px color-mix(in srgb, var(--cc) 45%, transparent)); animation: cs-in 0.5s ease-out; pointer-events: none; }
@keyframes cs-in { from { opacity: 0; transform: translateX(30px); } }
.cs-wrap { position: relative; z-index: 1; width: 100%; height: 100%; padding: 4vh 0 4vh 0; display: grid; grid-template-columns: minmax(380px, 40vw) 1fr; grid-template-rows: auto 1fr; }
.cs-lines { grid-column: 1; display: flex; gap: 8px; padding: 0 0 2vh 3vw; }
.cs-lines button { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; background: rgba(6, 6, 10, 0.55); border: 1px solid var(--line); border-radius: 3px; font-size: 13px; color: var(--ink-dim); }
.cs-lines button img { width: 30px; height: 30px; }
.cs-lines button.on { border-color: var(--cc); color: #fff; background: color-mix(in srgb, var(--cc) 16%, rgba(6, 6, 10, 0.7)); }
.cs-tree { grid-column: 1; align-self: start; }
.cs-node { display: flex; align-items: center; gap: 18px; width: 100%; border: 0; border-radius: 0; background: none; padding: 0; margin: 0; text-align: left; cursor: pointer; }
.cs-node:hover:not(:disabled) { background: none; border: 0; }
.cs-node.base { padding: 14px 0 14px 3vw; background: linear-gradient(90deg, rgba(150, 120, 70, 0.55), rgba(110, 90, 50, 0.35) 70%, transparent);
  border-top: 1px solid rgba(232, 215, 165, 0.45); border-bottom: 1px solid rgba(232, 215, 165, 0.45); }
.cs-node.base.sel, .cs-node.base:hover { background: linear-gradient(90deg, rgba(180, 145, 80, 0.65), rgba(120, 95, 55, 0.4) 70%, transparent); }
.cs-emb { position: relative; flex: none; display: grid; place-items: center; }
.cs-node.base .cs-emb { width: 120px; height: 120px; } .cs-node.base .cs-emb img { width: 120px; height: 120px; }
.cs-node.mastery .cs-emb { width: 74px; height: 74px; } .cs-node.mastery .cs-emb img { width: 74px; height: 74px; filter: saturate(0.8) brightness(0.85); }
.cs-node.mastery.sel .cs-emb img, .cs-node.mastery:hover .cs-emb img { filter: drop-shadow(0 0 10px var(--cc)); }
.cs-lock { position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 13px; background: rgba(6, 6, 10, 0.9); border: 1px solid var(--line-strong); border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; }
.cs-txt small { display: block; font: 500 12px var(--font-title); letter-spacing: 3px; color: var(--ink-dim); border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-bottom: 4px; width: 260px; }
.cs-node.base .cs-txt small { color: #e8dcc0; } .cs-node.mastery .cs-txt small { color: #c9a96a; }
.cs-txt b { font: 600 28px var(--font-title); letter-spacing: 3px; color: #fff; text-transform: uppercase; }
.cs-node.mastery .cs-txt b { font-size: 22px; color: var(--ink); } .cs-node.mastery.sel .cs-txt b, .cs-node.mastery:hover .cs-txt b { color: var(--cc); }
.cs-kids { position: relative; padding: 6px 0 0 calc(3vw + 23px); display: flex; flex-direction: column; gap: 10px; }
.cs-kids::before { content: ""; position: absolute; left: calc(3vw + 60px); top: 0; bottom: 40px; width: 1px; background: linear-gradient(180deg, rgba(232, 215, 165, 0.6), rgba(232, 215, 165, 0.15)); }
.cs-info { grid-column: 1; grid-row: 2; align-self: end; margin: 2vh 0 0 3vw; width: min(520px, 36vw); padding: 14px 18px; background: rgba(6, 6, 10, 0.72);
  border-left: 2px solid var(--cc); }
.cs-role { font: 500 12px var(--font-title); letter-spacing: 2px; text-transform: uppercase; color: var(--cc); }
.cs-quote { font-style: italic; color: #e8e0f0; margin: 4px 0; } .cs-info p { font-size: 13px; color: var(--ink-dim); margin: 6px 0; }
.cs-rates { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 16px; margin: 8px 0; }
.cs-rate { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-dim); } .cs-rate span { width: 62px; }
.cs-rate i b { display: inline-block; width: 12px; height: 5px; margin-right: 2px; background: rgba(255, 255, 255, 0.12); } .cs-rate i b.on { background: var(--cc); }
.cs-res { font-size: 12px; color: var(--ink-dim); } .cs-res b { color: var(--ink); }
.cs-skills { display: flex; gap: 5px; margin: 10px 0; } .cs-skills img { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 4px; }
.cs-unlock { font-size: 12px; color: #e0b070; margin: 6px 0 10px; }
.cs-start { display: block; width: 100%; padding: 11px; font-size: 16px; letter-spacing: 2px; border-color: var(--cc) !important; background: color-mix(in srgb, var(--cc) 20%, rgba(6, 6, 10, 0.7)) !important; }
.cs-back { position: absolute; right: 2vw; top: 3vh; }
@media (max-height: 760px) { .cs-node.base .cs-emb, .cs-node.base .cs-emb img { width: 90px; height: 90px; } .cs-node.mastery .cs-emb, .cs-node.mastery .cs-emb img { width: 56px; height: 56px; } .cs-kids { gap: 4px; } .cs-txt b { font-size: 22px; } .cs-node.mastery .cs-txt b { font-size: 18px; } }
.cs-wrap { grid-template-rows: auto auto 1fr; padding: 3vh 0 3vh 0; }
.cs-tree { grid-row: 2; } .cs-info { grid-row: 3; margin-top: 1.5vh; }
@media (max-height: 760px) { .cs-info p { display: none; } .cs-info { padding: 10px 14px; } .cs-skills { margin: 6px 0; } .cs-skills img { width: 30px; height: 30px; } .cs-start { padding: 8px; } }

/* ---------- CLASS TAB, layout A (panels.inventory 'class'): emblem tree + path card | info | splash ---------- */
.ct-layout { position: relative; display: grid; grid-template-columns: 400px 300px 1fr; grid-template-rows: 1fr auto; gap: 14px 18px; min-height: 100%; }
.ct-splash { position: absolute; right: 0; bottom: 0; height: min(92%, 640px); max-width: 42%; object-fit: contain; object-position: bottom right; pointer-events: none;
  filter: drop-shadow(0 0 26px color-mix(in srgb, var(--cc) 50%, transparent)); animation: cs-in 0.4s ease-out; }
.ct-left { grid-column: 1; grid-row: 1; position: relative; z-index: 1; }
.ct-node { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-radius: 3px; background: none; padding: 4px 8px; margin: 0; cursor: pointer; }
.ct-node:hover:not(:disabled) { background: rgba(255, 255, 255, 0.04); border: 0; }
.ct-node.base { padding: 8px 10px; border-radius: 0; background: linear-gradient(90deg, rgba(150, 120, 70, 0.55), transparent);
  border-top: 1px solid rgba(232, 215, 165, 0.4); border-bottom: 1px solid rgba(232, 215, 165, 0.4); }
.ct-node.base:hover:not(:disabled) { background: linear-gradient(90deg, rgba(180, 145, 80, 0.65), transparent); border-top: 1px solid rgba(232, 215, 165, 0.4); border-bottom: 1px solid rgba(232, 215, 165, 0.4); }
.ct-node.sel:not(.base) { background: color-mix(in srgb, var(--cc) 14%, transparent); }
.ct-emb { width: 44px; height: 44px; flex: none; } .ct-node.base .ct-emb { width: 70px; height: 70px; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--cc) 60%, transparent)); }
.ct-node.dim .ct-emb { filter: brightness(0.6) saturate(0.6); }
.ct-node.sel .ct-emb { filter: drop-shadow(0 0 8px var(--cc)); }
.ct-txt small { display: block; font: 500 10px var(--font-title); letter-spacing: 2px; color: #c9a96a; } .ct-node.base .ct-txt small { color: #e8dcc0; }
.ct-txt b { font: 600 15px var(--font-title); letter-spacing: 2px; text-transform: uppercase; color: var(--ink); } .ct-node.base .ct-txt b { font-size: 20px; color: #fff; }
.ct-node.sel .ct-txt b { color: var(--cc); } .ct-node.base.sel .ct-txt b { color: #fff; }
.ct-prog { display: block; width: 170px; height: 4px; margin-top: 4px; background: rgba(255, 255, 255, 0.1); border-radius: 2px; overflow: hidden; }
.ct-prog i { display: block; height: 100%; background: linear-gradient(90deg, #8a5a20, #e8c070); }
.ct-badge { display: inline-block; font: 600 9px var(--font-title); letter-spacing: 1px; padding: 1px 6px; border-radius: 2px; vertical-align: 2px; margin-left: 4px; }
.ct-badge.b-cur { background: #e8c070; color: #1a1206; } .ct-badge.b-open { background: #4caf7a; color: #fff; }
.ct-badge.b-ready { background: #b060ff; color: #fff; box-shadow: 0 0 8px #b060ff; } .ct-badge.b-lock { background: rgba(255, 255, 255, 0.1); color: #bbb; }
.ct-kids { position: relative; padding: 6px 0 0 30px; display: flex; flex-direction: column; gap: 4px; }
.ct-kids::before { content: ""; position: absolute; left: 44px; top: 0; bottom: 22px; width: 1px; background: rgba(232, 215, 165, 0.35); }
.ct-path { margin-top: 12px; padding: 10px 12px; background: rgba(6, 6, 10, 0.6); border: 1px solid var(--line); border-radius: 3px; }
.ct-path .k { font: 600 10px var(--font-title); letter-spacing: 2px; margin-bottom: 4px; }
.ct-path .trial { border-left-color: var(--cc); }
.ct-note { font-size: 13px; color: var(--ink-dim); }
.ct-go { width: 100%; padding: 10px; font-size: 15px; border-color: var(--cc) !important; background: color-mix(in srgb, var(--cc) 18%, transparent) !important; }
.ct-info { grid-column: 2; grid-row: 1; position: relative; z-index: 1; align-self: start; padding: 12px 14px; background: rgba(6, 6, 10, 0.7); border: 1px solid var(--line); border-left: 2px solid var(--cc); border-radius: 3px; }
.ct-role { font: 500 11px var(--font-title); letter-spacing: 2px; text-transform: uppercase; color: var(--cc); }
.ct-quote { font-style: italic; color: #e8e0f0; margin: 4px 0; font-size: 13px; } .ct-desc { font-size: 12.5px; color: var(--ink-dim); margin: 4px 0 8px; }
.ct-rates div { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-dim); margin: 2px 0; } .ct-rates span { width: 64px; }
.ct-rates b { display: inline-block; width: 13px; height: 5px; margin-right: 2px; background: rgba(255, 255, 255, 0.12); } .ct-rates b.on { background: var(--cc); }
.ct-res { font-size: 12px; color: var(--ink-dim); margin: 8px 0 6px; } .ct-res b { color: var(--ink); }
.ct-skills { display: flex; flex-wrap: wrap; gap: 4px; } .ct-skills img { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 3px; }
.ct-sw { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; font-size: 11px; color: var(--ink-dim); }
.ct-sw b { display: block; font: 600 10px var(--font-title); letter-spacing: 1px; margin-bottom: 2px; } .ct-sw .good { color: #8fe0a0; } .ct-sw .bad { color: #ff8a8a; }
.ct-records { grid-column: 1 / 3; grid-row: 2; position: relative; z-index: 1; }
.ct-records .k { font: 600 10px var(--font-title); letter-spacing: 2px; color: var(--ink-dim); }
.ct-chips span { display: inline-block; font-size: 11px; border: 1px solid var(--line); border-radius: 10px; padding: 1px 9px; margin: 4px 4px 0 0; color: var(--ink-dim); background: rgba(6, 6, 10, 0.6); }
.ct-chips b { color: #fff; }
@media (max-width: 1150px) { .ct-layout { grid-template-columns: 360px 1fr; } .ct-splash { opacity: 0.35; } }
/* ONLINE PARTY panel (N4, panels.party) */
.pt-h { font: 600 11px var(--font-title); letter-spacing: 2px; color: var(--ink-dim); margin: 12px 0 4px; }
.pt-row .np-name { font-size: 15px; } .pt-row.off { opacity: 0.55; }
.pt-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #8a8090; margin-right: 6px; vertical-align: 1px; }
.pt-dot.on { background: #7dffa0; box-shadow: 0 0 6px rgba(125, 255, 160, 0.7); }
.pt-row .np-right button, .np-row .np-right button { padding: 4px 9px; font-size: 12px; }
.pt-invite { display: flex; gap: 8px; margin-top: 14px; }
.pt-invite input { flex: 1; padding: 7px 10px; background: rgba(8, 6, 14, 0.72); border: 1px solid rgba(240, 225, 200, 0.3); border-radius: 3px; color: #fff4e0; font: 500 14px var(--font-body); outline: none; }
.pt-invite input:focus { border-color: rgba(255, 170, 90, 0.8); }
.pt-leave { margin-top: 12px; width: 100%; }
.pt-solo { margin: 10px 0; line-height: 1.5; }
/* DUNGEON GATE (N5, panels.dungeonGate / dungeonReady) */
.dg-list { display: flex; flex-direction: column; gap: 4px; }
.dg-area { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; margin: 0;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(236, 228, 210, 0.1); border-radius: 3px; }
.dg-area b { font: 500 14px var(--font-title); } .dg-area span { font-size: 12px; color: var(--ink-dim); }
.dg-area.sel { border-color: rgba(200, 150, 255, 0.75); background: rgba(150, 90, 230, 0.16); box-shadow: 0 0 10px rgba(160, 100, 255, 0.25); }
.dg-area.locked { opacity: 0.45; cursor: default; } .dg-area.locked span { color: #e0a090; }
.dg-act { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.dg-go { width: 100%; padding: 10px; }
.dg-ready p { margin: 6px 0 10px; }
.dg-members { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 10px; }
.dg-members div { font: 500 14px var(--font-title); color: var(--ink-dim); } .dg-members div.yes { color: #9dffb4; }
.dg-members i { display: inline-block; width: 20px; font-style: normal; }
.dg-ready .row { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }

/* Sound settings (panels.sound) */
.snd-list { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 12px; }
.snd-row { display: grid; grid-template-columns: 90px 1fr 34px; align-items: center; gap: 10px; font-size: 13px; }
.snd-row input { accent-color: var(--hl, #e6c27a); width: 100%; }
.snd-row b { text-align: right; font-family: var(--font-title); font-weight: 500; }

/* ---------- MAP SELECT (panels.dungeonGate; data/worldMap.js) — painted / drawn world map, pins, side panel ---------- */
.overlay.ms-ov { background: #05060a; align-items: stretch; justify-content: stretch; }
.ms { position: relative; width: 100%; height: 100%; display: grid; grid-template-columns: minmax(360px, 30vw) 1fr; }
.ms-map { grid-column: 2; position: relative; overflow: hidden;
  background: radial-gradient(ellipse 30% 22% at 30% 45%, rgba(110, 160, 80, 0.25), transparent 70%),
    radial-gradient(ellipse 30% 22% at 72% 45%, rgba(140, 190, 230, 0.22), transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 55%, rgba(60, 50, 80, 0.4), transparent 80%),
    repeating-linear-gradient(35deg, rgba(255, 255, 255, 0.015) 0 6px, transparent 6px 18px), linear-gradient(180deg, #121521, #0b0d14); }
.ms-map.art { background: #0b0d14 url("../../assets/ui/worldmap.png") center / cover no-repeat; }
.ms-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ms-map polyline { fill: none; stroke-width: 0.5; stroke-dasharray: 1.4 1; opacity: 0.55; vector-effect: non-scaling-stroke; stroke-width: 3; }
.ms-city { position: absolute; transform: translate(-50%, -50%); font: 600 13px var(--font-title); letter-spacing: 2px; color: var(--hl); text-shadow: 0 2px 6px #000; text-transform: uppercase; text-align: center; }
.ms-city span { display: block; font-size: 18px; }
.ms-pin { position: absolute; transform: translate(-50%, -50%); background: none; border: 0; padding: 0; margin: 0; width: 76px; height: 96px; cursor: pointer; }
.ms-pin:hover:not(:disabled) { background: none; border: 0; }
.ms-dia { position: relative; display: block; width: 58px; height: 58px; margin: 0 auto; }
.ms-dia::before { content: ""; position: absolute; inset: 0; transform: rotate(45deg); border: 2px solid var(--rc); background: rgba(8, 8, 14, 0.92); box-shadow: 0 0 0 3px rgba(6, 6, 10, 0.85); }
.ms-dia { overflow: visible; } .ms-face { position: absolute; left: 50%; top: 50%; image-rendering: pixelated; transform-origin: center; }
.ms-pin b { display: block; margin-top: 10px; font: 600 13px var(--font-title); color: #fff; text-shadow: 0 2px 4px #000; }
.ms-pin.sel .ms-dia::before, .ms-pin:hover .ms-dia::before { box-shadow: 0 0 0 3px rgba(6, 6, 10, 0.85), 0 0 18px var(--rc); border-width: 3px; }
.ms-pin.sel .ms-dia { transform: scale(1.18); } .ms-pin.locked .ms-face { filter: brightness(0.35) grayscale(1); }
.ms-pin.locked .ms-dia::before { border-color: rgba(200, 190, 170, 0.35); }
.ms-lock { position: absolute; left: 50%; top: 40px; transform: translateX(-50%); font-style: normal; font-size: 14px; }
.ms-top { position: absolute; left: calc(max(360px, 30vw) + 50% - 15vw); top: 18px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; z-index: 2; }
.ms-top { left: auto; right: 0; width: calc(100% - max(360px, 30vw)); transform: none; justify-content: center; }
.ms-chip { margin: 0; padding: 5px 12px; font: 600 12px var(--font-title); background: rgba(6, 6, 10, 0.8); }
.ms-chip.sel { border-color: var(--hl); color: #fff; } .ms-chip.locked { opacity: 0.45; }
.ms-side { grid-column: 1; grid-row: 1; position: relative; z-index: 2; display: flex; flex-direction: column; padding: 16px 20px; overflow-y: auto;
  background: linear-gradient(90deg, rgba(6, 6, 10, 0.97), rgba(6, 6, 10, 0.92)); border-right: 1px solid var(--line); }
.ms-tabs { display: flex; gap: 4px; margin-bottom: 10px; } .ms-tabs button { margin: 0; padding: 5px 16px; font-size: 13px; } .ms-tabs button.on { border-color: var(--hl); color: #fff; }
.ms-x { margin-left: auto !important; display: block; }
.ms-head { text-align: center; } .ms-dia.big { width: 86px; height: 86px; margin: 10px auto 18px; }
.ms-route { font: 600 11px var(--font-title); letter-spacing: 3px; } .ms-head h2 { border: 0; text-align: center; margin: 2px 0; font-size: 22px; letter-spacing: 2px; padding: 0; }
.ms-lv { font-size: 12px; color: var(--ink-dim); }
.ms-desc { font-size: 13px; color: var(--ink-dim); line-height: 1.5; text-align: center; margin: 8px 0; }
.ms-boss { display: flex; align-items: baseline; gap: 8px; font-size: 13px; padding: 4px 0; border-bottom: 1px solid rgba(236, 228, 210, 0.07); }
.ms-boss span { font: 600 10px var(--font-title); letter-spacing: 2px; color: var(--ink-dim); width: 74px; } .ms-boss i { margin-left: auto; font-style: normal; font-size: 11px; color: var(--ink-dim); } .ms-boss i.ok { color: #8fe0a0; }
.ms-req { font-size: 12px; color: #e0b070; margin: 6px 0; }
.ms-rewards { display: flex; flex-wrap: wrap; gap: 4px; } .ms-rewards .slot { width: 40px; height: 40px; } .ms-rewards .slot img { width: 32px; height: 32px; }
.ms-peds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 14px 0 8px; }
.ms-ped { position: relative; text-align: center; font-size: 10px; color: var(--ink-dim); padding-top: 34px; }
.ms-ped .ms-base { width: 100%; max-width: 78px; display: block; margin: 0 auto; opacity: 0.85; } .ms-ped.empty .ms-base { opacity: 0.3; }
.ms-ped .ms-emb { position: absolute; left: 50%; top: 0; transform: translateX(-50%); width: 46px; height: 46px; filter: drop-shadow(0 4px 6px #000); }
.ms-ped b { display: block; font: 600 11px var(--font-title); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-ped.off { opacity: 0.45; }
.ms-act { margin-top: auto; padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.ms-play { width: 100%; padding: 13px; font: 700 17px var(--font-title); letter-spacing: 3px; color: #1a1206 !important; border: 0 !important;
  background: linear-gradient(180deg, #f3e6c4, #cfb985) !important; clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 14px 100%, 0 50%); }
.ms-play:hover:not(:disabled) { filter: brightness(1.08); } .ms-play:disabled { background: rgba(255, 255, 255, 0.12) !important; color: var(--ink-dim) !important; }
.ms-open { display: flex; align-items: center; gap: 8px; font-size: 12px; } .ms-open span { flex: 1; } .ms-open button { margin: 0; padding: 3px 12px; }
.ms-leave { margin: 0; }
.ms-side .keys { padding: 10px 0 0; justify-content: center; }
.ms-pin.sel b { margin-top: 18px; color: var(--hl); }
/* the world box keeps the picture's shape (3:2) and covers the map area, so pins (% of the picture) stay on their spot */
.ms-map { container-type: size; }
.ms-map.art { background: #07080d; }
.ms-world { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); aspect-ratio: var(--ar);
  width: max(100cqw, calc(100cqh * var(--ar))); background: center / 100% 100% no-repeat; }
.ms-map.art .ms-world::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(4, 4, 8, 0.6)); }
.ms-map.art polyline { display: none; } /* the painted map has its own roads */
.ms-map.art .ms-pin, .ms-map.art .ms-city { z-index: 1; }

/* ---------- RUN SUMMARY (panels.runSummary) — banner, members table, EXP + counts + rewards ---------- */
.overlay.rs-ov { background: radial-gradient(ellipse at 50% 30%, rgba(4, 4, 8, 0.35), rgba(4, 4, 8, 0.8)); align-items: stretch; justify-content: stretch; }
.rs { position: relative; width: 100%; height: 100%; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; gap: 2vh 4vw; padding: 3vh 3vw 6vh; }
.rs-banner { grid-column: 1 / 3; text-align: center; position: relative; padding: 2vh 0 1vh;
  background: linear-gradient(90deg, transparent, rgba(6, 6, 10, 0.75) 20%, rgba(6, 6, 10, 0.75) 80%, transparent); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.rs-lvup { display: flex; flex-direction: column; align-items: center; margin-bottom: 4px; } .rs-lvup b { font: 600 20px var(--font-title); } .rs-lvup small { color: var(--ink-dim); }
.rs-chev { font: 700 26px var(--font-title); color: #fff; line-height: 0.8; }
.rs-title { font: 700 clamp(44px, 7vw, 92px) var(--font-title); letter-spacing: 6px; line-height: 1; color: #e8d7a5; text-shadow: 0 4px 18px rgba(0, 0, 0, 0.9); animation: rs-pop 0.6s ease-out; }
.rs-title.win { background: linear-gradient(180deg, #b6ffd8, #2fae6a 70%, #11402a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.8)); }
.rs-sub { color: var(--ink-dim); font-size: 13px; letter-spacing: 2px; margin-top: 4px; }
@keyframes rs-pop { from { opacity: 0; transform: scale(1.25); letter-spacing: 18px; } }
.rs-left { align-self: start; background: linear-gradient(90deg, rgba(6, 6, 10, 0.85), rgba(6, 6, 10, 0.4)); padding: 6px 0; }
.rs-row { display: grid; grid-template-columns: 1fr 90px 70px 50px; align-items: center; gap: 8px; padding: 8px 16px; font: 500 15px var(--font-title); text-align: center; }
.rs-row + .rs-row { border-top: 1px solid rgba(236, 228, 210, 0.06); }
.rs-row.you { background: linear-gradient(90deg, rgba(232, 215, 165, 0.16), transparent); }
.rs-headrow { font: 600 11px var(--font-title); letter-spacing: 2px; color: var(--ink-dim); padding: 4px 16px; }
.rs-who { display: flex; align-items: center; gap: 10px; text-align: left; } .rs-who img { width: 46px; height: 46px; } .rs-noemb { width: 46px; height: 46px; display: inline-block; }
.rs-who b { display: block; font: 600 16px var(--font-title); } .rs-who small { color: var(--ink-dim); font: 400 11px var(--font-body); }
.rs-mvp { font: 700 9px var(--font-title); background: #e8c070; color: #1a1206; padding: 1px 5px; border-radius: 2px; font-style: normal; vertical-align: 2px; }
.rs-right { align-self: start; padding: 10px 18px; background: rgba(6, 6, 10, 0.72); border: 1px solid var(--line); border-radius: 3px; }
.rs-lv { display: flex; justify-content: flex-end; } .rs-lv .cw-lvl { width: 70px; height: 70px; } .rs-lv .cw-lvl span { font-size: 26px; }
.rs-exp { display: flex; gap: 10px; font: 500 13px var(--font-title); } .rs-exp b { color: #d88cff; }
.rs-bar { height: 5px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden; margin: 4px 0 12px; } .rs-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8a3fb8, #c86fe8); }
.rs-stat { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; margin: 4px 0; background: linear-gradient(90deg, rgba(47, 174, 106, 0.38), rgba(47, 174, 106, 0.12)); font: 500 14px var(--font-title); }
.rs-stat b { text-align: right; }
.rs-right h4 { margin: 14px 0 6px; font: 600 15px var(--font-title); letter-spacing: 1px; color: var(--ink); }
.rs-rewards { display: flex; flex-wrap: wrap; gap: 5px; } .rs-rewards .slot { width: 50px; height: 50px; cursor: default; } .rs-rewards .slot img { width: 38px; height: 38px; }
.rs-ok { margin: 12px 0 0; width: 100%; padding: 10px; }
.rs-keys { position: absolute; right: 3vw; bottom: 2vh; }
@media (max-width: 1000px) { .rs { grid-template-columns: 1fr; } .rs-banner { grid-column: 1; } }
.overlay.rs-ov { background: rgba(4, 4, 8, 0.78); }
.rs-right { background: rgba(6, 6, 10, 0.96); } .rs-left { background: linear-gradient(90deg, rgba(6, 6, 10, 0.96), rgba(6, 6, 10, 0.75)); }

/* Thai (language switch): stacked vowel / tone marks need more line height; Thai glyphs come from Noto Sans Thai */
html[lang="th"] body, html[lang="th"] .overlay, html[lang="th"] button, html[lang="th"] input { line-height: 1.6; }
html[lang="th"] .ts-menu button, html[lang="th"] .esc-list button { line-height: 1.5; padding-top: 0.2em; }
html[lang="th"] .ts-foot { letter-spacing: 0; }
html[lang="th"] .overlay *, html[lang="th"] #loading * { letter-spacing: 0 !important; } /* spaced-out caps look broken in Thai */

/* ========== PHONE (landscape, short screens): title + class select (MOBILE M3) ========== */
@media (max-height: 520px) {
  /* TITLE: logo on the left, login + menu stacked on the right (thumb-sized controls) */
  .ts-art ~ .ts-wrap { display: grid; grid-template-columns: 1fr minmax(280px, 42vw); align-content: center; align-items: center;
    column-gap: 4vw; row-gap: 10px; padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); text-align: left; }
  .ts-art ~ .ts-wrap > * { grid-column: 2; }
  .ts-art ~ .ts-wrap .ts-logo-img { grid-column: 1; grid-row: 1 / span 6; width: 100%; max-width: 48vw; margin: 0; justify-self: center; }
  .ts-net { display: grid; grid-template-columns: 1fr 1fr; margin: 0; gap: 8px; }
  .ts-net input, .ts-net .ts-net-err, .ts-net span { grid-column: 1 / -1; }
  .ts-net input { width: 100%; height: 44px; font-size: 16px; }          /* 16 px: phones do not zoom into the field */
  .ts-net button { height: 44px; font-size: 15px; }
  .ts-net.ok { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
  .ts-net.ok button { height: 38px; }
  .ts-net-err { text-align: left; }
  .ts-art ~ .ts-wrap .ts-menu { margin: 4px 0 0 !important; align-items: stretch; gap: 6px; }
  .ts-menu button { font-size: 18px; padding: 4px 12px; text-align: center; background: rgba(8, 6, 14, 0.45); border: 1px solid rgba(240, 225, 200, 0.18); border-radius: 3px; }
  .ts-foot { display: none; }

  /* CLASS SELECT: tabs + tree on the left, the class card (scrolls, Begin always at the bottom) on the right */
  .cs-wrap { grid-template-columns: minmax(250px, 44vw) 1fr; grid-template-rows: auto 1fr; padding: 8px 0 8px env(safe-area-inset-left); }
  .cs-lines { grid-column: 1; grid-row: 1; padding: 0 0 6px 12px; gap: 6px; }
  .cs-lines button { padding: 4px 8px 4px 4px; font-size: 11px; gap: 4px; }
  .cs-lines button img { width: 24px; height: 24px; }
  .cs-tree { grid-column: 1; grid-row: 2; overflow-y: auto; align-self: stretch; }
  .cs-node.base { padding: 6px 0 6px 12px; gap: 10px; }
  .cs-node.base .cs-emb, .cs-node.base .cs-emb img { width: 52px; height: 52px; }
  .cs-node.mastery { gap: 10px; }
  .cs-node.mastery .cs-emb, .cs-node.mastery .cs-emb img { width: 38px; height: 38px; }
  .cs-txt small { font-size: 10px; width: 170px; padding-bottom: 2px; margin-bottom: 2px; letter-spacing: 2px; }
  .cs-txt b { font-size: 18px; letter-spacing: 2px; } .cs-node.mastery .cs-txt b { font-size: 14px; }
  .cs-kids { padding: 4px 0 0 26px; gap: 4px; } .cs-kids::before { display: none; }
  .cs-lock { width: 16px; height: 16px; font-size: 9px; }
  .cs-info { grid-column: 2; grid-row: 1 / span 2; align-self: stretch; width: auto; margin: 44px max(12px, env(safe-area-inset-right)) 0 8px;
    padding: 10px 12px 0; overflow-y: auto; display: flex; flex-direction: column; }
  .cs-info p { display: block; font-size: 12px; }
  .cs-rates { gap: 2px 12px; }
  .cs-skills img { width: 34px; height: 34px; }
  .cs-start { position: sticky; bottom: 0; margin: auto -12px 0; width: calc(100% + 24px); padding: 12px; font-size: 15px; min-height: 46px; }
  .cs-splash { height: 100vh; max-width: 56vw; right: 0; opacity: 0.4; }
  .cs-back { top: 8px; right: max(12px, env(safe-area-inset-right)); padding: 6px 14px; min-height: 34px; }
}

/* MAP SELECT: secret bosses (owner: unknown until beaten once) + the phone layout (MOBILE M4) */
.ms-face.secret { filter: brightness(0) drop-shadow(0 0 3px rgba(190, 160, 255, 0.55)) !important; }
.ms-q { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 700 22px var(--font-title); font-style: normal; color: #d8c8ff; text-shadow: 0 0 8px #6b4cc0, 0 2px 3px #000; pointer-events: none; }
.ms-dia.big .ms-q { font-size: 34px; }
.ms-info { display: none; }
@media (max-height: 520px) {
  .ms { grid-template-columns: minmax(250px, 34vw) 1fr; }
  .ms-side { padding: 8px 12px 0 max(12px, env(safe-area-inset-left)); }
  .ms-tabs { margin-bottom: 4px; } .ms-tabs button { padding: 8px 16px; min-height: 38px; font-size: 14px; }
  .ms-x { min-width: 44px; font-size: 18px; }
  .ms-head { display: grid; grid-template-columns: 64px 1fr 36px; align-items: center; text-align: left; column-gap: 10px; }
  .ms-head .ms-dia.big { grid-row: 1 / span 3; width: 50px; height: 50px; margin: 6px 0 0 7px; }
  .ms-head h2 { text-align: left; font-size: 17px; letter-spacing: 1px; } .ms-route { font-size: 10px; letter-spacing: 2px; }
  .ms-info { display: block; grid-column: 3; grid-row: 1 / span 3; width: 34px; height: 34px; margin: 0; padding: 0; border-radius: 50%; font: italic 700 16px Georgia, serif; }
  .ms.info .ms-info { border-color: var(--hl); color: #fff; }
  .ms-desc, .ms-side .pt-h, .ms-rewards, .ms-peds, .ms-side .keys, .ms-top kbd { display: none; }
  .ms.info .ms-desc, .ms.info .ms-side .pt-h, .ms.info .ms-peds { display: block; }
  .ms.info .ms-rewards { display: flex; } .ms.info .ms-peds { display: grid; }
  .ms-boss { font-size: 13px; padding: 6px 0; }
  .ms-act { position: sticky; bottom: 0; padding: 8px 0 max(8px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(5, 6, 10, 0.95) 30%); }
  .ms-play { padding: 14px 8px; font-size: 16px; letter-spacing: 2px; min-height: 52px; }
  .ms-open button, .ms-leave { min-height: 40px; }
  .ms-top { top: auto; bottom: max(8px, env(safe-area-inset-bottom)); padding: 0 8px; overflow-x: auto; justify-content: flex-start; flex-wrap: nowrap; }
  .ms-chip { flex: none; padding: 10px 16px; min-height: 40px; font-size: 14px; }
  .ms-pin { width: 60px; height: 76px; } .ms-dia { width: 44px; height: 44px; } .ms-pin b { font-size: 12px; margin-top: 6px; }
  .ms-city { font-size: 11px; }
}

/* PHONE: every window (MOBILE M4 step 3) — compact header, big close / tabs / buttons, character window in 2 columns */
@media (max-height: 520px) {
  .panel button, .dialogue button { min-height: 38px; }
  .panel .x, .panel .close, .np-x { min-width: 44px; min-height: 44px; font-size: 20px; }
  .cw-narrow { width: min(760px, 92vw) !important; max-width: none !important; }
  .cw-head { padding-top: 4px !important; padding-bottom: 4px !important; }
  .cw-lvl { transform: scale(0.72); margin: -8px -6px; }
  .cw-tabs button { padding-top: 6px !important; padding-bottom: 6px !important; }
  .cw-equip { display: grid !important; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); column-gap: 12px; align-items: start; }
  .cw-equip > .cw-top { grid-column: 1; grid-row: 1 / span 4; }
  .cw-equip > .cw-more { grid-column: 1; grid-row: 5; }
  .cw-equip > .cw-bagbar, .cw-equip > .cw-bag { grid-column: 2; }
  .cw-equip > .cw-bagbar { grid-row: 1; } .cw-equip > .cw-bag { grid-row: 2 / span 4; }
  .cw-equip > .keys { display: none; }
  .cw-stage { width: 120px !important; }
  .cw-pedestal { left: -20px; }
  .cw-hero { left: -100px; }
  .cw-bag { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)) !important; }
  .cw-bag .slot { width: auto; height: 44px; }
  .cw-filters button { min-height: 34px; min-width: 34px; }
  .item-tip { max-width: min(320px, 60vw); max-height: 90vh; overflow-y: auto; }
}
@media (max-height: 520px) {
  /* Skills tab on a phone: points + skill bar in one row, tree (shrunk) left, the skill card right */
  .st-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 8px 12px !important; }
  .st-left { grid-column: 1 / -1; display: flex !important; flex-wrap: wrap; align-items: center; gap: 4px 14px; text-align: left; }
  .st-left .st-lvl, .st-left .muted, .st-left h4 { display: none !important; }
  .st-left .st-bar { margin: 0 0 0 auto; }
  .st-mid { grid-column: 1; zoom: 0.62; }
  .st-right { grid-column: 2; }
}
@media (max-height: 520px) {
  /* RUN SUMMARY on a phone: one screen, members left, rewards right (scrolls), Continue always visible */
  .rs { grid-template-columns: 1fr 1fr !important; gap: 6px 14px; padding: 6px max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left)); overflow: hidden; }
  .rs-banner { grid-column: 1 / 3 !important; padding: 2px 0; }
  .rs-title { font-size: 34px; letter-spacing: 3px; } .rs-lvup b { font-size: 14px; } .rs-chev { font-size: 16px; } .rs-sub { font-size: 11px; margin: 0; }
  .rs-left { overflow-y: auto; max-height: 100%; }
  .rs-row { grid-template-columns: 1fr 64px 48px 32px; padding: 5px 8px; font-size: 13px; } .rs-who img, .rs-noemb { width: 32px; height: 32px; } .rs-who b { font-size: 13px; }
  .rs-right { overflow-y: auto; max-height: 100%; padding: 6px 12px 0; display: flex; flex-direction: column; }
  .rs-lv { display: none; } .rs-stat { padding: 5px 10px; font-size: 12px; margin: 2px 0; } .rs-right h4 { margin: 6px 0 4px; font-size: 13px; }
  .rs-rewards .slot { width: 42px; height: 42px; } .rs-rewards .slot img { width: 32px; height: 32px; }
  .rs-ok { position: sticky; bottom: 0; min-height: 48px; font-size: 16px; margin-top: auto; box-shadow: 0 -8px 12px rgba(6, 6, 10, 0.96); }
  .rs-keys { display: none; }
}
/* SETTINGS panel rows: label left, current choice right (tap = next) */
.set-list { overflow-y: auto; max-height: calc(100vh - 170px); }
.set-row { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; margin: 3px 0; padding: 9px 12px; text-align: left; font-size: 14px; }
.set-row b { color: var(--hl); font: 600 13px var(--font-title); }
@media (max-height: 520px) { .set-list { max-height: calc(100vh - 160px); } .set-row { min-height: 42px; } }
/* side windows: the ✕ added by Panels.show */
.overlay.side > .panel { position: relative; }
.side-x { position: absolute !important; top: 10px; right: 10px; margin: 0 !important; padding: 4px 12px; min-width: 40px; min-height: 40px; z-index: 3; }
/* TITLE: character slots (online) */
.ts-chars { display: flex; flex-direction: column; gap: 8px; width: min(420px, 90vw); margin: 10px auto 0; }
.ts-ch-h { font: 600 13px var(--font-title); letter-spacing: 3px; color: var(--hl); text-transform: uppercase; text-align: center; }
.ts-wait { text-align: center; color: var(--ink-dim); padding: 20px; }
.ts-char-wrap { position: relative; }
.ts-char { display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 12px; width: 100%; margin: 0;
  padding: 8px 14px; text-align: left; background: rgba(8, 6, 14, 0.72); border: 1px solid rgba(240, 225, 200, 0.22); border-radius: 4px; min-height: 64px; }
.ts-char:hover { border-color: var(--hl); background: rgba(30, 20, 46, 0.85); }
.ts-char img, .ts-char .ts-plus { grid-row: 1 / span 2; width: 48px; height: 48px; }
.ts-char .ts-plus { display: flex; align-items: center; justify-content: center; font: 300 34px var(--font-title); color: var(--hl); border: 1px dashed rgba(240, 225, 200, 0.35); border-radius: 50%; }
.ts-char b { font: 600 17px var(--font-title); color: #fff; } .ts-char small { color: var(--ink-dim); font-size: 12px; }
.ts-char.empty { opacity: 0.8; }
.ts-del { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); margin: 0; padding: 4px 10px; min-width: 36px; font-size: 13px; background: rgba(0, 0, 0, 0.4); }
@media (max-height: 520px) { .ts-chars { width: 100%; gap: 6px; margin: 0; } .ts-char { min-height: 54px; padding: 5px 12px; } .ts-char img, .ts-char .ts-plus { width: 40px; height: 40px; } }

/* BUILD ARCHETYPES (Character Build B1): chips per archetype (ui/loadoutUI.js archetypeHTML) */
.arch-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0; }
.arch-name { font-family: var(--font-title); font-size: 12px; letter-spacing: .08em; color: var(--hl, #e8d8b0); margin-right: 4px; }
.arch-chip { display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 11px; color: var(--ac, #ccc);
  border: 1px solid color-mix(in srgb, var(--ac, #ccc) 45%, transparent); background: rgba(0,0,0,.25); opacity: .7; }
.arch-chip.on { opacity: 1; background: color-mix(in srgb, var(--ac, #ccc) 16%, rgba(0,0,0,.3)); }
.arch-chip i { font-style: normal; opacity: .6; }
/* BUILD PRESETS (B5) */
.preset-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 4px 0 6px; }
.preset { display: inline-flex; }
.preset button { font-size: 11px; padding: 2px 8px; }
.preset button[disabled] { opacity: .45; }
.preset .preset-save { padding: 2px 5px; margin-left: 1px; }
/* gear picker beside the slots (character window): choose an item without scrolling to the bag */
.cw-picker { margin-top: 6px; border: 1px solid rgba(232, 215, 165, .35); border-radius: 6px; background: rgba(10, 8, 16, .55); padding: 6px; }
.cw-pick-h { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 5px; }
.cw-pick-h span { margin-left: auto; display: flex; gap: 4px; }
.cw-pick-h button { font-size: 11px; padding: 2px 8px; }
.cw-pick-grid { display: flex; flex-wrap: wrap; gap: 4px; max-height: 150px; overflow-y: auto; }
.cw-pick-grid .slot { width: 40px; height: 40px; }

/* F4 WARDROBE tab (charWindow.wardrobeTabHTML) */
.wr-layout { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
.wr-layout .cw-stage { position: sticky; top: 0; }
.wr-slot { margin-bottom: 12px; }
.wr-slot .k { font-family: var(--font-title); letter-spacing: 1px; color: var(--hl); margin-bottom: 6px; text-transform: uppercase; }
.wr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.wr-card { display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto; column-gap: 8px; text-align: left; padding: 6px 8px;
  background: rgba(10, 8, 16, 0.6); border: 1px solid rgba(255, 240, 220, 0.18); border-radius: 6px; color: inherit; cursor: pointer; }
.wr-card i { grid-row: span 2; width: 22px; height: 22px; border-radius: 50%; align-self: center; box-shadow: 0 0 8px currentColor; }
.wr-card b { font-weight: 600; font-size: 13px; } .wr-card span { font-size: 11px; opacity: 0.7; }
.wr-card:hover:not([disabled]) { border-color: var(--hl); }
.wr-card.on { border-color: var(--hl); box-shadow: 0 0 10px rgba(255, 217, 106, 0.35); } .wr-card.on span { color: var(--hl); opacity: 1; }
.wr-card.locked { opacity: 0.45; cursor: default; }
.wr-card.r-epic b { color: #c08aff; } .wr-card.r-legendary b { color: #ffb050; } .wr-card.r-rare b { color: #6ab4ff; }
@media (max-height: 520px) { .wr-layout { grid-template-columns: 1fr; } .wr-layout .cw-stage { position: static; } }

/* WELCOME GUIDE (ui/welcomeGuide.js): one rule per line, buttons in a row */
.guide { max-width: 640px; }
.guide .controls { display: grid; grid-template-columns: 1fr; gap: 10px; }
.guide .controls > div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: start; line-height: 1.5; }
.guide .esc-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.guide .guide-nav { flex-direction: row; justify-content: center; }
.guide label { display: block; margin-top: 6px; cursor: pointer; }

/* C1 CHAT BOX (ui/chatBox.js): bottom left, see-through; fades when idle; full log while typing */
.chatbox { position: fixed; left: 12px; bottom: 14px; width: min(380px, 40vw); z-index: 30; font-family: var(--font-body, 'Segoe UI', sans-serif);
  font-size: 13px; pointer-events: none; transition: opacity .6s; }
.chatbox.hidden { display: none; }
.chatbox.idle { opacity: 0.25; }
.chatbox .chat-log { max-height: 150px; overflow: hidden; padding: 4px 6px; pointer-events: auto; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.chatbox .chat-line { line-height: 1.35; word-break: break-word; }
.chatbox .chat-line b { font-weight: 600; }
.chatbox .chat-tag { opacity: .8; }
.chatbox .chat-in { display: none; gap: 6px; margin-top: 4px; pointer-events: auto; }
.chatbox.typing { opacity: 1; }
.chatbox.typing .chat-log { max-height: 260px; overflow-y: auto; background: rgba(8, 7, 14, 0.62); border-radius: 6px; }
.chatbox.typing .chat-in { display: flex; }
.chatbox .chat-ch { background: rgba(8, 7, 14, 0.8); border: 1px solid rgba(242,236,224,.3); border-radius: 5px; font: inherit; font-weight: 700; padding: 0 8px; cursor: pointer; }
.chatbox input { flex: 1; min-width: 0; background: rgba(8, 7, 14, 0.85); color: #f2ece0; border: 1px solid rgba(242,236,224,.35); border-radius: 5px;
  padding: 6px 8px; font: inherit; font-size: 14px; outline: none; }
.chatbox input:focus { border-color: rgba(232,208,255,.8); }
/* phones: under the player frame (the bottom left belongs to the joystick); 16 px text so the phone does not zoom */
body.touch .chatbox { top: 96px; bottom: auto; width: min(300px, 38vw); font-size: 12px; }
body.touch .chatbox .chat-log { max-height: 84px; }
body.touch .chatbox input { font-size: 16px; }
/* C3 quick chat row (shown while the chat box is open) + ✕ */
.chatbox .chat-quick { display: none; flex-wrap: wrap; gap: 4px; margin-top: 4px; pointer-events: auto; }
.chatbox.typing .chat-quick { display: flex; }
.chatbox .chat-quick button { background: rgba(8, 7, 14, 0.82); color: #f2ece0; border: 1px solid rgba(242,236,224,.3); border-radius: 12px;
  padding: 3px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.chatbox .chat-quick button:hover { border-color: rgba(232,208,255,.85); color: #fff; }
.chatbox .chat-x { background: rgba(8, 7, 14, 0.8); color: #f2ece0; border: 1px solid rgba(242,236,224,.3); border-radius: 5px; padding: 0 9px; cursor: pointer; font: inherit; }
body.touch .chatbox.typing { width: min(460px, 56vw); background: rgba(8, 7, 14, 0.55); border-radius: 8px; padding: 4px; }
body.touch .chatbox .chat-quick button { font-size: 14px; padding: 7px 12px; border-radius: 16px; } /* thumb-sized */
/* above the touch layer (#touch z 40) while open; when closed the log lets touches through to the joystick */
.chatbox { z-index: 45; }
body.touch .chatbox:not(.typing) .chat-log { pointer-events: none; }
