:root {
  --bg: #efe9da;
  --panel: #fdfcf7;
  --ink: #45415c;
  --ink-soft: #807c97;
  --mint: #8fd3ac;
  --sky: #8fc1e8;
  --coral: #f0a6ad;
  --lav: #c3b0e6;
  --cream: #f6e3a8;
  --sky-bg: #cfe6f5;
  --grass: #cde9cf;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #f0eee9; }
.ps { font-family: 'Press Start 2P', monospace; color: var(--ink); line-height: 1.5; }
.vt { font-family: 'VT323', monospace; color: var(--ink); }
.p8-px { image-rendering: pixelated; display: block; }

/* screen shell */
.p8-screen {
  width: 100%; height: 100%; position: relative; overflow: hidden;
  background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column;
}

/* HUD top bar */
.p8-hud {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; background: var(--panel);
  border-bottom: 4px solid var(--ink);
  box-shadow: 0 4px 0 rgba(69,65,92,.12);
  z-index: 4;
}
.p8-hud-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.p8-hud-sep { color: var(--coral); font-family: 'VT323', monospace; font-size: 22px; }
.p8-hud-sub { font-size: 21px; letter-spacing: 1px; white-space: nowrap; }

/* ---- A · scene ---- */
.p8-scene { background: linear-gradient(var(--sky-bg) 0%, var(--sky-bg) 58%, var(--grass) 58%, var(--grass) 100%); }
.p8-clouds { position: absolute; inset: 0; pointer-events: none; }
.p8-cloud {
  position: absolute; width: 70px; height: 22px; background: var(--panel);
  border-radius: 12px; box-shadow: 22px -10px 0 -4px var(--panel), -20px -6px 0 -6px var(--panel), 0 0 0 3px rgba(69,65,92,.10);
}
.p8-stage {
  flex: 1 1 auto; position: relative;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 26px;
}
.p8-bob { animation: p8bob 1.4s steps(2) infinite; position: relative; z-index: 2; }
@keyframes p8bob { 50% { transform: translateY(-6px); } }
.p8-shadow {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  width: 108px; height: 16px; background: rgba(69,65,92,.16); border-radius: 50%;
}
.p8-dialog {
  flex: 0 0 auto; position: relative; margin: 0 24px 24px; padding: 20px 26px;
  background: var(--panel); border: 4px solid var(--ink); border-radius: 12px;
  box-shadow: 0 0 0 4px var(--panel), 0 0 0 8px var(--ink);
}
.p8-dlg-name { font-size: 22px; color: var(--coral); letter-spacing: 1px; margin-bottom: 4px; }
.p8-dlg-text { margin: 0; font-size: 29px; line-height: 1.25; }
.p8-type {
  display: inline-block; overflow: hidden; white-space: nowrap; vertical-align: bottom;
  border-right: .16em solid var(--ink); width: 0;
  animation: p8type 2.4s steps(34, end) .5s forwards, p8caret .7s steps(1) infinite;
}
@keyframes p8type { to { width: var(--w); } }
@keyframes p8caret { 50% { border-color: transparent; } }
.p8-next { position: absolute; right: 22px; bottom: 14px; color: var(--coral); font-size: 22px; animation: p8nudge 1s steps(2) infinite; }
@keyframes p8nudge { 50% { transform: translateY(4px); } }

/* ---- tiled bg (B & C) ---- */
.p8-tile {
  background-color: var(--bg);
  background-image:
    linear-gradient(45deg, rgba(69,65,92,.035) 25%, transparent 25%, transparent 75%, rgba(69,65,92,.035) 75%),
    linear-gradient(45deg, rgba(69,65,92,.035) 25%, transparent 25%, transparent 75%, rgba(69,65,92,.035) 75%);
  background-size: 26px 26px; background-position: 0 0, 13px 13px;
}
.p8-center { align-items: center; justify-content: center; }

.p8-pixbox {
  background: var(--panel); border: 4px solid var(--ink); border-radius: 12px;
  box-shadow: 0 0 0 4px var(--panel), 0 0 0 8px var(--ink);
}

/* ---- B · menu ---- */
.p8-menu-wrap { flex: 1 1 auto; display: flex; align-items: center; gap: 40px; padding: 38px 56px; }
.p8-menu-aside { width: 280px; flex: 0 0 auto; }
.p8-photo {
  width: 132px; height: 132px; display: flex; align-items: center; justify-content: center;
  background: var(--sky-bg); border: 4px solid var(--ink); border-radius: 12px;
}
.p8-menu { flex: 1 1 auto; padding: 12px 14px 16px; align-self: stretch; }
.p8-menu-title { font-size: 11px; color: var(--ink-soft); padding: 8px 12px 14px; }
.p8-mi {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px 14px 14px; border-radius: 8px;
  border-bottom: 2px dotted rgba(69,65,92,.16);
}
.p8-mi:last-child { border-bottom: 0; }
.p8-mi.is-sel { background: var(--cream); }
.p8-mi-cur { width: 20px; flex: 0 0 auto; }
.p8-mi-k { font-size: 28px; letter-spacing: 1px; flex: 1 1 auto; }
.p8-mi-note { font-size: 21px; color: var(--ink-soft); white-space: nowrap; flex: 0 0 auto; }

/* ---- C · resident card ---- */
.p8-card { width: min(100%, 640px); padding: 0; overflow: hidden; }
.p8-card-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: var(--coral); border-bottom: 4px solid var(--ink); color: var(--ink);
}
.p8-card-body { display: flex; gap: 26px; padding: 26px 26px 8px; }
.p8-card-photo {
  width: 148px; height: 148px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  background: var(--sky-bg); border: 4px solid var(--ink); border-radius: 10px;
}
.p8-card-info { flex: 1 1 auto; min-width: 0; }
.p8-card-role { font-size: 22px; color: var(--ink-soft); margin: 6px 0 18px; }
.p8-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.p8-stat {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 12px; background: var(--bg); border: 3px solid var(--ink); border-radius: 7px;
}
.p8-stat-k { font-size: 18px; color: var(--ink-soft); letter-spacing: 1px; white-space: nowrap; }
.p8-stat-v { font-size: 16px; color: var(--coral); flex: 0 0 auto; }
.p8-badges { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.p8-badges-l { font-size: 16px; color: var(--ink-soft); margin-right: 6px; letter-spacing: 1px; }
.p8-card-foot { font-size: 22px; padding: 16px 26px 22px; border-top: 2px dotted rgba(69,65,92,.2); margin-top: 10px; }
.p8-next-inline { color: var(--coral); }

/* ---- D · title ---- */
.p8-title {
  align-items: center; justify-content: center; text-align: center;
  background: radial-gradient(circle at 50% 38%, #fff 0%, var(--bg) 60%);
}
.p8-title-pills { display: flex; gap: 12px; margin-bottom: 30px; }
.p8-wordmark { font-size: 80px; letter-spacing: 6px; text-shadow: 5px 5px 0 var(--coral); }
.p8-subtitle { font-size: 28px; letter-spacing: 3px; color: var(--ink-soft); margin-top: 24px; }
.p8-press { font-size: 18px; margin-top: 64px; color: var(--ink); }
.p8-blink { animation: p8blink 1s steps(1) infinite; }
@keyframes p8blink { 50% { opacity: 0; } }
.p8-title-foot { font-size: 20px; color: var(--ink-soft); margin-top: 40px; opacity: .8; }
