/* Screen layouts: the trail, the fight, the aftermath. */

/* ============ path ============ */
.path-top {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: var(--sp-3) 0;
  background: var(--canvas);
}
.path-top-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }

.section-banner {
  position: relative;
  margin-bottom: var(--sp-3);
  padding: var(--sp-4);
  padding-right: 128px;
  min-height: 132px;
  background: var(--brown-500);
  color: #fff;
  border-radius: var(--r-card);
  box-shadow: 0 var(--underside) 0 var(--brown-600);
  overflow: hidden;
}
.section-eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.4px;
  text-transform: uppercase; color: rgba(255, 255, 255, 0.8);
}
.section-title { font-size: 22px; line-height: 28px; font-weight: 800; letter-spacing: -0.2px; }
.section-sub { margin-top: var(--sp-1); font-size: 14px; font-weight: 700; color: rgba(255, 255, 255, 0.85); }
.section-hero {
  position: absolute;
  right: -10px; bottom: -12px;
  width: 132px;
}

.story-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: 0 var(--underside) 0 var(--line);
}
.story-mascot { width: 64px; flex: none; }
.story-text { font-size: 14px; font-weight: 600; color: var(--ink-soft); }

.trail {
  position: relative;
  margin-top: var(--sp-6);
  display: grid;
  gap: var(--sp-8);
  padding-bottom: var(--sp-8);
}
.trail::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 44px;
  transform: translateX(-50%);
  background: var(--trail);
  border-left: 3px solid var(--trail-edge);
  border-right: 3px solid var(--trail-edge);
  border-radius: var(--r-pill);
  z-index: 0;
}

.node-slot {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
  transform: translateX(var(--offset, 0));
}

.node {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--r-pill);
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  position: relative;
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.node:active:not(:disabled) { transform: translateY(5px); box-shadow: none !important; }
.node.is-available { background: var(--brown-500); box-shadow: 0 5px 0 var(--brown-600); }
.node.is-complete { background: var(--brown-600); box-shadow: 0 5px 0 var(--brown-700); }
.node.is-locked { background: var(--locked); box-shadow: 0 5px 0 var(--locked-shadow); color: var(--ink-mute); cursor: not-allowed; }
.node-art { width: 58px; height: 58px; object-fit: contain; }
.node-lock { font-size: 22px; }
.node-check {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  background: var(--ok);
  color: #fff;
  border: 2px solid var(--canvas);
  border-radius: var(--r-pill);
  font-size: 13px;
}
.node.is-available::after {
  content: '';
  position: absolute;
  inset: -8px;
  border: 3px solid var(--brown-400);
  border-radius: var(--r-pill);
  opacity: 0.6;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50% { transform: scale(1.08); opacity: 0; }
}

.start-bubble {
  position: relative;
  padding: 6px var(--sp-3);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-tile);
  box-shadow: 0 3px 0 var(--line);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--brown-500);
}
.start-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px; left: 50%;
  width: 12px; height: 12px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--surface);
  border-right: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
}

.node-label { text-align: center; }
.node-title { font-size: 15px; font-weight: 800; }
.node-topic { font-size: 12px; font-weight: 600; color: var(--ink-soft); }

.trail-yurt {
  position: absolute;
  width: 66px;
  right: -96px;
  top: 12px;
  opacity: 0.95;
  pointer-events: none;
}
.node-slot:nth-child(even) .trail-yurt { right: auto; left: -96px; }

/* ============ battle ============ */
.ex-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  background: var(--canvas);
}
.ex-close {
  width: 44px; height: 44px;
  flex: none;
  border: none;
  background: transparent;
  color: var(--ink-mute);
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  border-radius: var(--r-pill);
}
.hp-mini { display: inline-flex; align-items: center; gap: var(--sp-1); font-variant-numeric: tabular-nums; }
.hp-mini-icon { width: 22px; height: 22px; }

.stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background:
    linear-gradient(to bottom, transparent 55%, var(--steppe) 55%),
    var(--brown-100);
  border-radius: var(--r-card);
  border: 2px solid var(--line);
  overflow: hidden;
}
.fighter { display: grid; justify-items: center; gap: var(--sp-2); position: relative; }
.fighter-enemy { order: 2; }
.fighter-art { width: 116px; height: 116px; object-fit: contain; transition: transform 120ms ease; }
.fighter-art-hero { transform: scaleX(-1); }
.fighter-art.is-hit { animation: hit 400ms ease; }
.fighter-art-hero.is-hit { animation: hit-mirror 400ms ease; }
@keyframes hit {
  0%, 100% { transform: none; }
  25% { transform: translateX(-8px) rotate(-4deg); }
  60% { transform: translateX(6px) rotate(3deg); }
}
@keyframes hit-mirror {
  0%, 100% { transform: scaleX(-1); }
  25% { transform: scaleX(-1) translateX(-8px) rotate(-4deg); }
  60% { transform: scaleX(-1) translateX(6px) rotate(3deg); }
}
.fighter-meta { width: 100%; display: grid; gap: var(--sp-1); }
.fighter-name { font-size: 13px; font-weight: 800; text-align: center; }

.float-num {
  position: absolute;
  top: 8px; left: 50%;
  font-size: 22px;
  font-weight: 800;
  animation: floatup 900ms ease-out forwards;
  pointer-events: none;
}
.float-damage { color: var(--heart); }
.float-heal { color: var(--ok); }
@keyframes floatup {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, -44px); }
}

.spirit-badge {
  grid-column: 1 / -1;
  justify-self: center;
  padding: 4px var(--sp-3);
  background: var(--gold);
  color: var(--brown-700);
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.attack-label {
  margin: var(--sp-4) 0 var(--sp-2);
  font-size: 12px; font-weight: 700; letter-spacing: 0.4px;
  text-transform: uppercase; color: var(--ink-soft);
}
.attacks { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.attack {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: var(--sp-2) var(--sp-1);
  min-height: 88px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-tile);
  box-shadow: 0 3px 0 var(--line);
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease, background-color 120ms ease;
}
.attack:active { transform: translateY(3px); box-shadow: none; }
.attack.is-picked {
  background: var(--brown-100);
  border-color: var(--brown-500);
  box-shadow: 0 3px 0 var(--brown-500);
}
.attack-icon { font-size: 22px; line-height: 1; }
.attack-name { font-size: 13px; font-weight: 800; }
.attack-hint { font-size: 10px; font-weight: 600; color: var(--ink-soft); text-align: center; line-height: 1.2; }
.attack-stat { font-size: 11px; font-weight: 800; color: var(--brown-500); font-variant-numeric: tabular-nums; }

.question {
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-card);
}
.q-prompt { font-size: 18px; line-height: 24px; font-weight: 800; letter-spacing: -0.2px; }
.q-tex { margin: var(--sp-2) 0 var(--sp-3); text-align: center; overflow-x: auto; }
.q-body { margin-top: var(--sp-3); }

/* ============ result ============ */
.result { display: grid; gap: var(--sp-4); padding-top: var(--sp-8); }
.result-card {
  display: grid;
  justify-items: center;
  gap: var(--sp-3);
  padding: var(--sp-6) var(--sp-4);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-sheet);
  box-shadow: 0 var(--underside) 0 var(--line);
  text-align: center;
}
.result-mascot { width: 140px; }
.result-title { font-size: 26px; font-weight: 800; }
.result-sub { font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.result-reward { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: 20px; font-weight: 800; color: var(--gem); }
.result-gem { width: 28px; }
.result-outro { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.result-trophy-art { width: 96px; }

@media (max-width: 380px) {
  .tile-bank { grid-template-columns: 1fr; }
  .fighter-art { width: 96px; height: 96px; }
  .section-banner { padding-right: 104px; }
  .section-hero { width: 108px; }
  .trail-yurt { display: none; }
}
