/* Animathings Act II: The Syrup & Ice Road — Street Fighter Arcade UI */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --ink: #2b1a10;
  --cream: #fff7e6;
  --parchment: #f7ead1;
  --gold: #e69b2e;
  --gold-bright: #ffd36b;
  --frost: #45d1ff;
  --frost-deep: #1b6ea8;
  --crimson: #d94646;
  --bg-dark: #151b26;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--cream);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
  user-select: none;
}

.fighter-shell {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100dvh;
  background: radial-gradient(circle at top, #27344d 0%, #141923 70%);
}

/* ================= TOP NAV BAR ================= */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #322116 0%, #231710 100%);
  border-bottom: 2px solid #755033;
  z-index: 20;
  flex-shrink: 0;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1.5px solid #8a6242;
  background: linear-gradient(180deg, #4b3120, #342115);
  color: #fff3da;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.15s;
}

.nav-btn:hover {
  transform: translateY(-1px);
  border-color: var(--gold-bright);
}

.stage-pill {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(69, 209, 255, 0.14);
  border: 1.5px solid rgba(114, 224, 255, 0.45);
  color: #d6f6ff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.journey-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.j-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #73543b;
  background: #2b1d14;
  color: #c8ad8d;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.j-dot.done {
  background: #3d8f52;
  border-color: #9bf2ac;
  color: #fff;
}

.j-dot.active {
  background: var(--gold);
  border-color: #fff3c4;
  color: #2b1a10;
  box-shadow: 0 0 10px rgba(255, 211, 107, 0.7);
}

.j-dot.secret-dot {
  background: #3d1d30;
  border-color: #ff9c54;
  color: #ffe27a;
}

.j-dot.secret-dot.hidden {
  display: none;
}

.fighter-bar.p1.is-mantigus .hud-portrait {
  border-color: #79f282;
}

.fighter-bar.p1.is-mantigus .hp-fill {
  background: linear-gradient(90deg, #74f27a, #2fa349);
}

.fighter-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(58, 138, 68, 0.14);
  border: 1.5px solid rgba(58, 138, 68, 0.4);
}

.fighter-picker.hidden {
  display: none;
}

.fighter-picker-label {
  font-size: 12.5px;
  font-weight: 900;
  color: #2c6634;
}

.fp-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid #96734e;
  background: #fffaf0;
  color: #3a2110;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
}

.fp-btn.active {
  background: linear-gradient(180deg, #f3a12f, #d37019);
  border-color: #8c450d;
  color: #fff;
}

.fp-btn.mantigus.active {
  background: linear-gradient(180deg, #4ec25a, #2a8c38);
  border-color: #195e23;
  color: #fff;
}

.stage-card-btn.secret-card {
  border-color: #c94358;
  background: linear-gradient(180deg, #fff3e6, #ffe0e4);
}

/* ================= STAGE & CANVAS ================= */
.arena-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#fighter-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #101622;
}

/* ================= STREET FIGHTER BATTLE HUD ================= */
.battle-hud {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: min(940px, calc(100% - 20px));
  display: grid;
  grid-template-columns: 1fr 78px 1fr;
  align-items: start;
  gap: 10px;
  pointer-events: none;
  z-index: 10;
}

.battle-hud.hidden {
  display: none;
}

.fighter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fighter-bar.p2 {
  flex-direction: row-reverse;
}

.hud-portrait {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  overflow: hidden;
  border: 2.5px solid var(--gold-bright);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
  background: #231811;
  flex-shrink: 0;
}

.fighter-bar.p2 .hud-portrait {
  border-color: #7ee3ff;
}

.hud-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

.bar-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85);
}

.fighter-bar.p2 .name-row {
  flex-direction: row-reverse;
}

.fighter-name {
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.4px;
  color: #fff9ec;
}

.round-pips {
  display: flex;
  gap: 5px;
}

.round-pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 240, 200, 0.7);
  background: rgba(20, 24, 34, 0.65);
}

.round-pip.won {
  background: radial-gradient(circle at 35% 35%, #fff5a8, #f29d1d);
  border-color: #fff;
  box-shadow: 0 0 8px #ffc74f;
}

.hp-track {
  position: relative;
  height: 22px;
  border-radius: 7px;
  background: rgba(16, 18, 28, 0.85);
  border: 2px solid rgba(255, 245, 220, 0.75);
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

.hp-drain, .hp-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  transition: width 0.08s linear;
}

.fighter-bar.p1 .hp-drain,
.fighter-bar.p1 .hp-fill {
  right: 0;
}

.fighter-bar.p2 .hp-drain,
.fighter-bar.p2 .hp-fill {
  left: 0;
}

.hp-drain {
  background: #ff6961;
  transition: width 0.45s ease-out;
}

.fighter-bar.p1 .hp-fill {
  background: linear-gradient(90deg, #ffb938, #f47c20);
}

.fighter-bar.p2 .hp-fill {
  background: linear-gradient(90deg, #35c2ff, #2779e8);
}

.super-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fighter-bar.p2 .super-row {
  flex-direction: row-reverse;
}

.super-track {
  flex: 1;
  height: 9px;
  border-radius: 999px;
  background: rgba(14, 18, 28, 0.8);
  border: 1.5px solid rgba(255, 232, 180, 0.5);
  overflow: hidden;
}

.super-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffbe3b, #6deeff);
  transition: width 0.1s linear;
}

.super-fill.ready {
  background: linear-gradient(90deg, #fff176, #ff9d2e, #67f0ff);
  box-shadow: 0 0 12px #78f0ff;
  animation: pulseSuper 0.65s infinite alternate;
}

@keyframes pulseSuper {
  from { filter: brightness(1); }
  to { filter: brightness(1.45); }
}

.super-tag {
  font-size: 11px;
  font-weight: 900;
  color: #ffe39b;
  text-shadow: 0 1px 3px #000;
}

.timer-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 62px;
  border-radius: 14px;
  background: linear-gradient(180deg, #3c2617, #22150d);
  border: 2.5px solid var(--gold-bright);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.timer-num {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  color: #fff6dc;
}

.timer-sub {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #ffd578;
}

/* ================= COMBO & ANNOUNCEMENT BANNERS ================= */
.combo-badge {
  position: absolute;
  top: 96px;
  padding: 6px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(242, 146, 30, 0.94), rgba(204, 62, 46, 0.94));
  border: 2px solid #fff0be;
  font-weight: 900;
  font-size: 18px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 12;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.12s, transform 0.12s;
}

.combo-badge.show {
  opacity: 1;
  transform: scale(1);
}

.combo-badge.p1 { left: 26px; }
.combo-badge.p2 { right: 26px; background: linear-gradient(135deg, rgba(46, 152, 224, 0.94), rgba(74, 88, 210, 0.94)); }

.round-banner {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) scale(0.92);
  padding: 14px 36px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(35, 22, 14, 0.92), rgba(20, 32, 50, 0.92));
  border: 3px solid var(--gold-bright);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65);
  text-align: center;
  pointer-events: none;
  z-index: 14;
  opacity: 0;
  transition: opacity 0.16s, transform 0.16s;
}

.round-banner.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.round-banner-sub {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #8ee7ff;
  text-transform: uppercase;
}

.round-banner-title {
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #fff6db;
  text-shadow: 0 4px 12px rgba(230, 155, 46, 0.65);
}

/* ================= ARCADE TEXT DIALOGUE OVERLAY ================= */
.dialogue-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px 20px 22px;
  background: linear-gradient(180deg, rgba(10, 14, 24, 0.14) 0%, rgba(10, 14, 24, 0.72) 100%);
  z-index: 25;
}

.dialogue-overlay.hidden {
  display: none;
}

.dialogue-stage-wrap {
  width: min(860px, 100%);
  margin: 0 auto;
}

.dialogue-portraits {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 18px;
  margin-bottom: -8px;
}

.dlg-portrait-card {
  width: 138px;
  height: 162px;
  border-radius: 16px 16px 6px 6px;
  overflow: hidden;
  border: 3px solid var(--gold-bright);
  background: #231710;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s, filter 0.2s, opacity 0.2s;
}

.dlg-portrait-card.right {
  border-color: #7ee3ff;
}

.dlg-portrait-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

.dlg-portrait-card.dim {
  filter: brightness(0.48) saturate(0.75);
  transform: translateY(10px) scale(0.93);
}

.dlg-portrait-card.empty {
  opacity: 0;
  pointer-events: none;
}

.dialogue-box {
  position: relative;
  padding: 18px 22px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(46, 30, 19, 0.96), rgba(28, 19, 13, 0.98));
  border: 3px solid var(--gold-bright);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.7);
  cursor: pointer;
}

.dlg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dlg-speaker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 17px;
  color: #ffd97a;
}

.dlg-role {
  font-size: 12px;
  font-weight: 700;
  color: #a9d9f0;
  opacity: 0.9;
}

.dlg-text {
  min-height: 52px;
  font-size: clamp(15px, 2.2vw, 18px);
  line-height: 1.48;
  color: #fff9eb;
  margin: 0;
}

.dlg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 10px;
}

.dlg-hint {
  font-size: 12px;
  color: #d9be98;
  font-weight: 700;
}

.dlg-actions {
  display: flex;
  gap: 8px;
}

/* ================= MODALS (TITLE / STAGE SELECT / RESULT) ================= */
.modal-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(12, 16, 26, 0.78);
  backdrop-filter: blur(5px);
  z-index: 30;
}

.modal-overlay.hidden {
  display: none;
}

.arcade-modal {
  width: min(820px, 100%);
  max-height: calc(100dvh - 82px);
  overflow-y: auto;
  padding: 22px 24px;
  border-radius: 22px;
  background: linear-gradient(180deg, #fff6e3 0%, #f3e0be 100%);
  color: var(--ink);
  border: 3.5px solid #8c5a32;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.65);
}

.title-hero {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
}

.hero-card-badge {
  width: 122px;
  flex-shrink: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid #965b28;
  box-shadow: 0 8px 20px rgba(72, 42, 16, 0.3);
  background: #2a1a10;
  text-align: center;
}

.hero-card-badge img {
  display: block;
  width: 100%;
  height: 132px;
  object-fit: cover;
}

.hero-card-badge span {
  display: block;
  padding: 4px;
  font-size: 12px;
  font-weight: 900;
  color: #ffe8b3;
}

.act-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1b6ea8, #2b9ad6);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.arcade-modal h1 {
  margin: 0 0 6px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.1;
  color: #3a2010;
}

.arcade-modal p.lead {
  margin: 0 0 10px;
  font-size: 14.5px;
  line-height: 1.45;
  color: #543620;
}

.controls-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(110, 68, 32, 0.1);
  border: 1.5px solid rgba(110, 68, 32, 0.22);
  font-size: 12.5px;
  font-weight: 700;
  color: #4a2d18;
}

.controls-strip kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  background: #fff;
  border: 1px solid #b5926e;
  box-shadow: 0 1px 0 #b5926e;
  font-family: inherit;
  font-weight: 900;
  color: #2b1a10;
}

.stage-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.stage-card-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px;
  border-radius: 12px;
  border: 2px solid #b68c60;
  background: #fffaf0;
  color: #3a2110;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
}

.stage-card-btn:hover {
  transform: translateY(-2px);
  border-color: #d97724;
  box-shadow: 0 6px 14px rgba(130, 74, 24, 0.25);
}

.stage-card-btn img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 8px;
  margin-bottom: 5px;
}

.stage-card-btn .sc-num {
  font-size: 10px;
  font-weight: 900;
  color: #1f6fa5;
  text-transform: uppercase;
}

.stage-card-btn .sc-name {
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  line-height: 1.15;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 2px solid transparent;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, filter 0.12s;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.btn-primary {
  background: linear-gradient(180deg, #f3a12f, #d37019);
  border-color: #8c450d;
  color: #fff;
  box-shadow: 0 4px 0 #8c450d;
}

.btn-frost {
  background: linear-gradient(180deg, #3bb8eb, #1d7db8);
  border-color: #124f78;
  color: #fff;
  box-shadow: 0 4px 0 #124f78;
}

.btn-ghost {
  background: #f5e6cc;
  border-color: #b48a5e;
  color: #462a16;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 9px;
}

/* ================= MOBILE TOUCH CONTROLS ================= */
.touch-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 14px;
  pointer-events: none;
  z-index: 16;
}

.touch-controls.active {
  display: flex;
}

.touch-pad, .touch-actions {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.touch-actions {
  display: grid;
  grid-template-columns: repeat(2, 62px);
  gap: 8px;
}

.t-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 240, 200, 0.72);
  background: rgba(34, 24, 18, 0.68);
  color: #fff7e3;
  font-weight: 900;
  font-size: 14px;
  display: grid;
  place-items: center;
  touch-action: none;
}

.t-btn.special {
  background: rgba(30, 128, 190, 0.78);
  border-color: #8deeff;
}

.t-btn.super {
  background: rgba(224, 130, 22, 0.84);
  border-color: #ffe885;
}

.t-btn:active, .t-btn.pressed {
  transform: scale(0.92);
  filter: brightness(1.3);
}

@media (max-width: 720px) {
  .title-hero { flex-direction: column; text-align: center; }
  .stage-select-grid { grid-template-columns: repeat(3, 1fr); }
  .journey-dots { display: none; }
  .hud-portrait { width: 42px; height: 42px; }
  .fighter-name { font-size: 13px; }
  .dlg-portrait-card { width: 92px; height: 108px; }
}

@media (hover: none) and (pointer: coarse) {
  .touch-controls { display: flex; }
}
