/* ---------- Sound categories ---------- */
.cat { flex-basis: 100%; width: 100%; }
.cathead {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 14px 0 12px; padding: 0 4px; cursor: pointer; background: none; border: none; text-align: left;
  font-family: var(--f-ui); font-size: 23px; font-weight: 800; letter-spacing: 0.04em; color: var(--skin);
}
.cathead::after { content: ""; flex: 1; border-top: 2px dotted rgba(154, 168, 184, 0.3); }
.cathead .caret { font-size: 14px; transition: transform 0.2s; }
.cat.collapsed .cathead .caret { transform: rotate(-90deg); }
.cathead .n { font-family: var(--f-ui); font-size: 12px; font-weight: 400; color: var(--ink-dim); }
.cathead .bounty { font-size: 15px; color: var(--gold); }
.cat.collapsed .catgrid { display: none; }
.catgrid { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px 12px; }
.clip { position: relative; display: inline-block; }
.catplus {
  position: absolute; top: -10px; right: -10px; z-index: 3; width: 26px; height: 26px; padding: 0; border-radius: 50%; cursor: pointer;
  font: 900 18px/20px system-ui, sans-serif; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
  background: radial-gradient(circle at 30% 30%, #c4f57a, #4fae2e 60%, #24600f); border: 2px solid #133008; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
  opacity: 0; transform: scale(0.5); pointer-events: none; transition: opacity 0.15s, transform 0.15s cubic-bezier(.3, 1.8, .5, 1);
}
.clip:hover .catplus, .clip:focus-within .catplus { opacity: 1; transform: scale(1); pointer-events: auto; }
.catplus:hover { transform: scale(1.15) rotate(90deg) !important; }
/* no hover on touch screens, so keep the plus showing */
@media (hover: none) { .catplus { opacity: 0.9; transform: scale(0.85); pointer-events: auto; } }
/* the favourite star, top left: showing when starred, on hover or focus, and always on touch screens */
.favstar {
  position: absolute; top: -10px; left: -10px; z-index: 3; width: 26px; height: 26px; padding: 0; border-radius: 50%; cursor: pointer;
  font: 900 16px/22px system-ui, sans-serif; color: #fff6c8; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.7);
  background: radial-gradient(circle at 30% 30%, #6d6450, #3a3324 60%, #1d180e); border: 2px solid #2b220c; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
  opacity: 0; transform: scale(0.5); pointer-events: none; transition: opacity 0.15s, transform 0.15s cubic-bezier(.3, 1.8, .5, 1);
}
.favstar.on { color: #fff3a0; background: radial-gradient(circle at 30% 30%, #ffe98a, #e0a92a 60%, #8a5a08); opacity: 1; transform: scale(0.9); pointer-events: auto; }
.clip:hover .favstar, .clip:focus-within .favstar { opacity: 1; transform: scale(1); pointer-events: auto; }
.favstar:hover { transform: scale(1.2) rotate(-15deg) !important; }
@media (hover: none) { .favstar { opacity: 0.9; transform: scale(0.95); pointer-events: auto; width: 32px; height: 32px; line-height: 28px; font-size: 18px; } }
.cat.favs .cathead .cname { color: var(--gold); }
.favfilter {
  margin-left: 12px; padding: 4px 12px; border-radius: 14px; cursor: pointer; font-family: var(--f-ui); font-size: 17px;
  color: var(--ink-dim); background: rgba(21, 24, 30, 0.7); border: 2px solid rgba(224, 169, 42, 0.35); min-height: 32px;
}
.favfilter:hover, .favfilter:focus-visible { border-color: var(--gold); color: var(--ink); }
.favfilter.on { color: #1d180e; background: linear-gradient(180deg, #ffe98a, #e0a92a); border-color: #8a5a08; }
#catpick .catsound { margin: 10px 0 0; font-family: var(--f-ui); font-size: 20px; color: var(--ink); text-transform: capitalize; }
#catpick .catnow { margin: 6px 0 0; font-family: var(--f-ui); font-size: 18px; color: var(--ink-dim); }
#catpick .catnow b { color: var(--gold); }
#catchips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0 6px; max-height: 40vh; overflow-y: auto; }
#catchips .chip.on { color: #2b1d02; background: var(--gold); border-color: var(--gold); cursor: default; }
#catchips:empty::after { content: "No categories yet. Make the first one!"; font-family: var(--f-ui); font-size: 17px; color: var(--ink-dim); }
#catnew { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
#catnew input {
  flex: 1; min-width: 0; max-width: 260px; padding: 8px 12px; border-radius: 12px; font-family: var(--f-ui); font-size: 14px; color: var(--ink);
  background: rgba(0, 0, 0, 0.4); border: 2px solid rgba(154, 168, 184, 0.45);
}

/* ---------- Loader ---------- */
.loader { width: 100%; padding-top: 8vh; }
.cauldron { font-size: 90px; display: inline-block; animation: stir 0.9s ease-in-out infinite alternate; filter: drop-shadow(0 0 30px rgba(122, 255, 42, 0.6)); }
@keyframes stir { from { transform: rotate(-10deg) translateY(0); } to { transform: rotate(10deg) translateY(-8px); } }
.loader p, .dead p { font-family: var(--f-ui); font-size: 24px; color: var(--skin); letter-spacing: 0.05em; }
.dead { width: 100%; padding-top: 8vh; font-size: 120px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 60; transform: translate(-50%, 160%) rotate(-2deg); opacity: 0;
  padding: 14px 26px; border-radius: 26px 14px 30px 12px; max-width: calc(100vw - 32px);
  background: linear-gradient(160deg, #0a0612, #0f170b); border: 2px solid var(--skin); color: var(--bile);
  box-shadow: 0 6px 0 #0f170b, 0 0 40px rgba(122, 255, 42, 0.35);
  transition: transform 0.45s cubic-bezier(.3, 1.8, .5, 1), opacity 0.25s;
  text-transform: capitalize;
}
#toast.show { transform: translate(-50%, 0) rotate(-2deg); opacity: 1; }
#toast small { display: block; margin-top: 2px; font-family: var(--f-ui); font-size: 17px; text-transform: none; color: var(--ink-dim); }

footer {
  padding: 22px 16px 44px; margin: 0 16px; font-family: var(--f-ui); font-size: 17px; color: var(--ink-dim);
  border-top: 2px dotted rgba(154, 168, 184, 0.3); letter-spacing: 0.04em;
}

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  #upload, #random { width: auto; flex: 1; }
  #random { order: 2; }
  #channels { order: 3; flex-basis: 100%; }
  .stage { flex-direction: column; }
  #historypanel { width: 100%; position: static; max-height: none; }
  #history { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  #main { width: 100%; gap: 14px 10px; }
  .gob { --fs: 12px; }
}

@media (max-width: 760px) {
  #goblin .mascot { width: 96px; height: 77px; }
  .bubble { margin-bottom: 50px; max-width: calc(100vw - 130px); }
  .bubble p { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fly, #sweat { display: none; }
}
/* ---------- the player panel under the title ---------- */
#whoami.hud {
  display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "id wallet util" "nav nav nav"; align-items: center; gap: 12px 14px;
  /* wider than the header's middle column, which leaves room for the corner panels up by the title */
  width: min(1100px, calc(100vw - 32px)); margin: 14px 0 0 calc(50% - min(550px, 50vw - 16px)); padding: 12px 14px; box-sizing: border-box; text-align: left;
  border-radius: 20px; border: 1px solid rgba(154, 168, 184, 0.35);
  background: linear-gradient(180deg, rgba(30, 44, 16, 0.85), rgba(9, 13, 6, 0.9));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(230, 240, 74, 0.12);
}
#whoami .hud-id { grid-area: id; display: flex; align-items: center; gap: 10px; min-width: 0; }
#whoami .hud-crest {
  flex: none; width: 60px; height: 60px; display: grid; place-items: center; padding: 0; cursor: pointer; font-size: 28px;
  border-radius: 16px; border: 1px solid rgba(242, 182, 50, 0.45); background: radial-gradient(circle at 35% 25%, rgba(242, 182, 50, 0.25), rgba(0, 0, 0, 0.5));
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4); transition: transform 0.15s;
}
#whoami .hud-crest:hover { transform: rotate(-4deg) scale(1.05); }
#whoami .hud-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
#whoami .hud-name { font-family: var(--f-ui); font-size: 21px; line-height: 1.05; color: var(--ink); overflow-wrap: anywhere; }
#whoami .hud-co {
  all: unset; cursor: pointer; font-family: var(--f-ui); font-size: 14px; color: var(--gold); max-width: 260px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#whoami .hud-co:hover { text-decoration: underline; }
#whoami .hud-info .xpbar { width: 190px; height: 16px; }
#whoami .hud-info .xptext { line-height: 16px; }

#whoami .hud-wallet { grid-area: wallet; display: flex; gap: 8px; }
#whoami .cur {
  display: grid; grid-template-columns: 24px auto; grid-template-rows: auto auto; column-gap: 7px; align-items: center; cursor: pointer;
  min-width: 116px; padding: 4px 12px 4px 8px; border-radius: 12px; text-align: left; font: inherit; color: var(--ink);
  background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.1); transition: border-color 0.15s, background 0.15s;
}
#whoami .cur .ci { grid-row: 1 / 3; display: grid; place-items: center; font-size: 20px; line-height: 1; }
#whoami .cur .cv { font-family: var(--f-ui); font-size: 15px; line-height: 1.1; }
#whoami .cur .cl { font-family: var(--f-ui); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); line-height: 1; }
#whoami .cur.gold .cv { color: var(--gold); }
#whoami .cur.gold:hover { border-color: rgba(242, 182, 50, 0.6); background: rgba(242, 182, 50, 0.08); }
#whoami .cur.ruby .cv { color: #ff6b7d; }
#whoami .cur.ruby .ci svg { filter: drop-shadow(0 0 4px rgba(255, 60, 90, 0.55)); }
#whoami .cur.ruby:hover { border-color: rgba(255, 90, 110, 0.6); background: rgba(255, 60, 90, 0.08); }
#whoami .cur.jingle { animation: none; }
#whoami .cur.jingle .ci { animation: jingle 0.6s cubic-bezier(.3, 1.8, .5, 1); }

#whoami .hud-nav { grid-area: nav; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; min-width: 0; padding-top: 12px; border-top: 1px solid rgba(154, 168, 184, 0.18); }
#whoami .hud-grp { --ga: 143, 191, 58; display: flex; flex-direction: column; gap: 3px; padding: 4px 6px 6px; border-radius: 14px; background: rgba(var(--ga), 0.06); border: 1px solid rgba(var(--ga), 0.2); }
#whoami .g-progress { --ga: 217, 226, 60; } #whoami .g-loot { --ga: 242, 201, 76; } #whoami .g-games { --ga: 255, 120, 90; } #whoami .g-empire { --ga: 126, 224, 208; }
#whoami .hud-gl { font-family: var(--f-ui); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; text-align: center; color: rgba(var(--ga), 0.85); }
#whoami .hud-gt { display: flex; gap: 5px; }
#whoami .hud-gt .tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 72px; height: 56px; padding: 4px 2px; margin: 0; cursor: pointer; vertical-align: top;
  border-radius: 11px; border: 1px solid rgba(var(--ga), 0.25); background: rgba(0, 0, 0, 0.4); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
  font: inherit; color: var(--ink); text-shadow: none; transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
#whoami .hud-gt .tile:hover { transform: translateY(-2px); background: rgba(var(--ga), 0.16); border-color: rgba(var(--ga), 0.7); }
#whoami .hud-gt .tile:active { transform: translateY(1px); box-shadow: none; }
#whoami .hud-gt .tile:focus-visible { outline: 2px solid rgb(var(--ga)); outline-offset: 2px; }
#whoami .tile .ti { line-height: 0; }
#whoami .tile .ti .gi { width: 26px; height: 26px; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.5)); transition: transform 0.15s; }
#whoami .hud-gt .tile:hover .ti .gi { transform: scale(1.12) rotate(-4deg); }
#whoami .cur .ci .gi { width: 22px; height: 22px; }
#whoami .hud-mini .gi { width: 20px; height: 20px; }
#whoami .hud-crest .gi { width: 34px; height: 34px; }
#whoami .tile .tl { font-family: var(--f-ui); font-size: 9px; letter-spacing: 0.02em; line-height: 1.1; white-space: nowrap; }
#whoami .tile .tb {
  position: absolute; top: -6px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px;
  font-family: var(--f-ui); font-size: 10px; line-height: 18px; text-align: center; color: #2b1d02; background: var(--gold);
  border: 1px solid #5c4108; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
#whoami .tile .tb:empty { display: none; }
#whoami .tile .tb.lock { display: grid; place-items: center; padding: 0; width: 20px; height: 20px; }
#whoami .tile .tb.lock .gi { width: 13px; height: 13px; }
#whoami .tile .tb.tally { color: var(--ink); background: #2c3a1a; border-color: rgba(154, 168, 184, 0.6); font-size: 9px; }
#whoami .tile .tb.done { color: #0e1016; background: var(--skin); border-color: #0a0612; font-size: 9px; }
#whoami .tile .tb.crate { background: #ff9a3c; }
#whoami #skillbtn.haspoints { border-color: rgba(var(--ga), 0.9); }
#whoami #skillbtn.haspoints .tb { background: var(--bile); }

#whoami .hud-util { grid-area: util; display: flex; gap: 6px; }
#whoami .hud-mini {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0; cursor: pointer; font-size: 16px; text-decoration: none;
  border-radius: 10px; background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.1);
}
#whoami .hud-mini:hover { border-color: rgba(154, 168, 184, 0.6); }

@media (max-width: 640px) {
  #whoami.hud { grid-template-columns: 1fr auto; grid-template-areas: "id util" "wallet wallet" "nav nav"; gap: 10px; padding: 10px; }
  #whoami .cur { flex: 1; min-width: 0; }
  #whoami .hud-util { flex-direction: column; }
  #whoami .hud-info .xpbar { width: min(190px, 100%); }
  #whoami .hud-nav { display: grid; grid-template-columns: 1fr; gap: 8px; }
  #whoami .hud-gt .tile { flex: 1; width: auto; min-width: 0; }
}
