:root {
  color-scheme: dark;
  --paper: #fff0da;
  --muted: #c0aeba;
  --gold: #ffbd70;
  --line: #46313e;
  --panel: #211923;
  --dark: #140f17;
  font-family: "Arial Narrow", system-ui, sans-serif;
  background: var(--dark);
  color: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 48% 8%, #382434 0, transparent 65%); }
button, select { font: inherit; color: inherit; }
button, select {
  background: #2a1e2b; border: 1px solid #72536a; padding: .55rem .8rem;
  cursor: pointer; border-radius: 4px; font-weight: 700;
}
button:hover, select:hover { border-color: var(--gold); }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #ffd198; outline-offset: 3px; }
button:disabled { opacity: .6; cursor: wait; }
.cabinet { max-width: 1140px; margin: auto; padding: 0 clamp(10px, 3vw, 38px) 24px; }
.topbar { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.back { color: var(--paper); text-decoration: none; font-weight: 700; }
.back:hover { color: var(--gold); }
.utilities { display: flex; gap: 7px; }
.utilities button { font-size: .8rem; min-height: 36px; }
.menu, .play { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 22px 85px #0008; }
.hero {
  min-height: clamp(230px, 30vw, 375px);
  background: linear-gradient(95deg, #120d17f5 4%, #1b1124bd 34%, #1d122190 52%, #120d1720 82%),
    linear-gradient(0deg, #211923 0%, transparent 46%), url("./assets/honky-tonk.webp") 53% 48% / cover;
  display: grid; align-items: center;
}
.hero-content { padding: 25px clamp(15px, 5vw, 56px); }
.eyebrow { text-transform: uppercase; color: var(--gold); letter-spacing: .19em; font-size: .72rem; font-weight: 800; margin: 0 0 .6rem; }
h1, h2, .subtitle { margin: 0; }
h1, .dialog h2 { font-family: Impact, Haettenschweiler, "Arial Narrow Bold", system-ui, sans-serif; font-weight: 950; letter-spacing: -.055em; }
h1 { font-size: clamp(3.4rem, 9vw, 7.6rem); line-height: .94; text-shadow: 1px 3px 0 #462439, 2px 7px 22px #000e; }
h1 span { color: var(--gold); }
.subtitle { font-size: clamp(1rem, 3vw, 1.7rem); color: #f3d5cb; font-weight: 700; margin-top: .6rem; }
.menu-body { padding: 0 clamp(12px, 4vw, 44px) 22px; }
.section-line, .start-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.section-line { margin: 0 0 10px; }
.section-line h2 { font-size: clamp(.98rem, 2.5vw, 1.25rem); }
#record { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .83rem; }
.fighters { display: grid; grid-template-columns: repeat(5, 1fr); gap: clamp(4px, 1vw, 12px); }
.fighter {
  display: grid; justify-items: center; align-content: end; gap: .18rem; padding: .5rem 2px;
  background: radial-gradient(ellipse at 50% 35%, #594154, #251b27 75%); box-shadow: inset 0 -16px 26px #0c080c9c;
  min-width: 0;
}
.fighter[aria-pressed=true] { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold), inset 0 -16px 26px #0c080c9c; color: var(--gold); }
.fighter img { width: 92%; height: clamp(62px, 12vw, 140px); object-fit: contain; object-position: center bottom; filter: drop-shadow(0 4px 4px #000a); }
.fighter strong { font-size: clamp(.63rem, 2.6vw, 1rem); }
.fighter small { color: #ebcad6; font-size: clamp(.55rem, 1.4vw, .75rem); line-height: 1.2; }
.start-row { margin: 15px 0; flex-wrap: wrap; }
.stage-label { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; font-weight: 700; font-size: .87rem; }
.primary { background: var(--gold); color: #1e1318; border-color: #ffd29d; min-height: 42px; padding: .56rem 1.2rem; font-weight: 900; }
.primary:hover { background: #ffce93; }
.input-guide { margin: .45rem 0 0; font-size: .76rem; color: var(--muted); line-height: 1.5; }
kbd { color: #fff0da; font: inherit; font-weight: 700; }
.screen { position: relative; aspect-ratio: 960 / 500; overflow: hidden; isolation: isolate; background: #0c0a10; touch-action: none; }
canvas { display: block; width: 100%; height: 100%; }
.hud { position: absolute; inset: 0 0 auto; display: flex; justify-content: space-between; align-items: start; gap: .45rem; padding: clamp(5px, 1.55vw, 17px); background: linear-gradient(#100a17ed, transparent); text-shadow: 0 2px 3px #000; pointer-events: none; }
.player-hud { width: min(36%, 300px); }
.hud-name, #hud-stage, #boss-name { font-weight: 900; text-transform: uppercase; letter-spacing: .09em; }
.hud-name, #hud-stage { font-size: clamp(.56rem, 1.9vw, 1rem); }
.stage-hud { text-align: right; margin-left: auto; }
#score, #heat-label { color: var(--gold); font-size: clamp(.48rem, 1.4vw, .78rem); font-weight: 800; font-variant-numeric: tabular-nums; }
.bar { width: 100%; height: clamp(5px, 1.45vw, 14px); background: #1e101de8; border: 1px solid #ffedd987; overflow: hidden; }
.bar > div { height: 100%; transform-origin: left; }
.hp > div { background: linear-gradient(90deg, #ff7968, #ffcf85); }
.heat { margin-top: 3px; height: clamp(3px, .7vw, 7px); position: relative; }
.heat::after { content: ""; position: absolute; height: 100%; width: 1px; left: 45%; top: 0; background: white; }
.heat > div { background: linear-gradient(90deg, #836cff, #e9a1ff); }
.pause { min-width: 34px; min-height: 30px; padding: .08rem .35rem; pointer-events: auto; }
.boss-hud { position: absolute; top: 14%; right: 2%; width: 27%; text-align: right; text-shadow: 0 2px 3px #000; font-size: clamp(.48rem, 1.45vw, .83rem); pointer-events: none; }
.boss { height: clamp(5px, 1vw, 10px); }
.boss > div { background: linear-gradient(90deg, #b642a3, #ff6173); }
.tip-banner { position: absolute; inset: auto 0 5%; text-align: center; font: 900 clamp(.7rem, 2vw, 1.25rem) system-ui; text-transform: uppercase; letter-spacing: .13em; color: var(--gold); text-shadow: 0 2px 6px #000, 0 2px 12px #000; pointer-events: none; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; background: #0e0813b3; }
.dialog { background: #231824f7; border: 1px solid #ae8066; border-top: 3px solid var(--gold); box-shadow: 0 15px 45px #000b; padding: clamp(10px, 3vw, 30px); width: min(92%, 490px); }
.dialog h2 { font-size: clamp(1.35rem, 5vw, 3rem); line-height: 1; }
.dialog p:not(.eyebrow) { font-size: clamp(.73rem, 2.05vw, 1rem); line-height: 1.4; margin: .65rem 0; color: #f3dbe4; }
.dialog-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.dialog button { font-size: clamp(.68rem, 2vw, .9rem); min-height: 32px; }
.play-footer { display: flex; justify-content: space-between; gap: .5rem; padding: .6rem .8rem; font-size: .73rem; color: var(--muted); }
/* Touch controls float over the stage and leave its center clear. */
#touch {
  display: none;
  position: relative;
  min-height: 100px;
  padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  align-items: center;
  justify-content: space-between;
  background: #16101a;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
@media (any-pointer: coarse) {
  #touch { display: flex; }
  .cabinet.has-game:not(:fullscreen):not(.immersive) {
    padding-inline: max(4px, env(safe-area-inset-left)) max(4px, env(safe-area-inset-right));
  }
}
#joystick, .touch-actions button {
    pointer-events: auto;
    touch-action: none;
    -webkit-touch-callout: none;
}
#joystick {
    position: relative;
    width: clamp(74px, 21vw, 124px);
    aspect-ratio: 1;
    border: 1px solid #edb665ba;
    border-radius: 50%;
    background: repeating-radial-gradient(circle, transparent 0 23%, #edb66530 24% 25%, transparent 26% 45%), #151521aa;
    box-shadow: inset 0 0 16px #0009, 0 3px 12px #0006;
}
.joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 43%;
    aspect-ratio: 1;
    border: 1px solid #ffe1a7;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 29%, #fae3a2dd, #a87542dd 72%);
    box-shadow: 0 3px 9px #0009;
    transform: translate(-50%, -50%) translate(var(--stick-x, 0px), var(--stick-y, 0px));
    pointer-events: none;
}
.touch-actions {
    display: grid;
    grid-template-columns: repeat(4, clamp(44px, 11vw, 60px));
    gap: clamp(4px, 1vw, 8px);
}
.touch-actions button {
    min-height: 44px;
    aspect-ratio: 1;
    padding: 2px;
    border: 1px solid #edb665b5;
    border-radius: 50%;
    background: #181621c7;
    box-shadow: 0 2px 6px #0008;
    color: var(--paper);
    font-size: clamp(.56rem, 2.1vw, .75rem);
    line-height: 1.05;
    text-shadow: 0 1px 2px #000;
}
.touch-actions [data-hold="special"] { color: #ffdb93; }
.touch-actions [data-hold="guard"] { color: #c4ddff; }
.touch-actions button.held { background: #805839; border-color: #fff0cf; }
#touch .touch-actions button:nth-child(5) { grid-column: 2; }


@media (max-width: 580px) {
  .topbar { min-height: 49px; font-size: .79rem; }
  .play-footer { font-size: .61rem; }
  .fighter small { min-height: 1.8em; }
}
html.tulsa-playing, html.tulsa-playing body { overscroll-behavior: none; }
.cabinet.has-game, .cabinet.has-game button {
  touch-action: none;
  -webkit-touch-callout: none;
}
.cabinet:is(:fullscreen, .immersive) {
  width: 100%;
  height: 100dvh;
  max-width: none;
  overflow: auto;
  background: #130e16;
  padding: 0;
}
.cabinet.immersive { position: fixed; inset: 0; z-index: 20; }
.cabinet:is(:fullscreen, .immersive).has-game {
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.cabinet:is(:fullscreen, .immersive).has-game .topbar,
.cabinet:is(:fullscreen, .immersive) .play-footer { display: none; }
.cabinet:is(:fullscreen, .immersive) .play {
  display: grid;
  height: 100%;
  grid-template-rows: minmax(0, 1fr) auto;
  border: 0;
  background: #0c0a10;
}
.cabinet:is(:fullscreen, .immersive) .play-field {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  container-type: size;
}
.cabinet:is(:fullscreen, .immersive) .screen {
  width: min(100%, calc(100dvh * 1.92));
  width: min(100cqw, 192cqh);
}
@media (any-pointer: coarse) and (orientation: landscape) {
  .cabinet:is(:fullscreen, .immersive) .play:has(#touch:not([hidden])) {
    grid-template-columns: clamp(72px, 12dvh, 112px) minmax(0, 1fr) clamp(100px, 19dvh, 140px);
    grid-template-rows: minmax(0, 1fr);
  }
  .cabinet:is(:fullscreen, .immersive) #touch { display: contents; }
  .cabinet:is(:fullscreen, .immersive) .play-field { grid-column: 2; grid-row: 1; }
  .cabinet:is(:fullscreen, .immersive) .play:not(:has(#touch:not([hidden]))) .play-field { grid-column: 1; }
  .cabinet:is(:fullscreen, .immersive) #joystick {
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    justify-self: center;
    width: min(94%, 112px);
    margin-bottom: 12px;
  }
  .cabinet:is(:fullscreen, .immersive) .touch-actions {
    grid-column: 3;
    grid-row: 1;
    align-self: end;
    justify-self: center;
    grid-template-columns: repeat(2, clamp(44px, 12dvh, 60px));
    margin-bottom: 12px;
  }
  .cabinet:is(:fullscreen, .immersive) #touch .touch-actions button:nth-child(5) { grid-column: auto; }
}
.hero { position: relative; }
.crew-patch {
  position: absolute; width: clamp(65px, 14vw, 155px); height: auto; right: clamp(8px, 3.5vw, 36px);
  top: clamp(10px, 2.6vw, 28px); filter: drop-shadow(0 4px 9px #000b);
}
.cameo {
  position: absolute; top: 14%; left: 2%; width: min(63%, 450px); padding: clamp(4px, 1vw, 10px);
  display: flex; align-items: center; gap: clamp(4px, 1vw, 10px); pointer-events: none;
  background: #1a111de8; border: 1px solid #ffbf78; border-left-width: 3px; color: #fff0da;
}
.cameo img { width: 29%; max-height: 75px; object-fit: contain; }
.cameo strong { color: var(--gold); font-size: clamp(.53rem, 1.55vw, .9rem); }
.cameo p { margin: 2px 0; line-height: 1.22; font-size: clamp(.51rem, 1.42vw, .82rem); }
#weapon-label { display: block; color: #ffe2af; font-size: clamp(.5rem, 1.3vw, .78rem); font-weight: 850; }
