/* THE LORE GUYS — CHARACTER FORGE — arcade 9:16 stage */

:root {
  --bg: #0b0b14;
  --panel: #14142a;
  --panel2: #1d1d3a;
  --ink: #f2ecd8;
  --accent: #ffc93e;
  --accent2: #ff4b3e;
  --blue: #5b8cff;
  --green: #4bd47b;
  --border: 4px solid #000;
  --px: "Press Start 2P", "Courier New", monospace;
  --body: "VT323", "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #06060c;
  font-family: var(--px);
  color: var(--ink);
}

/* ---- 9:16 stage, centered, fills height ---- */
#stage-wrap {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#stage {
  position: relative;
  height: 100vh;
  width: 100vw;
  background:
    radial-gradient(ellipse at 50% 18%, #232349 0%, var(--bg) 62%);
  overflow: hidden;
}

/* scanlines + vignette for CRT feel */
.scanlines {
  pointer-events: none;
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    to bottom, rgba(0,0,0,0.16) 0 2px, transparent 2px 4px);
  mix-blend-mode: multiply;
  z-index: 50;
}

/* ---- HUD ---- */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 10px 6px;
  z-index: 10;
  text-shadow: 3px 3px 0 #000;
}
#hud-title { font-size: 15px; color: var(--accent); letter-spacing: 2px; }
#hud-day { font-size: 8px; margin-top: 6px; color: var(--blue); }
#mute-btn {
  position: absolute; right: 10px; top: 10px;
  background: none; border: none; font-size: 16px; cursor: pointer;
  filter: grayscale(0.2);
}

/* ---- fighter zone (upper half) ---- */
#fighter-zone {
  position: absolute; top: 52px; left: 0; right: 0;
  height: 44%;
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 5;
}
#fighter-bounce {
  position: relative;
  height: 96%;
  animation: idle-bounce 0.9s steps(2, end) infinite;
  filter: drop-shadow(0 10px 0 rgba(0,0,0,0.45));
}
#fighter-img {
  height: 100%;
  image-rendering: pixelated;
  border: var(--border);
  background: #b9b2c9;
}
@keyframes idle-bounce {
  0%   { transform: translateY(0) scaleY(1); }
  50%  { transform: translateY(-7px) scaleY(1.015); }
  100% { transform: translateY(0) scaleY(1); }
}

#aura {
  position: absolute; inset: 8% 12% 0 12%;
  border-radius: 50%;
  filter: blur(26px);
  opacity: 0;
  transition: opacity 0.5s, background 0.5s;
  z-index: -1;
}
#aura.on { opacity: 0.55; animation: aura-pulse 1.4s ease-in-out infinite; }
@keyframes aura-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

#class-badge {
  position: absolute; left: 8%; top: 6%;
  font-size: 34px;
  background: var(--panel2);
  border: var(--border);
  padding: 8px 10px;
  z-index: 8;
  text-shadow: 2px 2px 0 #000;
}

#gear-rail {
  position: absolute; right: 4%; top: 4%;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 8;
}
.gear-slot {
  font-size: 24px;
  background: var(--panel2);
  border: var(--border);
  padding: 7px 9px;
}

#flaw-sticker {
  position: absolute; left: 6%; bottom: 4%;
  font-family: var(--body);
  font-size: 16px;
  background: var(--accent2);
  color: #fff;
  border: 3px solid #000;
  padding: 7px 9px;
  transform: rotate(-7deg);
  max-width: 46%;
  line-height: 1.5;
  z-index: 8;
}
#flaw-sticker .flaw-icon { font-size: 18px; display: block; margin-bottom: 2px; }

#fighter-name-plate {
  position: absolute; bottom: -6px; left: 50%;
  transform: translateX(-50%);
  background: #000;
  color: var(--accent);
  font-size: 11px;
  padding: 7px 14px;
  border: 3px solid var(--accent);
  white-space: nowrap;
  z-index: 9;
}

/* layer pop-in */
.layer-pop { animation: layer-pop 0.35s cubic-bezier(.2,2.2,.4,1) both; }
@keyframes layer-pop {
  0% { transform: scale(0) rotate(-20deg); }
  100% { transform: scale(1) rotate(0); }
}
#flaw-sticker.layer-pop { animation-name: flaw-pop; }
@keyframes flaw-pop {
  0% { transform: scale(0) rotate(30deg); }
  100% { transform: scale(1) rotate(-7deg); }
}

/* ---- screens (lower half) ---- */
#screens {
  position: absolute; left: 0; right: 0; bottom: 0;
  top: 52px;
  z-index: 6;
  display: flex;
}
body.has-fighter #screens { top: calc(52px + 44% + 10px); }

.screen {
  display: none;
  flex: 1;
  max-width: 680px;
  margin: 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 12px 14px 18px;
  overflow-y: auto;
}
.screen.active { display: flex; }

/* keep prompts low in frame for IG clipping: on screens without the
   fighter zone (title/name/race), push content down out of the top third */
body:not(.has-fighter) .screen { padding-top: 16vh; }
body:not(.has-fighter) #screen-name { padding-top: 32vh; }

.prompt {
  font-size: 13px;
  text-align: center;
  line-height: 1.8;
  color: var(--ink);
  text-shadow: 3px 3px 0 #000;
  margin-top: 4px;
}
.prompt.small { font-size: 10px; color: var(--blue); }

/* title screen */
#screen-title { justify-content: center; }
.title-stack { text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.title-stack h1 {
  font-size: 30px; line-height: 1.35; color: var(--accent);
  text-shadow: 4px 4px 0 var(--accent2), 8px 8px 0 #000;
}
.subtitle { font-size: 11px; color: var(--blue); line-height: 1.8; }
.day-badge {
  font-size: 12px; background: var(--accent2); color: #fff;
  padding: 8px 14px; border: var(--border); transform: rotate(-3deg);
}
.press-blink { font-size: 8px; color: #8f8fb3; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* buttons */
.big-btn, .ghost-btn {
  font-family: var(--px);
  font-size: 14px;
  cursor: pointer;
  border: var(--border);
  padding: 15px 19px;
  color: #000;
  background: var(--accent);
  box-shadow: 0 6px 0 #000;
  transition: transform 0.06s;
}
.big-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 #000; }
.ghost-btn {
  background: var(--panel2); color: #fff;
  font-size: 11px; padding: 13px 16px;
  border-color: #6a6a9a;
  text-shadow: 2px 2px 0 #000;
}
.ghost-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #000; }

/* name input */
#follower-name {
  font-family: var(--px);
  font-size: 15px;
  text-align: center;
  padding: 15px 10px;
  width: 86%;
  background: #000;
  color: var(--green);
  border: var(--border);
  outline: none;
  caret-color: var(--green);
}

/* race / class grids */
.select-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
}
.select-grid.small { grid-template-columns: repeat(2, 1fr); }
.sel-card {
  background: var(--panel);
  border: var(--border);
  cursor: pointer;
  padding: 8px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  transition: transform 0.08s;
}
.sel-card:hover { transform: translateY(-3px); background: var(--panel2); }
.sel-card img {
  width: 100%; aspect-ratio: 3/4; object-fit: cover;
  border: 3px solid #000;
  image-rendering: pixelated;
}
.sel-card:hover img { animation: idle-bounce 0.5s steps(2, end) infinite; }
.sel-card .sel-emblem { font-size: 30px; padding: 8px 0 0; text-shadow: 2px 2px 0 #000; }
.sel-card .sel-name { font-size: 10px; color: var(--accent); }
.sel-card .sel-tag { font-family: var(--body); font-size: 16px; color: #a7a7c9; line-height: 1.2; }

/* items / flaws chips */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
}
.chip {
  display: flex; align-items: center; gap: 9px;
  background: var(--panel);
  border: 3px solid #000;
  cursor: pointer;
  padding: 10px;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.15;
  text-align: left;
  transition: transform 0.08s;
}
.chip:hover { background: var(--panel2); transform: translateY(-2px); }
.chip .chip-icon { font-size: 18px; }
.chip.picked { background: var(--accent); color: #000; border-color: #000; }

/* story madlib */
#story-box {
  background: var(--panel);
  border: var(--border);
  padding: 16px 14px;
  font-family: var(--body);
  font-size: 21px;
  line-height: 1.75;
  width: 100%;
  color: var(--ink);
}
.blank {
  display: inline-block;
  min-width: 110px;
  border: none;
  border-bottom: 3px solid var(--accent);
  background: rgba(255, 201, 62, 0.08);
  color: var(--accent);
  font-family: var(--body);
  font-size: 21px;
  text-align: center;
  padding: 1px 4px;
  outline: none;
}
.blank:focus { background: rgba(255, 201, 62, 0.22); }
.blank::placeholder { color: #8a7433; font-size: 16px; }
.story-hl { color: var(--green); }
.story-flaw { color: var(--accent2); }

/* card */
#screen-card { justify-content: flex-start; }
#card {
  width: 100%;
  background: linear-gradient(160deg, var(--panel2), var(--panel));
  border: var(--border);
  padding: 12px;
  display: flex; flex-direction: column; gap: 9px;
}
#card-head { display: flex; justify-content: space-between; font-family: var(--body); font-size: 15px; color: var(--blue); }
#card-art-wrap { position: relative; align-self: center; width: 46%; }
#card-art-wrap img {
  width: 100%; border: 3px solid #000; image-rendering: pixelated; display: block;
}
#card-emblem {
  position: absolute; right: -12px; bottom: -12px;
  font-size: 26px; background: var(--panel);
  border: 3px solid #000; padding: 5px 7px;
}
#card-name { text-align: center; font-size: 13px; color: var(--accent); text-shadow: 2px 2px 0 #000; }
#card-title { text-align: center; font-family: var(--body); font-size: 16px; color: var(--blue); line-height: 1.3; }
#card-stats { display: flex; flex-direction: column; gap: 5px; padding: 4px 2px; }
.stat-row { display: flex; align-items: center; gap: 8px; font-family: var(--body); font-size: 16px; }
.stat-row .stat-name { width: 118px; color: #a7a7c9; }
.stat-blocks { display: flex; gap: 3px; }
.stat-block { width: 11px; height: 11px; background: #2a2a4d; border: 2px solid #000; }
.stat-block.full { background: var(--green); }
#card-gear { display: flex; justify-content: center; gap: 8px; font-size: 14px; }
#card-gear .g { background: var(--panel); border: 2px solid #000; padding: 4px 6px; }
#card-lore { font-family: var(--body); font-size: 17px; line-height: 1.45; color: var(--ink); border-top: 2px dashed #444; padding-top: 8px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---- POW bursts ---- */
#pow-layer { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
.pow {
  position: absolute;
  left: 50%; top: 34%;
  transform: translate(-50%, -50%);
  animation: pow-in 0.75s cubic-bezier(.2,2.5,.4,1) both;
}
.pow svg { overflow: visible; }
.pow-text {
  font-family: var(--px);
  fill: #000;
  font-size: 15px;
  font-weight: bold;
  text-anchor: middle;
  dominant-baseline: middle;
}
@keyframes pow-in {
  0%   { transform: translate(-50%, -50%) scale(0) rotate(-25deg); opacity: 1; }
  55%  { transform: translate(-50%, -50%) scale(1.15) rotate(4deg); opacity: 1; }
  80%  { transform: translate(-50%, -50%) scale(1) rotate(-2deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.05) rotate(0); opacity: 0; }
}

.hidden { display: none !important; }

/* ---- wide/desktop layout: let the graphics breathe ---- */
@media (min-width: 900px) {
  .screen { max-width: 1100px; }
  .select-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .chip-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .chip { font-size: 19px; }
  #story-box { max-width: 840px; margin: 0 auto; font-size: 24px; }
  #card { max-width: 560px; align-self: center; }
  .title-stack h1 { font-size: 44px; }
  .subtitle { font-size: 14px; }
  .prompt { font-size: 17px; }
  #hud-title { font-size: 19px; }
}

/* shake on seal */
.shake { animation: shake 0.4s; }
@keyframes shake {
  0%, 100% { transform: translate(0,0); }
  20% { transform: translate(-6px, 2px); }
  40% { transform: translate(5px, -3px); }
  60% { transform: translate(-4px, -2px); }
  80% { transform: translate(3px, 2px); }
}
