:root {
  --bg: #07040e;
  --panel: rgba(18, 11, 34, 0.88);
  --line: #5b3f9a;
  --violet: #b26cff;
  --violet-soft: #c9b4ff;
  --pink: #ff3f9a;
  --cyan: #5fe3ff;
  --text: #ece6ff;
  --muted: #a99bd0;
  --tier: #c58bff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Rajdhani, "Segoe UI", sans-serif;
  user-select: none;
}

canvas { display: block; }
canvas.playing { cursor: none; }

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(10, 5, 22, 0.35), rgba(5, 2, 10, 0.8));
  animation: fade 0.25s ease-out;
}
.overlay.hidden { display: none; }
.booting #title, .booting #login { visibility: hidden; }
#title { background: radial-gradient(ellipse at center, rgba(10, 5, 22, 0.15), rgba(5, 2, 10, 0.7)); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.panel {
  width: min(560px, 100%);
  padding: 32px 36px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 0 60px rgba(150, 80, 255, 0.25), inset 0 0 40px rgba(120, 60, 220, 0.12);
  text-align: center;
  backdrop-filter: blur(6px);
  animation: rise 0.35s ease-out;
}
.panel.small { width: min(320px, 100%); display: flex; flex-direction: column; gap: 12px; }
/* the pause menu's views (menu, settings, ranking), one at a time */
.pause-view { display: flex; flex-direction: column; gap: 12px; }
#pause .ranking li { grid-template-columns: 26px 1fr auto 62px; gap: 6px; padding: 5px 8px; font-size: 14px; }
.overlay { overflow-y: auto; }
.panel { max-height: calc(var(--app-h, 100vh) - 32px); overflow-y: auto; }
.panel.wide { width: min(960px, 100%); }
.title-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: start; }
.title-cols .lore { margin: 16px 0; font-size: 16px; }
.title-cols .controls { margin-bottom: 16px; }
@media (max-width: 760px) { .title-cols { grid-template-columns: 1fr; } }

.name-field { display: flex; flex-direction: column; gap: 6px; margin: 0 auto 16px; width: min(280px, 100%); color: var(--muted); font-size: 14px; text-align: left; }
.name-field input {
  font: 700 17px Rajdhani, "Segoe UI", sans-serif;
  color: var(--text);
  background: #1c1236;
  border: 1px solid #6b4fb0;
  border-radius: 8px;
  padding: 8px 12px;
  outline: none;
}
.name-field input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(178, 108, 255, 0.25); }
.name-field input.locked { color: var(--muted); cursor: default; }

/* the game login (username and password) on the login screen */
.pass-form { display: flex; flex-direction: column; gap: 10px; margin: 14px auto 0; width: min(300px, 100%); }
.pass-form input {
  font: 700 17px Rajdhani, "Segoe UI", sans-serif;   /* 16px+ keeps phones from zooming in */
  color: var(--text); background: #1c1236; border: 1px solid #6b4fb0; border-radius: 8px; padding: 9px 12px; outline: none;
}
.pass-form input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(178, 108, 255, 0.25); }
.pass-form .btn { margin: 2px 0 0; }
.pass-msg { min-height: 18px; color: #ffb36b; font-size: 14px; }
.link-btn { background: none; border: 0; padding: 10px 12px; margin-top: 0; min-height: 40px; color: var(--muted); font: 600 13px Rajdhani, "Segoe UI", sans-serif; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--text); }
.name-field input.locked:focus { border-color: #6b4fb0; box-shadow: none; }

/* Ranking */
.rank-title { font-family: Orbitron, Rajdhani, sans-serif; font-weight: 700; letter-spacing: 0.2em; color: #ffe48f; font-size: 14px; margin: 6px 0 10px; }
.ranking ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ranking li {
  display: grid; grid-template-columns: 34px 1fr auto 76px; gap: 8px; align-items: center;
  padding: 6px 10px; border-radius: 8px; background: rgba(40, 24, 72, 0.55); font-size: 15px; text-align: left;
}
.ranking li.r1 .pos { color: #ffe48f; }
.ranking li.r2 .pos { color: #e6e4ff; }
.ranking li.r3 .pos { color: #ffb878; }
.ranking .pos { font-weight: 800; color: var(--muted); }
.ranking .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.ranking .hd { color: var(--muted); font-size: 13px; }
.ranking b { text-align: right; color: #fff; }
/* the logged-in player, in blue as on the site's ranking */
.ranking li.me { background: linear-gradient(90deg, rgba(59, 130, 246, 0.42), rgba(59, 130, 246, 0.14)); box-shadow: inset 4px 0 0 #60a5fa, 0 0 0 1px rgba(96, 165, 250, 0.5) inset; }.ranking li.gap { display: block; text-align: center; background: none; color: var(--muted); padding: 0; }
.ranking li.offline { background: rgba(40, 24, 72, 0.3); box-shadow: 0 0 0 1px rgba(201, 180, 255, 0.45) inset; border: 1px dashed rgba(201, 180, 255, 0.5); }
.ranking li.offline.me { background: linear-gradient(90deg, rgba(143, 77, 255, 0.35), rgba(255, 63, 154, 0.22)); }
.ranking .off-tag { margin-left: 6px; padding: 1px 5px; border-radius: 4px; font-style: normal; font-size: 10px; letter-spacing: 0.08em; color: #1c1236; background: #c9b4ff; vertical-align: 2px; }
.rank-note { margin-top: 8px; color: var(--muted); font-size: 12px; text-align: left; }
.rank-empty { color: var(--muted); font-size: 15px; padding: 16px 0; }
.ranking .prize { grid-column: 2 / -1; margin-top: -6px; line-height: 1.25; font-size: 11px; font-weight: 600; color: #ffe48f; opacity: 0.85; }
.ranking .prize .tk { width: 14px; height: 14px; margin-right: 3px; vertical-align: -3px; }
/* the site's raffle ticket icon, in the prize's color */
.ranking .prize .tkt { display: inline-block; width: 13px; height: 13px; margin-right: 3px; vertical-align: -2px; background: currentColor; -webkit-mask: url(assets/ticket.png) center / contain no-repeat; mask: url(assets/ticket.png) center / contain no-repeat; }
.ranking li .prize { color: #d8c79a; }
.ranking li.r1 .prize { color: #ffe48f; }
.ranking li.r2 .prize { color: #e6e4ff; }
.ranking li.r3 .prize { color: #ffb878; }
.rank-place { font-size: 18px; font-weight: 700; color: #ffe48f; }
#end .ranking { margin-bottom: 18px; }

.logo {
  font-family: Orbitron, Rajdhani, sans-serif;
  font-weight: 900;
  font-size: clamp(40px, 9vw, 64px);
  letter-spacing: 0.12em;
  background: linear-gradient(180deg, #f3e8ff, #b26cff 60%, #7a3dff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(178, 108, 255, 0.55));
}
.subtitle {
  font-family: Orbitron, Rajdhani, sans-serif;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: var(--violet-soft);
  font-size: 15px;
  margin-top: 4px;
}
.lore { color: var(--muted); font-size: 17px; line-height: 1.45; margin: 22px 0; }
.lore b { color: var(--text); }
.lore b.pink { color: var(--pink); }
.t-daily { color: #ffb878; font-weight: 700; }
.t-weekly { color: #ecebff; font-weight: 700; }
.t-monthly { color: #ffe48f; font-weight: 700; }
.t-annual { color: #b8f6ff; font-weight: 700; }

.controls {
  display: grid;
  gap: 8px;
  text-align: left;
  margin: 0 auto 24px;
  width: fit-content;
  font-size: 15px;
  color: var(--muted);
}
.controls div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.controls span { margin-right: 10px; }
kbd {
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 5px;
  border: 1px solid #6b4fb0;
  border-bottom-width: 3px;
  background: #1c1236;
  color: var(--text);
}

.btn {
  font-family: Orbitron, Rajdhani, sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.12em;
  color: #fff;
  padding: 14px 30px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(135deg, #8f4dff, #ff3f9a);
  box-shadow: 0 0 24px rgba(178, 108, 255, 0.5);
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 34px rgba(255, 63, 154, 0.6); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; border: 1px solid var(--line); box-shadow: none; }
/* the run left by mistake, offered back on the title for a few minutes */
.btn-continue { display: block; margin: 0 auto 12px; }
body.resuming .overlay:not(#title) { display: none !important; }
.btn-continue small { display: block; margin-top: 4px; font-family: Rajdhani, sans-serif; font-size: 13px; letter-spacing: 0.04em; font-weight: 600; opacity: 0.85; }
.best { margin-top: 14px; color: var(--muted); font-size: 15px; min-height: 18px; }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.online-note { margin-top: 10px; color: var(--violet-soft); font-size: 14px; min-height: 18px; }
.online-note.warn { color: #ffb36b; }
/* the day's online runs: a dot per run, lit once played */
.plays { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; text-align: center; margin: 10px auto 0; color: var(--muted); font-size: 14px; }
.plays b { color: #fff; }
.plays b.gold { color: #ffd166; }
.plays-dots { display: inline-flex; gap: 5px; }
.plays-dots i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--violet-soft); }
.plays-dots i.on { background: var(--violet-soft); box-shadow: 0 0 6px var(--violet-soft); }
.plays.spent { color: #ffb36b; }
.plays.spent .plays-dots i { border-color: #ffb36b; background: #ffb36b; box-shadow: none; }
#end .plays { margin: 0 auto 10px; }
.site-points { margin: -8px auto 14px; display: table; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 700;
  color: #ffd166; background: rgba(255, 209, 102, 0.12); border: 1px solid rgba(255, 209, 102, 0.4); }
#end .online-note { margin: -12px 0 16px; }
.login-panel .login-text { color: var(--muted); font-size: 16px; line-height: 1.45; margin: 14px 0 20px; }
.login-panel .btn.ghost { margin-top: 12px; }
.login-panel .raffle-line { margin-top: 12px; }

/* Boon selection */
.boon-wrap { width: min(980px, 100%); animation: rise 0.35s ease-out; }
.boon-head { text-align: center; margin-bottom: 22px; }
.boon-vault {
  font-family: Orbitron, Rajdhani, sans-serif;
  font-weight: 900;
  letter-spacing: 0.2em;
  font-size: 15px;
  color: var(--tier);
  text-transform: uppercase;
}
.boon-title { font-size: 30px; font-weight: 700; margin-top: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 20px 20px;
  font-family: inherit;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--tier) 55%, transparent);
  background: linear-gradient(180deg, rgba(40, 24, 72, 0.95), rgba(16, 10, 30, 0.95));
  box-shadow: 0 0 30px color-mix(in srgb, var(--tier) 20%, transparent);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.card:hover { transform: translateY(-6px); border-color: var(--tier); box-shadow: 0 0 44px color-mix(in srgb, var(--tier) 45%, transparent); }
.card .key {
  position: absolute; top: 10px; left: 12px;
  font-size: 12px; font-weight: 700; color: var(--muted);
  border: 1px solid #6b4fb0; border-radius: 4px; padding: 0 6px;
}
.card .icon { font-size: 40px; color: var(--tier); text-shadow: 0 0 18px var(--tier); line-height: 1.2; }
.card .name { font-size: 21px; font-weight: 700; }
.card .desc { font-size: 16px; color: var(--muted); line-height: 1.35; min-height: 44px; }
.card .lvl { font-size: 13px; font-weight: 700; color: var(--tier); letter-spacing: 0.08em; text-transform: uppercase; }

/* End screen */
.end-title {
  font-family: Orbitron, Rajdhani, sans-serif;
  font-weight: 900;
  font-size: clamp(22px, 5vw, 32px);
  letter-spacing: 0.08em;
  color: #ff7fbf;
}
#end.win .end-title { color: #ffe48f; text-shadow: 0 0 24px rgba(255, 228, 143, 0.5); }
.end-sub { color: var(--muted); margin: 8px 0 20px; font-size: 17px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.stats div {
  display: flex; justify-content: space-between;
  padding: 8px 12px; border-radius: 8px;
  background: rgba(40, 24, 72, 0.6);
  font-size: 15px;
}
.stats span { color: var(--muted); }
.score-label { color: var(--muted); letter-spacing: 0.3em; font-size: 13px; }
.score {
  font-family: Orbitron, Rajdhani, sans-serif;
  font-weight: 900;
  font-size: 44px;
  color: #fff;
  text-shadow: 0 0 20px rgba(178, 108, 255, 0.7);
}
#end .best { margin: 4px 0 20px; }

@media (max-width: 520px) {
  .panel { padding: 24px 20px; }
  .stats { grid-template-columns: 1fr; }
}

/* legendary fragment cards from a boss vault */
.card.legendary { background: linear-gradient(160deg, color-mix(in srgb, var(--tier) 16%, rgba(20,12,38,0.95)), rgba(20,12,38,0.95) 60%); }
.card.legendary .lvl { color: #ffe48f; }

/* hint and queue note around the choice cards */
.boon-hint { margin-top: 8px; font-size: 15px; color: var(--muted); min-height: 20px; }
.boon-more { text-align: center; margin-top: 42px; font-size: 14px; font-weight: 700; color: var(--tier); min-height: 18px; }

/* reroll button under the cards */
.boon-actions { text-align: center; margin-top: 10px; }
.boon-actions .btn { width: auto; padding: 10px 22px; font-size: 15px; }
.hidden { display: none !important; }

/* merchant / shrine panel */
#npc { --tier: #ffd166; }
.npc-panel { width: min(560px, 100%); text-align: center; border-color: color-mix(in srgb, var(--tier) 50%, transparent); }
.npc-panel .boon-title { font-size: 24px; margin-bottom: 6px; }
.npc-sub { color: var(--muted); font-size: 15px; margin-bottom: 16px; line-height: 1.4; }
.npc-sub b { color: var(--tier); }
.npc-items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.npc-item {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px; cursor: pointer; text-align: left;
  font-family: inherit; color: var(--text);
  background: rgba(30, 18, 54, 0.9); border: 1px solid color-mix(in srgb, var(--tier) 40%, transparent);
  transition: transform 0.12s, border-color 0.12s;
}
.npc-item:hover { transform: translateX(4px); border-color: var(--tier); }
.npc-item .ic { font-size: 26px; color: var(--tier); text-align: center; }
.npc-item .tx b { display: block; font-size: 17px; }
.npc-item .tx small { color: var(--muted); font-size: 13px; }
.npc-item .pr { font-weight: 800; font-size: 17px; color: var(--tier); }
.npc-item.off { opacity: 0.4; cursor: not-allowed; }
/* rarity: coloured edge, icon and tag */
.npc-item[class*='rar-'] { border-left: 3px solid var(--rar); }
.npc-item[class*='rar-'] .ic { color: var(--rar); }
.npc-item .rar { font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: 0.12em; color: var(--rar); margin-left: 6px; vertical-align: middle; }
.npc-item.rar-epic { background: linear-gradient(100deg, color-mix(in srgb, var(--rar) 14%, transparent), transparent 70%); }
.npc-item.sold .pr { font-size: 12px; letter-spacing: 0.08em; }
.npc-item.danger { border-color: #ff4a5a; background: rgba(60, 10, 20, 0.9); }

/* ---------- touch controls (phones) ---------- */
html, body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* nothing in the game can be selected or long-pressed: holding the joystick used to select the
   touch area (half the screen turned blue) and could open the "save image" menu on the canvas */
*, *::before, *::after {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
input { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
::selection { background: transparent; }
input::selection { background: rgba(178, 108, 255, 0.45); }
.touch-controls { display: none; }
body.touch .touch-controls { display: grid; }
body.touch .key-controls { display: none; }

/* the page in one box: normally the whole window; when a phone browser stays upright (e.g. the
   MetaMask app, which never turns) the box is laid out landscape and turned 90°, so the player
   just turns the phone. Its size is set from JS (Touch.layout). */
#app { position: fixed; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; }

/* while fighting on a phone nothing on the page may pan or zoom */
body.touch.fighting, body.touch.fighting * { touch-action: none; }

#touch { position: fixed; inset: 0; touch-action: none; pointer-events: none; }
#touch-zone { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; pointer-events: auto; touch-action: none; }
#touch-stick {
  position: absolute; left: 0; top: 0; width: 112px; height: 112px; margin: -56px 0 0 -56px;
  border-radius: 50%; border: 2px solid rgba(201, 180, 255, 0.35); background: rgba(40, 20, 80, 0.25);
  opacity: 0; transition: opacity 0.15s; pointer-events: none;
}
#touch-stick.active { opacity: 1; }
#touch-knob {
  position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px;
  border-radius: 50%; background: radial-gradient(circle at 35% 35%, #e3d4ff, #8a5cff); box-shadow: 0 0 18px rgba(178, 108, 255, 0.7);
}
.tbtn {
  --c: #c9b4ff;
  position: absolute; pointer-events: auto; touch-action: none;
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0;
  border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--c) 70%, transparent);
  background: radial-gradient(circle at 50% 30%, rgba(60, 36, 110, 0.72), rgba(14, 8, 30, 0.78) 70%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 14px color-mix(in srgb, var(--c) 30%, transparent);
  color: var(--c); backdrop-filter: blur(4px);
  transition: transform 0.06s, background 0.06s;
}
.tbtn .ico { width: 46%; height: 46%; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c) 60%, transparent)); }
.tbtn.down {
  transform: scale(0.93);
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--c) 45%, #1a0f33), rgba(14, 8, 30, 0.85) 75%);
  color: #fff;
}
.touch-pad {
  position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom));
  width: 210px; height: 190px; pointer-events: none;
}
.tbtn.attack { --c: #ff7fd0; right: 0; bottom: 0; width: 92px; height: 92px; border-width: 2px; }
.tbtn.attack .ico { width: 50%; height: 50%; }
.tbtn.dash { --c: #7ff3ff; right: 106px; bottom: 4px; width: 62px; height: 62px; }
.tbtn.shield { --c: #ffd166; right: 18px; bottom: 106px; width: 62px; height: 62px; }
.tbtn.talk { --c: #ffd166; right: 112px; bottom: 92px; width: 56px; height: 56px; animation: talk-in 0.25s ease-out, talk-pulse 1.4s ease-in-out 0.25s infinite; }
@keyframes talk-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes talk-pulse { 50% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 26px rgba(255, 209, 102, 0.75); } }
#touch-pause {
  top: max(10px, env(safe-area-inset-top)); left: calc(50% + 150px); width: 40px; height: 40px;
  border-radius: 12px; opacity: 0.85;
}
#touch-pause .ico { width: 50%; height: 50%; }
#touch-full {
  top: max(10px, env(safe-area-inset-top)); left: calc(50% - 190px); width: 40px; height: 40px;
  border-radius: 12px; opacity: 0.85;
}
#touch-full .ico { width: 55%; height: 55%; }
/* full screen controls only where the browser can do it (not on an iPhone) */
.full-only { display: none !important; }
body.can-full .full-only { display: flex !important; }
body.can-full .btn.full-only { display: block !important; }
.ico-unfull { display: none; }
body.is-full .ico-full { display: none; }
body.is-full .ico-unfull { display: inline; }
body.is-full #touch-full .ico-unfull { display: block; }
.title-full { width: auto; margin: 10px auto 0; padding: 8px 18px; font-size: 14px; }
.controls kbd.ik { display: inline-flex; align-items: center; justify-content: center; padding: 3px 6px; color: var(--violet-soft); }
.controls kbd.ik .ico { width: 16px; height: 16px; }

/* short screens (a phone on its side): tighter panels */
@media (max-height: 500px) {
  .overlay { padding: 8px; align-items: flex-start; }
  .panel { padding: 16px 20px; max-height: calc(100vh - 16px); }
  .title-cols { grid-template-columns: 1.3fr 1fr; gap: 16px; }
  .title-cols .lore { display: none; }
  .title-cols .controls { margin-bottom: 8px; font-size: 13px; }
  .title-rank .ranking li:nth-child(n+6) { display: none; }
  .logo { font-size: 40px !important; }
  .boon-head { margin-bottom: 10px; }
  .boon-title { font-size: 20px; }
  .boon-hint { font-size: 13px; margin-top: 2px; }
  .cards { gap: 10px; }
  .card { padding: 12px 14px; }
  .card .icon { font-size: 28px; }
  .card .name { font-size: 17px; }
  .card .desc { font-size: 13px; min-height: 0; }
  .boon-more { margin-top: 10px; }
  .npc-panel .boon-title { font-size: 18px; }
}
/* the 1 2 3 key hints mean nothing on a phone */
body.touch .card .key { display: none; }

/* the settings, always at the top right (desktop and phone) */
.sound-btn {
  position: absolute; z-index: 60; top: max(10px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  width: 40px; height: 40px; padding: 0; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid rgba(201, 180, 255, 0.55); color: #e3d4ff;
  background: radial-gradient(circle at 50% 30%, rgba(60, 36, 110, 0.75), rgba(14, 8, 30, 0.8) 70%);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  touch-action: manipulation;
}
.sound-btn:hover { border-color: #c9b4ff; color: #fff; }
.sound-btn .ico { width: 22px; height: 22px; }
.sound-btn .ico-off { display: none; }
/* full screen, left of the sound one (in a phone's fight the touch controls have their own) */
.full-btn { right: calc(max(12px, env(safe-area-inset-right)) + 48px); }
.full-btn .ico-unfull { display: none; }
body.is-full .full-btn .ico-unfull { display: block; }
body.touch.fighting .full-btn { display: none !important; }
body.muted .sound-btn .ico-on { display: none; }
body.muted .sound-btn .ico-off { display: block; }

/* end screen: highlights, the run's chart and sharing */
.highlights { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 8px; margin-bottom: 12px; }
.highlights .hl {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 10px 8px; border-radius: 10px;
  background: rgba(40, 24, 72, 0.6); border: 1px solid rgba(143, 98, 230, 0.35);
}
.highlights span { color: var(--muted); font-size: 13px; }
.highlights b { font-size: 26px; line-height: 1.1; color: #fff; }
.highlights i { font-style: normal; font-size: 12px; color: var(--muted); }
.highlights .combo b { color: #ffd166; text-shadow: 0 0 14px rgba(255, 209, 102, 0.45); }
.highlights .el { border-color: color-mix(in srgb, var(--el) 50%, transparent); }
.highlights .el b { color: var(--el); }
.chart-box { padding: 10px 10px 4px; margin-bottom: 12px; border-radius: 10px; background: rgba(20, 12, 40, 0.7); border: 1px solid rgba(143, 98, 230, 0.25); }
.chart-title, .share-title { color: var(--muted); font-size: 12px; letter-spacing: 0.18em; text-align: left; font-weight: 700; }
#end-chart { width: 100%; height: 130px; }
.share { margin: 4px 0 18px; }
.share-title { text-align: center; margin-bottom: 8px; }
.share-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.share-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; min-width: 44px; padding: 0 12px; border-radius: 12px; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 15px; color: #e3d4ff;
  border: 1px solid rgba(201, 180, 255, 0.4); background: rgba(40, 24, 72, 0.75);
  transition: transform 0.12s, border-color 0.12s, color 0.12s;
  touch-action: manipulation;
}
.share-btn .ico { width: 20px; height: 20px; }
.share-btn:hover { transform: translateY(-2px); border-color: #c9b4ff; color: #fff; }
.share-btn.main { background: linear-gradient(90deg, #8f4dff, #ff3f9a); border-color: transparent; color: #fff; padding: 0 16px; }
.share-toast { min-height: 18px; margin-top: 8px; font-size: 14px; color: #ffe48f; opacity: 0; transition: opacity 0.2s; }
.share-toast.show { opacity: 1; }
.touch-only { display: none; }
body.touch .touch-only:not(.hidden) { display: block; }
@media (max-width: 520px) {
  .highlights { grid-template-columns: 1fr 1fr; }
  .highlights .el { grid-column: 1 / -1; order: -1; }
}
@media (max-height: 500px) {
  .highlights b { font-size: 21px; }
  #end-chart { height: 96px; }
}

/* cursed fragments from the Risk Shrine's vault */
.card.cursed { background: linear-gradient(160deg, rgba(90, 10, 24, 0.95), rgba(20, 8, 14, 0.96) 65%); border-color: rgba(255, 74, 90, 0.6); }
.card.cursed .lvl { color: #ff6a7a; }
.card.cursed .icon { text-shadow: 0 0 18px #ff2a40; }
/* the merchant's restock row */
.npc-item.restock { border-style: dashed; }

/* title screen: a small start panel, with settings and ranking one tap away */
.title-panel { position: relative; width: min(440px, 100%); padding: 30px 30px 24px; }
.menu-tools { display: flex; justify-content: center; gap: 10px; margin: 16px auto 0; }
.tool-btn {
  width: 40px; height: 40px; padding: 0; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid rgba(201, 180, 255, 0.45); color: #e3d4ff;
  background: rgba(40, 24, 72, 0.7); touch-action: manipulation;
}
.tool-btn .ico { width: 21px; height: 21px; }
.tool-btn.lang-tool { width: auto; padding: 0 14px; font-weight: 700; font-size: 13px; letter-spacing: 0.06em; }
.tool-btn:hover, .tool-btn.on { border-color: #c9b4ff; color: #fff; background: rgba(90, 50, 160, 0.75); }
.title-view[data-view="main"] { padding-top: 6px; }
.title-sum { color: var(--muted); font-size: 16px; line-height: 1.45; margin: 16px auto 20px; max-width: 360px; }
.title-sum b { color: var(--text); }
.title-sum b.pink { color: var(--pink); }
.view-title { font-family: Orbitron, Rajdhani, sans-serif; font-weight: 900; letter-spacing: 0.14em; font-size: 20px; color: #e3d4ff; margin: 6px 0 16px; text-align: left; }
.view-sub { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.2em; text-align: left; margin: 16px 0 8px; }
/* the volumes of the music and of the effects (settings and pause menu) */
.vol-box { display: flex; flex-direction: column; gap: 8px; margin: 0 0 10px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(150, 120, 220, 0.35); background: rgba(12, 7, 26, 0.55); }
.vol-row { display: flex; align-items: center; gap: 10px; margin: 0; }
.vol-name { flex: 0 0 68px; text-align: left; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; }
.vol-val { flex: 0 0 44px; text-align: right; color: #ffe48f; font-size: 13px; font-weight: 800; }
.vol { flex: 1 1 auto; min-width: 0; height: 26px; margin: 0; padding: 0; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none; touch-action: pan-y; }
.vol::-webkit-slider-runnable-track { height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, #7a3dff 0, #ff5fb0 var(--fill, 100%), rgba(10, 6, 22, 0.9) var(--fill, 100%)); border: 1px solid rgba(150, 120, 220, 0.5); }
.vol::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
  background: #f3eaff; border: 2px solid #b388ff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.vol::-moz-range-track { height: 8px; border-radius: 4px; background: rgba(10, 6, 22, 0.9); border: 1px solid rgba(150, 120, 220, 0.5); }
.vol::-moz-range-progress { height: 8px; border-radius: 4px; background: linear-gradient(90deg, #7a3dff, #ff5fb0); }
.vol::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #f3eaff; border: 2px solid #b388ff; }
.view-cols > div:only-child { grid-column: 1 / -1; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.set-row .btn { width: 100%; min-width: 0; padding: 10px 6px; font-size: 13px; letter-spacing: 0.04em; line-height: 1.15; white-space: normal; overflow-wrap: break-word; margin: 0; }
.title-view .controls { margin: 0 0 4px; font-size: 14px; }
.title-view .lore { font-size: 14px; margin: 0 0 16px; text-align: left; }
.title-view .ranking { margin-bottom: 16px; text-align: left; }
.title-view .view-back { margin-top: 4px; }
@media (max-height: 500px) {
  .title-panel { padding: 16px 20px 14px; }
  .title-view[data-view="main"] { padding-top: 6px; }
  .title-panel .logo { font-size: 34px !important; }
  .title-sum { font-size: 13px; margin: 8px auto 10px; }
  .title-panel .name-field { margin-bottom: 10px; }
  .title-panel .btn { padding: 10px 16px; font-size: 15px; }
  .view-title { margin: 0 0 10px; font-size: 16px; }
  .view-sub { margin: 10px 0 6px; }
  .tool-btn { width: 34px; height: 34px; }
}

/* generated: the short-screen rules again for body.short (a phone held upright plays turned
   sideways, where 100vh and max-height media queries still see the upright screen) */
body.short .overlay { padding: 8px; align-items: flex-start; }
body.short .panel { padding: 16px 20px; max-height: calc(var(--app-h, 100vh) - 16px); }
body.short .title-cols { grid-template-columns: 1.3fr 1fr; gap: 16px; }
body.short .title-cols .lore { display: none; }
body.short .title-cols .controls { margin-bottom: 8px; font-size: 13px; }
body.short .title-rank .ranking li:nth-child(n+6) { display: none; }
body.short .logo { font-size: 40px !important; }
body.short .boon-head { margin-bottom: 10px; }
body.short .boon-title { font-size: 20px; }
body.short .boon-hint { font-size: 13px; margin-top: 2px; }
body.short .cards { gap: 10px; }
body.short .card { padding: 12px 14px; }
body.short .card .icon { font-size: 28px; }
body.short .card .name { font-size: 17px; }
body.short .card .desc { font-size: 13px; min-height: 0; }
body.short .boon-more { margin-top: 10px; }
body.short .npc-panel .boon-title { font-size: 18px; }
body.short .highlights b { font-size: 21px; }
body.short #end-chart { height: 96px; }
body.short .title-panel { padding: 16px 20px 14px; }
body.short .title-view[data-view="main"] { padding-top: 6px; }
body.short .title-panel .logo { font-size: 34px !important; }
body.short .title-sum { font-size: 13px; margin: 8px auto 10px; }
body.short .title-panel .name-field { margin-bottom: 10px; }
body.short .title-panel .btn { padding: 10px 16px; font-size: 15px; }
body.short .view-title { margin: 0 0 10px; font-size: 16px; }
body.short .view-sub { margin: 10px 0 6px; }
body.short .tool-btn { width: 34px; height: 34px; }

/* a phone on its side: settings in two columns and the ranking in two, so neither scrolls */
body.short .title-panel.wide-view { width: min(760px, calc(100% - 120px)); }
body.short .title-panel.wide-view .view-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
body.short .title-panel.wide-view .view-cols > div > .view-sub:first-child { margin-top: 0; }
body.short .title-panel.wide-view .ranking ol { display: grid; grid-auto-flow: column; grid-template-rows: repeat(5, auto); grid-template-columns: 1fr 1fr; gap: 6px 12px; }
body.short .title-panel.wide-view .ranking li { margin: 0; }
body.short .title-panel.wide-view .lore { margin-bottom: 0; }

/* a phone held upright: pause and full screen go under the sound button, out of the HUD's way */
body.portrait #touch-pause { left: auto; right: max(12px, env(safe-area-inset-right)); top: calc(max(10px, env(safe-area-inset-top)) + 48px); }
body.portrait #touch-full { left: auto; right: max(12px, env(safe-area-inset-right)); top: calc(max(10px, env(safe-area-inset-top)) + 96px); }
body.portrait .touch-pad { bottom: max(26px, env(safe-area-inset-bottom)); }

/* the training run's card: under the top HUD, never covering the thumbs' corners */
#tutorial {
  position: absolute; z-index: 40; left: 0; right: 0; margin: 0 auto; top: 132px;
  width: min(540px, calc(100% - 24px)); padding: 14px 18px 12px; border-radius: 14px;
  border: 1px solid rgba(201, 180, 255, 0.55); background: rgba(16, 9, 32, 0.9);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 30px rgba(143, 77, 255, 0.25);
  color: var(--text); text-align: left; backdrop-filter: blur(6px);
}
#tutorial.pop { animation: rise 0.3s ease-out; }
.tut-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.tut-count { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.1em; white-space: nowrap; }
.tut-title { font-family: Orbitron, Rajdhani, sans-serif; font-weight: 900; font-size: 16px; color: #ffe48f; letter-spacing: 0.04em; }
.tut-text { font-size: 15px; line-height: 1.45; color: #e6dcff; }
.tut-text b { color: #fff; }
.tut-text kbd { font-size: 12px; padding: 1px 6px; }
.tut-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; }
.tut-btn { width: auto; padding: 9px 18px; font-size: 14px; margin: 0; }
.tut-link { background: none; border: none; padding: 4px 0; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.tut-link:hover { color: #fff; }
.title-tut { margin-top: 10px; padding: 9px 16px; font-size: 14px; }
body.short #tutorial { top: 96px; left: 10px; right: auto; margin: 0; padding: 10px 14px 8px; width: min(40%, 340px); }
body.short .tut-text { font-size: 13px; }

/* the enemies screen */
.set-beasts { width: 100%; margin: 8px 0 0; padding: 10px; font-size: 14px; }
.bestiary { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 14px; text-align: left; }
.beast { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; background: rgba(40, 24, 72, 0.6); border: 1px solid rgba(143, 98, 230, 0.3); }
.beast.boss { border-color: rgba(255, 127, 191, 0.5); background: linear-gradient(90deg, rgba(90, 30, 70, 0.55), rgba(40, 24, 72, 0.6)); }
.beast-pic { flex: none; width: 64px; height: 64px; border-radius: 8px; background: radial-gradient(circle at 50% 60%, rgba(143, 77, 255, 0.28), rgba(10, 6, 20, 0.6) 70%); }
.beast-tx { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.beast-tx b { font-size: 15px; color: #fff; }
.beast-tx i { font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: #ffd27a; text-transform: uppercase; }
.beast.boss .beast-tx i { color: #ff9ccd; }
.beast-tx span { font-size: 13px; color: var(--muted); line-height: 1.35; }
.beast-note { grid-column: 1 / -1; font-size: 13px; color: var(--muted); padding: 4px 2px; }
.beast-note b { color: #ffe48f; }
.title-panel.beasts-view { width: min(760px, 100%); }
.title-panel.beasts-view .bestiary { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .title-panel.beasts-view .bestiary { grid-template-columns: 1fr; } }
body.short .title-panel.beasts-view { width: min(900px, calc(100% - 120px)); }
body.short .title-panel.beasts-view .bestiary { grid-template-columns: 1fr 1fr 1fr; }

/* a phone held upright: the title panel starts below the sound button in the corner */
@media (orientation: portrait) and (max-width: 600px) {
  #title.overlay { padding-top: 62px; }
  #title .panel { max-height: calc(var(--app-h, 100vh) - 78px); }
}

/* a phone held upright: a compact card right under the life panel, clear of the button column */
@media (orientation: portrait) and (max-width: 600px) {
  #tutorial { top: 132px; left: 10px; right: 62px; width: auto; margin: 0; padding: 9px 12px 8px; border-radius: 12px; }
  .tut-head { margin-bottom: 3px; }
  .tut-title { font-size: 14px; }
  .tut-text { font-size: 13px; line-height: 1.35; }
  .tut-actions { margin-top: 6px; gap: 6px 12px; }
  .tut-btn { padding: 7px 14px; font-size: 13px; }
  .tut-link { font-size: 12px; padding: 2px 0; }
}

/* the card's buttons: compact, so they sit in one row */
#tutorial .tut-btn { font-family: Rajdhani, sans-serif; font-weight: 700; letter-spacing: 0.04em; padding: 7px 14px; font-size: 14px; }
@media (orientation: portrait) and (max-width: 600px) { #tutorial .tut-btn { padding: 6px 12px; font-size: 13px; } }

/* touches go through the card to the joystick and the arena, except on its own buttons */
#tutorial { pointer-events: none; }
#tutorial button { pointer-events: auto; }

#tutorial.aside { display: none; }

/* the page's first error, for a player to read out to us (Game.showError); a tap closes it */
.error-strip { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 9999; padding: 8px 12px; border-radius: 8px; background: rgba(120, 10, 40, 0.92); color: #fff; font: 600 13px/1.35 Rajdhani, sans-serif; word-break: break-word; }
.error-strip b { margin-left: 4px; }
.error-strip .error-close { float: right; margin: -4px -6px 0 8px; padding: 0 8px; border: 0; background: none; color: #fff; font: 700 20px/1 sans-serif; }

/* the loading screen while the art is made (Game.loadingTick); over the title, under the sound and
   full-screen buttons */
#loading { z-index: 50; background: var(--bg); animation: none; }
.loading-box { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(320px, 80vw); }
.loading-title { font: 800 18px/1 Orbitron, sans-serif; letter-spacing: 0.3em; color: var(--text); }
.loading-bar { width: 100%; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.loading-bar span { display: block; width: 0; height: 100%; background: var(--pink); transition: width 0.2s linear; }

/* the site's raffles (js/raffles.js): a toast between hordes, a line in the pause menu, a card on
   the end screen */
.raffle-toast {
  position: absolute; z-index: 40; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: min(360px, calc(100vw - 32px)); padding: 10px 34px 10px 14px; border-radius: 14px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 2px; font: inherit; color: var(--text);
  border: 1.5px solid rgba(255, 79, 216, 0.7);
  background: linear-gradient(135deg, rgba(70, 20, 110, 0.94), rgba(24, 10, 44, 0.94));
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5), 0 0 18px rgba(255, 79, 216, 0.35);
  animation: rise 0.3s ease-out; touch-action: manipulation;
}
.raffle-toast.hidden { display: none; }
.raffle-toast .raffle-t { font-size: 17px; font-weight: 700; }
.raffle-toast .raffle-t b { color: #ffd166; }
.raffle-toast .raffle-s { font-size: 14px; color: var(--violet-soft); }
.raffle-toast .raffle-x { position: absolute; top: 4px; right: 8px; padding: 2px 6px; font-size: 20px; line-height: 1; color: var(--muted); }
.raffle-line {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px;
  font: inherit; font-size: 15px; color: var(--text); cursor: pointer; text-align: left;
  border: 1.5px solid rgba(255, 79, 216, 0.6); background: rgba(70, 20, 110, 0.55);
}
.raffle-line.hidden { display: none; }
.raffle-line b { color: #ffd166; }
.raffle-line i { font-style: normal; font-weight: 700; font-size: 13px; color: #fff; padding: 4px 10px; border-radius: 999px; background: var(--pink); white-space: nowrap; }
.raffle-end { margin: 18px 0 6px; padding: 14px; border-radius: 14px; border: 1.5px solid rgba(255, 79, 216, 0.6); background: rgba(70, 20, 110, 0.4); }
.raffle-end.hidden { display: none; }
.raffle-end-title { font-weight: 700; font-size: 16px; letter-spacing: 0.08em; margin-bottom: 8px; }
.raffle-end-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-bottom: 12px; }
.raffle-end-list button { display: flex; justify-content: space-between; gap: 8px; padding: 4px 6px; margin: 0 -6px; border: 0; border-radius: 8px;
  background: none; font: inherit; font-size: 15px; color: var(--text); cursor: pointer; text-align: left; }
.raffle-end-list button:hover { background: rgba(255, 79, 216, 0.15); }
.raffle-end-list b { color: #ffd166; }
.raffle-go { width: 100%; }

/* ---------- the finish of the menus ----------
   One look for every panel, on top of the rules above (nothing moves or changes size): a framed
   plate of dark glass with the colour of the dialog (--tier) in its corners and along its top,
   headings set between rules, buttons with a bevel and a sheen, rows that read as cards.
   Where a colour is mixed from --tier there is a plain one first, for browsers without color-mix. */
.overlay { background: radial-gradient(ellipse at center, rgba(8, 4, 18, 0.5), rgba(3, 1, 8, 0.9)); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#title { backdrop-filter: none; -webkit-backdrop-filter: none; }
@keyframes plate { from { opacity: 0; transform: translateY(14px) scale(0.975); } to { opacity: 1; transform: none; } }
@keyframes sheen { from { background-position: -160% 0, 0 0; } to { background-position: 260% 0, 0 0; } }
@keyframes dread { 0%, 100% { box-shadow: 0 0 0 1px rgba(255, 74, 90, 0.55), 0 0 22px rgba(255, 40, 64, 0.28), inset 0 0 26px rgba(255, 40, 64, 0.16); } 50% { box-shadow: 0 0 0 1px rgba(255, 110, 120, 0.9), 0 0 38px rgba(255, 40, 64, 0.5), inset 0 0 34px rgba(255, 40, 64, 0.26); } }

.panel {
  --edge: rgba(178, 108, 255, 0.55);
  --edge: color-mix(in srgb, var(--tier) 62%, transparent);
  --wash: rgba(178, 108, 255, 0.16);
  --wash: color-mix(in srgb, var(--tier) 18%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  /* the brackets in its four corners, the light along its top, then the glass itself */
  background:
    linear-gradient(var(--edge), var(--edge)) left top / 26px 2px no-repeat,
    linear-gradient(var(--edge), var(--edge)) left top / 2px 26px no-repeat,
    linear-gradient(var(--edge), var(--edge)) right top / 26px 2px no-repeat,
    linear-gradient(var(--edge), var(--edge)) right top / 2px 26px no-repeat,
    linear-gradient(var(--edge), var(--edge)) left bottom / 26px 2px no-repeat,
    linear-gradient(var(--edge), var(--edge)) left bottom / 2px 26px no-repeat,
    linear-gradient(var(--edge), var(--edge)) right bottom / 26px 2px no-repeat,
    linear-gradient(var(--edge), var(--edge)) right bottom / 2px 26px no-repeat,
    linear-gradient(90deg, transparent, var(--edge) 30%, var(--edge) 70%, transparent) center top / 62% 1px no-repeat,
    radial-gradient(ellipse 70% 120px at 50% 0, var(--wash), transparent 70%),
    linear-gradient(180deg, rgba(30, 19, 56, 0.96), rgba(11, 7, 22, 0.97));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 24px 70px rgba(0, 0, 0, 0.65), 0 0 90px var(--wash), inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: plate 0.32s cubic-bezier(0.2, 0.9, 0.25, 1);
}
.npc-panel { border-color: rgba(255, 255, 255, 0.07); }

/* headings: the small one between two rules, the big one with a soft light behind it */
.boon-vault, .panel.small .subtitle { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 13px; letter-spacing: 0.26em; }
.boon-vault::before, .boon-vault::after, .panel.small .subtitle::before, .panel.small .subtitle::after {
  content: ''; flex: 0 1 54px; height: 1px; background: linear-gradient(90deg, transparent, currentColor);
}
.boon-vault::after, .panel.small .subtitle::after { background: linear-gradient(270deg, transparent, currentColor); }
.boon-vault { text-shadow: 0 0 18px currentColor; }
.boon-title { letter-spacing: 0.01em; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5), 0 0 26px rgba(190, 150, 255, 0.28); }
.npc-sub { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }

/* buttons: a bevelled plate with a moving sheen under the pointer */
.btn {
  position: relative; border-radius: 6px; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.26) 50%, transparent 70%) -160% 0 / 55% 100% no-repeat, linear-gradient(135deg, #8a4bff, #ff3f9a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.55), 0 8px 22px rgba(120, 50, 220, 0.42);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
}
.btn:hover { animation: sheen 0.7s ease-out; filter: brightness(1.08); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.55), 0 10px 30px rgba(255, 63, 154, 0.5); }
.btn.ghost {
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.12) 50%, transparent 70%) -160% 0 / 55% 100% no-repeat, linear-gradient(180deg, rgba(58, 38, 104, 0.55), rgba(22, 14, 44, 0.6));
  border: 1px solid rgba(160, 122, 240, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.5);
}
.btn.ghost:hover { border-color: #c9b4ff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 22px rgba(178, 108, 255, 0.35); }

/* the rows of a dialog with a visitor: a card with its colour down its left edge, the sign in
   a ringed badge, the price on a plate */
.npc-item {
  position: relative; padding: 12px 16px; gap: 14px; border-radius: 6px;
  grid-template-columns: 46px 1fr auto;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), transparent 46%), linear-gradient(180deg, rgba(44, 28, 80, 0.92), rgba(22, 14, 42, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: inset 3px 0 0 var(--tier), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.14s, box-shadow 0.14s, border-color 0.14s, filter 0.14s;
}
.npc-item[class*='rar-'] { border-left: 1px solid rgba(255, 255, 255, 0.09); box-shadow: inset 3px 0 0 var(--rar), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 16px rgba(0, 0, 0, 0.35); }
.npc-item:hover { transform: translateY(-2px); filter: brightness(1.12); border-color: rgba(255, 255, 255, 0.28); }
.npc-item .ic {
  display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 50%; font-size: 24px;
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.35) 70%);
  box-shadow: 0 0 0 1px currentColor, 0 0 16px -2px currentColor, inset 0 0 10px rgba(0, 0, 0, 0.5);
  text-shadow: 0 0 12px currentColor;
}
.npc-item .tx b { font-size: 17px; letter-spacing: 0.03em; }
.npc-item .tx small { display: block; margin-top: 2px; }
.npc-item .pr { padding: 5px 10px; border-radius: 4px; font-size: 15px; background: rgba(0, 0, 0, 0.38); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); white-space: nowrap; }
.npc-item.off { filter: grayscale(0.6); }

/* the curse: blood glass that breathes, a hazard band behind it */
.npc-item.danger {
  border-color: rgba(255, 74, 90, 0.75);
  background: repeating-linear-gradient(135deg, rgba(255, 60, 80, 0.07) 0 12px, transparent 12px 24px), linear-gradient(90deg, rgba(255, 60, 80, 0.28), transparent 60%), linear-gradient(180deg, rgba(86, 12, 26, 0.96), rgba(34, 6, 14, 0.97));
  animation: dread 2.2s ease-in-out infinite;
}
.npc-item.danger .ic { color: #ff5a6a; }
.npc-item.danger .tx b { color: #ffd9dc; letter-spacing: 0.08em; }
.npc-item.danger .tx small { color: #f0a0a8; }
.npc-item.danger .pr { color: #ff5a6a; background: rgba(0, 0, 0, 0.45); box-shadow: inset 0 0 0 1px rgba(255, 90, 106, 0.5); }
.npc-item.danger:hover { filter: brightness(1.2); }

/* the upgrade cards: the same glass and corners */
.card {
  border-radius: 6px;
  background:
    linear-gradient(var(--tier), var(--tier)) left top / 18px 2px no-repeat, linear-gradient(var(--tier), var(--tier)) left top / 2px 18px no-repeat,
    linear-gradient(var(--tier), var(--tier)) right bottom / 18px 2px no-repeat, linear-gradient(var(--tier), var(--tier)) right bottom / 2px 18px no-repeat,
    radial-gradient(ellipse 80% 90px at 50% 0, rgba(255, 255, 255, 0.09), transparent 70%),
    linear-gradient(180deg, rgba(44, 27, 80, 0.97), rgba(13, 8, 26, 0.97));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 14px 34px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.card .name { letter-spacing: 0.02em; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); }
@media (prefers-reduced-motion: reduce) { .npc-item.danger, .btn:hover, .panel { animation: none; } }

/* ---------- the raffle notices, finished like the menus ----------
   The toast between hordes: the ticket in a gold medal, the raffle's name small over its prize in
   big gold figures, a button to join and a bar that runs out with the time it stays. The line of
   the pause menu and the card of the end screen in the same dress. */
.raffle-toast {
  width: min(430px, calc(100vw - 24px)); padding: 12px 14px 15px 12px; border-radius: 16px; overflow: hidden;
  flex-direction: row; align-items: center; gap: 12px;
  border: 1px solid rgba(255, 209, 102, 0.55);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255, 209, 102, 0.16), rgba(255, 209, 102, 0) 55%),
    linear-gradient(135deg, rgba(74, 22, 118, 0.97), rgba(22, 9, 42, 0.97));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 26px rgba(255, 79, 216, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 1px rgba(255, 79, 216, 0.25);
  animation: raffle-in 0.45s cubic-bezier(0.2, 1.3, 0.4, 1);
}
@keyframes raffle-in { from { opacity: 0; transform: translateX(-50%) translateY(26px) scale(0.94); } to { opacity: 1; transform: translateX(-50%); } }
/* a sheen crossing it now and then */
.raffle-toast::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 34%; pointer-events: none;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
  transform: skewX(-18deg); animation: raffle-sheen 3.2s ease-in-out 0.5s infinite;
}
@keyframes raffle-sheen { 0% { left: -40%; } 45%, 100% { left: 120%; } }
.raffle-toast .raffle-ic {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 30%, #fff3c4, #ffd166 45%, #c98a1c 100%);
  box-shadow: 0 0 0 2px rgba(60, 26, 8, 0.55), 0 0 14px rgba(255, 209, 102, 0.6), inset 0 -3px 5px rgba(120, 60, 0, 0.45);
  animation: raffle-bob 1.8s ease-in-out infinite;
}
.raffle-toast .raffle-ic::after {
  content: ""; position: absolute; top: 10px; left: 10px; right: 10px; bottom: 10px; background: #4a1a06;
  -webkit-mask: url(assets/ticket.png) center / contain no-repeat; mask: url(assets/ticket.png) center / contain no-repeat;
}
@keyframes raffle-bob { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg) scale(1.06); } }
.raffle-toast .raffle-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.raffle-toast .raffle-k { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--violet-soft); }
.raffle-toast .raffle-v {
  font: 800 25px/1.05 Orbitron, sans-serif; letter-spacing: 0.02em; color: #ffd166;
  text-shadow: 0 0 14px rgba(255, 190, 70, 0.55), 0 2px 0 rgba(70, 30, 0, 0.6);
}
.raffle-toast .raffle-s { font-size: 12px; line-height: 1.25; color: var(--muted); }
.raffle-toast .raffle-cta {
  flex: 0 0 auto; margin-right: 14px; padding: 9px 13px; border-radius: 999px; font-style: normal; font-weight: 800; font-size: 12px; letter-spacing: 0.08em; white-space: nowrap; color: #fff;
  background: linear-gradient(180deg, #ff6fb6, #ff3f9a 55%, #c81f74);
  box-shadow: 0 3px 0 #7c0f46, 0 0 14px rgba(255, 63, 154, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  animation: raffle-pulse 1.4s ease-in-out infinite;
}
@keyframes raffle-pulse { 0%, 100% { transform: none; } 50% { transform: scale(1.06); } }
.raffle-toast .raffle-x { top: 2px; right: 4px; padding: 4px 8px; font-size: 18px; font-weight: 400; color: var(--muted); z-index: 1; }
.raffle-toast:hover { border-color: rgba(255, 224, 150, 0.9); }
/* the time it stays, running out along its foot */
.raffle-toast .raffle-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.1); }
.raffle-toast .raffle-bar::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 100%; transform-origin: left center;
  background: linear-gradient(90deg, #ff3f9a, #ffd166); animation: raffle-drain 8s linear forwards;
}
@keyframes raffle-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (max-width: 380px) {
  .raffle-toast .raffle-ic { width: 38px; height: 38px; }
  .raffle-toast .raffle-v { font-size: 21px; }
  .raffle-toast .raffle-cta { padding: 8px 10px; font-size: 11px; margin-right: 10px; }
}
@media (prefers-reduced-motion: reduce) { .raffle-toast, .raffle-toast::before, .raffle-toast .raffle-ic, .raffle-toast .raffle-cta { animation: none; } }

.raffle-line {
  position: relative; overflow: hidden; padding: 11px 12px; border-radius: 14px;
  border: 1px solid rgba(255, 209, 102, 0.5);
  background: radial-gradient(120% 160% at 0% 0%, rgba(255, 209, 102, 0.14), rgba(255, 209, 102, 0) 55%), linear-gradient(135deg, rgba(74, 22, 118, 0.8), rgba(28, 12, 52, 0.8));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 16px rgba(255, 79, 216, 0.18);
}
.raffle-line b { font-family: Orbitron, sans-serif; font-weight: 800; text-shadow: 0 0 10px rgba(255, 190, 70, 0.5); }
.raffle-line i {
  padding: 6px 12px; letter-spacing: 0.08em; font-size: 12px; font-weight: 800;
  background: linear-gradient(180deg, #ff6fb6, #ff3f9a 55%, #c81f74); box-shadow: 0 2px 0 #7c0f46, inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.raffle-end {
  border: 1px solid rgba(255, 209, 102, 0.5);
  background: radial-gradient(120% 120% at 0% 0%, rgba(255, 209, 102, 0.12), rgba(255, 209, 102, 0) 55%), linear-gradient(135deg, rgba(74, 22, 118, 0.6), rgba(28, 12, 52, 0.6));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 18px rgba(255, 79, 216, 0.16);
}
.raffle-end-title { font-family: Orbitron, sans-serif; font-size: 14px; letter-spacing: 0.16em; color: #ffe48f; }
.raffle-end-list button { padding: 7px 9px; margin: 0; border-radius: 10px; border: 1px solid rgba(201, 180, 255, 0.18); background: rgba(12, 5, 26, 0.45); }
.raffle-end-list button:hover { background: rgba(255, 79, 216, 0.18); border-color: rgba(255, 209, 102, 0.5); }
.raffle-end-list b { font-family: Orbitron, sans-serif; font-weight: 800; }

/* the line of the pause menu: the ticket, the raffle's name over its prize (each on one line,
   never broken; a long one is cut with an ellipsis), the button at the end */
.raffle-line { width: 100%; gap: 8px; padding: 10px; }
.raffle-line .raffle-ic {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 30%, #fff3c4, #ffd166 45%, #c98a1c 100%);
  box-shadow: 0 0 0 2px rgba(60, 26, 8, 0.55), 0 0 10px rgba(255, 209, 102, 0.5), inset 0 -2px 4px rgba(120, 60, 0, 0.45);
}
.raffle-line .raffle-ic::after {
  content: ""; position: absolute; top: 7px; left: 7px; right: 7px; bottom: 7px; background: #4a1a06;
  -webkit-mask: url(assets/ticket.png) center / contain no-repeat; mask: url(assets/ticket.png) center / contain no-repeat;
}
.raffle-line .raffle-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; text-align: left; }
.raffle-line .raffle-body em, .raffle-line .raffle-body b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.raffle-line .raffle-body em { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--violet-soft); }
.raffle-line .raffle-body b { font-size: 16px; line-height: 1.15; letter-spacing: 0; }
.raffle-line i { flex: 0 0 auto; padding: 6px 9px; font-size: 11px; letter-spacing: 0.04em; }
@media (max-width: 360px) {
  .raffle-line .raffle-ic { width: 28px; height: 28px; }
  .raffle-line .raffle-ic::after { top: 6px; left: 6px; right: 6px; bottom: 6px; }
  .raffle-line .raffle-body b { font-size: 14px; }
  .raffle-line i { padding: 5px 7px; font-size: 10px; }
}
