:root {
  /* DESIGN typography proof: IBM Plex Mono** readouts Interface labels: **Press Start 2P** buttons */
  --ink-void: #080A1A;
  --reiwa-sakura: #FF7AB8;
  --phosphor-mint: #45FFD2;
  --rice-paper-glow: #FFF1D6;
  --pixel-plum: #3B1B6D;
  --alert-koi-orange: #FF9A3D;
  --dim-hud-blue: #1F6CFF;
  --shadow-mauve: #201428;
  --split: 50%;
  --scan-y: 45%;
  --scan-x: 50%;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--rice-paper-glow);
  background: var(--ink-void);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-x: hidden;
  cursor: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(transparent 50%, rgba(69, 255, 210, .07) 51%) 0 0 / 100% 6px,
    radial-gradient(circle at var(--scan-x) var(--scan-y), rgba(69, 255, 210, .16), transparent 18rem),
    radial-gradient(circle at 12% 18%, rgba(255, 122, 184, .18), transparent 22rem);
  mix-blend-mode: screen;
}

.scanline-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(180deg, transparent calc(var(--scan-y) - 3px), rgba(69, 255, 210, .55), transparent calc(var(--scan-y) + 3px));
  opacity: .32;
}

.cursor-koi {
  position: fixed;
  width: 22px;
  height: 14px;
  z-index: 20;
  pointer-events: none;
  transform: translate(-50%, -50%);
  background: var(--alert-koi-orange);
  box-shadow: 8px 0 0 var(--reiwa-sakura), -6px 4px 0 var(--phosphor-mint), 0 0 18px var(--alert-koi-orange);
  clip-path: polygon(0 50%, 28% 0, 100% 0, 78% 50%, 100% 100%, 28% 100%);
}

.folio-nav {
  position: fixed;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  display: grid;
  gap: 10px;
}

.folio-nav a {
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
  color: var(--phosphor-mint);
  text-decoration: none;
  font-size: 8px;
  padding: 8px;
  background: rgba(8, 10, 26, .72);
  border: 2px solid var(--pixel-plum);
  box-shadow: 3px 3px 0 var(--shadow-mauve), 0 0 16px rgba(69, 255, 210, .18);
}

.era-seam {
  position: fixed;
  top: 0;
  left: var(--split);
  width: 18px;
  height: 100vh;
  transform: translateX(-50%);
  z-index: 12;
  background: linear-gradient(90deg, transparent, var(--reiwa-sakura), var(--phosphor-mint), transparent);
  box-shadow: 0 0 24px var(--reiwa-sakura), 0 0 42px rgba(69, 255, 210, .7);
  animation: seamPulse 2.2s steps(4) infinite;
}

.seam-core {
  display: block;
  height: 100%;
  margin: 0 auto;
  width: 4px;
  background: var(--rice-paper-glow);
}

.pixel-sun {
  position: absolute;
  top: 22vh;
  left: 24px;
  width: 22px;
  height: 22px;
  background: var(--alert-koi-orange);
  box-shadow: 0 0 0 5px var(--reiwa-sakura), 0 0 26px var(--alert-koi-orange), 10px 10px 0 rgba(255, 154, 61, .35);
  opacity: 0;
}

body.booted .pixel-sun { animation: sunCross 3.8s steps(18) .2s forwards; }

.chamber {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--split) calc(100% - var(--split));
  position: relative;
  isolation: isolate;
}

.paper-panel, .hud-panel {
  min-height: 100vh;
  padding: clamp(48px, 8vw, 110px);
  position: relative;
  overflow: hidden;
}

.paper-panel {
  color: var(--shadow-mauve);
  background:
    linear-gradient(90deg, rgba(255, 122, 184, .12), transparent 42%),
    radial-gradient(circle at 85% 20%, rgba(255, 154, 61, .18), transparent 15rem),
    repeating-linear-gradient(0deg, rgba(32, 20, 40, .05) 0 1px, transparent 1px 12px),
    var(--rice-paper-glow);
  border-right: 8px solid var(--reiwa-sakura);
}

.hud-panel {
  background:
    linear-gradient(90deg, rgba(31, 108, 255, .14) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(0deg, rgba(69, 255, 210, .08) 1px, transparent 1px) 0 0 / 24px 24px,
    radial-gradient(circle at 60% 35%, rgba(59, 27, 109, .9), transparent 22rem),
    var(--ink-void);
  border-left: 8px solid var(--phosphor-mint);
}

.running-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(32, 20, 40, .28);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.ceremony-label, .moon-caption {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  font-weight: 600;
  font-style: italic;
  color: var(--pixel-plum);
  font-size: clamp(22px, 2.2vw, 34px);
}

.type-title, h2 {
  font-family: "EB Garamond", Garamond, Georgia, serif;
  font-weight: 700;
  letter-spacing: -.045em;
  line-height: .88;
  margin: 34px 0 24px;
}

.type-title { font-size: clamp(76px, 11vw, 168px); min-height: 1em; }
h2 { font-size: clamp(56px, 7vw, 118px); }

.date-line, .date-stamp {
  font-family: "EB Garamond", Garamond, Georgia, serif;
  font-weight: 600;
  color: var(--pixel-plum);
  font-size: clamp(32px, 4.6vw, 72px);
  line-height: 1;
}

.diary-copy, .poem, .closing-line {
  max-width: 620px;
  font-family: "EB Garamond", Garamond, Georgia, serif;
  font-size: clamp(22px, 2.2vw, 34px);
  line-height: 1.28;
}

.day-seals { display: flex; gap: 18px; margin: 32px 0; }
.seal, .large-seal {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 3px solid var(--shadow-mauve);
  background: var(--reiwa-sakura);
  color: var(--rice-paper-glow);
  font-family: "EB Garamond", serif;
  font-size: 38px;
  box-shadow: 6px 6px 0 var(--pixel-plum), 0 0 22px rgba(255, 122, 184, .45);
}

button { cursor: none; }
.seal { appearance: none; }
.large-seal { width: 112px; height: 112px; background: var(--alert-koi-orange); }

.hud-topline, .panel-title, .checksum-grid, .fortune-result, .coordinate-tags, .save-slot, .annotation, .loader {
  font-family: "Press Start 2P", "IBM Plex Mono", monospace;
}

.hud-topline {
  display: flex;
  justify-content: space-between;
  color: var(--phosphor-mint);
  font-size: 10px;
  text-shadow: 0 0 12px var(--phosphor-mint);
}

.hud-corners::before, .hud-corners::after, .hud-panel::before, .hud-panel::after {
  content: "";
  position: absolute;
  width: 46px;
  height: 46px;
  border-color: var(--phosphor-mint);
  filter: drop-shadow(0 0 8px var(--phosphor-mint));
}

.hud-panel::before { top: 28px; left: 28px; border-top: 4px solid; border-left: 4px solid; }
.hud-panel::after { right: 28px; bottom: 28px; border-right: 4px solid; border-bottom: 4px solid; }
.hud-corners::before { top: 28px; right: 28px; border-top: 4px solid; border-right: 4px solid; }
.hud-corners::after { left: 28px; bottom: 28px; border-left: 4px solid; border-bottom: 4px solid; }

.boot-stack { margin-top: 14vh; display: grid; gap: 24px; }
.loader { color: var(--rice-paper-glow); font-size: 10px; display: grid; grid-template-columns: 120px 1fr 64px; align-items: center; gap: 18px; }
.loader i {
  height: 28px;
  border: 2px solid var(--phosphor-mint);
  background: repeating-linear-gradient(90deg, rgba(69, 255, 210, .18) 0 12px, transparent 12px 18px);
  box-shadow: inset 0 0 18px rgba(69, 255, 210, .22), 0 0 18px rgba(69, 255, 210, .18);
  position: relative;
  overflow: hidden;
}
.loader i::before { content: ""; position: absolute; inset: 0 100% 0 0; background: linear-gradient(90deg, var(--dim-hud-blue), var(--phosphor-mint)); transition: inset 1.4s steps(12); }
.loader.loaded i::before { inset-right: calc(100% - var(--load)); }
.loader i::after, .skeleton-row::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,241,214,.45), transparent); animation: shimmer 1.3s infinite steps(8); }

.radar-orb {
  position: absolute;
  right: 12%;
  bottom: 12%;
  width: 190px;
  height: 190px;
  border: 2px solid var(--dim-hud-blue);
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 0 30px rgba(31, 108, 255, .42);
}
.radar-orb span { width: 130px; height: 130px; border: 2px dashed var(--phosphor-mint); border-radius: 50%; animation: rotate 8s linear infinite; }
.radar-orb em { position: absolute; bottom: -28px; color: var(--phosphor-mint); font-family: "IBM Plex Mono", monospace; font-size: 12px; }

.sprite { position: absolute; image-rendering: pixelated; }
.cloud-one { width: 72px; height: 28px; left: 18%; top: 24%; background: var(--rice-paper-glow); box-shadow: 18px -12px 0 var(--rice-paper-glow), 38px 0 0 var(--phosphor-mint), 0 0 18px var(--phosphor-mint); animation: drift 9s steps(16) infinite; }
.crane-one { width: 34px; height: 24px; right: 24%; top: 48%; background: var(--reiwa-sakura); clip-path: polygon(0 60%, 35% 10%, 58% 60%, 100% 0, 74% 84%, 34% 84%); animation: stepSprite 1s steps(2) infinite; }

.segmented-ring { width: 330px; height: 330px; margin: 6vh auto; position: relative; border: 8px dashed var(--dim-hud-blue); border-radius: 50%; animation: rotate 12s steps(32) infinite; }
.segmented-ring span { position: absolute; inset: 52px; border: 4px solid var(--phosphor-mint); border-radius: 50%; box-shadow: 0 0 18px var(--phosphor-mint); }
.segmented-ring span:nth-child(2) { inset: 98px; border-color: var(--reiwa-sakura); }
.segmented-ring span:nth-child(3) { inset: 144px; background: var(--alert-koi-orange); border: 0; border-radius: 0; }

.checksum-grid { display: grid; gap: 14px; font-size: 9px; color: var(--phosphor-mint); }
.checksum-grid p { display: flex; justify-content: space-between; border: 2px solid var(--pixel-plum); padding: 14px; background: rgba(32, 20, 40, .62); }
.checksum-grid b { color: var(--alert-koi-orange); }

.pixel-button, .item {
  appearance: none;
  border: 3px solid var(--phosphor-mint);
  color: var(--phosphor-mint);
  background: var(--shadow-mauve);
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  padding: 18px;
  box-shadow: 6px 6px 0 var(--pixel-plum), 0 0 18px rgba(69, 255, 210, .25);
}
.pixel-button:hover, .item.active { color: var(--ink-void); background: var(--phosphor-mint); }

.fortune-console { margin-top: 16vh; border: 4px solid var(--phosphor-mint); padding: 28px; box-shadow: 0 0 28px rgba(69, 255, 210, .28); background: rgba(8, 10, 26, .62); }
.skeleton-row { height: 34px; margin: 18px 0; background: linear-gradient(90deg, rgba(255,122,184,.25), rgba(69,255,210,.2)); position: relative; overflow: hidden; }
.skeleton-row.wide { width: 92%; } .skeleton-row.mid { width: 70%; } .skeleton-row.slim { width: 48%; }
.fortune-result { color: var(--alert-koi-orange); margin-top: 28px; font-size: 11px; line-height: 1.9; }
.battery-meter { position: absolute; right: 12%; top: 16%; display: flex; gap: 6px; align-items: center; color: var(--phosphor-mint); }
.battery-meter span { width: 18px; height: 42px; background: var(--phosphor-mint); box-shadow: 0 0 12px var(--phosphor-mint); animation: battery 1.6s steps(4) infinite; }
.battery-meter small { margin-left: 10px; font-family: "Press Start 2P"; font-size: 8px; }
.pixel-lantern { position: absolute; left: 18%; bottom: 16%; width: 34px; height: 48px; background: var(--reiwa-sakura); box-shadow: 0 -8px 0 var(--alert-koi-orange), 0 0 22px var(--reiwa-sakura); animation: flicker 1.4s steps(3) infinite; }

.pixel-city { position: absolute; left: 12%; right: 12%; bottom: 22%; height: 280px; display: flex; align-items: end; gap: 16px; }
.pixel-city span { flex: 1; background: var(--dim-hud-blue); box-shadow: inset 0 0 0 4px var(--ink-void), 0 0 20px rgba(31,108,255,.58); animation: cityWake 2.8s steps(5) infinite alternate; }
.pixel-city span:nth-child(1) { height: 42%; } .pixel-city span:nth-child(2) { height: 70%; } .pixel-city span:nth-child(3) { height: 52%; } .pixel-city span:nth-child(4) { height: 88%; } .pixel-city span:nth-child(5) { height: 60%; } .pixel-city span:nth-child(6) { height: 35%; }
.torii { position: absolute; left: 42%; bottom: 18%; width: 180px; height: 108px; border-top: 18px solid var(--reiwa-sakura); border-bottom: 10px solid var(--reiwa-sakura); filter: drop-shadow(0 0 16px var(--reiwa-sakura)); }
.torii::before, .torii::after { content:""; position: absolute; top: 10px; width: 18px; height: 100px; background: var(--reiwa-sakura); }
.torii::before { left: 38px; } .torii::after { right: 38px; }
.coordinate-tags { position: absolute; right: 12%; top: 18%; display: grid; gap: 12px; color: var(--phosphor-mint); font-size: 9px; }
.coordinate-tags b { border: 2px solid var(--phosphor-mint); padding: 10px; background: rgba(8,10,26,.7); }

.inventory-grid { display: grid; grid-template-columns: repeat(2, minmax(130px, 1fr)); gap: 24px; align-content: center; }
.item { min-height: 150px; line-height: 2; }
.item i { display: block; width: 34px; height: 34px; margin: 18px auto 0; background: var(--alert-koi-orange); box-shadow: 12px 0 0 var(--reiwa-sakura), 0 0 18px var(--alert-koi-orange); }
#itemReadout { grid-column: 1 / -1; color: var(--rice-paper-glow); font-family: "IBM Plex Mono"; border: 2px solid var(--pixel-plum); padding: 20px; background: rgba(32, 20, 40, .7); }

.save-card { display: flex; flex-direction: column; justify-content: center; }
.save-hud { display: grid; place-items: center; }
.save-slot { width: min(520px, 80%); min-height: 310px; border: 6px solid var(--phosphor-mint); padding: 38px; display: grid; place-items: center; color: var(--phosphor-mint); background: rgba(32, 20, 40, .72); box-shadow: 10px 10px 0 var(--pixel-plum), 0 0 46px rgba(69, 255, 210, .45); }
.save-slot span { color: var(--alert-koi-orange); font-size: 15px; }
.save-slot b { font-size: clamp(18px, 3vw, 34px); color: var(--rice-paper-glow); }
.save-slot i { width: 86%; height: 22px; background: repeating-linear-gradient(90deg, var(--phosphor-mint) 0 16px, transparent 16px 24px); }
.night-moon { position: absolute; right: 13%; top: 14%; width: 80px; height: 80px; background: var(--alert-koi-orange); box-shadow: -22px 0 0 var(--ink-void), 0 0 28px var(--alert-koi-orange); }

.petal {
  position: fixed;
  width: 8px;
  height: 8px;
  z-index: 18;
  pointer-events: none;
  background: var(--reiwa-sakura);
  box-shadow: 8px 0 0 var(--reiwa-sakura), 0 8px 0 var(--phosphor-mint), 8px 8px 0 var(--reiwa-sakura);
  animation: petalFall 1.1s steps(8) forwards;
}

@keyframes seamPulse { 0%,100% { width: 14px; opacity: .88; } 50% { width: 28px; opacity: 1; } }
@keyframes sunCross { 0% { opacity: 0; transform: translateX(180px); } 15% { opacity: 1; } 100% { opacity: 1; transform: translateX(-210px) translateY(42px); } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes rotate { to { transform: rotate(360deg); } }
@keyframes drift { 0%,100% { transform: translateX(0); } 50% { transform: translateX(58px); } }
@keyframes stepSprite { 50% { transform: translateY(-8px) scaleX(-1); } }
@keyframes battery { 50% { opacity: .42; } }
@keyframes flicker { 50% { filter: brightness(1.7); } }
@keyframes cityWake { to { filter: brightness(1.6); transform: translateY(-10px); } }
@keyframes petalFall { to { transform: translate(38px, 96px) rotate(90deg); opacity: 0; } }

@media (max-width: 860px) {
  body { cursor: auto; }
  .cursor-koi { display: none; }
  .folio-nav { display: none; }
  .chamber { grid-template-columns: 1fr; }
  .paper-panel, .hud-panel { min-height: 70vh; padding: 42px 28px; }
  .era-seam { left: 50%; opacity: .55; }
  .loader { grid-template-columns: 1fr; }
}
