/* Kindlewild UI — Octopath-inspired: dark translucent panels, thin gold rules, serif type. */
:root {
  --ink: #f3ecd9;
  --ink-dim: #b8ae98;
  --gold: #d9b96c;
  --gold-hi: #f6dc94;
  --gold-lo: #8a7243;
  --panel: rgba(13, 16, 32, 0.88);
  --panel-2: rgba(22, 26, 48, 0.9);
  --line: rgba(217, 185, 108, 0.75);
  --hp: #6fd36b;
  --hp-mid: #e8c94a;
  --hp-low: #e85b4a;
  --sp: #5aa8ff;
  --xp: #f2c75c;
  --serif: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --title: 'Cinzel', 'Trajan Pro', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #070810; color: var(--ink); font-family: var(--serif); -webkit-font-smoothing: antialiased; }
body { overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas#game { position: fixed; inset: 0; display: block; image-rendering: pixelated; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#ui .panel, #ui button, #ui input, #ui select, #ui .starters, #ui .window-wrap, #ui .title-screen, #ui .touch .stick, #ui .chip, #ui .swatch, #ui .dialog { pointer-events: auto; }
#ui .passive, #ui .passive *, #ui .prompt, #ui .party-strip, #ui .party-strip *, #ui .b-foes, #ui .b-allies, #ui .b-plate, #ui .b-plate *, #ui .b-order, #ui .b-order *, #ui .b-msg,
#ui .fade, #ui .loading, #ui .toasts, #ui .toast, #ui .zone-banner, #ui .dmg, #ui .break-text, #ui .nametag, #ui .bubble, #ui .hud-top, #ui .hud-top *, #ui .b-timer { pointer-events: none !important; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; font-size: 22px; }
.hidden { display: none !important; }

/* ------------------------------------------------------------- panels */
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(26, 30, 56, 0.93), rgba(9, 11, 22, 0.93));
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.7), 0 8px 30px rgba(0, 0, 0, 0.55);
  color: var(--ink);
}
.panel::before {
  content: ''; position: absolute; inset: 3px; pointer-events: none;
  border: 1px solid rgba(217, 185, 108, 0.22);
}
.panel::after {
  content: ''; position: absolute; inset: -4px; pointer-events: none;
  background:
    linear-gradient(45deg, transparent 42%, var(--gold) 42% 58%, transparent 58%) top left / 9px 9px no-repeat,
    linear-gradient(45deg, transparent 42%, var(--gold) 42% 58%, transparent 58%) top right / 9px 9px no-repeat,
    linear-gradient(45deg, transparent 42%, var(--gold) 42% 58%, transparent 58%) bottom left / 9px 9px no-repeat,
    linear-gradient(45deg, transparent 42%, var(--gold) 42% 58%, transparent 58%) bottom right / 9px 9px no-repeat;
  opacity: 0.9;
}
.panel h2, .panel h3 { font-family: var(--title); font-weight: 500; letter-spacing: 0.08em; color: var(--gold-hi); margin: 0 0 10px; }
.panel h2 { font-size: 20px; }
.panel h3 { font-size: 15px; }
.rule { height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); margin: 10px 0; }

.btn {
  font-family: var(--title); font-size: 14px; letter-spacing: 0.08em; color: var(--ink);
  background: linear-gradient(180deg, rgba(48, 52, 86, 0.95), rgba(20, 22, 40, 0.95));
  border: 1px solid var(--line); padding: 8px 16px; cursor: pointer; position: relative;
  transition: box-shadow 0.15s, color 0.15s, transform 0.08s;
}
.btn:hover, .btn.sel { color: #fff; box-shadow: 0 0 0 1px var(--gold-hi), 0 0 14px rgba(246, 220, 148, 0.35); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.4; cursor: default; box-shadow: none; }
.btn.small { font-size: 12px; padding: 5px 10px; }
.btn.ghost { background: transparent; }

input.field, select.field {
  font-family: var(--serif); font-size: 19px; color: var(--ink); width: 100%;
  background: rgba(0, 0, 0, 0.35); border: none; border-bottom: 1px solid var(--line);
  padding: 7px 4px; outline: none;
}
input.field:focus { border-bottom-color: var(--gold-hi); background: rgba(0, 0, 0, 0.5); }
label.lbl { display: block; font-family: var(--title); font-size: 11px; letter-spacing: 0.14em; color: var(--ink-dim); margin: 12px 0 2px; text-transform: uppercase; }

/* menus */
.menu { list-style: none; margin: 0; padding: 0; }
.menu li {
  position: relative; padding: 6px 12px 6px 26px; font-size: 19px; cursor: pointer; white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.menu li.sel, .menu li:hover { background: linear-gradient(90deg, rgba(246, 220, 148, 0.28), rgba(246, 220, 148, 0)); color: #fff; }
.menu li.sel::before { content: ''; position: absolute; left: 9px; top: 50%; width: 8px; height: 8px; margin-top: -4px; background: var(--gold-hi); transform: rotate(45deg); box-shadow: 0 0 6px var(--gold-hi); }
.menu li.off { opacity: 0.38; }
.menu li .r { margin-left: auto; color: var(--ink-dim); font-size: 16px; }

/* bars */
.bar { position: relative; height: 7px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(0, 0, 0, 0.7); box-shadow: 0 0 0 1px rgba(217, 185, 108, 0.25); }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(180deg, #9cf08f, var(--hp)); transition: width 0.45s ease-out; }
.bar.mid > i { background: linear-gradient(180deg, #ffe07a, var(--hp-mid)); }
.bar.low > i { background: linear-gradient(180deg, #ff8f7a, var(--hp-low)); }
.bar.sp > i { background: linear-gradient(180deg, #9ccbff, var(--sp)); }
.bar.xp > i { background: linear-gradient(180deg, #ffe39a, var(--xp)); }
.bar.thin { height: 4px; }

.kind-ico { display: inline-flex; width: 20px; height: 20px; border-radius: 4px; align-items: center; justify-content: center; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.12); }
.kind-ico svg { width: 14px; height: 14px; }
.kind-ico.unknown { background: rgba(255, 255, 255, 0.08); color: var(--ink-dim); font-family: var(--title); font-size: 12px; }
.tag { font-family: var(--title); font-size: 10px; letter-spacing: 0.1em; padding: 2px 5px; border: 1px solid currentColor; border-radius: 2px; }

/* ------------------------------------------------------------- title */
.title-screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; padding: 2vh 0; pointer-events: auto; background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.55)); }
.logo { text-align: center; flex: none; }
.logo h1 { font-family: var(--title); font-weight: 700; font-size: clamp(42px, 7vw, 86px); letter-spacing: 0.16em; margin: 0; line-height: 1;
  background: linear-gradient(180deg, #fff6d8 10%, #f1cf7c 45%, #b98a3c 70%, #f7e1a0 90%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(40, 24, 8, 0.9)) drop-shadow(0 0 18px rgba(255, 200, 110, 0.35)); }
.logo .sub { font-style: italic; font-size: clamp(16px, 2vw, 22px); color: #f0e6cc; letter-spacing: 0.12em; text-shadow: 0 2px 6px #000; margin-top: 8px; }
.logo .orn { width: min(520px, 80vw); height: 14px; margin: 12px auto 0; background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold) 80%, transparent) center / 100% 1px no-repeat; position: relative; }
.logo .orn::after { content: ''; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; background: var(--gold-hi); transform: translate(-50%, -50%) rotate(45deg); box-shadow: 0 0 10px var(--gold-hi); }
.auth { width: min(460px, 94vw); padding: 18px 24px 20px; max-height: 76vh; overflow-y: auto; flex: none; }
@media (max-height: 820px) { .logo h1 { font-size: clamp(34px, 6vh, 64px); } .logo .sub { font-size: 16px; margin-top: 4px; } .logo .orn { margin-top: 6px; } .auth label.lbl { margin-top: 7px; } }
.auth .tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.auth .tabs .btn { flex: 1; }
.auth .row { display: flex; gap: 10px; margin-top: 18px; }
.auth .row .btn { flex: 1; }
.auth .err { color: #ff9f8a; min-height: 22px; margin-top: 10px; font-size: 17px; }
.auth .note { color: var(--ink-dim); font-size: 15px; margin-top: 8px; font-style: italic; }

/* ------------------------------------------------------------- character creator (title + wardrobe) */
.auth.wide { width: min(820px, 96vw); }
.auth-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.look-editor { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 18px; align-items: start; margin-top: 4px; }
.look-stage { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.look-preview { width: 160px; height: auto; image-rendering: pixelated; cursor: grab; touch-action: none; border: 1px solid rgba(217, 185, 108, 0.35);
  background: radial-gradient(ellipse 30% 5% at 50% 91.5%, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0) 100%), radial-gradient(ellipse at 50% 62%, rgba(246, 220, 148, 0.17), rgba(0, 0, 0, 0.34)); }
.look-preview:active { cursor: grabbing; }
.look-turn { display: flex; gap: 6px; }
.look-turn .btn { min-width: 42px; }
.look-random { width: 160px; }
.look-caption { color: var(--ink-dim); font-size: 15px; font-style: italic; text-align: center; min-height: 20px; }
.look-tabs { display: flex; gap: 6px; margin-bottom: 6px; }
.look-tabs .btn { flex: 1; }
.look-pane { min-height: 232px; }
.look-row label.lbl { margin: 8px 0 5px; }
.look-tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.look-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 70px; padding: 5px 4px 3px; cursor: pointer; border: 1px solid rgba(217, 185, 108, 0.3); background: rgba(0, 0, 0, 0.25); }
.look-tile canvas { height: auto; image-rendering: pixelated; }
.look-tile span { font-size: 13px; color: var(--ink-dim); white-space: nowrap; }
.look-tile:hover { border-color: rgba(246, 220, 148, 0.7); }
.look-tile.sel { border-color: var(--gold-hi); box-shadow: 0 0 0 1px var(--gold-hi), 0 0 10px rgba(246, 220, 148, 0.3); background: rgba(246, 220, 148, 0.12); }
.look-tile.sel span { color: #fff; }
.swatch.eye { border-radius: 50%; }
.swatch.outfit { width: 28px; }
.swatch.reset { position: relative; }
.swatch.reset::after { content: ''; position: absolute; inset: 4px; border: 1px dashed rgba(255, 255, 255, 0.75); }
.window.wardrobe { width: min(800px, 96vw); }
.wardrobe-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
@media (max-width: 640px) { .look-editor, .auth-fields { grid-template-columns: 1fr; } }
@media (max-height: 820px) { .look-preview { width: 120px; } .look-random { width: 132px; } .look-pane { min-height: 0; } .auth .row { margin-top: 12px; } }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 24px; height: 24px; border: 1px solid rgba(0, 0, 0, 0.6); cursor: pointer; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15); }
.swatch.sel { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 10px var(--gold-hi); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: 15px; padding: 2px 9px; border: 1px solid rgba(217, 185, 108, 0.4); cursor: pointer; text-transform: capitalize; }
.chip.sel { background: rgba(246, 220, 148, 0.22); border-color: var(--gold-hi); color: #fff; }
.version { position: fixed; right: 12px; bottom: 8px; font-size: 13px; color: rgba(255, 255, 255, 0.45); pointer-events: none; }

/* ------------------------------------------------------------- HUD */
.zone-banner { position: fixed; left: 50%; top: 16%; transform: translateX(-50%); text-align: center; pointer-events: none; opacity: 0; transition: opacity 0.9s; }
.zone-banner.show { opacity: 1; }
.zone-banner .name { font-family: var(--title); font-size: clamp(26px, 4vw, 44px); letter-spacing: 0.2em; color: #fbf1d4; text-shadow: 0 2px 0 #000, 0 0 20px rgba(0, 0, 0, 0.8); }
.zone-banner .line { width: min(560px, 80vw); height: 1px; margin: 8px auto; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.zone-banner .sub { font-style: italic; font-size: 18px; color: var(--ink); text-shadow: 0 1px 4px #000; }

.hud-top { position: fixed; left: 14px; top: 12px; display: flex; gap: 10px; align-items: center; pointer-events: none; }
.hud-chip { font-family: var(--title); font-size: 13px; letter-spacing: 0.1em; padding: 6px 12px 6px 10px; }
.hud-chip .clock { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: -1px; background: #ffd56a; box-shadow: 0 0 8px #ffd56a; }
.hud-chip .clock.night { background: #b8c8ff; box-shadow: 0 0 8px #b8c8ff; }
.hud-right { position: fixed; right: 14px; top: 12px; display: flex; gap: 8px; }
.hud-btn { font-family: var(--title); font-size: 12px; letter-spacing: 0.1em; padding: 7px 11px; cursor: pointer; }
.hud-btn kbd { font-family: var(--serif); font-size: 13px; color: var(--gold-hi); margin-left: 6px; }
.hud-btn .badge { display: inline-block; min-width: 16px; margin-left: 6px; padding: 0 4px; border-radius: 8px; background: #2f8f55; color: #eafff0; font-family: var(--serif); font-size: 12px; letter-spacing: 0; line-height: 16px; text-align: center; }
.hud-btn .badge.hidden { display: none; }
.party-strip { position: fixed; left: 14px; top: 56px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.party-strip .pm { width: 184px; padding: 5px 8px 6px; display: grid; grid-template-columns: 34px 1fr; gap: 2px 8px; align-items: center; }
.party-strip .pm canvas { grid-row: span 3; width: 34px; height: 34px; image-rendering: pixelated; }
.party-strip .pm .n { font-size: 15px; line-height: 1; display: flex; justify-content: space-between; }
.party-strip .pm .n b { font-weight: 600; }
.party-strip .pm.down { opacity: 0.5; }

.prompt { position: fixed; transform: translate(-50%, -100%); pointer-events: none; font-family: var(--title); font-size: 13px; letter-spacing: 0.08em; padding: 4px 10px; white-space: nowrap; }
.prompt kbd { color: var(--gold-hi); font-family: var(--title); margin-right: 6px; }
.nametag { position: fixed; transform: translate(-50%, -100%); pointer-events: none; font-size: 15px; font-weight: 600; color: #fff; text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 1px #000; white-space: nowrap; }
.nametag.npc { color: var(--gold-hi); font-size: 14px; }
.nametag.partner { color: #a8f0bc; }
.nametag.friend { color: #b9dcff; }
.nametag.guild { color: #f2c98a; }
.hud-side { position: fixed; right: 14px; top: 54px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.hud-team { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; font-size: 15px; }
.hud-team .lbl { font-family: var(--title); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #8fe0a8; }
.hud-team .btn { padding: 2px 8px; font-size: 12px; }
/* quest tracker (under the menu buttons) and the marks over townsfolk */
.quest-track { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.qt { width: 250px; padding: 6px 12px 7px; cursor: pointer; transition: box-shadow 0.15s; }
.qt:hover { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--gold-hi), 0 0 14px rgba(246, 220, 148, 0.3); }
.qt-title { font-family: var(--title); font-size: 12px; letter-spacing: 0.08em; color: var(--gold-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt-goal { font-size: 16px; line-height: 1.2; margin-top: 2px; }
.qt-goal b { color: #9ccbff; font-weight: 600; white-space: nowrap; }
.qt.back .qt-goal { color: #a8f0bc; }
.qmark { position: fixed; transform: translate(-50%, -100%); font-family: var(--title); font-weight: 700; font-size: 30px; line-height: 1; color: #ffd84a;
  text-shadow: 0 0 2px #000, 0 2px 0 #5a3500, 0 0 12px rgba(255, 196, 60, 0.85); animation: qbob 1.3s ease-in-out infinite; }
.qmark.ready { color: #fff1a0; text-shadow: 0 0 2px #000, 0 2px 0 #5a3500, 0 0 16px rgba(255, 220, 90, 1); }
.qmark.busy { color: #c9ccd8; opacity: 0.55; font-size: 24px; text-shadow: 0 0 2px #000, 0 2px 0 #1c1e28; animation: none; }
@keyframes qbob { 50% { margin-top: -5px; } }
.nametag .fight { color: #ff9a6a; margin-left: 4px; }
.bubble { position: fixed; transform: translate(-50%, -100%); pointer-events: none; max-width: 240px; font-size: 16px; line-height: 1.2; padding: 6px 10px; background: rgba(250, 244, 228, 0.95); color: #2a2236; border-radius: 3px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4); }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: none; border-top-color: rgba(250, 244, 228, 0.95); }

.toasts { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 30; }
.toast { padding: 7px 16px; font-size: 18px; animation: toastIn 0.25s ease-out; }
.toast.out { opacity: 0; transition: opacity 0.4s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* chat */
.chat { position: fixed; left: 14px; bottom: 14px; width: min(420px, 60vw); pointer-events: none; }
.chat .log { max-height: 190px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; font-size: 17px; line-height: 1.25; text-shadow: 0 1px 3px #000, 0 0 2px #000; }
.chat .log div { opacity: 1; transition: opacity 1s; }
.chat .log div.old { opacity: 0; }
.chat.open .log div.old { opacity: 0.85; }
.chat .log b { color: var(--gold-hi); font-weight: 600; }
.chat .log .sys { color: #9fd0ff; font-style: italic; }
.chat .log .world b { color: #ffb9e0; }
.chat .log .team b { color: #8fe0a8; }
.chat .log .whisper { color: #ecd8ff; }
.chat .log .whisper b { color: #d4a8ff; }
.chat .log .info { color: var(--ink-dim); font-style: italic; }
.chat .log .presence { color: #b9dcff; font-style: italic; }
.chat .log .guild b { color: #f2c98a; }
.chat .log .guild-note { color: #f2dcb4; font-style: italic; }
.chat .log .guild-note b { color: #f2c98a; font-style: normal; }
.chat .input { display: none; margin-top: 6px; pointer-events: auto; }
.chat.open .input { display: flex; gap: 6px; }
.chat .input input { flex: 1; font-family: var(--serif); font-size: 17px; color: var(--ink); background: rgba(8, 10, 20, 0.85); border: 1px solid var(--line); padding: 6px 8px; outline: none; }
.chat .input .ch { font-family: var(--title); font-size: 11px; padding: 0 8px; cursor: pointer; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat .input .ch.ch-world { color: #ffb9e0; }
.chat .input .ch.ch-team { color: #8fe0a8; }
.chat .input .ch.ch-whisper { color: #d4a8ff; }
.chat .input .ch.ch-guild { color: #f2c98a; }

/* dialog */
.dialog { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); width: min(880px, 94vw); min-height: 128px; padding: 22px 30px 18px; font-size: 22px; line-height: 1.38; cursor: pointer; z-index: 20; }
.dialog .who { position: absolute; left: 22px; top: -18px; font-family: var(--title); font-size: 15px; letter-spacing: 0.12em; padding: 5px 16px; color: var(--gold-hi); }
.dialog .more { position: absolute; right: 18px; bottom: 10px; width: 10px; height: 10px; background: var(--gold-hi); transform: rotate(45deg); animation: bob 0.9s infinite; }
@keyframes bob { 50% { transform: translateY(4px) rotate(45deg); } }
.dialog .choices { margin-top: 12px; }
.dialog .reward { margin-top: 8px; color: var(--gold-hi); font-size: 18px; font-style: italic; }

/* starter pick */
.starters { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(4, 5, 12, 0.55); z-index: 25; }
.starters .wrap { padding: 22px 26px; width: min(980px, 96vw); }
.starters .cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.starters .card { padding: 14px; text-align: center; cursor: pointer; border: 1px solid rgba(217, 185, 108, 0.3); background: rgba(0, 0, 0, 0.25); transition: transform 0.15s, box-shadow 0.15s; }
.starters .card:hover, .starters .card.sel { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--gold-hi), 0 0 24px rgba(246, 220, 148, 0.25); }
.starters canvas { width: 100%; max-width: 220px; aspect-ratio: 1; image-rendering: pixelated; }
.starters .nm { font-family: var(--title); font-size: 20px; color: var(--gold-hi); letter-spacing: 0.1em; }
.starters .desc { font-size: 17px; color: var(--ink-dim); min-height: 66px; margin-top: 6px; }
@media (max-width: 720px) { .starters .cards { grid-template-columns: 1fr; } .starters canvas { max-width: 120px; } .starters .desc { min-height: 0; } }

/* windows (party, bag, kinbook, shop, settings) */
.window-wrap { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(4, 5, 12, 0.45); z-index: 22; }
.window { width: min(1000px, 96vw); max-height: 90vh; padding: 20px 24px; display: flex; flex-direction: column; }
.window .head { display: flex; align-items: center; gap: 12px; }
.window .head h2 { margin: 0; flex: 1; }
.window .body { overflow: auto; margin-top: 12px; min-height: 0; }
.window .tabs { display: flex; gap: 6px; }
.split { display: grid; grid-template-columns: 340px 1fr; gap: 18px; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.kin-list .kin { display: grid; grid-template-columns: 52px 1fr; gap: 3px 10px; padding: 7px 10px; cursor: pointer; border: 1px solid transparent; align-items: center; }
.kin-list .kin canvas { grid-row: span 3; width: 52px; height: 52px; image-rendering: pixelated; }
.kin-list .kin.sel { background: linear-gradient(90deg, rgba(246, 220, 148, 0.2), rgba(246, 220, 148, 0)); border-color: rgba(217, 185, 108, 0.5); }
.kin-list .kin .n { display: flex; justify-content: space-between; font-size: 18px; }
.kin-detail .top { display: grid; grid-template-columns: 170px 1fr; gap: 16px; }
.kin-detail canvas.big { width: 170px; height: 170px; image-rendering: pixelated; background: radial-gradient(ellipse at 50% 70%, rgba(246, 220, 148, 0.15), rgba(0, 0, 0, 0.25)); }
.kin-detail .name { font-family: var(--title); font-size: 22px; color: var(--gold-hi); letter-spacing: 0.06em; }
.kin-detail .types { display: flex; gap: 6px; margin: 6px 0; align-items: center; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 14px; font-size: 17px; margin-top: 8px; }
.stats div { display: flex; justify-content: space-between; border-bottom: 1px dotted rgba(217, 185, 108, 0.2); }
.stats b { font-weight: 600; color: #fff; }
.moves .mv { display: flex; align-items: center; gap: 8px; padding: 4px 8px; font-size: 17px; cursor: pointer; }
.moves .mv.eq { background: rgba(246, 220, 148, 0.12); }
.moves .mv .sp { margin-left: auto; color: #9ccbff; font-size: 15px; }
.moves .mv .pw { color: var(--ink-dim); font-size: 15px; width: 42px; text-align: right; }
.muted { color: var(--ink-dim); }
.grid-book { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.grid-book .e { text-align: center; padding: 8px; border: 1px solid rgba(217, 185, 108, 0.2); cursor: pointer; }
.grid-book .e canvas { width: 80px; height: 80px; image-rendering: pixelated; }
.grid-book .e.unseen { opacity: 0.35; }
.grid-book .e.sel { box-shadow: 0 0 0 1px var(--gold-hi); }
.grid-book .num { font-family: var(--title); font-size: 11px; color: var(--ink-dim); }
.shop-list li .price { margin-left: auto; color: var(--gold-hi); }
.coins { font-family: var(--title); color: var(--gold-hi); letter-spacing: 0.06em; }
.coins::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff1b0, #d9a63a 60%, #8a6420); margin-right: 6px; vertical-align: 0; }

/* challenge */
/* friends window */
.friend-add { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.friend-add input.text { flex: 0 1 280px; font-family: var(--serif); font-size: 17px; color: var(--ink); background: rgba(8, 10, 20, 0.85); border: 1px solid var(--line); padding: 5px 8px; outline: none; }
.friend-list { display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.friend-row { display: grid; grid-template-columns: 14px minmax(120px, 200px) 1fr auto; gap: 10px; align-items: center; padding: 6px 10px; border: 1px solid rgba(217, 185, 108, 0.25); font-size: 18px; }
.friend-row.blocked { grid-template-columns: 1fr auto; }
.friend-row .dot { width: 10px; height: 10px; border-radius: 50%; background: #555a66; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
.friend-row.on .dot { background: #5fdc8a; box-shadow: 0 0 6px #5fdc8a; }
.friend-row:not(.on):not(.blocked) b { color: var(--ink-dim); font-weight: 600; }
.friend-row .where { font-size: 16px; }
.friend-row .acts { display: flex; gap: 6px; }
.friend-note { font-size: 15px; font-style: italic; margin-top: 12px; }

/* guild tab (Social window) */
.window input.text { flex: 0 1 280px; font-family: var(--serif); font-size: 17px; color: var(--ink); background: rgba(8, 10, 20, 0.85); border: 1px solid var(--line); padding: 5px 8px; outline: none; }
.window input.text.wide { flex: 1 1 auto; }
.btn.danger { color: #ffd0c4; border-color: #c4553f; background: linear-gradient(180deg, rgba(120, 40, 34, 0.95), rgba(60, 18, 16, 0.95)); }
.guild-box { display: flex; flex-direction: column; gap: 8px; }
.guild-box h3 { margin: 6px 0 0; }
.guild-box p { font-size: 18px; margin: 4px 0; }
.guild-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.guild-title { display: flex; align-items: baseline; gap: 10px; }
.guild-title .gname { font-family: var(--title); font-size: 22px; letter-spacing: 0.06em; color: var(--gold-hi); }
.guild-title .gtag { font-family: var(--title); font-size: 15px; letter-spacing: 0.12em; color: #f2c98a; }
.guild-motd { display: flex; align-items: center; gap: 10px; font-size: 18px; font-style: italic; padding: 6px 10px; border-left: 2px solid rgba(217, 185, 108, 0.6); background: rgba(246, 220, 148, 0.06); }
.guild-motd > span { flex: 1; }
.guild-motd .btn { font-style: normal; }
.guild-goal { display: flex; flex-direction: column; gap: 5px; padding: 8px 12px 10px; border: 1px solid rgba(217, 185, 108, 0.3); }
.gg-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 17px; }
.gg-top .muted { font-size: 15px; font-style: italic; }
.gg-bar { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: 16px; }
.gg-bar .bar { height: 9px; }
.gg-track { position: relative; }
.gg-mark { position: absolute; top: -3px; width: 2px; height: 15px; margin-left: -1px; background: rgba(255, 255, 255, 0.35); pointer-events: none; }
.gg-mark.reached { background: var(--gold-hi); box-shadow: 0 0 6px var(--gold-hi); }
.gg-mine { font-size: 15px; }
.gg-mine .ok { color: #8fd480; }
.gg-tier { display: grid; grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1fr) 150px; gap: 10px; align-items: center; font-size: 16px; padding: 3px 0; border-top: 1px dotted rgba(217, 185, 108, 0.2); }
.gg-tier b { font-family: var(--title); font-size: 12px; letter-spacing: 0.1em; color: var(--ink-dim); }
.gg-tier.reached b { color: var(--gold-hi); }
.gg-tier.got { opacity: 0.6; }
.gg-tier.late .task-state { font-style: italic; color: var(--ink-dim); }
.gg-size { font-size: 14px; font-style: italic; }
.gg-tier .btn, .gg-tier .task-state { justify-self: end; }
.guild-roster { display: grid; grid-template-columns: 14px minmax(110px, 170px) 74px minmax(0, 1fr) 40px auto; column-gap: 10px; row-gap: 4px; }
/* (each row a subgrid of the roster's columns, so the columns line up from row to row) */
.guild-row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; padding: 5px 10px; border: 1px solid rgba(217, 185, 108, 0.25); font-size: 18px; }
@supports not (grid-template-columns: subgrid) {
  .guild-roster { display: flex; flex-direction: column; }
  .guild-row { grid-template-columns: 14px minmax(110px, 170px) 74px minmax(0, 1fr) 40px auto; column-gap: 10px; }
}
.guild-row .dot { width: 10px; height: 10px; border-radius: 50%; background: #555a66; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
.guild-row.on .dot { background: #5fdc8a; box-shadow: 0 0 6px #5fdc8a; }
.guild-row:not(.on) b { color: var(--ink-dim); font-weight: 600; }
.guild-row .where { font-size: 16px; }
.guild-row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.guild-row .gweek { text-align: right; color: #9ccbff; font-size: 16px; }
.grank { font-family: var(--title); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); }
.grank.leader { color: var(--gold-hi); }
.grank.officer { color: #9ccbff; }
.guild-log { font-size: 15px; display: flex; flex-direction: column; gap: 2px; }
.guild-foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 6px; }
.guild-foot .muted { font-size: 15px; font-style: italic; }
.guild-disband { justify-content: flex-end; flex-wrap: wrap; }
.guild-disband .warn { color: #ffb4a0; font-size: 15px; font-style: italic; }
@media (max-width: 760px) {
  .guild-roster { display: flex; flex-direction: column; }
  .guild-row { grid-template-columns: 14px 1fr auto; column-gap: 10px; }
  .guild-row .where, .guild-row .gweek { display: none; }
  .guild-row .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .gg-tier { grid-template-columns: 52px 1fr auto; }
  .gg-tier > .muted { grid-column: 2; }
}

/* founding a guild */
.window.found { width: min(560px, 96vw); }
.window.found input.text { display: block; width: 100%; max-width: none; }
.window.found input.text.tag { width: 120px; text-transform: uppercase; letter-spacing: 0.12em; }
.found-preview { margin: 12px 0 0; font-size: 17px; }
.found-preview b { color: #f2c98a; }
.found-err { color: #ff9f8a; min-height: 22px; margin: 6px 0; font-size: 17px; }
.found-foot { display: flex; justify-content: flex-end; }

/* quest log */
.quest-list { display: flex; flex-direction: column; gap: 4px; }
.quest-row { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; cursor: pointer; border: 1px solid transparent; font-size: 18px; }
.quest-row b { font-weight: 600; }
.quest-row .muted { font-size: 15px; }
.quest-row.sel { background: linear-gradient(90deg, rgba(246, 220, 148, 0.2), rgba(246, 220, 148, 0)); border-color: rgba(217, 185, 108, 0.5); }
.quest-row.back .muted { color: #a8f0bc; }
.quest-count { margin-top: 10px; font-size: 15px; font-style: italic; }
.quest-detail h3 { margin-bottom: 2px; }
.quest-detail p { font-size: 18px; }
.quest-steps { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; font-size: 18px; }
.qs.done { color: var(--ink-dim); }
.qs.now { color: #fff; }
.qs.now b { color: #9ccbff; font-weight: 600; }
.qs.now.back { color: #a8f0bc; }
.quest-reward { color: var(--gold-hi); }

/* daily tasks (quest log tab and task boards) */
.daily { display: flex; flex-direction: column; gap: 8px; }
.daily > p { margin: 2px 0; font-size: 17px; }
.daily h3 { margin: 10px 0 0; }
.task-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px 170px; gap: 14px; align-items: center; padding: 8px 12px; border: 1px solid rgba(217, 185, 108, 0.25); }
.task-row.ready { border-color: var(--gold-hi); box-shadow: 0 0 14px rgba(246, 220, 148, 0.18); }
.task-row.got { opacity: 0.55; }
.task-text { display: flex; flex-direction: column; font-size: 18px; }
.task-text b { font-weight: 600; }
.task-text .muted { font-size: 15px; }
.task-progress { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 16px; }
.task-state { text-align: right; font-size: 15px; font-style: italic; color: var(--ink-dim); }
.task-state.ready { color: var(--gold-hi); }
.task-row .btn { justify-self: end; }
.task-bonus { color: var(--gold-hi); font-style: italic; }
.task-bonus.got { color: #a8f0bc; }
.task-reset { font-size: 15px; font-style: italic; }
@media (max-width: 760px) { .task-row { grid-template-columns: 1fr; gap: 6px; } .task-state { text-align: left; } .task-row .btn { justify-self: start; } }
.modal { position: fixed; left: 50%; top: 30%; transform: translateX(-50%); padding: 18px 24px; width: min(420px, 92vw); text-align: center; z-index: 28; }
.modal p { font-size: 20px; margin: 4px 0 14px; }
.modal .row { display: flex; gap: 10px; justify-content: center; }
.modal .row.col { flex-direction: column; align-items: stretch; }
.modal .offer-title { display: block; font-family: var(--title); font-weight: 500; font-size: 20px; letter-spacing: 0.06em; color: var(--gold-hi); }
.modal .offer-reward { display: block; margin-top: 6px; font-size: 17px; font-style: italic; color: var(--ink-dim); }

/* trade */
.trade-offers { display: flex; flex-direction: column; gap: 8px; }
.trade-side { border: 1px solid rgba(217, 185, 108, 0.25); padding: 10px 12px; min-height: 110px; }
.trade-side.ready { border-color: var(--gold-hi); box-shadow: 0 0 16px rgba(246, 220, 148, 0.22); }
.trade-side h3 { display: flex; justify-content: space-between; align-items: center; }
.trade-side .ok { color: #8fd480; font-size: 12px; letter-spacing: 0.12em; }
.trade-card .top { grid-template-columns: 120px 1fr; gap: 14px; }
.trade-card canvas.big { width: 120px; height: 120px; }
.trade-card .stats { font-size: 16px; }
.trade-swap { text-align: center; color: var(--gold); font-size: 20px; line-height: 1; }
.trade-foot { text-align: center; }
.trade-foot p { margin: 4px 0 10px; }
.trade-notice { color: #ffcf7a; }

/* ------------------------------------------------------------- battle */
.battle-ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.battle-ui > * { pointer-events: auto; }
.b-order { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 6px 12px; pointer-events: none; }
.b-order .lbl { font-family: var(--title); font-size: 12px; letter-spacing: 0.14em; color: var(--ink-dim); margin-right: 6px; }
.b-order .slot { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; border: 2px solid rgba(217, 185, 108, 0.6); background: rgba(0, 0, 0, 0.4); }
.b-order .slot.foe { border-color: #e8786a; }
.b-order .slot.ally { border-color: #7fc4ff; }
.b-order .slot.ally.partner { border-color: #8fe0a8; }
.b-order .slot canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.b-order .arrow { color: var(--gold); font-size: 14px; }
.b-foes { position: fixed; left: 18px; top: 66px; display: flex; flex-direction: column; gap: 8px; }
.b-allies { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 8px; }
.b-plate { padding: 10px 14px 12px; width: 300px; pointer-events: none; }
.b-plate.ally { width: 330px; }
.b-foes.two .b-plate { padding: 7px 12px 8px; width: 270px; }
.b-foes.two .b-plate .n { font-size: 17px; }
.b-foes.two .b-plate .row { margin-top: 5px; }
.b-plate.mini { width: 300px; padding: 7px 12px 9px; }
.b-plate.mini .who { font-family: var(--title); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #8fe0a8; }
.b-plate.mini .n { font-size: 17px; }
.b-plate.foe .who { font-family: var(--title); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #ffb4a8; }
.b-plate .n { display: flex; align-items: baseline; gap: 8px; font-size: 20px; }
.b-plate .n b { font-weight: 700; }
.b-plate .n .lv { margin-left: auto; font-family: var(--title); font-size: 13px; color: var(--ink-dim); }
.b-plate .nums { display: flex; justify-content: space-between; font-size: 15px; color: var(--ink-dim); margin-top: 3px; }
.b-plate .nums b { color: #fff; font-weight: 600; }
.b-plate .bar { margin-top: 4px; }
.b-plate .row { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.shield { position: relative; width: 30px; height: 34px; display: grid; place-items: center; font-family: var(--title); font-weight: 700; font-size: 15px; color: #1c2236;
  background: linear-gradient(180deg, #e9eef8, #9aa8c4); clip-path: polygon(50% 0, 100% 15%, 92% 62%, 50% 100%, 8% 62%, 0 15%); }
.shield.crack { animation: crack 0.35s; }
.shield.broken { background: linear-gradient(180deg, #ff9d7a, #b8402a); color: #fff; }
@keyframes crack { 30% { transform: scale(1.35) rotate(-8deg); filter: brightness(2); } }
.weak-row { display: flex; gap: 4px; flex-wrap: wrap; }
.weak-row .kind-ico.flip { animation: flip 0.45s; }
@keyframes flip { 0% { transform: rotateY(90deg) scale(1.3); filter: brightness(3); } 100% { transform: none; } }
.status-badge { font-family: var(--title); font-size: 10px; letter-spacing: 0.08em; padding: 2px 6px; border-radius: 2px; color: #120d1e; font-weight: 700; }
.broken-badge { font-family: var(--title); font-weight: 700; font-size: 12px; letter-spacing: 0.14em; color: #ffd0b0; text-shadow: 0 0 8px #ff6a3a; animation: pulse 0.8s infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.bp-orbs { display: flex; gap: 5px; align-items: center; }
.bp-orbs i { width: 13px; height: 13px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 220, 150, 0.35); }
.bp-orbs i.on { background: radial-gradient(circle at 35% 35%, #fff6cc, #ffbf3a 55%, #b86a10); box-shadow: 0 0 8px #ffb84a; border-color: #ffe7a0; }
.bp-orbs i.use { background: radial-gradient(circle at 35% 35%, #fff, #ff7a3a 55%, #b8301a); box-shadow: 0 0 12px #ff6a3a; }
.bp-orbs .lbl { font-family: var(--title); font-size: 11px; color: var(--ink-dim); letter-spacing: 0.12em; margin-right: 4px; }
.b-cmd { position: fixed; right: 366px; bottom: 18px; width: 300px; padding: 10px 6px; }
.b-cmd .menu li { font-size: 20px; }
.b-cmd .boost { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px 2px; font-size: 16px; }
.b-cmd .boost .btn { padding: 2px 10px; }
.b-cmd .hint { padding: 6px 12px 2px; font-size: 15px; color: var(--ink-dim); font-style: italic; min-height: 24px; }
.b-msg { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); padding: 8px 22px; font-size: 21px; min-width: 300px; text-align: center; pointer-events: none; }
.dmg { position: fixed; transform: translate(-50%, -50%); font-family: var(--title); font-weight: 700; font-size: 34px; color: #fff; pointer-events: none;
  text-shadow: 0 0 2px #000, 0 2px 0 #000, 2px 0 0 #000, -2px 0 0 #000, 0 -2px 0 #000, 0 0 12px rgba(0, 0, 0, 0.8); animation: dmg 1.1s ease-out forwards; z-index: 15; }
.dmg.weak { color: #ffd84a; font-size: 42px; }
.dmg.heal { color: #8cf08a; }
.dmg.small { font-size: 20px; }
.dmg .t { display: block; font-size: 14px; letter-spacing: 0.2em; color: #ffb26a; }
@keyframes dmg { 0% { opacity: 0; transform: translate(-50%, -20%) scale(1.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -110%); } }
.break-text { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); font-family: var(--title); font-weight: 700; font-size: clamp(56px, 9vw, 110px); letter-spacing: 0.18em; color: #fff3e0; pointer-events: none; z-index: 16;
  text-shadow: 0 0 20px #ff6a2a, 0 0 40px #ff3a1a, 0 4px 0 #5a1a0a; animation: breakIn 1.2s ease-out forwards; }
@keyframes breakIn { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2.4); letter-spacing: 0.6em; } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1); letter-spacing: 0.18em; } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1.05); } }
.b-result { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); padding: 22px 34px; text-align: center; min-width: 340px; z-index: 18; }
.b-result h2 { font-size: 30px; }
.b-result p { font-size: 20px; margin: 6px 0; }
.b-timer { position: fixed; left: 50%; top: 120px; transform: translateX(-50%); font-family: var(--title); color: var(--ink-dim); font-size: 13px; letter-spacing: 0.12em; pointer-events: none; }

/* touch controls */
.touch { position: fixed; inset: auto 0 0 0; height: 46vh; pointer-events: none; z-index: 5; }
.touch .stick { position: absolute; left: 0; bottom: 0; width: 50vw; height: 100%; pointer-events: auto; }
.touch .knob { position: absolute; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35); background: radial-gradient(circle, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.04)); display: none; }
.touch .knob i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: rgba(255, 240, 210, 0.5); }
.touch .act { position: absolute; right: 22px; bottom: 34px; width: 74px; height: 74px; border-radius: 50%; pointer-events: auto; font-family: var(--title); font-size: 15px; display: grid; place-items: center; }
.touch .run { position: absolute; right: 108px; bottom: 22px; width: 56px; height: 56px; border-radius: 50%; pointer-events: auto; font-family: var(--title); font-size: 11px; display: grid; place-items: center; }
.touch .run.on { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 14px var(--gold-hi); }

.fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.35s; z-index: 40; }
.fade.on { opacity: 1; }
.loading { position: fixed; left: 50%; top: 55%; transform: translateX(-50%); font-family: var(--title); letter-spacing: 0.2em; color: var(--ink-dim); z-index: 41; pointer-events: none; }

@media (max-width: 640px) {
  .window { padding: 16px 14px; }
  .window .head { flex-wrap: wrap; row-gap: 8px; }
  .window .head .tabs { order: 3; width: 100%; flex-wrap: wrap; }
  .party-strip { display: none; }
  .dialog { font-size: 18px; padding: 18px 18px 14px; bottom: 12px; }
  .b-plate { width: 230px; }
  .b-plate.ally { width: 250px; }
  .b-cmd { width: auto; left: 12px; right: 270px; bottom: 12px; }
}

/* The HUD on smaller screens. Toasts keep clear of the quest tracker: beside it on a wide screen,
   below it on a narrower one, where the tracker shows only the latest quest (the log has them all).
   The menu buttons get compact, and on a phone the area chip and the tracker drop below them. */
@media (min-width: 1000px) { .toast { max-width: calc(100vw - 580px); } }
@media (max-width: 999px) {
  .quest-track .qt:nth-child(n+2) { display: none; }
  .toasts { top: 184px; }
  .hud.hidden + .toasts { top: 64px; } /* (in a battle, where there's no tracker) */
}
@media (max-width: 760px) {
  .hud-btn kbd { display: none; }
  .hud-right { right: 8px; top: 8px; gap: 4px; }
  .hud-btn { font-size: 11px; letter-spacing: 0.04em; padding: 6px 7px; }
  .hud-btn .badge { margin-left: 3px; }
}
@media (max-width: 640px) {
  .hud-right { left: 8px; justify-content: flex-end; }
  .hud-btn { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; }
  .hud-top { top: 48px; left: 8px; }
  .hud-chip { max-width: calc(100vw - 232px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hud-side { top: 48px; right: 8px; }
  .qt { width: 200px; padding: 5px 9px 6px; }
  .qt-goal { font-size: 14px; }
  .toasts { width: calc(100vw - 24px); }
  .toast { font-size: 16px; text-align: center; }
}
@media (max-height: 500px) { .qt-goal { font-size: 14px; } }

/* ------------------------------------------------------------- ranks */
.rank { display: inline-grid; place-items: center; flex: none; font-family: var(--title); font-weight: 700; line-height: 1; border-radius: 3px; color: #10121c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.6); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35); }
.rank-D { background: linear-gradient(180deg, #c9c9d2, #8e8e99); }
.rank-C { background: linear-gradient(180deg, #a6e39a, #5fa452); }
.rank-B { background: linear-gradient(180deg, #9ccbff, #3f86d8); }
.rank-A { background: linear-gradient(180deg, #e2b8ff, #9a52e0); }
.rank-S { background: linear-gradient(180deg, #fff3b0, #f2b23a 55%, #c27a12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), 0 0 0 1px rgba(60, 30, 0, 0.7), 0 0 10px rgba(255, 200, 80, 0.75); animation: rankGlow 1.6s ease-in-out infinite; }
@keyframes rankGlow { 50% { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), 0 0 0 1px rgba(60, 30, 0, 0.7), 0 0 18px rgba(255, 210, 100, 1); } }
.grade { font-family: var(--title); font-size: 11px; font-weight: 700; margin-left: 6px; opacity: 0.9; }
.grade-D { color: #b0b0bb; } .grade-C { color: #8fd480; } .grade-B { color: #8cc0ff; } .grade-A { color: #d4a2ff; } .grade-S { color: #ffd45e; text-shadow: 0 0 6px rgba(255, 200, 80, 0.8); }
.legend-tag { font-family: var(--title); font-size: 10px; letter-spacing: 0.16em; color: #ffe9a8; text-shadow: 0 0 8px rgba(255, 200, 90, 0.9); }
.legend-tag.rare { color: #d6ecff; text-shadow: 0 0 8px rgba(120, 180, 255, 0.9); }
