:root {
  --bg: #050805;
  --panel: rgba(8, 16, 10, .82);
  --line: #1c3a22;
  --green: #39ff7a;
  --green-dim: #1f9c4b;
  --amber: #ffb000;
  --text: #b8f5c8;
  --muted: #6b9a78;
  --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font-family: var(--mono); font-size: 16px; line-height: 1.55;
}
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .5; }
.crt {
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.22) 2px 3px),
    radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,.6) 100%);
  animation: flicker 6s infinite;
}
@keyframes flicker { 0%,100% { opacity: 1 } 50% { opacity: .93 } 52% { opacity: 1 } }

.shell { position: relative; z-index: 1; max-width: 1040px; margin: 0 auto; padding: 0 16px 40px; }

.top {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  padding: 18px 0; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--green); }
.sym {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 2px solid var(--green); border-radius: 4px; font-weight: 700; font-size: 18px;
  text-shadow: 0 0 8px var(--green); box-shadow: 0 0 12px rgba(57,255,122,.35) inset;
}
.word { letter-spacing: .25em; font-weight: 700; text-shadow: 0 0 8px rgba(57,255,122,.6); }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs a {
  padding: 6px 12px; color: var(--muted); text-decoration: none; font-size: 14px; letter-spacing: .12em;
  border: 1px solid transparent; border-radius: 3px;
}
.tabs a:hover { color: var(--green); border-color: var(--line); }
.tabs a.on { color: var(--bg); background: var(--green); box-shadow: 0 0 12px rgba(57,255,122,.5); }

.panel { display: none; padding: 32px 0; }
.panel.on { display: block; animation: in .25s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

h1 { font-size: clamp(26px, 5vw, 46px); line-height: 1.15; margin: 8px 0 16px; color: var(--green); text-shadow: 0 0 14px rgba(57,255,122,.5); min-height: 1.2em; }
h2 { margin: 0 0 12px; color: var(--amber); letter-spacing: .2em; font-size: 22px; text-shadow: 0 0 10px rgba(255,176,0,.4); }
h2::before { content: "// "; color: var(--green-dim); }
.prompt { color: var(--muted); margin: 0; }
.cursor { color: var(--green); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0 } }
.lede { color: var(--muted); max-width: 62ch; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 20px; }
.card {
  display: block; padding: 16px; text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: var(--green); box-shadow: 0 0 16px rgba(57,255,122,.25); transform: translateY(-2px); }
.card b { display: block; color: var(--green); letter-spacing: .15em; margin-bottom: 4px; }
.card span { color: var(--muted); font-size: 14px; }
.card .tag { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--amber); border: 1px solid #5a4100; padding: 0 6px; border-radius: 2px; }

.screen {
  margin-top: 16px; padding: 10px; background: #000; border: 1px solid var(--green-dim);
  border-radius: 6px; box-shadow: 0 0 24px rgba(57,255,122,.15), inset 0 0 30px rgba(57,255,122,.06);
}
.screen iframe { display: block; width: 100%; aspect-ratio: 16/9; border: 0; }
.screen.forge iframe { aspect-ratio: auto; height: max(560px, calc(100vh - 300px)); }
#ruffle-host { min-height: 120px; }
#ruffle-host ruffle-player, #ruffle-host ruffle-embed { display: block; width: 100%; max-width: 800px; height: 600px; margin: 0 auto; }
.note { margin: 8px 0 0; color: var(--amber); font-size: 14px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.empty code { color: var(--green); }

.links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.links a { color: var(--green); border: 1px solid var(--line); padding: 6px 12px; text-decoration: none; border-radius: 3px; }
.links a:hover { border-color: var(--green); box-shadow: 0 0 12px rgba(57,255,122,.3); }

.foot { border-top: 1px solid var(--line); padding-top: 14px; color: var(--muted); font-size: 13px; }

@media (max-width: 560px) {
  .tabs a { padding: 6px 8px; font-size: 13px; }
  #ruffle-host ruffle-player, #ruffle-host ruffle-embed { height: 360px; }
}
@media (prefers-reduced-motion: reduce) {
  .crt, .cursor, .panel.on { animation: none; }
}

.bigbtn {
  display: inline-block; padding: 14px 26px; font-weight: 700; letter-spacing: .1em; text-decoration: none;
  color: var(--bg); background: var(--green); border-radius: 4px; box-shadow: 0 0 16px rgba(57,255,122,.45);
}

.moreview { margin-top: 28px; }
.morehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.morehead h3 { margin: 0; color: var(--green); letter-spacing: .1em; }
.mini { font: inherit; font-size: 13px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 3px; padding: 4px 12px; cursor: pointer; }
.mini:hover { color: var(--green); border-color: var(--green); }
button.card { text-align: left; font: inherit; cursor: pointer; width: 100%; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; display: block; }
.gallery a:hover img { border-color: var(--green); }
.livebox { display: grid; gap: 6px; }
.liverow { display: flex; justify-content: space-between; gap: 16px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.liverow .k { color: var(--muted); } .liverow .v { color: var(--green); text-align: right; word-break: break-word; }

.doc { padding: 6px 8px; line-height: 1.65; max-width: 80ch; }
.doc h2, .doc h3, .doc h4, .doc h5, .doc h6 { color: var(--green); letter-spacing: .06em; margin: 1.4em 0 .5em; text-shadow: none; }
.doc h2::before { content: ""; }
.doc h2 { font-size: 22px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.doc h3 { font-size: 18px; } .doc h4 { font-size: 16px; }
.doc p, .doc li { color: var(--text); }
.doc a { color: var(--amber); }
.doc code { background: #0b140e; border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; color: var(--green); font-size: .92em; }
.doc pre { background: #070d09; border: 1px solid var(--line); border-radius: 4px; padding: 12px; overflow: auto; }
.doc pre code { background: none; border: 0; padding: 0; }
.doc blockquote { margin: 1em 0; padding: 2px 14px; border-left: 3px solid var(--green2); color: var(--muted); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
.doc img { max-width: 100%; border: 1px solid var(--line); border-radius: 4px; }
.doc .tablewrap { overflow-x: auto; }
.doc table { border-collapse: collapse; margin: 1em 0; font-size: 14px; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.doc th { color: var(--green); background: #0b140e; }

.livegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.livecard { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; }
.livecard h4 { margin: 0 0 6px; color: var(--green); letter-spacing: .1em; }

.petgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.petcard { display: flex; gap: 14px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; }
.petsprite { width: 56px; height: 56px; flex: none; image-rendering: pixelated; background: #070d09; border: 1px solid var(--line); border-radius: 4px; }
.petinfo { min-width: 0; }
.pethead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.pethead b { color: var(--green); letter-spacing: .08em; }
.pethead small { color: var(--muted); }
.petname { font-weight: 700; }
.petname.rc { color: #c9d1d9; } .petname.ru { color: #4ade80; } .petname.rr { color: #5cc8ff; } .petname.rl { color: #ffb000; } .petname.rd { color: #ff7ad9; }
.petabil { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.petabil span { font-size: 12px; padding: 1px 6px; border-radius: 3px; border: 1px solid var(--line); }
.petabil .ok { color: var(--green); border-color: #1f5a33; }
.petabil .no { color: var(--muted); text-decoration: line-through; }
.petplan { color: var(--muted); font-size: 13px; }
