@font-face {
  font-family: "Luckiest Guy";
  src: url("../assets/luckiest-guy.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ffe340;
  --ink: #141414;
  --bar: #141414;
  --bar-text: #ffe340;
  --muted: rgba(20, 20, 20, 0.55);
  --panel: #fff8c4;
  --pink: #ff4d7a;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --world-h: calc(58px + var(--safe-bottom));
  --tools-w: 360px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: auto;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Luckiest Guy", "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
  letter-spacing: 0.02em;
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  cursor: pointer;
}

body {
  min-height: 100dvh;
  min-height: 100svh;
}

#app {
  position: relative;
  z-index: 1;
  height: auto;
  min-height: 100dvh;
  min-height: 100svh;
  padding: calc(10px + var(--safe-top)) 16px calc(96px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: padding-right 0.28s ease;
}

.top {
  text-align: center;
  width: 100%;
  flex: 0 0 auto;
  position: relative;
  z-index: 4;
}

.top h1 {
  font-size: clamp(28px, 8vw, 72px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.04em;
  text-shadow: 3px 3px 0 #fff, 6px 6px 0 rgba(0,0,0,0.08);
  margin-top: 4px;
}

.count {
  font-size: clamp(52px, 16vw, 148px);
  line-height: 0.9;
  letter-spacing: 0.02em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  text-shadow: 4px 4px 0 #fff;
}

.rate {
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

.stage {
  flex: 1 1 auto;
  min-height: 0;
  width: min(100%, 520px);
  max-height: calc(100dvh - 320px - var(--safe-top) - var(--safe-bottom));
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  touch-action: none;
  margin-top: 4px;
  perspective: 900px;
}

.face-wrap {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform-origin: center 58%;
  will-change: transform;
}

.stage.is-wide .face-wrap { align-items: center; }

.face, .flip {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: bottom center;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.face { display: block; }

.stage.is-wide .face {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-position: center center;
}

.flip {
  display: none;
  position: absolute;
  inset: 0;
  margin: auto;
  background: var(--bg);
  object-fit: contain;
}

.stage.is-flipping .face-wrap { visibility: hidden; }
.stage.is-flipping .flip { display: block; }

.stage.is-down:not(.is-jumpscare) .face {
  transform: scale(0.985) translateY(4px);
}

.jumpscare {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.jumpscare[hidden] { display: none; }
.jumpscare-flash {
  position: absolute;
  inset: 0;
  background: #c00000;
  opacity: 0;
}
.jumpscare.is-on .jumpscare-flash {
  animation: scare-flash 1.05s ease-out;
}
.jumpscare-face {
  position: relative;
  z-index: 1;
  width: auto;
  height: 95dvh;
  max-width: 100vw;
  max-height: 100dvh;
  object-fit: contain;
  transform: scale(var(--scare-start, 0.22));
  transform-origin: center center;
  will-change: transform;
}
.jumpscare.is-on .jumpscare-face {
  animation: scare-zoom 1.05s cubic-bezier(.12,.85,.2,1) forwards;
}
@keyframes scare-zoom {
  0%   { transform: scale(var(--scare-start, 0.22)); }
  12%  { transform: scale(1.22) translate(10px, -8px) rotate(-3deg); }
  20%  { transform: scale(1.08) translate(-12px, 8px) rotate(3deg); }
  28%  { transform: scale(1.18) translate(8px, 6px) rotate(-2.5deg); }
  38%  { transform: scale(1.06) translate(-7px, -9px) rotate(2deg); }
  52%  { transform: scale(1.14) translate(6px, 4px) rotate(-1.5deg); }
  70%  { transform: scale(1.05) translate(-3px, 3px) rotate(1deg); }
  100% { transform: scale(1); }
}
@keyframes scare-flash {
  0% { opacity: 0; }
  8% { opacity: 0.72; }
  16% { opacity: 0.12; }
  24% { opacity: 0.55; }
  36% { opacity: 0.08; }
  48% { opacity: 0.28; }
  70% { opacity: 0.05; }
  100% { opacity: 0; }
}

.pref-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.pref-row input {
  width: 18px;
  height: 18px;
  accent-color: #c00000;
  cursor: pointer;
}

.hint {
  margin-top: 8px;
  font-family: system-ui, sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
}

.hint.is-hidden { opacity: 0; transition: opacity 0.4s ease; }

.world {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bar);
  color: var(--bar-text);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px calc(14px + var(--safe-bottom));
  z-index: 5;
  box-shadow: 0 -8px 0 rgba(0,0,0,0.08);
}

.world-label {
  font-size: clamp(16px, 4vw, 26px);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.world-count {
  font-size: clamp(22px, 6vw, 40px);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.world[data-state="offline"] .world-label,
.world[data-state="offline"] .world-count {
  font-family: system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: none;
}

.world[data-state="offline"] .world-count { display: none; }
.world[data-state="offline"] .world-label { font-size: 15px; letter-spacing: 0.02em; }

.world.is-pulse .world-count {
  animation: popnum 0.18s ease-out;
}

@keyframes popnum {
  0% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* Tools button */
.tools-btn {
  position: fixed;
  left: 12px;
  bottom: calc(var(--world-h) + 12px);
  z-index: 15;
  cursor: pointer;
  border: 0;
  background: var(--ink);
  color: var(--bar-text);
  font-family: inherit;
  font-size: 18px;
  letter-spacing: 0.06em;
  padding: 10px 16px 8px;
  border-radius: 999px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.15);
  line-height: 1;
}

.tools-btn:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 rgba(0,0,0,0.15); }

.tools-badge {
  display: inline-block;
  margin-left: 6px;
  background: var(--pink);
  color: #fff;
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: 12px;
  min-width: 18px;
  padding: 2px 5px;
  border-radius: 999px;
  vertical-align: top;
}

.tools-badge[hidden] { display: none; }

.tools-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.35);
  z-index: 20;
  border: 0;
}

.tools-backdrop[hidden] { display: none; }

.tools-panel {
  position: fixed;
  z-index: 25;
  background: var(--panel);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 0 rgba(0,0,0,0.12);
  cursor: default;
}

.tools-panel[hidden] { display: none; }

/* Mobile: slide-up drawer */
.tools-panel {
  left: 0;
  right: 0;
  bottom: var(--world-h);
  max-height: min(70vh, 560px);
  border-radius: 22px 22px 0 0;
  padding: 14px 14px 10px;
  animation: drawer-in 0.32s cubic-bezier(.2,1.2,.3,1);
}

@keyframes drawer-in {
  from { transform: translateY(110%); }
  to { transform: translateY(0); }
}

.tools-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.tools-head h2 {
  font-size: 28px;
  line-height: 0.95;
  letter-spacing: 0.04em;
}

.tools-sub {
  font-family: system-ui, sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

.tools-close {
  cursor: pointer;
  border: 0;
  background: var(--ink);
  color: var(--bar-text);
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.04em;
  padding: 8px 12px 6px;
  border-radius: 999px;
}

.tools-power {
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.tools-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 6px;
  touch-action: pan-y;
}

.tool {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 8px 10px;
  align-items: center;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 10px 10px 9px;
}

.tool.is-locked {
  background: #efe6a8;
  border-style: dashed;
  opacity: 0.85;
}

.tool.is-new {
  animation: tool-pop 0.45s cubic-bezier(.2,1.5,.3,1);
}

@keyframes tool-pop {
  0% { transform: scale(0.7) rotate(-3deg); background: #ffd0dc; }
  60% { transform: scale(1.06) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}

.tool-emoji {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 26px;
  background: var(--bg);
  border-radius: 10px;
  line-height: 1;
}

.tool.is-locked .tool-emoji { filter: grayscale(1); font-size: 22px; }

.tool-body { min-width: 0; }

.tool-name {
  font-size: 16px;
  letter-spacing: 0.03em;
  line-height: 1.05;
}

.tool-meta {
  font-family: system-ui, sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}

.tool-action {
  justify-self: end;
}

.tool-status {
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: right;
}

.upgrade-btn {
  cursor: pointer;
  border: 0;
  background: var(--ink);
  color: var(--bar-text);
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 9px;
  border-radius: 10px;
  white-space: nowrap;
}

.upgrade-btn:disabled {
  cursor: default;
  background: #bbb;
  color: #666;
}

.toasts {
  position: fixed;
  top: calc(12px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100% - 24px));
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: var(--bar-text);
  text-align: center;
  padding: 12px 16px 10px;
  border-radius: 16px;
  box-shadow: 0 8px 0 rgba(0,0,0,0.12);
  animation: toast-in 0.4s cubic-bezier(.2,1.4,.3,1);
}

.toast-kicker {
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pink);
}

.toast-title {
  font-size: 22px;
  letter-spacing: 0.03em;
  line-height: 1.05;
  margin-top: 2px;
}

.toast-sub {
  font-family: system-ui, sans-serif;
  font-weight: 700;
  font-size: 13px;
  margin-top: 2px;
  color: #ffe9a3;
}

@keyframes toast-in {
  0% { transform: translateY(-20px) scale(0.8); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.floaters {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 35;
  overflow: hidden;
}

.floater {
  position: absolute;
  font-size: clamp(22px, 5vw, 36px);
  color: var(--ink);
  text-shadow: 2px 2px 0 #fff, -1px -1px 0 #fff;
  animation: float-up 0.75s ease-out forwards;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.floater.is-auto { color: #c2185b; }

@keyframes float-up {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -140px) scale(1.2); }
}


.tools-tabs {
  display: flex;
  gap: 6px;
  margin: 4px 0 10px;
}

.tools-tab {
  flex: 1;
  cursor: pointer;
  border: 3px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 7px 4px 5px;
  border-radius: 999px;
}

.tools-tab.is-on {
  background: var(--ink);
  color: var(--bar-text);
}


.tools-list[hidden],
.chars-list[hidden],
.walls-list[hidden],
.reviews-pane[hidden] {
  display: none !important;
}

.tools-list,
.chars-list,
.walls-list {
  flex: 1 1 auto;
  min-height: 0;
}

.tools-panel.is-chars .tools-power,
.tools-panel.is-walls .tools-power,
.tools-panel.is-reviews .tools-power { display: none; }

.chars-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-bottom: 6px;
  touch-action: pan-y;
}

.char-card {
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  padding: 8px 8px 10px;
  text-align: center;
  cursor: pointer;
  min-width: 0;
  align-self: start;
}

.char-card.is-selected {
  background: var(--bg);
  box-shadow: 0 0 0 4px var(--pink);
}

.char-card.is-locked {
  background: #efe6a8;
  border-style: dashed;
  cursor: default;
  opacity: 0.9;
}

.char-card.is-new { animation: tool-pop 0.45s cubic-bezier(.2,1.5,.3,1); }

.char-shot {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  max-height: 170px;
  object-fit: contain;
  object-position: center center;
  background: var(--bg);
  border-radius: 10px;
  pointer-events: none;
  display: block;
}

.char-card.is-locked .char-shot {
  filter: brightness(0);
  opacity: 0.38;
}

.char-name {
  font-size: 16px;
  letter-spacing: 0.03em;
  margin-top: 6px;
  line-height: 1.05;
}

.char-meta {
  font-family: system-ui, sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}


/* Wallpapers */
.wallpaper {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: #ffe340;
}

.wallpaper-fx {
  position: absolute;
  inset: -20%;
  pointer-events: none;
}

.wp-classic { background: #ffe340; }

.wp-bubblegum { background: #ff6fb0; }

.wp-sunset {
  background: linear-gradient(180deg, #ffe56a 0%, #ff9e4a 42%, #ff5d8f 100%);
}

.wp-stripes {
  background: repeating-linear-gradient(-45deg, #ffe340 0 26px, #ff7ad1 26px 52px);
  background-size: 74px 74px;
  animation: stripe-move 1.8s linear infinite;
}
@keyframes stripe-move {
  from { background-position: 0 0; }
  to { background-position: 74px 0; }
}

.wp-starfield { background: #0b1026; }
.wp-starfield::before,
.wp-starfield::after {
  content: "";
  position: absolute;
  inset: -40%;
  background-image:
    radial-gradient(1px 1px at 10% 20%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 80%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 50% 30%, #ffe9a3 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 60%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 85% 15%, #cfe8ff 50%, transparent 51%),
    radial-gradient(2px 2px at 15% 55%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 45% 10%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 75%, #ffe9a3 50%, transparent 51%),
    radial-gradient(1px 1px at 62% 90%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 78% 42%, #fff 50%, transparent 51%);
  background-size: 240px 240px;
  animation: star-drift 48s linear infinite;
  opacity: 0.9;
}
.wp-starfield::after {
  background-size: 180px 180px;
  animation-duration: 32s;
  animation-direction: reverse;
  opacity: 0.55;
}
@keyframes star-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-240px, -120px, 0); }
}

.wp-rainbow {
  background: linear-gradient(120deg, #ff4d7a, #ffe340, #6cff8a, #4dc3ff, #c84dff, #ff4d7a);
  background-size: 500% 500%;
  animation: rainbow-shift 9s ease infinite;
}
@keyframes rainbow-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.wp-party { background: #7c5cff; }
.wp-party .wallpaper-fx {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  font-size: 36px;
  line-height: 1.35;
  letter-spacing: 0.2em;
  opacity: 0.28;
  animation: party-scroll 22s linear infinite;
  user-select: none;
}
@keyframes party-scroll {
  from { transform: translateY(0); }
  to { transform: translateY(-40%); }
}

.wp-aurora { background: #07131f; }
.wp-aurora::before,
.wp-aurora::after {
  content: "";
  position: absolute;
  inset: -30%;
  background: radial-gradient(ellipse at 20% 30%, rgba(80, 255, 200, 0.55), transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(120, 90, 255, 0.5), transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(255, 90, 170, 0.35), transparent 55%);
  filter: blur(20px);
  animation: aurora-shift 16s ease-in-out infinite alternate;
}
.wp-aurora::after {
  animation-duration: 22s;
  animation-direction: alternate-reverse;
  opacity: 0.7;
}
@keyframes aurora-shift {
  from { transform: translate3d(-6%, -4%, 0) rotate(-4deg); }
  to { transform: translate3d(8%, 6%, 0) rotate(5deg); }
}

body.theme-dark {
  --ink: #fff6d8;
  --muted: rgba(255, 246, 216, 0.72);
}
body.theme-dark .top h1,
body.theme-dark .count {
  text-shadow: 3px 3px 0 #141414, -1px -1px 0 #141414, 0 0 10px rgba(0,0,0,0.45);
}
body.theme-dark .rate,
body.theme-dark .hint {
  color: var(--muted);
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}
body.theme-dark .tools-btn {
  box-shadow: 4px 4px 0 rgba(0,0,0,0.35), 0 0 0 2px rgba(255,246,216,0.15);
}

/* walls cards */
.walls-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-bottom: 6px;
  touch-action: pan-y;
}

.wall-card {
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  min-width: 0;
}

.wall-card.is-selected {
  box-shadow: 0 0 0 4px var(--pink);
  background: #fff;
}

.wall-card.is-locked {
  background: #efe6a8;
  border-style: dashed;
  cursor: default;
  opacity: 0.9;
}

.wall-card.is-new { animation: tool-pop 0.45s cubic-bezier(.2,1.5,.3,1); }

.wall-swatch {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  border: 2px solid rgba(20,20,20,0.15);
  overflow: hidden;
  position: relative;
}

.wall-card.is-locked .wall-swatch { filter: grayscale(0.4) brightness(0.85); }

.wall-name {
  font-size: 15px;
  letter-spacing: 0.03em;
  margin-top: 6px;
  line-height: 1.05;
}

.wall-meta {
  font-family: system-ui, sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}


@media (min-width: 900px) {
  #app { padding-top: calc(12px + var(--safe-top)); }
  .stage { width: min(100%, 620px); max-height: calc(100dvh - 300px - var(--safe-top) - var(--safe-bottom)); }

  .tools-btn { left: auto; right: 16px; bottom: calc(var(--world-h) + 16px); font-size: 20px; }
  .chat-btn { right: auto; left: 16px; bottom: calc(var(--world-h) + 16px); font-size: 20px; }
  .chat-drawer {
    left: 0;
    right: auto;
    top: 0;
    bottom: var(--world-h);
    width: var(--tools-w);
    max-height: none;
    height: auto;
    border-radius: 0;
    box-shadow: 8px 0 0 rgba(0,0,0,0.08);
  }
  body.chat-open #app { padding-left: calc(var(--tools-w) + 8px); }

  .tools-backdrop { display: none !important; }

  .tools-panel {
    top: 0;
    right: 0;
    left: auto;
    bottom: var(--world-h);
    width: var(--tools-w);
    max-height: none;
    height: auto;
    border-radius: 0;
    box-shadow: -8px 0 0 rgba(0,0,0,0.08);
    padding: 18px 16px 12px;
    animation: panel-in 0.28s ease-out;
  }

  @keyframes panel-in {
    from { transform: translateX(110%); }
    to { transform: translateX(0); }
  }

  body.tools-open #app {
    padding-right: calc(var(--tools-w) + 8px);
  }
}


/* Admin Abuse */
.abuse-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 32px;
  padding: 6px 12px;
  font-size: 13px;
  letter-spacing: 0.04em;
  border-bottom: 3px solid var(--ink);
  background: #fff4b0;
  color: var(--ink);
  text-align: center;
}
.abuse-bar[data-state="on"] {
  min-height: 48px;
  padding: 10px 12px;
  font-size: 20px;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, #ff2d2d, #ff8a00, #ffe340, #ff2d2d);
  background-size: 300% 100%;
  color: #1a0a00;
  animation: abuseFlash 0.7s steps(2, end) infinite, abuseSlide 2.4s linear infinite;
  text-shadow: 0 1px 0 #fff, 0 0 12px #fff38a;
  border-bottom-width: 4px;
}
.abuse-bar[data-state="on"] .abuse-title {
  font-size: 22px;
}
.abuse-time {
  font-variant-numeric: tabular-nums;
}
@keyframes abuseFlash {
  50% { filter: brightness(1.25) saturate(1.3); }
}
@keyframes abuseSlide {
  to { background-position: 300% 0; }
}
body.theme-dark .abuse-bar[data-state="wait"] {
  background: #2a2208;
  color: #ffe9a8;
  border-bottom-color: #000;
}

/* Rebirth */
.rebirth-badge {
  margin: 2px 0 0;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: #8a1a8a;
  text-shadow: 1px 1px 0 #fff;
}
body.theme-dark .rebirth-badge {
  color: #ff9cff;
  text-shadow: 1px 1px 0 #000;
}
.rebirth-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 18px 10px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(#fff 0%, #ff9cff 100%);
  color: var(--ink);
  font-family: inherit;
  font-size: 18px;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  animation: rebirthPulse 1.4s ease-in-out infinite;
}
.rebirth-btn[hidden] { display: none; }
@keyframes rebirthPulse {
  50% { transform: scale(1.06); box-shadow: 5px 5px 0 var(--ink); }
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0,0,0,0.55);
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(420px, 100%);
  padding: 22px 20px 18px;
  border: 4px solid var(--ink);
  border-radius: 22px;
  background: var(--gold);
  color: var(--ink);
  box-shadow: 8px 8px 0 #000;
  text-align: center;
}
.modal-card h3 {
  margin: 0 0 8px;
  font-size: 32px;
}
.modal-card p {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: 0.02em;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.rebirth-confirm,
.rebirth-cancel,
.review-submit {
  font-family: inherit;
  font-size: 18px;
  letter-spacing: 0.04em;
  padding: 8px 16px 10px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
}
.rebirth-confirm {
  background: #ff6ad5;
  color: var(--ink);
}
.rebirth-cancel,
.review-submit {
  background: #fffbe8;
  color: var(--ink);
}
.review-submit {
  width: 100%;
}

/* Reviews */
.reviews-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.reviews-summary {
  font-size: 15px;
  letter-spacing: 0.03em;
  text-align: center;
}
.review-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: rgba(255,255,255,0.72);
}
body.theme-dark .review-form {
  background: rgba(0,0,0,0.35);
}
.review-form input,
.review-form textarea {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 15px;
  background: #fffef6;
  color: var(--ink);
  resize: vertical;
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}
.star-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}
.star-btn {
  border: 0;
  background: none;
  color: #c9c2a8;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  text-shadow: 1px 1px 0 var(--ink);
}
.star-btn.is-on { color: #ffb000; }
.review-status {
  min-height: 1.2em;
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-align: center;
}
.review-status.is-err { color: #b00020; }
.review-status.is-ok { color: #0a6b2a; }
body.theme-dark .review-status.is-err { color: #ff8a9a; }
body.theme-dark .review-status.is-ok { color: #7dff9a; }
.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.review-card {
  padding: 8px 10px 10px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fffef6;
}
body.theme-dark .review-card { background: rgba(20,16,8,0.72); }
.review-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}
.review-stars { color: #ffb000; letter-spacing: 1px; }
.review-body {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: 0.02em;
  word-break: break-word;
}
.reviews-empty {
  text-align: center;
  font-size: 15px;
  padding: 8px;
}

@media (min-width: 800px) {
  .tools-tab { font-size: 16px; }
}


.admin-link {
  position: absolute;
  right: 10px;
  bottom: calc(4px + var(--safe-bottom));
  font-family: system-ui, sans-serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  text-decoration: none;
  color: var(--bar-text);
  opacity: 0.28;
  line-height: 1;
  padding: 2px 4px;
  z-index: 6;
}
.admin-link:hover,
.admin-link:focus {
  opacity: 0.7;
}

.lb-jump {
  margin-top: 6px;
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}
.lb-jump:hover { text-decoration: underline; }

.leaderboard {
  position: relative;
  z-index: 1;
  width: min(640px, calc(100% - 32px));
  margin: 8px auto calc(24px + var(--world-h));
  padding: 16px 16px 20px;
  border: 4px solid var(--ink);
  border-radius: 24px;
  background: rgba(255, 248, 196, 0.92);
  box-shadow: 6px 6px 0 var(--ink);
}
body.theme-dark .leaderboard {
  background: rgba(12, 16, 28, 0.86);
  color: #ffe9a8;
  border-color: #000;
  box-shadow: 6px 6px 0 #000;
}
.leaderboard h2 {
  font-size: clamp(28px, 6vw, 42px);
  letter-spacing: 0.04em;
  text-align: center;
  margin-bottom: 6px;
}
.lb-status, .lb-me {
  font-family: system-ui, sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-align: center;
  margin: 0 0 10px;
}
.lb-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lb-row {
  display: grid;
  grid-template-columns: 2.2em 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 8px 10px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fffef6;
  font-family: system-ui, sans-serif;
  font-weight: 800;
}
body.theme-dark .lb-row { background: rgba(20,16,8,0.72); }
.lb-row.is-you {
  background: #ffe36a;
  box-shadow: 3px 3px 0 var(--ink);
}
body.theme-dark .lb-row.is-you { background: #5a3d00; color: #fff3b0; }
.lb-rank { opacity: 0.7; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-variant-numeric: tabular-nums; }

.player-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.player-row label {
  font-size: 13px;
  letter-spacing: 0.04em;
}
.player-row input {
  flex: 1;
  min-width: 120px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 16px;
  background: #fffef6;
  color: var(--ink);
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}
.player-row button,
.name-form button {
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 0.04em;
  padding: 6px 12px 8px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fffbe8;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}
.name-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.name-form input {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 18px;
  background: #fffef6;
  color: var(--ink);
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}
