:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #fff6e8;
  background: #100d14;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: #100d14; -webkit-tap-highlight-color: transparent; touch-action: none; }
button { font: inherit; }
[hidden] { display: none !important; }

#game { display: block; width: 100%; height: 100%; outline: none; }

#fightHud {
  position: fixed;
  inset: max(14px, env(safe-area-inset-top)) 14px auto;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 92px minmax(150px, 1fr);
  gap: 12px;
  align-items: start;
  pointer-events: none;
}

.fighter-status {
  padding: 10px 12px;
  border: 1px solid #f1c47b66;
  border-radius: 12px;
  background: #17121be8;
  box-shadow: 0 8px 26px #05040980;
}

.name-row, .meter-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.name-row { margin-bottom: 7px; color: #fff2d6; font-size: 13px; font-weight: 900; letter-spacing: .05em; }
.name-row span:last-child { color: #d7b986; font-size: 9px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.health-track, .special-track { height: 11px; overflow: hidden; border-radius: 8px; background: #39232b; }
.health-track i, .special-track i { display: block; width: 100%; height: 100%; border-radius: inherit; transition: width .16s ease; }
.health-track i { background: linear-gradient(90deg, #dd5345, #ffca67); }
.rival-status .health-track i { background: linear-gradient(90deg, #f7a94f, #f4e16b); }
.special-track { height: 5px; margin-top: 6px; background: #302541; }
.special-track i { width: 0; background: linear-gradient(90deg, #7a64fa, #dca4ff); }
.meter-row { margin-top: 4px; color: #b7a9ac; font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.match-info { display: grid; justify-items: center; gap: 3px; color: #ffe6ae; text-shadow: 0 2px 6px #000; }
.match-info strong { font-size: 10px; letter-spacing: .13em; }
.match-info b { font-size: 29px; line-height: 1; font-variant-numeric: tabular-nums; }
.match-info button { width: 38px; height: 30px; border: 1px solid #e8c07788; border-radius: 8px; color: #fff2d6; background: #17121be8; pointer-events: auto; }

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: auto;
  background: linear-gradient(90deg, #09080bcc, #09080b66 52%, #09080bcc);
}

.menu-card {
  width: min(94vw, 760px);
  max-height: 96vh;
  overflow: auto;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid #e7bd7970;
  border-radius: 20px;
  background: linear-gradient(145deg, #211924f5, #151219f5);
  box-shadow: 0 25px 90px #070508b3, inset 0 1px #fff3d414;
  text-align: center;
}

.eyebrow { margin: 0 0 10px; color: #e8bb78; font-size: 10px; font-weight: 900; letter-spacing: .2em; }
h1 { margin: 0; color: #fff0cf; font: 700 clamp(38px, 8vw, 62px)/.93 Georgia, "Times New Roman", serif; text-shadow: 0 4px 24px #d4894b55; }
h1 span { color: #eab66c; }
.intro { max-width: 470px; margin: 15px auto 17px; color: #d5c6c3; font-size: 14px; line-height: 1.55; }

.roster { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fighter-card {
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid #695565;
  border-radius: 11px;
  color: #eee2d5;
  background: #201a25;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s, background .16s, transform .16s;
}
.fighter-card:hover { transform: translateY(-2px); border-color: #e8bd7c; }
.fighter-card.selected { border-color: #f0c77e; background: linear-gradient(140deg, #493025, #2a2029); box-shadow: inset 0 0 0 1px #f0c77e33; }
.card-top { display: flex; align-items: center; gap: 8px; }
.fighter-swatch { flex: 0 0 24px; width: 24px; height: 24px; border: 2px solid #ffffff55; border-radius: 50%; box-shadow: 0 0 12px currentColor; }
.fighter-card strong { display: block; overflow: hidden; color: #fff0d4; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.fighter-card small { display: block; margin-top: 2px; color: #c8b7b2; font-size: 9px; }

.fighter-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 12px 0 14px;
  padding: 10px 12px;
  border: 1px solid #66506466;
  border-radius: 10px;
  background: #100d14b8;
  text-align: left;
}
.detail-copy { min-width: 0; }
.detail-copy strong { color: #ffe0a6; font-size: 12px; }
.detail-copy p { margin: 4px 0 0; color: #bdafb3; font-size: 11px; line-height: 1.45; }
.stats { display: flex; flex: 0 0 auto; gap: 8px; }
.stat { min-width: 44px; text-align: center; }
.stat b { display: block; color: #fff0d2; font-size: 12px; }
.stat span { display: block; color: #a9989f; font-size: 8px; font-weight: 800; letter-spacing: .09em; }

.primary-button {
  min-width: 218px;
  padding: 13px 20px;
  border: 0;
  border-radius: 11px;
  color: #281c19;
  background: linear-gradient(135deg, #ffe09f, #e6a14e);
  box-shadow: 0 8px 25px #e6a14e3d;
  font-size: 14px;
  font-weight: 950;
  cursor: pointer;
}
.primary-button:hover { filter: brightness(1.08); }
.primary-button:focus-visible, button:focus-visible { outline: 3px solid #fff3d2; outline-offset: 3px; }
.controls-hint, .touch-hint { margin: 13px 0 0; color: #baabb0; font-size: 10px; line-height: 1.7; }
.touch-hint { display: none; }
kbd { display: inline-block; min-width: 19px; padding: 1px 4px; border: 1px solid #8a7283; border-radius: 4px; color: #f2d5a5; font: inherit; font-size: 9px; }
.fine-print { margin: 12px 0 0; color: #82757e; font-size: 9px; }
.policy-links { display: flex; justify-content: center; gap: 9px; margin: 8px 0 0; color: #a9989f; font-size: 10px; }
.policy-links a { color: #e8bb78; text-underline-offset: 3px; }
.engine-error { margin: 12px 0 0; color: #ffb4a1; font-size: 12px; }

.callout {
  position: fixed;
  top: 24%;
  left: 50%;
  padding: 9px 16px;
  border: 1px solid #f1c47b88;
  border-radius: 20px;
  color: #fff2d6;
  background: #1a1420dc;
  box-shadow: 0 5px 25px #05040980;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .1em;
  pointer-events: none;
  transform: translateX(-50%);
}

#touchControls {
  position: fixed;
  right: 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 14px;
  pointer-events: none;
}
.movement-pad, .action-pad { display: flex; align-items: flex-end; gap: 7px; }
.vertical-pad { display: grid; gap: 7px; }
#touchControls button {
  min-width: 52px;
  height: 52px;
  border: 1px solid #e5bf8588;
  border-radius: 14px;
  color: #fff1d2;
  background: #1b1524dd;
  box-shadow: 0 4px 15px #0005;
  font-size: 11px;
  font-weight: 900;
  pointer-events: auto;
  touch-action: none;
}
.movement-pad button { min-width: 47px; font-size: 23px !important; }
.vertical-pad button { height: 37px !important; min-width: 41px !important; }
.action-pad button[data-action="special"] { color: #1c1424; background: linear-gradient(135deg, #e6b4ff, #a68eff); }

@media (pointer: coarse) {
  .controls-hint { display: none; }
  .touch-hint { display: block; }
}

@media (max-width: 560px) {
  #fightHud { inset-inline: 8px; grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr); gap: 5px; }
  .fighter-status { padding: 8px; }
  .name-row { display: block; font-size: 11px; }
  .name-row span:last-child { display: block; margin-top: 2px; }
  .match-info strong { font-size: 8px; }
  .match-info b { font-size: 24px; }
  .match-info button { width: 32px; height: 25px; }
  .roster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-card { padding: 20px 14px; }
  .fighter-details { align-items: flex-start; }
  .stats { gap: 4px; }
  .stat { min-width: 35px; }
  #touchControls { padding-inline: 7px; }
  .movement-pad, .action-pad { gap: 4px; }
  #touchControls button { min-width: 43px; height: 46px; border-radius: 12px; font-size: 9px; }
  .movement-pad button { min-width: 39px; }
}
