/* Sweaty Goblin: the site's styles, split across css/app-*.css (index.html links them in order, and later files win ties) */
:root {
  --swamp-0: #070b05;
  --swamp-1: #0f170b;
  --swamp-2: #2a2e36;
  --skin: #8fbf3a;
  --skin-dark: #4f7a1c;
  --bile: #d9e23c;
  --torch: #ff9a3c;
  --gold: #f2b632;
  --sweat: #a8ecff;
  --ink: #f1f6d6;
  --ink-dim: rgba(240, 236, 224, 0.6);
  --grease: linear-gradient(110deg, #7aff2a 0%, #e6f04a 22%, #7af0c6 38%, #c6a2ff 52%, #f2b632 68%, #7aff2a 84%, #e6f04a 100%);
}

* { box-sizing: border-box; }

textarea:focus, input:focus { outline: none; }
::-webkit-scrollbar { display: none; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--swamp-0);
  color: var(--ink);
  font-family: var(--f-ui);
  text-align: center;
  overflow-x: hidden;
}

/* ---------- The cave ---------- */
.cave {
  position: fixed; inset: 0; z-index: -3;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(154, 168, 184, 0.22), transparent 55%),
    radial-gradient(ellipse at 50% 120%, rgba(79, 122, 28, 0.35), transparent 60%),
    radial-gradient(circle at 50% 40%, var(--swamp-2), var(--swamp-0) 75%);
}
.cave::after {
  content: ""; position: absolute; inset: 0; opacity: 0.22;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.3  0 0 0 0 0.45  0 0 0 0 0.15  0 0 0 1.2 -0.1'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.torch {
  position: fixed; top: 30%; width: 70vmin; height: 70vmin; z-index: -2; pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 154, 60, 0.28), rgba(255, 154, 60, 0.08) 40%, transparent 70%);
  animation: flicker 3.2s infinite steps(1);
}
.torch.left { left: -35vmin; }
.torch.right { right: -35vmin; animation-delay: -1.4s; }
@keyframes flicker {
  0% { opacity: 1; } 8% { opacity: 0.75; } 12% { opacity: 0.95; } 30% { opacity: 0.8; } 34% { opacity: 1; }
  55% { opacity: 0.7; } 58% { opacity: 0.92; } 80% { opacity: 0.85; } 86% { opacity: 1; }
}

.slime { position: fixed; top: 0; left: 0; right: 0; height: 0; z-index: 40; pointer-events: none; }
.slime .band { position: absolute; top: 0; left: 0; width: 100%; height: 34px; display: block; }
/* a drip swells and shrinks from where it hangs (only its transform changes, so it's cheap to animate) */
.gdrip { position: absolute; top: 14px; transform-origin: 50% 0; animation: gdrip var(--d) ease-in-out infinite; animation-delay: var(--delay); will-change: transform; }
.gdrip svg { display: block; overflow: visible; }
@keyframes gdrip { 0%, 100% { transform: scaleY(0.72); } 45% { transform: scaleY(1.12) scaleX(0.94); } 60% { transform: scaleY(1.04); } }
/* now and then a drop lets go and falls, stretching, then fades */
.gfall { position: absolute; left: 50%; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; opacity: 0;
  background: radial-gradient(circle at 35% 30%, #f0ffc8 0 14%, #b6e04c 32%, #6fa21f 72%, #3f6614);
  animation: gfall var(--f) ease-in infinite; animation-delay: var(--fd); will-change: transform, opacity; }
@keyframes gfall {
  0%, 70% { transform: translateY(0) scale(0.4); opacity: 0; }
  74% { transform: translateY(0) scale(1); opacity: 1; }
  96% { transform: translateY(55vh) scaleX(0.8) scaleY(1.35); opacity: 0.9; }
  100% { transform: translateY(60vh) scale(0.8); opacity: 0; }
}

#fx { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#sweat { position: fixed; inset: 0; z-index: 35; pointer-events: none; }

/* ---------- The goblin who pops up with opinions ---------- */
#goblin {
  position: fixed; bottom: -10px; z-index: 55; display: flex; align-items: flex-end; gap: 4px;
  /* hidden: far enough down to clear the screen even when lifted above the skill bar, then invisible */
  transform: translateY(calc(100% + 120px)); visibility: hidden;
  transition: transform 0.7s cubic-bezier(.3, 1.5, .5, 1), visibility 0s linear 0.7s;
  pointer-events: none;
}
#goblin.left { left: 12px; flex-direction: row-reverse; }
#goblin.right { right: 12px; }
#goblin.show { transform: translateY(0); visibility: visible; transition-delay: 0s; pointer-events: auto; }
#goblin.show .mascot { animation: bob 2.6s ease-in-out infinite; }
#goblin .mascot { width: 130px; height: 104px; flex: none; margin-bottom: 4px; }
#goblin.left .mascot { transform: scaleX(-1); }
#goblin.imposter .eyeball { fill: #ffb36a; }
#goblin.frenzied .mascot { animation: frenzy 0.25s linear infinite !important; }
@keyframes frenzy { 0% { translate: -2px 0; rotate: -6deg; } 50% { translate: 2px -3px; rotate: 6deg; } 100% { translate: -2px 0; rotate: -6deg; } }
@keyframes bob { 0%, 100% { translate: 0 0; rotate: -4deg; } 50% { translate: 0 -8px; rotate: 4deg; } }
.bubble {
  position: relative; max-width: min(300px, calc(100vw - 170px)); margin-bottom: 70px; padding: 14px 16px 16px;
  border-radius: 22px 26px 8px 24px; text-align: left;
  background: linear-gradient(160deg, #f3f7d9, #d6e4a8); color: #2a2e36;
  border: 3px solid #0a0612; box-shadow: 0 6px 0 #0a0612, 0 18px 40px rgba(0, 0, 0, 0.6);
}
#goblin.left .bubble { border-radius: 26px 22px 24px 8px; }
.bubble::after {
  content: ""; position: absolute; bottom: -3px; right: -16px; width: 22px; height: 18px;
  background: #d6e4a8; border: 3px solid #0a0612; border-left: none; border-top: none;
  clip-path: polygon(0 0, 100% 100%, 0 100%); border-radius: 0 0 6px 0;
}
#goblin.left .bubble::after { right: auto; left: -16px; transform: scaleX(-1); }
.bubble p { margin: 0 0 12px; font-family: var(--f-ui); font-weight: 500; font-size: 19px; line-height: 1.25; }
.bubble p b { font-family: var(--f-ui); font-weight: 400; font-size: 0.85em; color: #4f7a1c; text-transform: capitalize; }
.bubble-actions { display: flex; flex-wrap: wrap; gap: 10px; }
#goblin.pressing .bubble-actions { display: none; }
#goblin.pressing .bubble p { margin-bottom: 0; }

/* hot clips */
.gob.hot {
  border-color: var(--torch);
  animation: embers 1.4s ease-in-out infinite alternate;
}
.gob.hot .flame {
  position: absolute; top: -15px; right: -8px; font-size: 20px; line-height: 1; pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(255, 120, 30, 0.9));
  animation: flicker-flame 0.35s ease-in-out infinite alternate;
  transform-origin: 50% 100%;
}
.gob.hot1 .flame { font-size: 28px; top: -22px; right: -12px; }
.gob.hot1 { animation-duration: 0.9s; }
@keyframes embers {
  from { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.35), 0 5px 0 var(--edge, #0a0612), 0 0 10px rgba(255, 140, 40, 0.55), 0 0 22px rgba(255, 60, 0, 0.25); }
  to { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.35), 0 5px 0 var(--edge, #0a0612), 0 0 18px rgba(255, 170, 60, 0.85), 0 0 38px rgba(255, 70, 0, 0.5); }
}
@keyframes flicker-flame {
  from { transform: scale(1, 1) rotate(-6deg); }
  to { transform: scale(1.1, 1.25) rotate(5deg); }
}
.bubble-actions .gob { --fs: 13px; --py: 7px; --px: 12px; min-height: 34px; }

.fly { position: fixed; z-index: 45; font-size: 18px; pointer-events: none; transition: transform 0.4s linear; }

/* ---------- Header ---------- */
header { padding: 70px 16px 6px; position: relative; }

.mascot { width: 150px; height: 120px; display: block; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.6)); }
.mascot .bead { animation: bead 1.8s ease-in infinite; }
.mascot .bead.b2 { animation-delay: 0.7s; }
.mascot .bead.b3 { animation-delay: 1.2s; }
@keyframes bead { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(40px); opacity: 0; } }

h1 {
  margin: 0; font-family: var(--f-head); font-weight: 400;
  font-size: clamp(52px, 11vw, 132px); line-height: 1; letter-spacing: 0.02em;
  background: var(--grease); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: grease 7s linear infinite;
  filter: drop-shadow(0 5px 0 #0a0612) drop-shadow(0 0 26px rgba(122, 255, 42, 0.4));
}
@keyframes grease { to { background-position: 250% 0; } }

.subtitle {
  display: inline-block; margin: 14px 0 0; padding: 6px 16px; border-radius: 999px;
  font-family: var(--f-ui); font-weight: 500; font-size: clamp(15px, 2.2vw, 19px); letter-spacing: 0.08em;
  color: var(--ink-dim); border: 1px dashed rgba(154, 168, 184, 0.45); background: rgba(21, 24, 30, 0.6);
}
#whoami { margin-top: 10px; font-family: var(--f-ui); font-size: 17px; color: var(--ink-dim); min-height: 1em; }
#whoami b { color: var(--bile); font-weight: 800; }
#whoami a { color: var(--skin); }

body.locked .topbar, body.locked .searchwrap, body.locked #historypanel, body.locked .ticker { display: none; }
.gate {
  width: 100%; max-width: 520px; margin: 4vh auto 0; padding: 30px 22px 34px; border-radius: 30px 18px 34px 20px;
  background: linear-gradient(160deg, rgba(58, 64, 72, 0.92), rgba(21, 24, 30, 0.92));
  border: 2px solid rgba(154, 168, 184, 0.4); box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.7), 0 20px 60px rgba(0, 0, 0, 0.6);
}
.gate .lock { font-size: 70px; animation: stir 1.2s ease-in-out infinite alternate; }
.gate h2 { margin: 6px 0 8px; font-family: var(--f-head); font-weight: 400; font-size: clamp(30px, 6vw, 44px); color: var(--bile); }
.gate p { margin: 0 0 22px; font-family: var(--f-ui); font-size: 20px; color: var(--ink-dim); }
.gate a.gob { text-decoration: none; }

.subtitle b { font-family: var(--f-ui); font-weight: 400; color: var(--bile); letter-spacing: 0.12em; font-size: 0.9em; }

.ticker {
  margin: 22px auto 0; max-width: 1200px; overflow: hidden; white-space: nowrap;
  border-top: 2px dotted rgba(154, 168, 184, 0.35); border-bottom: 2px dotted rgba(154, 168, 184, 0.35);
  mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}
.ticker span {
  display: inline-block; padding: 9px 0; font-family: var(--f-ui); font-weight: 800;
  font-size: 17px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--skin);
  animation: ticker 50s linear infinite;
}
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Top controls (original layout: upload left, random right, channels between) ---------- */
.topbar { display: flex; align-items: flex-start; gap: 14px; padding: 22px 16px 0; }
#upload { width: 20%; text-align: left; }
#random { width: 20%; text-align: right; }

#channels {
  flex: 1; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px;
  padding: 16px 14px 20px; border-radius: 28px 14px 32px 18px;
  background: linear-gradient(160deg, rgba(58, 64, 72, 0.85), rgba(21, 24, 30, 0.85));
  border: 2px solid rgba(154, 168, 184, 0.3);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.7), 0 18px 50px rgba(0, 0, 0, 0.6);
}
#channels::before {
  content: "~ Pick Yer Hovel ~"; flex-basis: 100%;
  font-family: var(--f-ui); font-weight: 800; font-size: 16px; color: var(--skin); letter-spacing: 0.12em;
}

/* ---------- Goblin buttons: each one generated from its own name ---------- */
.gob {
  position: relative; display: inline-block; isolation: isolate;
  font-family: var(--f-ui); text-transform: capitalize; color: var(--ink);
  font-size: var(--fs, 14px); padding: var(--py, 9px) var(--px, 14px); min-height: 40px; line-height: 1.25;
  border-radius: var(--radius, 14px); border: var(--bw, 2px) var(--bs, solid) var(--edge, #0a0612);
  background: var(--skin-bg, var(--skin-dark));
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.35), 0 5px 0 var(--edge, #0a0612), 0 10px 18px rgba(0, 0, 0, 0.55);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.65), 0 0 6px rgba(0, 0, 0, 0.5);
  rotate: var(--tilt, 0deg);
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(.3, 1.8, .5, 1), box-shadow 0.2s, filter 0.2s;
}
/* greasy sheen */
.gob::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.04) 45%, transparent 55%),
    linear-gradient(105deg, transparent 35%, rgba(232, 255, 170, 0.45) 50%, transparent 65%);
  background-size: 100% 100%, 300% 100%;
  background-position: 0 0, 120% 0;
}
/* sweat bead */
.gob.sweats::after {
  content: ""; position: absolute; top: calc(100% - 2px); left: var(--drip-x, 50%); width: 7px; height: 9px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--sweat) 45%, #4fb6d9);
  opacity: 0; pointer-events: none;
  animation: sweat var(--drip-dur, 4s) ease-in infinite; animation-delay: var(--drip-delay, 0s);
}
@keyframes sweat {
  0%, 55% { transform: translateY(-4px) scale(0.3); opacity: 0; }
  65% { transform: translateY(0) scale(1); opacity: 1; }
  80% { transform: translateY(2px) scale(1, 1.15); opacity: 1; }
  100% { transform: translateY(34px) scale(0.8, 1.3); opacity: 0; }
}
.gob .trinket { display: inline-block; margin-right: 6px; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.5)); }

.gob:hover {
  filter: brightness(1.18) saturate(1.2);
  transform: translateY(-3px) scale(1.06);
  animation: jiggle 0.45s ease-in-out infinite;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.35), 0 8px 0 var(--edge, #0a0612), 0 0 22px rgba(217, 226, 60, 0.45), 0 16px 26px rgba(0, 0, 0, 0.6);
  z-index: 2;
}
.gob:hover::before { animation: sheen 0.9s ease-out; }
.gob:hover.sweats::after { animation-duration: 0.9s; animation-delay: 0s; }
.gob:active { transform: translateY(4px) scale(0.94); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35), 0 1px 0 var(--edge, #0a0612), 0 4px 8px rgba(0, 0, 0, 0.5); animation: none; }
.gob:focus-visible { outline: 3px dashed var(--bile); outline-offset: 4px; }
@keyframes jiggle { 0%, 100% { rotate: var(--tilt, 0deg); } 25% { rotate: calc(var(--tilt, 0deg) - 2.5deg); } 75% { rotate: calc(var(--tilt, 0deg) + 2.5deg); } }
@keyframes sheen { from { background-position: 0 0, 120% 0; } to { background-position: 0 0, -120% 0; } }


.gob.fresh { outline: 3px dashed var(--bile); outline-offset: 4px; animation: glowpulse 1.4s ease-in-out infinite; }
.gob.big { --fs: 15px; --py: 12px; --px: 18px; }
.gob.hoard {
  --skin-bg: radial-gradient(circle at 30% 25%, #fff3b0, var(--gold) 35%, #a07418 80%);
  --edge: #5c4108; color: #2b1d02; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

#channels .gob.active { outline: 3px solid var(--torch); outline-offset: 3px; box-shadow: 0 0 0 6px rgba(255, 154, 60, 0.25), 0 0 30px var(--torch), 0 5px 0 var(--edge); }
#channels .gob.active::before { background: linear-gradient(180deg, rgba(255, 200, 120, 0.45), transparent 60%); }
#channels .gob.active .trinket { animation: burn 0.3s infinite alternate; }
@keyframes burn { to { transform: scale(1.25) rotate(8deg); } }

/* ---------- Search ---------- */
.searchwrap { margin: 30px auto 10px; max-width: 640px; padding: 0 16px; }
.searchfield { position: relative; }
#search {
  width: 100%; padding: 16px 22px 16px 58px; font-family: var(--f-ui); font-size: 125%; color: var(--bile);
  text-transform: capitalize; border-radius: 22px 30px 18px 34px;
  background: rgba(21, 24, 30, 0.85); border: 2px solid rgba(154, 168, 184, 0.4);
  box-shadow: inset 0 3px 14px rgba(0, 0, 0, 0.8), 0 0 0 5px rgba(154, 168, 184, 0.06);
  transition: box-shadow 0.3s, border-color 0.3s;
}
#search::placeholder { color: rgba(154, 168, 184, 0.45); font-family: var(--f-ui); font-weight: 500; text-transform: none; letter-spacing: 0.05em; }
#search:focus { border-color: var(--bile); box-shadow: inset 0 3px 14px rgba(0, 0, 0, 0.8), 0 0 0 5px rgba(217, 226, 60, 0.2), 0 0 36px rgba(122, 255, 42, 0.35); }
.searchfield .snout { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); font-size: 24px; pointer-events: none; }
#search:focus + .snout, .searchfield:focus-within .snout { animation: sniff 0.35s ease-in-out infinite alternate; }
@keyframes sniff { to { transform: translateY(-50%) scale(1.2) rotate(-10deg); } }
#count { font-family: var(--f-ui); color: var(--ink-dim); margin-top: 10px; font-size: 18px; letter-spacing: 0.04em; }
#count b { color: var(--gold); font-family: var(--f-ui); font-weight: 400; font-size: 0.85em; }

