:root {
  --ink: #2a1d14;
  --parchment: #f3e6c9;
  --parchment-2: #e9d8ae;
  --capulet: #8c2f2f;
  --capulet-dark: #5e1f1f;
  --montague: #2d4a73;
  --montague-dark: #1d3250;
  --gold: #c99a3c;
  --shadow: rgba(20, 12, 4, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #140d08;
  color: var(--ink);
  font-family: 'EB Garamond', Georgia, serif;
}

#app {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(140, 47, 47, 0.25), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(45, 74, 115, 0.25), transparent 55%),
    #140d08;
}

h1, h2, .eyebrow, .btn {
  font-family: 'Cinzel', Georgia, serif;
}

.screen {
  display: none;
  width: 100%;
}
.screen.active { display: flex; justify-content: center; }

.panel {
  background: linear-gradient(180deg, var(--parchment), var(--parchment-2));
  border: 1px solid #00000022;
  border-radius: 10px;
  box-shadow: 0 18px 50px var(--shadow), inset 0 0 0 6px #ffffff22;
  padding: 36px 32px;
  max-width: 540px;
  width: 100%;
  text-align: center;
}
.panel.wide { max-width: 780px; }
.panel.narrow { max-width: 480px; }

.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--capulet-dark);
  font-weight: 700;
}

h1 {
  margin: 4px 0 16px;
  font-size: 2.1rem;
  line-height: 1.25;
  color: var(--ink);
}
h2 {
  margin: 4px 0 18px;
  font-size: 1.5rem;
  color: var(--ink);
}

.lede, .hint {
  font-size: 1.08rem;
  line-height: 1.55;
  color: #3a2a1c;
  margin: 0 0 22px;
}
.hint { font-style: italic; font-size: 0.98rem; opacity: 0.85; }

.btn {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 13px 30px;
  font-size: 1rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  margin: 6px 6px 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:disabled {
  cursor: default;
  opacity: 0.4;
  filter: grayscale(0.5);
  box-shadow: none !important;
  transform: none !important;
}
.btn:active { transform: translateY(1px) scale(0.98); }

.btn-primary {
  background: linear-gradient(180deg, var(--capulet), var(--capulet-dark));
  color: #fdeedb;
  box-shadow: 0 6px 0 #3c1414, 0 10px 18px var(--shadow);
}
.btn-primary:hover { box-shadow: 0 6px 0 #3c1414, 0 12px 22px var(--shadow); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid #00000033;
}
.btn-ghost:hover { background: #00000010; }
#armory-pts-badge {
  display: inline-block;
  margin-left: 4px;
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 0.85em;
  color: var(--capulet-dark);
}
.card.selected { cursor: default; }
.card .upg-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; gap: 8px;
}
.card .upg-level {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: #6b5436;
}
.card .upg-dots { display: flex; gap: 4px; }
.card .upg-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #00000022; border: 1px solid #00000033;
}
.card .upg-dot.filled { background: var(--gold); border-color: #00000022; }

.howto-list {
  text-align: left;
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  font-size: 1.05rem;
  line-height: 1.9;
}
.howto-list b { color: var(--capulet-dark); }

/* ---- character / weapon cards ---- */

.card-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 10px 0 24px;
}

.card {
  flex: 1 1 200px;
  max-width: 240px;
  background: #fffaef;
  border: 2px solid #00000018;
  border-radius: 10px;
  padding: 18px 16px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 20px var(--shadow); }
.card.selected { border-color: var(--gold); box-shadow: 0 0 0 3px #c99a3c55; }

.card-swatch {
  width: 36px; height: 36px; border-radius: 50%;
  margin-bottom: 10px;
  box-shadow: inset 0 0 0 3px #ffffff55, 0 2px 6px #00000030;
}
.card h3 {
  font-family: 'Cinzel', Georgia, serif;
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.card p { margin: 0; font-size: 0.92rem; line-height: 1.4; color: #4a3826; }
.card .stat-row {
  margin-top: 10px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #6b5436;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- script lines (cutscenes / intros / endings) ---- */

.script-lines {
  text-align: left;
  background: #00000008;
  border-left: 3px solid var(--gold);
  padding: 14px 18px;
  margin: 0 0 22px;
  border-radius: 4px;
}
.script-lines p { margin: 0 0 10px; line-height: 1.55; font-size: 1.02rem; }
.script-lines p:last-child { margin-bottom: 0; }
.script-lines .speaker { font-weight: 700; color: var(--capulet-dark); margin-right: 6px; }
.script-lines .stage { font-style: italic; opacity: 0.75; }

.stats-row {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin: 0 0 20px;
  font-size: 0.92rem;
  color: #4a3826;
  flex-wrap: wrap;
}
.stats-row b { color: var(--ink); font-size: 1.15rem; display: block; }

/* ---- duel screen ---- */

.duel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 980px;
}

.hud {
  width: 960px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 4px;
}
.hud-side { flex: 1 1 0; min-width: 0; }
.hud-right { text-align: right; }
.hud-name {
  font-family: 'Cinzel', Georgia, serif;
  color: #f3e6c9;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  text-shadow: 0 1px 3px #000;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.hud-right .hud-name { justify-content: flex-end; }
.hp-num {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.78rem;
  color: #d9c9a3cc;
  font-style: italic;
}
.hud-mid {
  font-family: 'Cinzel', Georgia, serif;
  color: var(--gold);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 1px 3px #000;
}

.healthbar {
  height: 16px;
  border-radius: 999px;
  background: #00000066;
  border: 1.5px solid #00000088;
  overflow: hidden;
  box-shadow: inset 0 2px 4px #00000066;
}
.healthbar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #4caf6a, #2e7d46);
  transition: width 0.18s ease;
}
.healthbar-enemy .healthbar-fill { background: linear-gradient(180deg, #d96b4a, #a8402a); }
.healthbar-fill.low { background: linear-gradient(180deg, #e2453f, #a4211c); }

.staminabar {
  height: 7px;
  margin-top: 4px;
  border-radius: 999px;
  background: #00000055;
  border: 1px solid #00000066;
  overflow: hidden;
}
.staminabar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #e3c766, #b99429);
  transition: width 0.12s ease;
}
.staminabar-fill.spent { background: linear-gradient(180deg, #8a7a52, #5f5436); }
.staminabar-enemy .staminabar-fill { background: linear-gradient(180deg, #d99ab0, #a85a78); }

#dmg-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.dmg-num {
  position: absolute;
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #ffdede;
  text-shadow: 0 2px 4px #000, 0 0 8px #000;
  transform: translate(-50%, -50%);
  opacity: 1;
  transition: transform 0.75s ease-out, opacity 0.75s ease-out;
  white-space: nowrap;
}
.dmg-num.rise { transform: translate(-50%, -140%) scale(1.15); opacity: 0; }
.dmg-num.crit { color: #ffd45c; font-size: 1.35rem; }
.dmg-num.block { color: #bcd6ffcc; font-size: 0.85rem; }

#viewport {
  position: relative;
  width: 960px;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  background: #0d0905;
  border-radius: 12px;
  box-shadow: 0 16px 40px var(--shadow), inset 0 0 0 4px #00000055;
  overflow: hidden;
  cursor: crosshair;
}
#arena3d { display: block; width: 100%; height: 100%; }

#crosshair {
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#crosshair::before, #crosshair::after {
  content: '';
  position: absolute;
  background: #f3e6c9cc;
}
#crosshair::before { left: 50%; top: 2px; bottom: 2px; width: 2px; transform: translateX(-50%); }
#crosshair::after { top: 50%; left: 2px; right: 2px; height: 2px; transform: translateY(-50%); }

#hit-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 0 transparent;
  background: radial-gradient(ellipse at center, transparent 55%, #8c0000 130%);
  opacity: 0;
  transition: opacity 0.08s ease;
}
#hit-vignette.show { opacity: 0.55; }

.lock-prompt {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #000000aa;
  color: #f3e6c9;
  text-align: center;
  font-family: 'Cinzel', Georgia, serif;
  cursor: pointer;
}
.lock-prompt .hint {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 0.92rem;
  color: #d9c9a3;
  max-width: 380px;
  font-style: normal;
  opacity: 0.9;
}
.lock-prompt.hidden { display: none; }

.duel-quit {
  position: absolute;
  top: 10px; right: 10px;
  padding: 7px 16px;
  font-size: 0.78rem;
  background: #140d08aa;
  color: #f3e6c9;
  border-color: #f3e6c955;
  z-index: 4;
}

.duel-banner {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 2rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-shadow: 0 2px 10px #000, 0 0 30px #000;
  text-align: center;
  pointer-events: none;
  z-index: 5;
}
.duel-banner.hidden { display: none; }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .panel { padding: 26px 18px; }
  h1 { font-size: 1.6rem; }
  .hud { width: 100%; }
}
