/* ==========================================================================
   PIGGY'S QUEST — styles
   Sits on top of Chart Run's css/style.css (colours, fonts, buttons, cards,
   dialogs) and only adds what the RPG needs.
   ========================================================================== */

/* ─────────────────────────────── title + scenes */
.scene {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg2);
}
.scene canvas { width: 100%; }
.save-line { margin: 0; text-align: center; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; color: var(--muted); }

/* ─────────────────────────────── map */
.zone-head { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.zone-dots { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.zone-dots li { width: 26px; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .12); }
.zone-dots li.is-done { background: var(--blue); }
.zone-dots li.is-here { background: var(--pink); }
.zone-dots.is-long { gap: 4px; }
.zone-dots.is-long li { width: 16px; }
.zone-title { margin: -4px 0 0; font-family: var(--display); font-weight: 400; font-size: clamp(38px, 11vw, 52px); line-height: 1; color: var(--cream); }
.bar--hp i { background: linear-gradient(90deg, #3BE58C, #9BF0C4); }
.bar--hp i[data-low] { background: var(--red); }
.bar--op i { background: linear-gradient(90deg, var(--pink-dk), var(--pink)); }
.bar--foe i { background: linear-gradient(90deg, var(--red), #FF8FA3); transition: width .35s; }

.path { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; position: relative; }
.path::before {
  content: '';
  position: absolute;
  left: 33px;
  top: 20px;
  bottom: 20px;
  width: 3px;
  border-radius: 3px;
  background: var(--line);
}
.node {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 12px 8px 10px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--bg2));
}
.node__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .05);
  font-size: 24px;
}
.node__icon canvas { display: block; }
.node__text b { display: block; font-family: var(--ui); font-size: 16px; }
.node__text small { font-size: 13px; color: var(--muted); }
.node .btn { min-height: 42px; padding: 0 16px; font-size: 15px; box-shadow: 0 3px 0 var(--c-dk); }
.node .btn--ghost { box-shadow: none; }
.node__state { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.node.is-here { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue), 0 8px 24px rgba(47, 127, 224, .25); }
.node.is-boss .node__icon { background: rgba(255, 61, 94, .14); }
.node.is-locked { opacity: .55; }
.node.is-locked .node__icon canvas { filter: grayscale(1) brightness(.7); }
.node.is-done .node__state { color: #3BE58C; }

/* ─────────────────────────────── battle */
.battle { display: flex; flex-direction: column; gap: 8px; padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
body[data-view="battle"] .top { display: none; }
body[data-view="battle"] { overscroll-behavior: none; }
.fighter__name { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.fighter__name b { font-family: var(--ui); font-size: 18px; }
.fighter__name small, .fighter__bars small { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.intent {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin: 6px 0 0;
  padding: 4px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, .03);
  font-family: var(--ui);
  font-weight: 600;
  font-size: 14px;
  color: var(--cream);
}
.intent__icon { font-size: 16px; }
.intent.is-warn { border-color: var(--gold); color: var(--gold); background: rgba(255, 201, 77, .08); animation: pulse 1s ease-in-out infinite; }
.intent.is-phish { border-color: var(--blue-hi); color: var(--blue-hi); background: rgba(125, 184, 247, .08); }
.intent.is-hidden { color: var(--muted); border-style: dashed; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(255, 201, 77, .15); } }
.fighter__bars { display: grid; grid-template-columns: 2em 1fr 4.6em; align-items: center; gap: 4px 8px; }
.fighter__bars small { text-align: right; }
.fighter__tag { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--cream); }
.status { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; margin-top: 6px; }
.status:empty { display: none; }
.status .chip { height: 26px; padding: 0 10px; font-size: 11px; }
.chip--shield { border-color: var(--pink); color: var(--pink); }
.chip--fear { border-color: #B9A6EC; color: #B9A6EC; }
.chip--pump { border-color: #3BE58C; color: #3BE58C; }

.log {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 66px;
  margin: 0;
  padding: 6px 12px;
  overflow: hidden;
  list-style: none;
  border-radius: 14px;
  background: rgba(0, 0, 0, .22);
  font-size: 13.5px;
  line-height: 1.35;
}
.log li { color: var(--muted); }
.log li:last-child { color: var(--cream); }

.moves { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.move {
  display: grid;
  align-content: center;
  gap: 1px;
  min-height: 46px;
  min-width: 0;
  padding: 4px 10px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  color: var(--cream);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.move b, .move small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.move b { font-family: var(--ui); font-size: 15px; }
.move small { font-size: 12px; line-height: 1.3; color: var(--muted); }
.move small em { font-style: normal; font-weight: 700; color: var(--pink); }
.move:active:not(:disabled) { transform: translateY(2px); }
.move:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.move:disabled { opacity: .42; cursor: default; }
.move.is-hint { border-color: var(--gold); }
.move--util { border-style: dashed; }
.moves.is-busy .move { pointer-events: none; }
/* phone held sideways: the scene on the left, the log and moves on the right */
@media (orientation: landscape) and (max-height: 520px) {
  .battle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "foe log" "scene moves" "me moves";
    align-content: start;
    gap: 8px 14px;
    max-width: 920px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .fighter--foe { grid-area: foe; }
  .battle .scene { grid-area: scene; }
  .fighter--me { grid-area: me; }
  .log { grid-area: log; height: auto; min-height: 0; }
  .moves { grid-area: moves; align-content: start; }
}

/* ─────────────────────────────── camp */
.tip p:last-child { margin: 6px 0 0; line-height: 1.5; color: var(--cream); }
.tip { border-top-color: var(--gold); }
.shop__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.shop__list, .bag { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.shop__list li, .bag li {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
}
.item__icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, .06); font-size: 18px; }
.item__text b { display: block; font-family: var(--ui); font-size: 15px; }
.item__text small { font-size: 12.5px; color: var(--muted); }
.shop__list .btn, .bag .btn { min-height: 38px; padding: 0 14px; font-size: 14px; box-shadow: 0 3px 0 var(--c-dk); }
.shop__list .btn--ghost, .bag .btn--ghost { box-shadow: none; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.bag__label { margin: 12px 0 6px; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.bag__label:first-of-type { margin-top: 0; }
.bag li.is-on { outline: 1.5px solid var(--blue); }
.bag__empty { font-size: 14px; color: var(--muted); }

/* ─────────────────────────────── results + end */
.result { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.result li { padding: 10px 12px; border-radius: 12px; background: var(--panel); font-family: var(--ui); font-weight: 600; font-size: 15px; color: var(--cream); }
.result li.is-up { background: rgba(47, 127, 224, .18); color: var(--blue-hi); }
.result li.is-loot { background: rgba(255, 201, 77, .12); color: var(--gold); }
.result li.is-bad { background: rgba(255, 61, 94, .12); color: #FF8FA3; }
.end-stats { grid-template-columns: repeat(3, 1fr); margin: 0; padding: 12px; border-top-color: var(--gold); }

/* ─────────────────────────────── badges + outfits */
.links { display: flex; justify-content: center; gap: 8px; }
.links .link-btn { margin: 0; }
#badgeList li { font-size: 14px; font-weight: 500; }
#badgeList li:not(.is-loot) { color: var(--muted); }

/* ─────────────────────────────── later zones: more status, Run away */
.intent-row { display: flex; align-items: stretch; gap: 8px; margin-top: 6px; }
.intent-row .intent { flex: 1; min-width: 0; margin: 0; }
.flee { flex: none; width: 40px; height: auto; min-height: 34px; border-radius: 12px; font-size: 18px; }
.chip--bleed { border-color: var(--red); color: #FF8FA3; }
.chip--stop { border-color: var(--gold); color: var(--gold); }
.chip--halving { border-color: var(--blue-hi); color: var(--blue-hi); }
.chip--foe { border-color: rgba(255, 61, 94, .6); color: #FF8FA3; }
@media (max-height: 600px) and (orientation: portrait) {
  .log { height: 50px; font-size: 12.5px; }
  .move { min-height: 42px; padding: 3px 9px; }
  .move b { font-size: 14px; }
}
