:root {
  --bg: #0d0b1e;
  --panel: #17143a;
  --panel-2: #221d52;
  --ink: #f4f1ff;
  --dim: #9d97c9;
  --gold: #ffd23f;
  --red: #ff3b5c;
  --cyan: #3bf0ff;
  --green: #7cff6b;
  --px: "Press Start 2P", ui-monospace, Menlo, monospace;
  --body: "VT323", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 22px;
  line-height: 1.25;
  min-height: 100%;
}

body {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  padding: env(safe-area-inset-top) 0 calc(env(safe-area-inset-bottom) + 84px);
}

#app { max-width: 520px; margin: 0 auto; padding: 14px; }

h1, h2, h3, .px { font-family: var(--px); font-weight: 400; letter-spacing: 0.5px; }
h1 { font-size: 20px; color: var(--gold); text-shadow: 3px 3px 0 var(--red); margin: 10px 0 16px; text-align: center; }
h2 { font-size: 13px; color: var(--cyan); margin: 0 0 12px; line-height: 1.5; }
h3 { font-size: 11px; color: var(--gold); margin: 18px 0 6px; line-height: 1.5; }
p { margin: 0 0 10px; }
.dim { color: var(--dim); }
.center { text-align: center; }

/* Chunky pixel frame */
.panel {
  background: var(--panel);
  border: 4px solid var(--ink);
  box-shadow: 6px 6px 0 #000;
  padding: 16px;
  margin-bottom: 18px;
}
.panel.gold { border-color: var(--gold); }
.panel.red { border-color: var(--red); }
.panel.cyan { border-color: var(--cyan); }

button {
  font-family: var(--px);
  font-size: 12px;
  line-height: 1.5;
  color: #000;
  background: var(--gold);
  border: 4px solid #000;
  box-shadow: 4px 4px 0 #000, inset -4px -4px 0 rgba(0, 0, 0, 0.22);
  padding: 14px 12px;
  width: 100%;
  margin-top: 10px;
  cursor: pointer;
  touch-action: manipulation;
}
button:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #000; }
button.red { background: var(--red); color: #fff; }
button.cyan { background: var(--cyan); }
button.ghost { background: var(--panel-2); color: var(--ink); }
button.small { font-size: 10px; padding: 10px 8px; }
button:disabled { opacity: 0.45; }

.sprite { display: block; width: 100%; height: auto; image-rendering: pixelated; border: 4px solid #000; background: #000; }

/* Fighter select */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: start; }
.fighter { background: none; border: 0; box-shadow: none; padding: 0; margin: 0; color: var(--ink); text-align: center; }
.fighter:active { transform: none; box-shadow: none; }
.fighter .sprite { border-color: var(--ink); }
.fighter:active .sprite, .fighter.picked .sprite { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold); }
.fighter .name { font-family: var(--body); font-size: 20px; display: block; margin-top: 4px; }
.fighter .tag { font-family: var(--px); font-size: 7px; display: block; margin-top: 3px; color: var(--green); min-height: 9px; }
.fighter.dead .sprite { filter: grayscale(1) brightness(0.45); }
.fighter.dead .tag { color: var(--red); }
.fighter .tag.exposed { color: var(--gold); }

/* PIN pad */
.dots { display: flex; justify-content: center; gap: 14px; margin: 14px 0; }
.dots span { width: 22px; height: 22px; border: 4px solid var(--ink); }
.dots span.on { background: var(--gold); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pad button { margin: 0; font-size: 18px; padding: 16px 0; background: var(--panel-2); color: var(--ink); }

/* Intro card */
.intro { position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow: auto; padding: 22px 18px 30px; display: flex; flex-direction: column; justify-content: center; }
.intro .inner { max-width: 420px; margin: 0 auto; width: 100%; }
.intro .portrait { width: 62%; margin: 0 auto 16px; animation: slam 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.intro .sprite { border-color: var(--gold); box-shadow: 8px 8px 0 var(--red); }
.intro .who { font-family: var(--px); font-size: 22px; text-align: center; color: var(--gold); text-shadow: 3px 3px 0 var(--red); line-height: 1.4; animation: rise 0.4s 0.35s both; }
.intro .title { font-family: var(--px); font-size: 10px; text-align: center; color: var(--cyan); margin: 8px 0 18px; animation: rise 0.4s 0.5s both; }
.intro .sheet { animation: rise 0.4s 0.65s both; }
.stat { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; margin: 8px 0; }
.stat .label { font-family: var(--px); font-size: 9px; }
.bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.bar i { height: 14px; background: var(--panel-2); border: 2px solid #000; }
.bar i.on { background: var(--green); }
.special { margin-top: 14px; font-family: var(--px); font-size: 9px; line-height: 1.7; }
.special b { color: var(--gold); font-weight: 400; }
.blink { animation: blink 1s steps(2) infinite; }

@keyframes slam { from { transform: scale(2.4) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes blink { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* Contract */
.contract { position: relative; min-height: 190px; user-select: none; -webkit-user-select: none; }
.contract .cover { text-align: center; padding: 38px 6px; }
.contract .cover .px { font-size: 11px; line-height: 1.8; color: var(--gold); }
.contract .skull { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; display: grid; place-items: center; font-size: 24px; opacity: 0.55; }
.contract .target { display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: center; }
.contract .target .name { font-family: var(--px); font-size: 14px; color: var(--red); line-height: 1.5; }
.contract .mission { margin-top: 14px; font-size: 25px; }
.badge { display: inline-block; font-family: var(--px); font-size: 8px; padding: 5px 7px; background: var(--red); color: #fff; margin-bottom: 8px; }
.badge.green { background: var(--green); color: #000; }
.badge.gold { background: var(--gold); color: #000; }

.statusbar { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; margin-bottom: 16px; }
.statusbar .who { font-family: var(--px); font-size: 12px; line-height: 1.5; }
.statusbar .kills { font-family: var(--px); font-size: 9px; color: var(--gold); text-align: right; line-height: 1.6; }

/* Tabs */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #000; border-top: 4px solid var(--ink); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); }
nav.tabs button { margin: 0; border: 0; box-shadow: none; background: #000; color: var(--dim); font-size: 9px; padding: 18px 2px; }
nav.tabs button.on { color: var(--gold); background: var(--panel); }
nav.tabs button:active { transform: none; }

/* Voting chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.chips button { width: auto; margin: 0; font-family: var(--body); font-size: 20px; padding: 6px 12px; background: var(--panel-2); color: var(--ink); box-shadow: 3px 3px 0 #000; }
.chips button.on { background: var(--gold); color: #000; }
.death { border-top: 4px dashed var(--panel-2); padding-top: 12px; margin-top: 12px; }
.clue { border-left: 4px solid var(--cyan); padding-left: 10px; margin: 8px 0; font-style: italic; }

/* Overlay */
.veil { position: fixed; inset: 0; z-index: 40; background: rgba(5, 4, 14, 0.92); display: flex; align-items: center; justify-content: center; padding: 18px; }
.veil .panel { width: 100%; max-width: 440px; margin: 0; }
.toast { position: fixed; left: 14px; right: 14px; top: calc(env(safe-area-inset-top) + 14px); z-index: 50; background: var(--gold); color: #000; border: 4px solid #000; box-shadow: 5px 5px 0 #000; padding: 12px; font-family: var(--px); font-size: 10px; line-height: 1.6; text-align: center; }

textarea, input[type="text"], input[type="password"] {
  width: 100%; font-family: var(--body); font-size: 22px; padding: 10px; background: #000; color: var(--ink); border: 4px solid var(--ink); border-radius: 0;
}
details { margin-bottom: 8px; border-bottom: 2px solid var(--panel-2); padding-bottom: 8px; }
summary { font-size: 23px; color: var(--gold); cursor: pointer; padding: 6px 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.list-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 2px solid var(--panel-2); }
.list-row button { width: auto; margin: 0; }
.big { font-family: var(--px); font-size: 26px; color: var(--gold); text-shadow: 3px 3px 0 var(--red); text-align: center; line-height: 1.4; margin: 10px 0; }

/* Confessional booth and recap */
.attached { margin-top: 10px; text-align: center; }
.attached img { width: 60%; border: 4px solid var(--ink); display: block; margin: 0 auto; }
.attached .px { display: block; font-size: 11px; color: var(--green); padding: 18px 0 4px; }
.beat { border-left: 4px solid var(--cyan); padding: 2px 0 2px 12px; margin: 0 0 16px; }
.beat.kill { border-left-color: var(--red); }
.beat .when { font-family: var(--px); font-size: 8px; color: var(--gold); }
.beat p { margin: 4px 0; }
.beat .quote { font-size: 24px; }
.shot { position: relative; margin: 6px 0; }
.shot img, .shot video { width: 100%; display: block; border: 4px solid var(--ink); background: #000; }
.shot span { position: absolute; left: 4px; right: 4px; bottom: 4px; padding: 8px 10px; background: rgba(0, 0, 0, 0.72); font-size: 22px; }

/* The Godmother's console: bigger and calmer, made for an iPad on the table. */
body.gm { font-size: 28px; padding-bottom: 40px; }
body.gm #app { max-width: 640px; }
body.gm h1 { font-size: 26px; }
body.gm h2 { font-size: 17px; }
body.gm h3 { font-size: 13px; }
body.gm button { font-size: 16px; padding: 24px 14px; }
body.gm button.small { font-size: 12px; padding: 14px 10px; }
body.gm .chips button { font-family: var(--body); font-size: 28px; padding: 12px 20px; }
body.gm summary { font-size: 24px; color: var(--dim); }
