/* Astro Merge: The Cosmogony — JustPlays Original */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
:root {
  --ink: #f2ecff;
  --dim: #a99fc4;
  --dimmer: #746b95;
  --gold: #e8c67a;
  --gold-dim: #a2843c;
  --line: rgba(232, 198, 122, .26);
  --glass: rgba(14, 12, 28, .72);
  --glass2: rgba(20, 17, 38, .88);
  --violet: #b7a8ff;
  --good: #9fe8b0;
  --bad: #ff8f7a;
  --radius: 14px;
  --ff: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
}
html, body { height: 100%; }
body {
  margin: 0;
  background: #07060e;
  color: var(--ink);
  font-family: var(--ff);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ------------------------------------------------------------- the shell */
.shell {
  height: 100vh;
  height: 100dvh;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  background: radial-gradient(120% 80% at 50% 0%, #16123a 0%, #08060f 60%, #04030a 100%);
  overflow: hidden;
}
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 8, 24, .96), rgba(10, 8, 24, .55));
}
.brand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
}
.brand span {
  display: block;
  font-size: 9px;
  letter-spacing: .3em;
  color: var(--dimmer);
  margin-top: 2px;
}
.hud { margin-left: auto; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .035);
  min-width: 58px;
}
.chip b { font-size: 14px; line-height: 1.1; color: #fff8e6; font-variant-numeric: tabular-nums; }
.chip span { font-size: 8.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--dimmer); }
.chip.wide { min-width: 168px; max-width: 260px; position: relative; padding-bottom: 9px; }
.chip.wide b { font-size: 11.5px; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.meter { position: absolute; left: 8px; right: 8px; bottom: 4px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.meter u { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); transition: width .18s ease; }
.chip.combo { border-color: rgba(255, 220, 150, .5); background: rgba(255, 210, 130, .1); }
.chip.combo.hot b { color: #ffe9a8; }
.chip.combo { font-size: 11px; font-weight: 700; color: #ffe9a8; padding: 8px 10px; }
.hud-btns { display: flex; gap: 5px; }
.icobtn {
  position: relative;
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .045);
  color: var(--gold);
  font-size: 15px;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease;
}
.icobtn:hover { background: rgba(255, 255, 255, .1); transform: translateY(-1px); }
.icobtn:active { transform: translateY(0) scale(.96); }
.icobtn .badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 15px; height: 15px; line-height: 15px;
  border-radius: 8px; background: var(--gold); color: #221a06;
  font-size: 9.5px; font-style: normal; font-weight: 700;
}
.icobtn:disabled, .icobtn.off { opacity: .38; }

/* ------------------------------------------------------------- the stage */
.stagewrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 240px;
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
  outline: none;
}
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.dangerbar {
  position: absolute; left: 50%; top: 6px; transform: translateX(-50%);
  width: min(52%, 320px); height: 4px; border-radius: 3px;
  background: rgba(255, 255, 255, .08); overflow: hidden; pointer-events: none;
}
.dangerbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffb26b, #ff5b45); transition: width .12s linear; }

.toasts {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  pointer-events: none; width: max-content; max-width: 92%;
}
.toast {
  padding: 7px 14px; border-radius: 999px;
  background: rgba(12, 10, 24, .88);
  border: 1px solid var(--line);
  color: var(--ink); font-size: 12.5px; letter-spacing: .01em;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .45);
  animation: tin .28s ease both;
}
.toast.gold { border-color: rgba(232, 198, 122, .7); color: #ffeec4; }
.toast.violet { border-color: rgba(183, 168, 255, .65); color: #ddd6ff; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .5s ease; }
@keyframes tin { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }

/* ----------------------------------------------------------- bottom bar */
.sealbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: linear-gradient(0deg, rgba(8, 6, 18, .97), rgba(8, 6, 18, .6));
  min-height: 46px;
}
.sealbar .lore { font-size: 12.5px; color: var(--dim); font-style: italic; line-height: 1.35; }
.chaptermeta { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; min-width: 0; }
.cm-act { font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-dim); white-space: nowrap; }
.cm-ch { font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dimmer); white-space: nowrap; }
.cm-title { font-size: 13px; color: #fff6e2; font-weight: 700; white-space: nowrap; }
.cm-title::after { content: '·'; color: var(--dimmer); margin: 0 8px; font-weight: 400; }
.btn.seal { margin-left: auto; white-space: nowrap; border-color: rgba(232, 198, 122, .8); color: #221a06; background: linear-gradient(180deg, #ffe6ad, #e0b45f); font-weight: 700; }
.btn.seal:hover { filter: brightness(1.08); }

/* ------------------------------------------------------------- overlays */
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: radial-gradient(120% 90% at 50% 30%, rgba(10, 8, 24, .74), rgba(4, 3, 10, .9));
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  z-index: 5;
  animation: fade .26s ease both;
  overflow: auto;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.panel {
  width: min(520px, 100%);
  padding: 22px 22px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--glass2), rgba(10, 8, 20, .96));
  box-shadow: 0 26px 70px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
  text-align: center;
  animation: pop .3s cubic-bezier(.2, .9, .25, 1.1) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.widepanel { width: min(720px, 100%); text-align: left; }
.kicker { font-size: 10px; letter-spacing: .26em; text-transform: uppercase; color: var(--gold-dim); }
.panel h2 { font-size: 22px; font-weight: 700; letter-spacing: .01em; margin: 8px 0 4px; color: #fff8ea; }
.bigtitle { font-size: 40px !important; letter-spacing: .06em; background: linear-gradient(180deg, #fff3d2, var(--gold) 55%, #9a7628); -webkit-background-clip: text; background-clip: text; color: transparent; }
.subtitle { font-size: 12px; letter-spacing: .42em; text-transform: uppercase; color: var(--violet); margin-bottom: 12px; }
.blurb { font-size: 13px; line-height: 1.62; color: var(--dim); margin: 10px 0 4px; }
.btnrow { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.btn {
  font-family: var(--ff);
  font-size: 13px; letter-spacing: .04em;
  padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  color: var(--ink); cursor: pointer;
  transition: transform .12s ease, background .16s ease, border-color .16s ease;
}
.btn:hover { background: rgba(255, 255, 255, .11); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn.primary { background: linear-gradient(180deg, #ffe6ad, #e0b45f); color: #221a06; font-weight: 700; border-color: rgba(255, 235, 180, .8); }
.foot { font-size: 11px; color: var(--dimmer); margin-top: 12px; letter-spacing: .04em; }

.stars { display: flex; justify-content: center; gap: 6px; margin: 8px 0 4px; font-size: 30px; }
.stars i { color: rgba(255, 255, 255, .16); font-style: normal; }
.stars i.on { color: var(--gold); text-shadow: 0 0 16px rgba(232, 198, 122, .7); }
.scores { display: flex; justify-content: center; gap: 22px; margin: 10px 0 4px; }
.scores div { display: flex; flex-direction: column; align-items: center; }
.scores b { font-size: 20px; color: #fff8e6; font-variant-numeric: tabular-nums; }
.scores span { font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--dimmer); }

.chgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin: 12px 0 4px; max-height: 46vh; overflow: auto; }
.chcard {
  display: flex; flex-direction: column; gap: 2px;
  padding: 9px 10px; border-radius: 11px; text-align: left;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .04);
  color: var(--ink); cursor: pointer; font-family: var(--ff);
  transition: transform .12s ease, background .16s ease;
}
.chcard:hover { background: rgba(255, 255, 255, .1); transform: translateY(-2px); }
.chcard b { font-size: 15px; color: var(--gold); }
.chcard span { font-size: 10.5px; line-height: 1.3; color: var(--dim); }
.chcard i { font-style: normal; font-size: 11px; color: var(--gold); letter-spacing: .1em; }
.chcard em { font-style: normal; font-size: 9.5px; color: var(--dimmer); }
.chcard.done { border-color: rgba(232, 198, 122, .55); background: rgba(232, 198, 122, .08); }
.chcard.locked { opacity: .48; }

.codexlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin: 12px 0 4px; }
.codex { padding: 9px 11px; border-radius: 11px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .03); }
.codex b { display: block; font-size: 12.5px; color: var(--dimmer); margin-bottom: 2px; }
.codex span { font-size: 11px; color: var(--dimmer); line-height: 1.4; }
.codex.got { border-color: rgba(232, 198, 122, .55); background: rgba(232, 198, 122, .09); }
.codex.got b { color: var(--gold); }
.codex.got span { color: var(--dim); }

.howto { margin: 10px 0 0 18px; }
.howto li { font-size: 12.8px; line-height: 1.6; color: var(--dim); margin-bottom: 7px; }
.howto li b { color: var(--ink); }
table.keys { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 12.5px; }
table.keys th, table.keys td { text-align: left; padding: 7px 8px; border-bottom: 1px solid rgba(255, 255, 255, .09); color: var(--dim); }
table.keys th { font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-dim); }
kbd { font: 11px/1 ui-monospace, monospace; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); border-radius: 4px; padding: 2px 5px; color: #fff; }

/* ------------------------------------------------------------- the copy */
.article { max-width: 860px; margin: 0 auto; padding: 40px 20px 60px; }
.article h1 { font-size: 27px; line-height: 1.28; letter-spacing: .01em; color: #fff8ea; margin-bottom: 12px; }
.article h2 { font-size: 19px; margin: 26px 0 8px; color: var(--gold); letter-spacing: .02em; }
.article p, .article li { font-size: 14.5px; line-height: 1.72; color: #cdc6e0; }
.article .lede { font-size: 15.5px; color: #dcd6ee; }
.article strong { color: #fff; }
.article em { color: var(--gold); font-style: italic; }
.article ol.howto, .article ul.howto { margin: 8px 0 4px 22px; }
.article ol.howto li, .article ul.howto li { margin: 5px 0; }
.article table { width: 100%; border-collapse: collapse; margin: 10px 0 6px; font-size: 13px; table-layout: fixed; }
.article th, .article td { text-align: left; padding: 7px 9px; border-bottom: 1px solid rgba(255, 255, 255, .1); overflow-wrap: break-word; color: #c9c2dd; }
.article th { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-dim); }
.article code { font: 12.5px ui-monospace, monospace; background: rgba(255, 255, 255, .08); padding: 1px 5px; border-radius: 4px; color: #ffe9a8; }
.article details { border: 1px solid rgba(255, 255, 255, .1); border-radius: 11px; padding: 11px 13px; margin: 8px 0; background: rgba(255, 255, 255, .028); }
.article summary { cursor: pointer; font-size: 14px; font-weight: 700; color: #fff8ea; }
.article details p { margin-top: 8px; font-size: 13.5px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 22px; }
.tag { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; }
.src { margin-top: 16px; }
.src a { color: var(--gold); text-decoration: none; border-bottom: 1px solid var(--line); }

/* -------------------------------------------------------------- mobile */
@media (max-width: 720px) {
  .topbar { padding: 7px 9px; gap: 7px; flex-wrap: wrap; }
  .brand { font-size: 12.5px; letter-spacing: .1em; }
  .brand span { font-size: 8px; letter-spacing: .22em; }
  .chip { min-width: 46px; padding: 3px 7px; }
  .chip b { font-size: 12px; }
  .chip span { font-size: 7.5px; }
  .chip.wide { min-width: 116px; }
  .chip.wide b { font-size: 10px; }
  .icobtn { width: 30px; height: 30px; font-size: 13px; }
  .sealbar { flex-direction: column; align-items: stretch; gap: 6px; padding: 7px 10px; }
  .sealbar .lore { font-size: 11.5px; }
  .btn.seal { margin-left: 0; }
  .bigtitle { font-size: 32px !important; }
  .panel { padding: 18px 15px 14px; }
  .article { padding: 28px 15px 48px; }
  .article h1 { font-size: 21px; }
  .article h2 { font-size: 17px; }
  .article table { font-size: 12px; }
}
@media (max-height: 560px) {
  .chip.wide { display: none; }
  .sealbar .lore { display: none; }
}
