/* Build 07A — Chapter Zero, an illustrated threshold into the LifeQuest world. */
#screen-adventure {
  --adv-ink: #101a2b;
  --adv-deep: #0b1422;
  --adv-stone: #263246;
  --adv-gold: #d8b574;
  --adv-gold-light: #f1d9a5;
  --adv-mist: #c4d0d0;
  --adv-muted: #9eabb5;
  --adv-line: rgba(218, 186, 126, .34);
  position: relative;
  width: min(1440px, calc(100vw - 32px));
  margin-inline: auto;
  padding: 22px 0 calc(104px + env(safe-area-inset-bottom, 0px));
  color: #f0eee6;
  isolation: isolate;
}
#screen-adventure::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -30px 0 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 49% 23%, rgba(118, 130, 135, .11), transparent 39%),
    radial-gradient(ellipse at 8% 45%, rgba(74, 115, 128, .08), transparent 34%),
    linear-gradient(180deg, rgba(22, 31, 49, .48), transparent 70%);
}
.adv-shell { max-width: 1320px; margin: 0 auto; }
.adv-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px 30px;
  padding: clamp(20px, 3vw, 36px);
  overflow: hidden;
  border: 1px solid rgba(222, 189, 128, .32);
  border-radius: 25px 8px 25px 8px;
  background:
    linear-gradient(110deg, rgba(18, 30, 46, .97), rgba(31, 43, 59, .91) 55%, rgba(20, 33, 49, .97)),
    #172338;
  box-shadow: 0 24px 58px rgba(2, 8, 18, .4), inset 0 1px rgba(255, 233, 190, .12);
}
.adv-hero::before {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: 0;
  opacity: .48;
  background:
    linear-gradient(118deg, transparent 0 56%, rgba(235, 208, 160, .035) 56.2%, transparent 56.5%),
    radial-gradient(circle, rgba(237, 217, 178, .27) .7px, transparent 1.2px) 17px 21px / 76px 83px;
  mask-image: linear-gradient(90deg, #000, transparent 75%);
}
.adv-return {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 43px;
  width: max-content;
  padding: 8px 15px;
  border: 1px solid rgba(225, 190, 124, .48);
  border-radius: 4px 12px 4px 12px;
  background: rgba(8, 18, 31, .62);
  color: #f1d8a5;
  font: 800 11px/1.4 'Cairo', sans-serif;
  letter-spacing: .015em;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.adv-return::before { content: "←"; font: 17px/1 'Cinzel', serif; }
[dir="rtl"] .adv-return::before { content: "→"; }
.adv-return:hover { transform: translateY(-2px); background: rgba(225, 190, 124, .13); border-color: #e7c988; }
.adv-intro { min-width: 0; position: relative; }
.adv-eyebrow {
  display: block;
  color: #cfb47f;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .19em;
  line-height: 1.5;
  text-transform: uppercase;
}
#adv-title {
  margin: 6px 0 7px;
  color: #f3ddaf;
  font-family: 'Cinzel', 'Cairo', serif;
  font-size: clamp(26px, 3.1vw, 42px);
  font-weight: 700;
  letter-spacing: .025em;
  line-height: 1.2;
  text-shadow: 0 3px 20px rgba(0, 0, 0, .36);
}
#adv-intro { max-width: 650px; color: #c3cccd; font-size: 13px; line-height: 1.7; }
.adv-identity {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 225px;
  padding: 12px 14px;
  border-inline-start: 1px solid rgba(223, 190, 130, .35);
}
.adv-avatar {
  width: 56px;
  height: 56px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid #d9b979;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 23%, #697581, #26384a 54%, #121e30);
  background-position: center;
  background-size: cover;
  box-shadow: 0 0 0 4px rgba(213, 178, 111, .1), 0 7px 17px rgba(0, 0, 0, .38);
  font-size: 26px;
}
.adv-avatar[data-frame="bronze"] { border-color: #cd9167; box-shadow: 0 0 0 4px #654532, 0 0 0 7px rgba(232,167,112,.5); }
.adv-avatar[data-frame="silver"] { border-color: #d5e5e7; box-shadow: 0 0 0 4px #547685, 0 0 0 7px rgba(216,234,235,.53); }
.adv-avatar[data-frame="gold"] { border-color: #ffde99; box-shadow: 0 0 0 4px #9d7036, 0 0 0 8px rgba(250,205,118,.61); }
.adv-player { min-width: 0; flex: 1; }
.adv-player strong, .adv-player small { display: block; overflow-wrap: anywhere; }
.adv-player strong { color: #f2dfb8; font-size: 13px; }
.adv-player small { margin-top: 2px; color: #aebdc1; font-size: 10px; }
.adv-ap {
  min-width: 76px;
  padding: 7px 10px;
  border: 1px solid rgba(228, 193, 126, .27);
  border-radius: 9px;
  background: rgba(5, 15, 28, .42);
  text-align: center;
}
.adv-ap small, .adv-ap strong, .adv-ap span { display: block; }
.adv-ap small { color: #afc0c0; font-size: 9px; }
.adv-ap strong { color: #f3d393; font: 700 20px/1.15 'Cinzel', 'Cairo', serif; }
.adv-ap span { color: #97a9ad; font-size: 8px; }
.adv-ap { max-width: 225px; }
.adv-story {
  position: relative;
  display: flex;
  align-items: center;
  gap: 17px;
  margin: 18px 2px 23px;
  padding: 14px 19px;
  border-inline-start: 2px solid #9e8354;
  background: linear-gradient(90deg, rgba(26, 42, 57, .65), rgba(26, 42, 57, .14));
  color: #c9d0ce;
  font-size: 12px;
  line-height: 1.7;
}
.adv-griffin-symbol {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  flex: none;
  border: 1px solid rgba(221, 190, 132, .42);
  border-radius: 50%;
  color: #e4c98e;
  font: 700 19px/1 'Cinzel', serif;
  text-shadow: 0 0 15px rgba(228, 197, 132, .3);
}
.adv-chapter-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 2px 12px;
}
.adv-chapter-heading h2, .adv-chapter-heading h3 {
  margin: 0;
  color: #f1d9a6;
  font: 700 clamp(18px, 2.2vw, 24px)/1.3 'Cinzel', 'Cairo', serif;
  letter-spacing: .035em;
}
.adv-chapter-heading small { color: #a9b7bb; font-size: 10px; }
.adv-map-scroll {
  position: relative;
  overflow: hidden;
  direction: ltr;
  border: 1px solid rgba(220, 186, 122, .55);
  border-radius: 23px 6px 23px 6px;
  background: #152337;
  box-shadow: 0 26px 65px rgba(0, 0, 0, .48), inset 0 0 0 5px rgba(9, 18, 32, .42);
}
.adv-map {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 390px;
  overflow: hidden;
  isolation: isolate;
  direction: ltr;
}
.adv-map::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 15, 27, .16), transparent 22% 73%, rgba(7, 15, 27, .36)),
    radial-gradient(ellipse at center, transparent 42%, rgba(5, 12, 23, .33));
  box-shadow: inset 0 0 75px 18px rgba(5, 12, 23, .35);
}
.adv-map-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  user-select: none;
  pointer-events: none;
}
.adv-map-route {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.adv-map-route path {
  fill: none;
  stroke: rgba(241, 205, 135, .78);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 2 8;
  filter: drop-shadow(0 1px 4px rgba(3, 8, 15, .95));
}
.adv-map-overlay {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(8, 16, 27, .19), transparent 18% 82%, rgba(8, 16, 27, .17));
}
.adv-stage-layer { position: absolute; z-index: 4; inset: 0; pointer-events: auto; }
.adv-stage {
  position: absolute;
  left: var(--stage-left, 50%);
  top: var(--stage-top, 50%);
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 9px;
  min-width: 152px;
  max-width: 190px;
  min-height: 54px;
  padding: 8px 11px;
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  border: 1px solid rgba(223, 189, 127, .73);
  border-radius: 3px 13px 3px 13px;
  color: #f3eee1;
  background: linear-gradient(135deg, rgba(9, 20, 34, .94), rgba(22, 37, 53, .91));
  box-shadow: 0 9px 22px rgba(0, 0, 0, .64), inset 0 1px rgba(255, 237, 197, .13);
  backdrop-filter: blur(6px);
  text-align: start;
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.adv-stage:hover, .adv-stage:focus-visible {
  transform: translate(-50%, -50%) scale(1.045);
  border-color: #ffe1a1;
  background: linear-gradient(135deg, rgba(20, 34, 48, .98), rgba(40, 53, 65, .96));
  box-shadow: 0 0 0 3px rgba(226, 190, 121, .2), 0 12px 25px rgba(0, 0, 0, .65);
}
.adv-stage-number {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(219, 184, 118, .67);
  border-radius: 50%;
  color: #f0d29a;
  background: radial-gradient(circle at 35% 25%, #5b5c57, #202c39 72%);
  font: 700 14px/1 'Cinzel', serif;
}
.adv-stage strong { min-width: 0; color: #f4dfb4; font-size: 10px; line-height: 1.35; }
.adv-stage small {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: #c1cccb;
  font-size: 9px;
  line-height: 1.25;
}
.adv-stage small::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: #b5a47c;
}
.adv-stage.available { border-color: #e6ca8d; box-shadow: 0 0 22px rgba(230, 197, 131, .29), 0 9px 22px rgba(0,0,0,.62); }
.adv-stage.available .adv-stage-number { color: #fff1c9; box-shadow: 0 0 16px rgba(233, 197, 124, .33); }
.adv-stage.available small::before { background: #f0d18e; box-shadow: 0 0 8px #e8c27e; }
.adv-stage.completed { border-color: rgba(151, 199, 177, .72); }
.adv-stage.completed .adv-stage-number { border-color: #92b9a4; color: #d4efdc; background: radial-gradient(circle at 35% 25%, #49665e, #1d3939); }
.adv-stage.completed small::before { background: #a7d2b5; }
.adv-stage.locked { border-color: rgba(169, 176, 180, .36); background: linear-gradient(135deg, rgba(12, 21, 33, .94), rgba(26, 35, 46, .9)); }
.adv-stage.locked .adv-stage-number { color: #aeb7bb; border-color: rgba(174, 183, 187, .38); filter: saturate(.5); }
.adv-stage.locked strong, .adv-stage.locked small { color: #aeb8bd; }
.adv-stage.locked small::before { background: #87939b; }
.adv-stage.selected { border-color: #ffe1a1; box-shadow: 0 0 0 2px rgba(226, 190, 121, .33), 0 9px 22px rgba(0,0,0,.62); }
.adv-map-hint { margin: 10px 4px 0; color: #a8b5ba; font-size: 10px; line-height: 1.5; text-align: center; }
.adv-stage-list { display: none; }
.adv-detail, .adv-scene {
  position: relative;
  scroll-margin-top: 14px;
  margin-top: 23px;
  padding: clamp(19px, 3vw, 30px);
  overflow: hidden;
  border: 1px solid rgba(220, 187, 126, .35);
  border-radius: 6px 23px 6px 23px;
  background:
    radial-gradient(ellipse at 92% 0%, rgba(167, 139, 91, .12), transparent 41%),
    linear-gradient(135deg, rgba(34, 48, 65, .97), rgba(17, 31, 48, .98));
  box-shadow: 0 18px 43px rgba(0, 0, 0, .26), inset 0 1px rgba(255, 255, 255, .06);
}
#adv-detail:not([open]) { display: none; }
#adv-detail[open] {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: min(680px, calc(100vw - 28px));
  max-width: none;
  max-height: min(85dvh, 760px);
  margin: auto;
  overflow-y: auto;
}
#adv-detail::backdrop { background: rgba(6, 12, 23, .77); backdrop-filter: blur(4px); }
.adv-detail-close {
  position: absolute;
  z-index: 1;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(220, 187, 126, .55);
  border-radius: 8px;
  color: #f1d8a4;
  background: #263246;
  cursor: pointer;
}
[dir="rtl"] .adv-detail-close { right: auto; left: 12px; }
.adv-detail::before, .adv-scene::before {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: 10px;
  border: 1px solid rgba(225, 195, 139, .09);
}
.adv-detail h2, .adv-scene h2, .adv-detail h3, .adv-scene h3 {
  position: relative;
  margin: 0 0 8px;
  color: #f1d8a4;
  font: 700 clamp(20px, 2.4vw, 28px)/1.3 'Cinzel', 'Cairo', serif;
}
.adv-detail p, .adv-scene p { position: relative; color: #c4cfce; font-size: 12px; line-height: 1.7; }
.adv-detail-story { max-width: 790px; margin-bottom: 16px; }
.adv-detail dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 15px 0; }
.adv-detail dl dt { color: #b0c0c1; font-size: 10px; font-weight: 700; }
.adv-detail dl dd { margin: 4px 0 0; color: #f1ddba; font-size: 12px; line-height: 1.5; }
.adv-detail-objective, .adv-detail-type, .adv-detail-ap, .adv-detail-reason, .adv-detail-status {
  margin-top: 9px;
  padding: 10px 13px;
  border-inline-start: 2px solid rgba(219, 183, 113, .6);
  background: rgba(6, 17, 31, .33);
}
.adv-detail-actions, .adv-scene-actions { position: relative; display: flex; gap: 10px; margin-top: 20px; }
.adv-detail-actions button, .adv-scene-actions button {
  min-height: 44px;
  padding: 10px 19px;
  border: 1px solid rgba(232, 198, 134, .68);
  border-radius: 3px 11px 3px 11px;
  background: linear-gradient(135deg, #e5c786, #b68b4f);
  color: #172235;
  font: 800 12px/1.4 'Cairo', sans-serif;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .22);
  transition: transform .2s ease, filter .2s ease, box-shadow .2s ease;
}
.adv-detail-actions button:hover:not(:disabled), .adv-scene-actions button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 10px 24px rgba(0, 0, 0, .3); }
.adv-detail-actions button:disabled { cursor: not-allowed; filter: grayscale(.7); opacity: .58; }
.adv-scene-actions .btn-ghost { background: rgba(10, 23, 39, .55); color: #f1d8a5; box-shadow: none; }
.adv-scene { border-color: rgba(115, 162, 168, .4); background: radial-gradient(ellipse at 50% 0%, rgba(74, 132, 137, .13), transparent 50%), linear-gradient(145deg, #1b3041, #121d30); }
.adv-scene-art {
  position: relative;
  min-height: 150px;
  margin: -10px -10px 19px;
  border: 1px solid rgba(213, 187, 131, .22);
  background:
    linear-gradient(180deg, rgba(10, 20, 32, .12), rgba(9, 18, 31, .76)),
    url('../attached_assets/generated_images/lifequest-adventure-realm.jpg') center 48% / cover;
}
.adv-scene-note { margin-top: 13px; color: #aebdc0 !important; font-size: 10px !important; }
.adv-banner, .adv-error {
  position: relative;
  margin: 0 0 14px;
  padding: 11px 14px;
  border: 1px solid rgba(225, 187, 114, .46);
  border-radius: 4px 12px 4px 12px;
  background: rgba(30, 43, 57, .88);
  color: #edd5a2;
  font-size: 11px;
  line-height: 1.6;
}
.adv-banner[data-preview] { border-color: rgba(126, 185, 184, .5); color: #c4e1d9; }
.adv-banner[data-preview]:not([hidden]) { display: inline-block; margin: 12px 0 0; padding: 5px 11px; border-radius: 999px; font-size: 10px; }
.gate-preview-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 62px;
  margin-top: 10px;
  padding: 9px 12px;
  border-color: rgba(226, 180, 90, .32);
  background: rgba(24, 34, 66, .58);
  color: #efd18f;
  text-align: center;
  opacity: 1;
}
.gate-preview-btn:hover:not(:disabled) {
  border-color: rgba(226, 180, 90, .68);
  background: rgba(32, 43, 78, .8);
}
.gate-preview-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(226, 180, 90, .35);
  border-radius: 999px;
  padding: 1px 7px;
  background: rgba(226, 180, 90, .12);
  color: #f2d89f;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.5;
}
.gate-preview-btn strong { font-size: 12px; line-height: 1.35; }
.gate-preview-btn small { color: #bfc8dc; font-size: 10px; line-height: 1.35; }
.gate-preview-btn[hidden] { display: none; }
html[data-appearance="light"] .gate-modal .gate-preview-btn {
  border-color: rgba(145, 98, 29, .4);
  background: rgba(32, 37, 74, .06);
  color: #765016;
}
html[data-appearance="light"] .gate-modal .gate-preview-btn:hover:not(:disabled) {
  background: rgba(32, 37, 74, .1);
}
html[data-appearance="light"] .gate-preview-badge {
  border-color: rgba(145, 98, 29, .32);
  background: rgba(145, 98, 29, .1);
  color: #765016;
}
html[data-appearance="light"] .gate-preview-btn small { color: #536176; }
.adv-error { border-color: rgba(213, 122, 127, .55); color: #f0b7b8; }
#screen-adventure button:focus-visible {
  outline: 2px solid #ffe1a1;
  outline-offset: 3px;
}
#screen-adventure button:not(.adv-stage):active:not(:disabled) { transform: translateY(0) scale(.985); }
#screen-adventure .adv-stage:active:not(:disabled) { transform: translate(-50%, -50%) scale(.985); border-color: #ffe1a1; }

@media (min-width: 1440px) {
  .adv-shell { max-width: 1360px; }
}
@media (max-width: 900px) {
  #screen-adventure { width: min(calc(100vw - 28px), 1050px); }
  .adv-hero { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .adv-identity { width: 100%; border-inline-start: 0; border-top: 1px solid rgba(223, 190, 130, .27); padding: 12px 0 0; }
  .adv-map { min-height: 350px; }
  .adv-stage { min-width: 137px; max-width: 165px; column-gap: 7px; padding: 7px 8px; }
  .adv-stage-number { width: 30px; height: 30px; }
  .adv-stage strong { font-size: 9px; }
}
@media (max-width: 600px) {
  #screen-adventure { width: calc(100vw - 22px); padding-top: 12px; }
  .adv-hero { padding: 18px 16px; border-radius: 19px 5px 19px 5px; }
  .adv-return { min-height: 42px; }
  #adv-title { font-size: clamp(24px, 7vw, 31px); }
  #adv-intro { font-size: 12px; }
  .adv-identity { display: grid; grid-template-columns: 48px minmax(0,1fr); gap: 10px; }
  .adv-avatar { width: 48px; height: 48px; }
  .adv-player { min-width: 0; }
  .adv-player strong { font-size: 12px; }
  .adv-ap { grid-column: 1 / -1; min-width: 0; width: 100%; max-width: none; padding: 8px; }
  .adv-ap span { font-size: 9px; }
  .adv-story { gap: 12px; margin: 14px 0 19px; padding: 12px; font-size: 11px; }
  .adv-griffin-symbol { width: 38px; height: 38px; }
  .adv-chapter-heading { align-items: start; flex-direction: column; gap: 4px; margin-bottom: 10px; }
  .adv-chapter-heading h2 { font-size: 19px; }
  .adv-map-scroll { border-radius: 15px 4px 15px 4px; overflow-x: auto; overflow-y: hidden; touch-action: pan-x; }
  .adv-map { width: 840px; min-height: 0; aspect-ratio: 16 / 9; }
  .adv-map-art { object-position: center; }
  .adv-stage {
    grid-template-columns: 28px minmax(0, 1fr);
    min-width: 0;
    width: 145px;
    max-width: 145px;
    min-height: 47px;
    padding: 5px 6px;
    column-gap: 6px;
    border-radius: 3px 9px 3px 9px;
  }
  .adv-stage-number { width: 26px; height: 26px; font-size: 11px; }
  .adv-stage strong { font-size: 10px; line-height: 1.2; }
  .adv-stage small { font-size: 9px; }
  .adv-map-route path { stroke-width: 3; }
  .adv-map-hint { margin-top: 8px; font-size: 9px; }
  .adv-stage-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 12px;
  }
  .adv-list-stage {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 46px;
    padding: 7px 9px;
    border: 1px solid rgba(219, 185, 120, .34);
    border-radius: 3px 10px 3px 10px;
    background: linear-gradient(145deg, rgba(32, 47, 64, .94), rgba(15, 28, 44, .94));
    color: #e8dfce;
    cursor: pointer;
    touch-action: manipulation;
    text-align: start;
  }
  .adv-list-stage strong { font-size: 9px; line-height: 1.35; }
  .adv-list-stage small { display: block; color: #aebbc0; font-size: 8px; }
  .adv-list-stage.locked { opacity: .7; border-color: rgba(169, 176, 180, .25); }
  .adv-list-stage.available { border-color: rgba(230, 197, 131, .75); }
  .adv-list-stage.completed { border-color: rgba(151, 199, 177, .67); }
  .adv-list-stage.selected { border-color: #ffe1a1; box-shadow: 0 0 0 2px rgba(226,190,121,.2); }
  .adv-list-stage .adv-stage-number { width: 25px; height: 25px; }
  .adv-detail, .adv-scene { margin-top: 16px; padding: 18px 15px; border-radius: 5px 17px 5px 17px; }
  .adv-detail dl { grid-template-columns: 1fr; }
  .adv-detail-actions, .adv-scene-actions { flex-direction: column; }
  .adv-detail-actions button, .adv-scene-actions button { width: 100%; }
  .adv-scene-art { min-height: 125px; }
}
@media (max-width: 360px) {
  .adv-stage-list { grid-template-columns: 1fr; }
  .adv-stage { width: 145px; }
  .adv-map { aspect-ratio: 16 / 9; }
  .adv-story { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  #screen-adventure *, #screen-adventure *::before, #screen-adventure *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.adv-loadout-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 16px 0 3px;
}
.adv-loadout-button, .adv-tools-tab, .adv-tools-return, .adv-prep-actions button {
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid rgba(220, 187, 126, .45);
  border-radius: 4px 12px 4px 12px;
  background: linear-gradient(145deg, rgba(31, 47, 64, .97), rgba(13, 27, 43, .96));
  color: #f0d9a9;
  font: 700 11px/1.4 'Cairo', sans-serif;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.adv-loadout-button:hover, .adv-tools-tab:hover, .adv-tools-return:hover, .adv-prep-actions button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #f4d99e;
  background: linear-gradient(145deg, rgba(50, 67, 81, .98), rgba(21, 37, 54, .98));
}
.adv-tools-dialog {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: min(850px, calc(100vw - 28px));
  max-width: none;
  max-height: min(88dvh, 850px);
  margin: auto;
  padding: clamp(20px, 3vw, 31px);
  overflow-y: auto;
  border: 1px solid rgba(220, 187, 126, .47);
  border-radius: 6px 23px 6px 23px;
  background:
    radial-gradient(ellipse at 92% 0%, rgba(167, 139, 91, .17), transparent 41%),
    linear-gradient(135deg, rgba(34, 48, 65, .99), rgba(14, 28, 45, .99));
  color: #f0eee6;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .58), inset 0 1px rgba(255, 255, 255, .06);
}
.adv-tools-dialog::backdrop { background: rgba(6, 12, 23, .8); backdrop-filter: blur(4px); }
.adv-tools-dialog[data-mode="prep"] {
  width: min(610px, calc(100vw - 28px));
  max-height: min(76dvh, 640px);
}
.adv-tools-dialog[data-mode="prep"] .adv-tools-tabs { display: none; }
.adv-tools-dialog[data-mode="prep"] .adv-tools-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 10px 0 12px; }
.adv-tools-dialog h3 {
  position: relative;
  margin: 5px 48px 5px 0;
  color: #f1d8a4;
  font: 700 clamp(20px, 2.4vw, 28px)/1.3 'Cinzel', 'Cairo', serif;
}
[dir="rtl"] .adv-tools-dialog h3 { margin-right: 0; margin-left: 48px; }
.adv-tools-note { margin: 7px 0 15px; color: #c4cfce; font-size: 11px; line-height: 1.6; }
.adv-tools-note.error { color: #f0b7b8; }
.adv-tools-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.adv-tools-tab { min-height: 36px; padding: 7px 13px; font-size: 10px; }
.adv-tools-tab.active { border-color: #f1d391; color: #171f2d; background: linear-gradient(135deg, #e5c786, #b68b4f); }
.adv-tools-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 13px 0 17px;
}
.adv-tools-stat {
  min-width: 0;
  padding: 10px 9px;
  border: 1px solid rgba(221, 190, 133, .27);
  border-radius: 3px 10px 3px 10px;
  background: rgba(7, 18, 31, .42);
  text-align: center;
}
.adv-tools-stat strong, .adv-tools-stat small { display: block; }
.adv-tools-stat strong { color: #f3d89d; font: 700 17px/1.3 'Cinzel', 'Cairo', serif; overflow-wrap: anywhere; }
.adv-tools-stat small { margin-top: 3px; color: #aebdc1; font-size: 9px; line-height: 1.4; }
.adv-choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.adv-choice-card {
  display: flex;
  min-height: 130px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 15px 10px;
  border: 1px solid rgba(218, 186, 126, .34);
  border-radius: 4px 15px 4px 15px;
  background: linear-gradient(145deg, rgba(30, 46, 62, .95), rgba(11, 24, 40, .96));
  color: #f0e9d9;
  cursor: pointer;
  text-align: center;
}
.adv-choice-card.selected { border-color: #f0d18e; box-shadow: 0 0 0 2px rgba(226, 190, 121, .2), 0 0 22px rgba(230, 197, 131, .16); }
.adv-choice-icon { font-size: 28px; line-height: 1.2; }
.adv-choice-card strong { color: #f2dbab; font-size: 12px; }
.adv-choice-card small { color: #aebdc1; font-size: 9px; line-height: 1.4; }
.adv-skill-branch { margin: 14px 0 0; }
.adv-skill-branch h4, .adv-prep-branch h4 {
  margin: 0 0 8px;
  color: #e9d19d;
  font: 700 13px/1.4 'Cinzel', 'Cairo', serif;
}
.adv-skill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.adv-skill-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(218, 186, 126, .28);
  border-radius: 4px 12px 4px 12px;
  background: rgba(6, 18, 31, .48);
}
.adv-skill-card.owned { border-color: rgba(151, 199, 177, .61); background: rgba(20, 47, 47, .48); }
.adv-skill-card.future { opacity: .72; }
.adv-skill-icon { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid rgba(219, 184, 118, .46); border-radius: 50%; color: #f2d491; font-size: 16px; }
.adv-skill-copy { min-width: 0; }
.adv-skill-copy strong { display: block; color: #f1dbad; font-size: 10px; }
.adv-skill-copy p { margin: 2px 0; color: #b9c4c4; font-size: 9px; line-height: 1.4; }
.adv-skill-copy small { color: #a9b8bc; font-size: 8px; line-height: 1.3; }
.adv-skill-buy {
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid rgba(228, 193, 126, .54);
  border-radius: 3px 9px 3px 9px;
  background: rgba(180, 139, 76, .2);
  color: #f0d9a9;
  font: 700 9px/1.3 'Cairo', sans-serif;
  cursor: pointer;
}
.adv-skill-buy:disabled { cursor: not-allowed; opacity: .54; }
.adv-prep-skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.adv-prep-branch { min-width: 0; padding: 12px; border: 1px solid rgba(218, 186, 126, .25); border-radius: 3px 12px 3px 12px; background: rgba(6, 18, 31, .36); }
.adv-prep-branch ul { margin: 0; padding-inline-start: 19px; color: #c1cccb; font-size: 10px; line-height: 1.6; }
.adv-prep-loadout { padding: 11px 13px; border: 1px solid rgba(218, 186, 126, .25); border-radius: 3px 12px 3px 12px; background: rgba(6, 18, 31, .36); }
.adv-prep-loadout strong { color: #e9d19d; font-size: 10px; }
.adv-prep-loadout p { margin: 5px 0 0; color: #c1cccb; font-size: 10px; line-height: 1.5; }
.adv-rewards-note { margin: 13px 0; color: #aebdc0; font-size: 9px; line-height: 1.5; }
.adv-prep-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.adv-prep-actions button:disabled { cursor: not-allowed; opacity: .56; }
.adv-prep-actions button.primary { border-color: rgba(232, 198, 134, .68); background: linear-gradient(135deg, #e5c786, #b68b4f); color: #172235; }
.adv-tools-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.adv-tools-return { min-height: 38px; padding: 7px 14px; }
.adv-prep-button { background: rgba(10, 23, 39, .55) !important; color: #f1d8a5 !important; }

@media (max-width: 650px) {
  .adv-loadout-bar { display: grid; grid-template-columns: 1fr; }
  .adv-tools-dialog { max-height: min(90dvh, 850px); padding: 20px 15px; border-radius: 5px 17px 5px 17px; }
  .adv-tools-dialog[data-mode="prep"] { max-height: min(78dvh, 640px); }
  .adv-tools-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adv-choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adv-skill-grid, .adv-prep-skills { grid-template-columns: 1fr; }
  .adv-skill-card { grid-template-columns: 30px minmax(0, 1fr); }
  .adv-skill-buy { grid-column: 2; justify-self: start; }
  .adv-prep-actions { flex-direction: column; }
  .adv-prep-actions button { width: 100%; }
}