/* nomnomeme: tokyo night with the cyberpunk dial turned up, same family as donce.dev */

:root {
  --bg-deep: #07080f;
  --bg: #0b0c14;
  --panel: rgba(22, 22, 30, 0.88);
  --panel-edge: #292e42;
  --fg: #a9b1d6;
  --fg-bright: #c0caf5;
  --comment: #565f89;
  --cyan: #7dcfff;
  --blue: #7aa2f7;
  --purple: #bb9af7;
  --magenta: #ff007c;
  --green: #9ece6a;
  --yellow: #e0af68;
  --red: #f7768e;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --pixel: "VT323", var(--mono);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-deep);
  color: var(--fg);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--cyan); }
::selection { background: var(--magenta); color: var(--bg-deep); }

/* ---------- shell ---------- */

.tv, .page {
  position: relative;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255, 0, 124, 0.16), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(125, 207, 255, 0.14), transparent 60%),
    var(--bg);
  overflow-x: hidden;
}

.tv__bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }

.tv__grid {
  position: absolute;
  left: -50%; right: -50%; bottom: -10%;
  height: 55%;
  background-image:
    linear-gradient(rgba(187, 154, 247, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(187, 154, 247, 0.22) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(420px) rotateX(62deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, black 10%, transparent 85%);
  animation: grid-run 3s linear infinite;
}

@keyframes grid-run { to { background-position: 0 48px, 0 0; } }

.tv__kana {
  position: absolute;
  top: 50%;
  writing-mode: vertical-rl;
  font-size: 15px;
  letter-spacing: 0.5em;
  color: rgba(255, 0, 124, 0.32);
  text-shadow: 0 0 8px rgba(255, 0, 124, 0.5);
  transform: translateY(-50%);
  white-space: nowrap;
}
.tv__kana--left { left: 18px; }
.tv__kana--right { right: 18px; color: rgba(125, 207, 255, 0.3); text-shadow: 0 0 8px rgba(125, 207, 255, 0.5); }

.tv__fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.14) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.38) 100%);
  animation: flicker 6s infinite steps(1);
}

@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: 0.86; } 48% { opacity: 1; } 83% { opacity: 0.92; } }

.tv__window {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1160px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(255, 0, 124, 0.25),
    0 0 32px rgba(255, 0, 124, 0.18),
    0 0 80px rgba(125, 207, 255, 0.1),
    inset 0 0 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.tv__window::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(90deg, var(--magenta), var(--purple), var(--cyan));
  box-shadow: 0 0 12px var(--magenta);
}

.tv__bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--panel-edge);
  font-family: var(--pixel);
  font-size: 20px;
  line-height: 1;
  color: var(--comment);
}

.tv__dots { display: flex; gap: 7px; }
.tv__dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--red); }
.tv__dots i:nth-child(2) { background: var(--yellow); }
.tv__dots i:nth-child(3) { background: var(--green); }

.tv__name {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--fg-bright);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv__onair { display: flex; align-items: center; gap: 6px; color: var(--red); letter-spacing: 0.08em; }

.tv__led {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
  animation: pulse 1.6s ease-in-out infinite;
}
.kitchen .tv__led { background: var(--green); box-shadow: 0 0 8px var(--green); }

@keyframes pulse { 50% { opacity: 0.35; } }

.tv__buyad {
  font-family: var(--pixel);
  font-size: 20px;
  color: #221600;
  text-decoration: none;
  padding: 3px 10px 4px;
  border: 2px solid #000;
  background: linear-gradient(115deg, #ffd86b, #ff9d3c, #fff3b0, #ffb347, #ffe08a, #ffd86b);
  background-size: 300% 100%;
  box-shadow: 3px 3px 0 #000;
  animation: holo 5s linear infinite;
  white-space: nowrap;
}
.tv__buyad:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }

@keyframes holo { to { background-position: 300% 0; } }

/* ---------- body ---------- */

.tv__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  padding: 22px;
}

.stage { min-width: 0; }

.stage__screen {
  position: relative;
  width: min(100%, 640px);
  margin: 0 auto;
  border: 2px solid var(--panel-edge);
  background: #000;
  box-shadow: 0 0 0 1px rgba(125, 207, 255, 0.2), 0 0 40px rgba(187, 154, 247, 0.18);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.stage__canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  transition: opacity 120ms steps(2), filter 120ms steps(2);
}
.stage__screen.is-switching .stage__canvas { opacity: 0.35; filter: hue-rotate(80deg) contrast(1.6); }

.stage__badge, .stage__sponsor {
  position: absolute;
  top: 10px;
  font-family: var(--pixel);
  font-size: 20px;
  line-height: 1;
  padding: 3px 8px 4px;
  pointer-events: none;
}
.stage__badge { top: auto; bottom: 12px; left: 10px; color: var(--fg-bright); background: rgba(0, 0, 0, 0.55); }
.stage__sponsor { right: 10px; display: none; color: #221600; background: linear-gradient(115deg, #ffd86b, #ff9d3c, #fff3b0, #ffb347, #ffd86b); background-size: 300% 100%; animation: holo 5s linear infinite; }
.stage__screen.is-sponsor { border-color: #ffb347; box-shadow: 0 0 24px rgba(255, 180, 60, 0.5); }
.stage__screen.is-sponsor .stage__sponsor { display: block; }

.stage__progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, 0.4); }
.stage__progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--magenta), var(--cyan)); transform-origin: left; transform: scaleX(0); }

.heart-burst {
  position: absolute;
  font-size: 64px;
  color: var(--red);
  text-shadow: 0 0 12px var(--magenta);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: burst 900ms ease-out forwards;
}

@keyframes burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  25% { opacity: 1; transform: translate(-50%, -60%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(1); }
}

.stage__meta { width: min(100%, 640px); margin: 14px auto 0; }

.stage__title {
  margin: 0;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
  color: var(--fg-bright);
  text-shadow: 0 0 10px rgba(187, 154, 247, 0.45);
  overflow-wrap: anywhere;
}

.stage__byline { margin: 6px 0 0; font-size: 13px; color: var(--comment); }
.stage__visit { display: inline-block; margin-top: 6px; font-size: 13px; color: var(--yellow); }

.stage__controls {
  width: min(100%, 640px);
  margin: 14px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stage__hint { width: min(100%, 640px); margin: 10px auto 0; font-size: 11px; color: var(--comment); }

.btn {
  font: 18px/1 var(--pixel);
  color: var(--fg-bright);
  background: #1f2335;
  border: 1px solid var(--panel-edge);
  padding: 8px 12px 9px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 120ms, color 120ms;
}
.btn:hover { border-color: var(--cyan); color: var(--cyan); }
.btn:focus-visible { outline: 2px solid var(--magenta); outline-offset: 2px; }
.btn--like { color: var(--red); }
.btn--like.is-liked { border-color: var(--red); box-shadow: 0 0 14px rgba(247, 118, 142, 0.6); }
.btn--ghost { color: var(--comment); margin-left: auto; }
.btn--primary { background: var(--magenta); color: #0b0c14; border-color: var(--magenta); box-shadow: 0 0 16px rgba(255, 0, 124, 0.35); }
.btn--primary:hover { color: #0b0c14; background: #ff3d97; }
.btn--big { font-size: 26px; padding: 12px 18px; }

/* ---------- side ---------- */

.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.panel {
  border: 1px solid var(--panel-edge);
  background: rgba(11, 12, 20, 0.6);
  padding: 12px 14px;
}

.panel__title {
  margin: 0 0 10px;
  font: 400 22px/1 var(--pixel);
  color: var(--green);
}

.feed { display: flex; flex-direction: column; gap: 10px; border-color: rgba(255, 0, 124, 0.45); }

.feed__text, .chef__name {
  width: 100%;
  font: 14px/1.5 var(--mono);
  color: var(--fg-bright);
  background: #0b0c14;
  border: 1px solid var(--panel-edge);
  padding: 8px 10px;
  resize: vertical;
}
.feed__text:focus, .chef__name:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 10px rgba(125, 207, 255, 0.25); }

.feed__file {
  display: block;
  font-size: 12px;
  color: var(--purple);
  border: 1px dashed var(--panel-edge);
  padding: 8px 10px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feed__file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.feed__file:focus-within { border-color: var(--cyan); }
.feed__file span::before { content: "📎 "; }

.feed__status { margin: 0; min-height: 1.2em; font-size: 12px; color: var(--yellow); }
.feed__privacy { margin: 0; font-size: 11px; color: var(--comment); line-height: 1.5; }

.kitchen { margin: 0; font-size: 13px; color: var(--fg-bright); display: flex; align-items: center; gap: 8px; }

.chef__row { display: flex; gap: 8px; }
.karma { color: var(--yellow); }

.muted { margin: 6px 0 0; font-size: 12px; color: var(--comment); }

.list { margin: 0; padding: 0; list-style: none; font-size: 13px; counter-reset: rank; }
.list li { display: flex; gap: 8px; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed rgba(41, 46, 66, 0.7); }
.list li:not(.muted)::before { counter-increment: rank; content: counter(rank) "."; color: var(--comment); width: 1.6em; flex: none; }
.list li a, .list li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-bright); text-decoration: none; }
.list li a:hover { color: var(--cyan); }
.list li b { color: var(--yellow); font-weight: 400; white-space: nowrap; }

.side__foot { margin: 0; font-size: 11px; color: var(--comment); }
.side__foot a { color: var(--comment); }

/* ---------- goblin & toast ---------- */

.critters { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* No filter on the moving element: mobile browsers leave smeared drop-shadow trails behind it. */
.goblin {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  cursor: pointer;
  will-change: transform;
  backface-visibility: hidden;
  contain: layout style;
  -webkit-tap-highlight-color: transparent;
}
.goblin canvas { display: block; image-rendering: pixelated; }

.goblin__say {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 6px;
  white-space: nowrap;
  font: 20px/1 var(--pixel);
  color: #0b0c14;
  background: var(--green);
  padding: 4px 8px 5px;
  box-shadow: 3px 3px 0 #000;
  opacity: 0;
  transition: opacity 150ms;
  pointer-events: none;
}
.goblin__say.is-on { opacity: 1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  z-index: 70;
  font: 22px/1 var(--pixel);
  color: #0b0c14;
  background: var(--cyan);
  padding: 8px 14px 9px;
  box-shadow: 4px 4px 0 #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms, transform 160ms;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- pages ---------- */

.page__window { max-width: 760px; }
.page__body { padding: 22px 26px 28px; line-height: 1.7; font-size: 14px; color: var(--fg-bright); }
.page__body h1 { margin: 0 0 12px; font: 400 40px/1 var(--pixel); color: var(--green); }
.page__list { padding-left: 1.2em; }
.page__list li::marker { content: "> "; color: var(--magenta); }
.holo { color: #221600; padding: 0 6px; background: linear-gradient(115deg, #ffd86b, #ff9d3c, #fff3b0, #ffb347, #ffd86b); background-size: 300% 100%; animation: holo 5s linear infinite; }

/* ---------- admin ---------- */

.admin { padding: 16px; font-size: 13px; background: var(--bg); }
.admin__nav { display: flex; gap: 16px; margin-bottom: 16px; }
.admin__notice { color: var(--yellow); }
.admin__table { border-collapse: collapse; width: 100%; }
.admin__table th, .admin__table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--panel-edge); vertical-align: top; }
.admin__table tr.hidden { opacity: 0.45; }
.admin__table form { margin: 0; }
.admin__form { display: grid; gap: 10px; max-width: 520px; }
.admin__form input[type=text], .admin__form input[type=url], .admin__form input[type=number], .admin__form textarea { width: 100%; display: block; background: #0b0c14; color: var(--fg-bright); border: 1px solid var(--panel-edge); padding: 6px 8px; font: inherit; }

/* ---------- small screens ---------- */

@media (max-width: 900px) {
  .tv__body { grid-template-columns: 1fr; }
  .tv__kana { display: none; }
}

@media (max-width: 640px) {
  .tv, .page { padding: 0; }
  .tv__window { border-radius: 0; border-left: 0; border-right: 0; }
  .tv__window::before { border-radius: 0; }
  .tv__body { padding: 12px 16px 20px; gap: 16px; }
  .tv__dots, .tv__onair { display: none; }
  .stage__title { font-size: 28px; }
  .btn { padding: 8px 10px 9px; }
  .page__body { padding: 18px 16px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .tv__grid, .tv__fx, .tv__led, .tv__buyad, .holo, .stage__sponsor { animation: none; }
}

/* ---------- ad checkout ---------- */

.ad-form { display: grid; gap: 12px; margin: 18px 0; max-width: 560px; }
.ad-form label { display: grid; gap: 4px; font-size: 12px; color: var(--purple); }
.ad-form input, .ad-form textarea {
  font: 14px/1.5 var(--mono);
  color: var(--fg-bright);
  background: #0b0c14;
  border: 1px solid var(--panel-edge);
  padding: 8px 10px;
}
.ad-form input:focus, .ad-form textarea:focus { outline: none; border-color: var(--cyan); }
.ad-form .btn { justify-self: start; }
.ad-form .btn:disabled { opacity: 0.6; cursor: wait; }
.ad-done h2 { font: 400 30px/1 var(--pixel); color: var(--yellow); }
.ad-done a { overflow-wrap: anywhere; }
