/* Build 10B — shared HUD, combat feedback, and touch controls for WebGL stages. */
.adventure-stages {
  --as-gold: #e5c486;
  position: relative;
  isolation: isolate;
  color: #f1ecdf;
  font-family: 'Cairo', sans-serif;
}
.adventure-stages *, .adventure-stages *::before, .adventure-stages *::after { box-sizing: border-box; }
.adventure-stages [hidden] { display: none !important; }
.as-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 10px;
  padding: 0 3px;
}
.as-brand { display: flex; align-items: center; min-width: 0; gap: 11px; }
.as-portrait {
  display: block;
  width: 46px;
  height: 46px;
  flex: none;
  border: 2px solid var(--as-gold);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #72828a, #29394a 57%, #111a29);
  background-position: center;
  background-size: cover;
  box-shadow: 0 0 17px rgba(230, 191, 120, .32);
}
.as-brand small { display: block; color: #e8cc92; font: 700 11px/1.4 'Cinzel', 'Cairo', serif; letter-spacing: .12em; }
.as-brand p { margin: 2px 0 0; color: #c6d0d0; font-size: 11px; }
.as-actions { display: flex; align-items: center; justify-content: end; gap: 7px; flex-wrap: wrap; }
.as-actions button, .as-preview {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid rgba(224, 190, 130, .53);
  border-radius: 4px 11px 4px 11px;
  background: rgba(13, 27, 43, .92);
  color: #f0ddb9;
  font: 700 11px 'Cairo', sans-serif;
}
.as-actions button, .as-dialog button, .as-weapons button, .as-touch button { cursor: pointer; }
.as-preview { min-height: auto; color: #c4e4d8; border-color: rgba(134, 192, 176, .5); }
.as-world {
  position: relative;
  height: clamp(410px, calc(100dvh - 220px), 720px);
  min-height: 380px;
  overflow: hidden;
  border: 1px solid rgba(224, 190, 130, .69);
  border-radius: 18px 5px 18px 5px;
  background: #121c2b;
  box-shadow: 0 22px 58px rgba(0, 0, 0, .57), inset 0 0 55px rgba(4, 12, 22, .38);
  direction: ltr;
  touch-action: none;
}
.as-canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
.as-combat-fx { position: absolute; z-index: 3; inset: 0; overflow: hidden; pointer-events: none; }
.as-damage-number {
  position: absolute;
  top: 0;
  left: 0;
  color: #fff0c4;
  font: 800 18px/1 'Cinzel', 'Cairo', serif;
  text-shadow: 0 2px 2px #271a10, 0 0 12px rgba(255, 192, 95, .95);
  white-space: nowrap;
  will-change: transform, opacity;
}
.as-damage-number.is-power { color: #fff9dc; font-size: 24px; text-shadow: 0 2px 3px #3e2810, 0 0 18px #ffd26f; }
.as-world::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(180deg, rgba(4, 12, 23, .56), transparent 25%, transparent 66%, rgba(4, 12, 22, .52)),
    radial-gradient(ellipse at 50% 52%, transparent 48%, rgba(3, 9, 17, .24));
}
.as-world.is-damaged::after {
  background: linear-gradient(180deg, rgba(130, 22, 31, .26), transparent 27%, transparent 72%, rgba(130, 22, 31, .3)),
    radial-gradient(ellipse at 50% 50%, transparent 43%, rgba(120, 17, 26, .45));
}
.as-hud {
  position: absolute;
  z-index: 2;
  inset: 13px 14px auto;
  display: grid;
  grid-template-columns: minmax(125px, 190px) minmax(130px, 1fr) minmax(95px, 145px);
  align-items: start;
  gap: 12px;
  pointer-events: none;
}
.as-health, .as-weapon {
  padding: 9px 11px;
  border: 1px solid rgba(222, 191, 137, .38);
  border-radius: 4px 12px 4px 12px;
  background: rgba(9, 20, 34, .82);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
}
.as-health strong, .as-weapon small { display: block; color: #dfc58f; font: 700 9px 'Cinzel', 'Cairo', serif; letter-spacing: .08em; }
.as-health > div {
  height: 9px;
  margin-top: 5px;
  overflow: hidden;
  border: 1px solid rgba(231, 216, 189, .28);
  border-radius: 10px;
  background: #1a2027;
}
.as-health-fill { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #9e554c, #d6956b); transition: width .2s ease; }
.as-health small { display: block; margin-top: 3px; color: #ccd1cc; font-size: 9px; }
.as-objective {
  justify-self: center;
  max-width: min(100%, 480px);
  padding: 8px 15px;
  border: 1px solid rgba(224, 190, 130, .53);
  border-radius: 5px 15px 5px 15px;
  background: rgba(8, 20, 34, .84);
  color: #f2dfb7;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.as-weapon { justify-self: end; min-width: 110px; text-align: center; }
.as-weapon strong { display: block; margin: 2px 0; color: #fff0ca; font: 700 14px 'Cinzel', 'Cairo', serif; }
.as-progress {
  position: absolute;
  z-index: 2;
  top: 82px;
  left: 50%;
  max-width: min(82%, 620px);
  transform: translateX(-50%);
  padding: 6px 12px;
  border: 1px solid rgba(224, 190, 130, .39);
  border-radius: 4px 11px 4px 11px;
  background: rgba(8, 20, 34, .75);
  color: #f0d9a8;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}
.as-boss-wrap {
  position: absolute;
  z-index: 2;
  top: 120px;
  left: 50%;
  width: min(40%, 380px);
  transform: translateX(-50%);
  padding: 7px 10px 8px;
  border: 1px solid rgba(235, 198, 131, .6);
  border-radius: 4px 12px 4px 12px;
  background: rgba(12, 21, 32, .84);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .32);
  text-align: center;
  pointer-events: none;
}
.as-boss-title {
  display: block;
  margin-bottom: 5px;
  color: #f2d394;
  font: 700 10px 'Cinzel', 'Cairo', serif;
  letter-spacing: .1em;
}
.as-boss-wrap > div {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(240, 223, 191, .34);
  border-radius: 8px;
  background: #211f20;
}
.as-boss-fill { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #95604c, #e3b768); transition: width .18s ease; }
.as-boss-wrap.is-critical .as-boss-fill { background: linear-gradient(90deg, #6d2027, #f07b5e); }
.as-stage-status {
  position: absolute;
  z-index: 2;
  right: 14px;
  bottom: 14px;
  max-width: min(34%, 300px);
  padding: 5px 9px;
  border: 1px solid rgba(224, 190, 130, .32);
  border-radius: 4px 10px 4px 10px;
  background: rgba(8, 20, 34, .7);
  color: #d8c99f;
  font-size: 9px;
  text-align: end;
  pointer-events: none;
}
.as-touch button:disabled { cursor: not-allowed; opacity: .52; }
.as-message {
  position: absolute;
  z-index: 3;
  top: 25%;
  left: 50%;
  width: max-content;
  max-width: min(86%, 560px);
  transform: translateX(-50%);
  padding: 8px 16px;
  border: 1px solid rgba(245, 207, 138, .66);
  border-radius: 6px 15px 6px 15px;
  background: rgba(8, 18, 30, .88);
  color: #f5dfb0;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 8px 25px rgba(0, 0, 0, .45);
  pointer-events: none;
}
.as-hint {
  position: absolute;
  z-index: 2;
  bottom: 19px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 13px;
  border: 1px solid rgba(244, 208, 141, .6);
  border-radius: 999px;
  background: rgba(8, 18, 30, .84);
  color: #f4dfb7;
  font-size: 11px;
  pointer-events: none;
}
.as-touch { display: none; }
.as-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  color: #aebdc0;
  direction: ltr;
}
.as-footer > span { font-size: 10px; }
.as-weapons { display: flex; gap: 6px; }
.as-weapons button {
  min-height: 35px;
  padding: 6px 10px;
  border: 1px solid rgba(224, 190, 130, .42);
  border-radius: 5px 10px 5px 10px;
  background: rgba(17, 31, 47, .94);
  color: #e9d7b4;
  font: 700 10px 'Cairo', sans-serif;
}
.as-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
  background: rgba(5, 13, 24, .81);
  backdrop-filter: blur(6px);
  direction: inherit;
}
.as-error { z-index: 8; }
.as-dialog {
  width: min(100%, 470px);
  max-height: 100%;
  overflow: auto;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid rgba(230, 194, 127, .67);
  border-radius: 5px 23px 5px 23px;
  background: radial-gradient(ellipse at 50% 0, rgba(180, 141, 74, .2), transparent 55%), #18283b;
  box-shadow: 0 22px 68px rgba(0, 0, 0, .67), inset 0 1px rgba(255, 237, 200, .1);
  text-align: center;
}
.as-dialog > small { color: #dec18a; font: 700 10px 'Cinzel', 'Cairo', serif; letter-spacing: .14em; }
.as-dialog h3 { margin: 7px 0 12px; color: #f6dfac; font: 700 clamp(22px, 4vw, 32px)/1.25 'Cinzel', 'Cairo', serif; }
.as-dialog p { color: #c8d0ce; font-size: 12px; line-height: 1.65; }
.as-dialog button {
  display: block;
  width: 100%;
  min-height: 43px;
  margin-top: 9px;
  padding: 9px 14px;
  border: 1px solid #e4c382;
  border-radius: 4px 12px 4px 12px;
  background: linear-gradient(115deg, #e2c586, #ab824d);
  color: #152236;
  font: 800 12px 'Cairo', sans-serif;
}
.as-dialog button + button { background: #23364a; color: #eddbb7; }
.as-sigil { color: #ebca8a; font-size: 47px; line-height: 1; text-shadow: 0 0 22px #c28b43; }
.as-controls-copy { padding: 9px; border-inline-start: 2px solid #bb985d; background: rgba(6, 17, 29, .55); text-align: start; }
.as-save-error { color: #ffb9b2 !important; }
.adventure-stages button:focus-visible { outline: 2px solid #ffe4a8; outline-offset: 2px; }
@media (pointer: coarse), (max-width: 720px) {
  .as-header { align-items: flex-start; }
  .as-actions { max-width: 48%; }
  .as-actions button { min-height: 40px; padding-inline: 9px; }
  .as-world { height: clamp(350px, calc(100dvh - 272px), 510px); min-height: 340px; }
  .as-hud { inset: 8px 8px auto; grid-template-columns: minmax(100px, 1fr) minmax(80px, 1.5fr); gap: 6px; }
  .as-health, .as-weapon { padding: 6px 8px; }
  .as-objective { grid-row: 2; grid-column: 1 / -1; max-width: 93%; padding: 5px 9px; font-size: 10px; }
  .as-weapon { grid-column: 2; grid-row: 1; min-width: 0; }
  .as-progress { top: 87px; max-width: 90%; font-size: 9px; }
  .as-boss-wrap { top: 132px; width: min(66%, 340px); }
  .as-stage-status { display: none; }
  .as-touch { position: absolute; z-index: 3; inset: auto 8px 8px; display: flex; align-items: end; justify-content: space-between; pointer-events: none; }
  .as-dpad { display: grid; grid-template-columns: repeat(3, 42px); grid-template-rows: repeat(2, 39px); gap: 3px; pointer-events: auto; }
  .as-dpad button, .as-pad button {
    display: grid;
    place-items: center;
    min-width: 42px;
    min-height: 39px;
    padding: 4px;
    border: 1px solid rgba(229, 197, 138, .61);
    border-radius: 8px;
    background: rgba(16, 32, 49, .9);
    color: #f0d9a6;
    font: 800 15px 'Cairo', sans-serif;
    touch-action: none;
    user-select: none;
  }
  .as-dpad [data-move="up"] { grid-column: 2; grid-row: 1; }
  .as-dpad [data-move="left"] { grid-column: 1; grid-row: 2; }
  .as-dpad [data-move="down"] { grid-column: 2; grid-row: 2; }
  .as-dpad [data-move="right"] { grid-column: 3; grid-row: 2; }
  .as-pad { display: grid; grid-template-columns: repeat(2, minmax(61px, 76px)); gap: 4px; pointer-events: auto; }
  .as-pad button { min-height: 41px; background: rgba(35, 51, 65, .94); font-size: 10px; }
  .as-footer { display: grid; gap: 6px; }
  .as-footer > span { display: none; }
  .as-weapons { justify-content: space-between; }
  .as-weapons button { flex: 1; min-height: 40px; padding: 5px 3px; font-size: 9px; }
}
@media (max-width: 430px) {
  .as-brand { gap: 8px; }
  .as-portrait { width: 39px; height: 39px; }
  .as-brand small { font-size: 9px; }
  .as-brand p { max-width: 175px; font-size: 9px; }
  .as-actions { gap: 4px; }
  .as-actions button { min-height: 37px; padding: 5px 7px; font-size: 9px; }
  .as-preview { display: none; }
  .as-world { height: clamp(330px, calc(100dvh - 270px), 460px); min-height: 330px; }
  .as-dpad { grid-template-columns: repeat(3, 38px); grid-template-rows: repeat(2, 36px); }
  .as-dpad button { min-width: 38px; min-height: 36px; }
  .as-pad { grid-template-columns: repeat(2, 64px); }
  .as-pad button { min-width: 64px; min-height: 39px; }
}
@media (prefers-reduced-motion: reduce) {
  .adventure-stages *, .adventure-stages *::before, .adventure-stages *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}