:root {
  --bg: #120d1a;
  --panel: #1b1426;
  --panel-2: #241b33;
  --line: #33284a;
  --text: #f3ecfa;
  --muted: #a397b8;
  --pink: #ff8fc7;
  --pink-2: #ff5fae;
  --gold: #ffd36b;
  --mint: #7ee8c0;
  --mono: "VT323", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(ellipse at top, #22163a, var(--bg) 60%) fixed;
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

.bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(27,20,38,.85);
  backdrop-filter: blur(6px);
  font-size: 14px;
  position: sticky; top: 0; z-index: 5;
}
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #ff4f6d; box-shadow: 0 0 8px #ff4f6d; animation: pulse 1.6s infinite; flex: none; }
.live { font-weight: 700; color: #ff4f6d; letter-spacing: .06em; font-size: 12px; }
.chan { font-weight: 600; }
.stream-title { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.spacer { flex: 1; }
.chip { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; flex: none; }
.chip:hover { border-color: #4b3d68; }
.chip.on { background: var(--pink); border-color: var(--pink); color: #2a0f20; font-weight: 700; }
@keyframes pulse { 50% { opacity: .35; } }

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  padding: 16px;
  max-width: 1320px;
  margin: 0 auto;
  align-items: start;
}
.left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.feedwrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0,0,0,.5), 0 0 0 1px rgba(255,143,199,.06);
  user-select: none;
  -webkit-user-select: none;
}
#feed {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.feedwrap.pop #feed { animation: tap .12s ease-out; }
@keyframes tap { 50% { transform: scale(.992); } }
.hud {
  position: absolute;
  font-family: var(--mono);
  font-size: clamp(16px, 2.3vw, 24px);
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.9);
  pointer-events: none;
  line-height: 1;
  background: rgba(10,6,16,.45);
  padding: 3px 8px;
  border-radius: 6px;
}
.tl { top: 10px; left: 10px; display: flex; align-items: center; gap: 6px; }
.tr { top: 10px; right: 10px; }
.bl { bottom: 10px; left: 50%; transform: translateX(-50%); color: var(--gold); white-space: nowrap; }
.rec { width: 9px; height: 9px; border-radius: 50%; background: #ff4f6d; animation: pulse 1s steps(1) infinite; }

.toast {
  position: absolute; left: 50%; top: 16%;
  transform: translateX(-50%) translateY(6px);
  font-family: var(--mono);
  font-size: clamp(20px, 3vw, 30px);
  background: rgba(20,10,30,.8);
  border: 1px solid var(--pink);
  color: var(--pink);
  padding: 4px 14px;
  border-radius: 8px;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

.raid {
  position: absolute;
  font-family: var(--mono);
  font-size: clamp(16px, 2vw, 22px);
  white-space: nowrap;
  background: linear-gradient(135deg, #ffe08a, #ffb84d);
  color: #3a2200;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: 0 0 22px rgba(255,211,107,.8);
  animation: bob 1s ease-in-out infinite;
  transform: translate(-50%, -50%);
}
.raid:hover { filter: brightness(1.1); }
@keyframes bob { 50% { margin-top: -6px; } }

.stats { text-align: center; padding: 4px 0; }
.big { font-family: var(--mono); font-size: clamp(42px, 7vw, 64px); line-height: 1; color: var(--pink); text-shadow: 0 0 18px rgba(255,95,174,.35); }
.unit { font-size: .5em; color: var(--text); }
.sub { color: var(--muted); font-size: 14px; margin-top: 4px; font-variant-numeric: tabular-nums; }

.chat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex; flex-direction: column;
  height: 220px;
}
.chat-head, .shop-head { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.log { flex: 1; overflow-y: auto; padding: 8px 14px; font-size: 14px; line-height: 1.45; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.msg { overflow-wrap: anywhere; animation: msgin .2s ease-out; }
.msg b { font-weight: 700; margin-right: 5px; }
.msg.sys { color: var(--muted); text-align: center; font-family: var(--mono); font-size: 18px; }
.msg.mira { background: rgba(255,143,199,.1); border-left: 2px solid var(--pink); padding: 2px 7px; border-radius: 4px; }
@keyframes msgin { from { opacity: 0; transform: translateY(4px); } }

.shop {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  position: sticky; top: 62px;
  max-height: calc(100vh - 78px);
  display: flex; flex-direction: column;
}
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shop-head h2 { margin: 0; font-size: 12px; font-weight: 600; }
.buy-mode { display: flex; gap: 4px; text-transform: none; letter-spacing: 0; }
.items { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
#cam-slot { padding: 8px 8px 0; }

.item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  transition: border-color .15s, transform .08s, opacity .2s;
}
.item:hover:not(:disabled) { border-color: var(--pink); }
.item:active:not(:disabled) { transform: scale(.985); }
.item:disabled { opacity: .5; cursor: not-allowed; }
.item.locked { opacity: .35; }
.item .ico { font-size: 26px; text-align: center; }
.item .name { font-weight: 600; font-size: 14px; }
.item .desc { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .cost { font-family: var(--mono); font-size: 20px; color: var(--pink); text-align: right; line-height: 1; }
.item .own { font-family: var(--mono); font-size: 16px; color: var(--muted); text-align: right; }
.item.cam { background: linear-gradient(135deg, #2b2142, #3a2350); border-color: #5b3f7e; }
.item.cam .cost { color: var(--gold); }
.item.cam.maxed { cursor: default; }

.shop-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 12px; padding: 0; }
.link:hover { color: var(--text); }

.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center;
  padding: 24px 16px;
  background: radial-gradient(ellipse at center, rgba(40,22,60,.96), rgba(12,8,18,.985));
  overflow-y: auto;
}
.overlay.hidden { display: none; }
.title-card { width: min(440px, 100%); text-align: center; }
h1 {
  font-family: var(--mono); font-weight: 400;
  font-size: clamp(52px, 13vw, 84px);
  line-height: .9; margin: 0 0 22px;
  color: #fff;
  text-shadow: 0 0 22px rgba(255,95,174,.6), 3px 3px 0 var(--pink-2);
}
.phone { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 7px; }
.phone-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: #3a2350; display: grid; place-items: center; font-size: 14px; }
.ago { margin-left: auto; color: var(--muted); font-weight: 400; font-size: 12px; }
.bubble { margin: 0; background: #3a2350; padding: 7px 12px; border-radius: 14px 14px 14px 4px; width: fit-content; max-width: 88%; font-size: 14px; opacity: 0; animation: pop .3s ease-out forwards; animation-delay: var(--d); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
.howto { text-align: left; color: var(--muted); font-size: 14px; line-height: 1.55; padding-left: 20px; margin: 18px 0; }
.big-btn { background: linear-gradient(135deg, var(--pink), var(--pink-2)); color: #2a0f20; border: 0; border-radius: 999px; padding: 13px 30px; font-weight: 800; font-size: 16px; box-shadow: 0 0 24px rgba(255,95,174,.4); transition: transform .1s; }
.big-btn:hover { transform: translateY(-1px) scale(1.02); }
.fine { color: var(--muted); font-size: 12px; margin-top: 10px; }

.page { max-width: 680px; margin: 0 auto; padding: 32px 16px 64px; line-height: 1.65; }
.page h1 { font-size: clamp(44px, 10vw, 64px); margin-bottom: 8px; }
.page h2 { font-size: 18px; margin: 28px 0 6px; color: var(--pink); }
.page p, .page li { color: #d8cfe6; }
.page a { color: var(--pink); }
.page .updated { color: var(--muted); font-size: 14px; }
.foot-links { text-align: center; padding: 8px 16px 24px; font-size: 12px; color: var(--muted); }
.foot-links a { color: var(--muted); }

@media (max-width: 900px) {
  .stage { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; gap: 12px; }
  .left { display: contents; }
  .feedwrap { order: 1; } .stats { order: 2; } .shop { order: 3; } .chat { order: 4; }
  .shop { position: static; max-height: none; }
  .items { overflow: visible; }
  .stream-title { display: none; }
  .chat { height: 180px; }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot, .rec, .raid, .bubble { animation: none; opacity: 1; }
}
