@charset "UTF-8";

/* ---------- 環島故事：map screen ---------- */

.screen--story { padding-bottom: 36px; }

.story-progress { display: flex; align-items: center; gap: 10px; font: 800 15px/1 var(--font-display); color: var(--gold-hi); letter-spacing: .06em; white-space: nowrap; }
.story-progress-track { display: flex; gap: 4px; }
.story-progress-track i { width: 8px; height: 8px; border-radius: 50%; background: rgb(233 185 91 / .2); box-shadow: inset 0 0 0 1px rgb(233 185 91 / .45); }
.story-progress-track i.is-on { background: var(--lacquer-hi); box-shadow: 0 0 0 1px var(--gold), 0 0 8px rgb(255 90 60 / .8); }

.story {
  display: grid;
  grid-template-columns: auto minmax(300px, 360px);
  justify-content: center;
  align-items: start;
  gap: clamp(24px, 4vw, 56px);
  width: min(1120px, 100% - 32px);
  margin: 4px auto 0;
}

.story-map {
  --pin: 46px;
  position: relative;
  height: clamp(560px, calc(100dvh - 86px), 980px);
  aspect-ratio: 452 / 930;
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 3px var(--gold-lo), 0 0 0 8px var(--wood), 0 0 0 9px var(--wood-lo), 0 28px 60px rgb(0 0 0 / .6);
}
.story-map-art {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 70px 12px rgb(7 19 15 / .5);
}

.story-patches { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.story-dock { display: none; }

.story-route { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.route-bed { fill: none; stroke: rgb(255 248 228 / .72); stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; }
.route-leg { fill: none; stroke: rgb(42 31 20 / .7); stroke-width: 5.5; stroke-linecap: round; stroke-dasharray: 0 11; }
.route-leg.is-done { stroke: var(--lacquer); stroke-width: 7; stroke-dasharray: 0 10; }

.story-pins { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; }
.pin { position: absolute; width: 0; height: 0; }
.pin-button {
  position: absolute;
  left: 0;
  top: 0;
  translate: -50% -50%;
  display: grid;
  place-items: center;
  width: var(--pin);
  height: var(--pin);
  padding: 3px;
  border: 0;
  border-radius: 50%;
  background: conic-gradient(var(--gold-hi), var(--gold-lo), var(--gold), var(--gold-lo), var(--gold-hi));
  box-shadow: 0 0 0 2px var(--lacquer-lo), 0 6px 12px rgb(0 0 0 / .5);
  cursor: pointer;
  transition: scale var(--dur-fast) var(--ease-out);
}
.pin-button:hover { scale: 1.08; }
.pin-face { width: 100%; height: 100%; border-radius: 50%; }
.pin-num {
  position: absolute;
  top: -7px;
  left: -7px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--lacquer);
  box-shadow: 0 0 0 2px var(--gold);
  color: var(--gold-hi);
  font: 800 12px/1 var(--font-num);
}

.pin.is-available .pin-button::before {
  content: "";
  position: absolute;
  inset: -3px;
  z-index: -1;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgb(255 140 70 / .55), 0 0 22px 6px rgb(255 190 80 / .75);
  animation: pin-pulse 1.8s ease-in-out infinite;
}
@keyframes pin-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgb(255 120 60 / .75), 0 0 16px 4px rgb(255 200 90 / .6); }
  60% { box-shadow: 0 0 0 12px rgb(255 120 60 / 0), 0 0 28px 9px rgb(255 200 90 / .9); }
}

.pin.is-locked .pin-button {
  --pin: 42px;
  background: radial-gradient(circle, #6f7772 0 15px, #39403b 15px 17px, transparent 17.5px);
  box-shadow: none;
  color: #e6e9e4;
  filter: drop-shadow(0 3px 4px rgb(0 0 0 / .45));
  cursor: not-allowed;
}
.pin.is-locked .pin-button:hover { scale: none; }
.pin.is-locked .pin-num { top: -2px; left: -2px; width: 17px; height: 17px; background: #4a514c; box-shadow: 0 0 0 1.5px #a3aca5; color: #eef1ec; font-size: 10px; }
.pin-lock { width: 16px; height: 16px; }

.pin-stamp {
  position: absolute;
  right: -16px;
  bottom: -9px;
  padding: 2px 5px 1px;
  border: 2px solid var(--lacquer-lo);
  border-radius: 5px;
  background: linear-gradient(var(--gold-hi), var(--gold) 55%, var(--gold-lo));
  box-shadow: 0 2px 4px rgb(0 0 0 / .4);
  color: var(--lacquer-lo);
  font: 900 12px/1.2 var(--font-display);
  letter-spacing: .08em;
  white-space: nowrap;
  rotate: -12deg;
}

.pin-tag {
  position: absolute;
  top: 0;
  translate: 0 -50%;
  padding: 5px 11px;
  border: 1px solid var(--gold);
  border-radius: 7px;
  background: linear-gradient(var(--lacquer-hi), var(--lacquer));
  box-shadow: 0 4px 10px rgb(0 0 0 / .45);
  color: var(--gold-hi);
  font: 800 14px/1.3 var(--font-display);
  letter-spacing: .04em;
  white-space: nowrap;
  pointer-events: none;
}
.pin-tag--right { left: calc(var(--pin) / 2 + 10px); }
.pin-tag--left { right: calc(var(--pin) / 2 + 10px); }

.pin.is-stamping .pin-stamp,
.slot.is-stamping .slot-ink { animation: stamp-in 560ms var(--ease-out) 200ms both; }
@keyframes stamp-in {
  from { opacity: 0; transform: scale(2.4); }
  55% { opacity: 1; transform: scale(.9); }
  to { opacity: 1; transform: none; }
}
.pin.is-unlocking .pin-button { animation: unlock-pop 640ms var(--ease-out) 700ms both; }
@keyframes unlock-pop {
  from { transform: scale(.5); filter: grayscale(1); }
  65% { transform: scale(1.18); filter: none; }
  to { transform: none; }
}

/* ---------- 環島集章卡 ---------- */

.passport {
  display: grid;
  gap: 16px;
  padding: 24px 22px 22px;
  border-radius: var(--r-lg);
  background: radial-gradient(120% 50% at 50% 0%, #fffaf0, transparent 70%), linear-gradient(var(--paper), var(--paper-lo));
  box-shadow: 0 0 0 3px var(--gold-lo), 0 0 0 8px var(--lacquer-lo), var(--shadow-lift);
  color: var(--ink);
}
.passport-title { font: 900 26px/1.2 var(--font-display); color: var(--lacquer-lo); letter-spacing: .14em; }
.passport-note { margin-top: -8px; font-size: 14px; line-height: 1.65; color: var(--ink-soft); }
.passport-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 6px; margin: 0; padding: 0; list-style: none; }
.slot { display: grid; justify-items: center; gap: 8px; text-align: center; }
.slot-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 62px;
  aspect-ratio: 1;
  border: 2px dashed rgb(74 58 40 / .35);
  border-radius: 50%;
}
.slot-ring b { font: 800 20px/1 var(--font-num); color: rgb(74 58 40 / .4); }
.slot-face { width: 50px; height: 50px; border-radius: 50%; }
.slot.is-available .slot-ring { border-color: var(--gold-lo); box-shadow: 0 0 14px rgb(233 185 91 / .55); }
.slot.is-available .slot-face { opacity: .6; filter: grayscale(.4); }
.slot.is-cleared .slot-ring { border: 4px double var(--lacquer); }
.slot.is-cleared .slot-face { filter: sepia(.3) saturate(1.15); }
.slot-ink {
  position: absolute;
  bottom: -8px;
  padding: 1px 5px;
  border: 2px solid var(--lacquer);
  border-radius: 4px;
  background: var(--paper);
  color: var(--lacquer);
  font: 900 12px/1.25 var(--font-display);
  letter-spacing: .08em;
  white-space: nowrap;
  rotate: -9deg;
}
.slot-name { font: 700 12px/1.35 var(--font-body); color: var(--ink-soft); }
.slot.is-locked .slot-name { color: rgb(74 58 40 / .55); }

.passport-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px dashed rgb(162 115 47 / .5);
}
.passport-next p { display: grid; gap: 2px; }
.passport-next span { font-size: 13px; color: var(--ink-soft); }
.passport-next b { font: 900 19px/1.3 var(--font-display); color: var(--lacquer-lo); }

.story-toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: var(--z-banner);
  translate: -50% 0;
  display: grid;
  gap: 4px;
  width: min(440px, 100% - 32px);
  padding: 14px 18px;
  border: 1px solid var(--gold);
  border-radius: 14px;
  background: linear-gradient(#5b1310, #36100c);
  box-shadow: 0 0 0 4px rgb(108 20 15 / .55), 0 18px 40px rgb(0 0 0 / .6);
  color: var(--cream);
  font-size: 15px;
  line-height: 1.55;
  pointer-events: none;
}
.story-toast[hidden] { display: none; }
.story-toast b { font: 800 14px/1.3 var(--font-display); color: var(--gold-hi); letter-spacing: .1em; }
.story-toast.is-on { animation: toast-in var(--dur-slow) var(--ease-out); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px); } }

/* ---------- chapter card, retry, ending (inside #game-dialog) ---------- */

.story-card {
  display: grid;
  grid-template-columns: minmax(130px, 180px) 1fr;
  grid-template-areas: "art head" "art body";
  gap: 8px 24px;
  align-items: start;
}
.story-card .detail-portrait { grid-area: art; margin-bottom: 14px; }
.story-card-head { grid-area: head; display: grid; gap: 4px; padding-right: 30px; }
.story-card-body { grid-area: body; display: grid; gap: 14px; }
.story-card-station { display: flex; align-items: center; gap: 12px; font: 800 14px/1.4 var(--font-display); color: var(--ink-soft); letter-spacing: .12em; }
.story-card-station .seal-stamp { font-size: 13px; padding: 1px 6px; }
.story-card-boss { font-size: 14px; color: var(--ink-soft); }
.story-card-boss b { color: var(--ink); }
.story-terms { display: grid; gap: 10px; margin: 0; }
.story-terms div { padding: 10px 12px; border: 1px solid rgb(162 115 47 / .35); border-radius: 10px; background: rgb(255 255 255 / .45); }
.story-terms dt { font: 800 13px/1.3 var(--font-display); color: var(--lacquer-lo); letter-spacing: .08em; }
.story-terms dd { margin: 4px 0 0; font-size: 15px; line-height: 1.6; }
.story-rivals { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13px; color: var(--ink-soft); }
.story-rivals ul { display: flex; gap: 14px; margin: 0; padding: 0; list-style: none; }
.story-rivals li { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--ink); }
.rival-face { width: 36px; height: 36px; border-radius: 50%; box-shadow: 0 0 0 2px var(--gold-lo); }
.story-card-body .button--primary { justify-self: start; min-width: 150px; }

.story-result { display: grid; justify-items: center; gap: 14px; text-align: center; }
.story-result > p { max-width: 26em; font-size: 15px; line-height: 1.7; color: var(--ink-soft); text-wrap: pretty; }
.story-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }

.ending-ring { position: relative; width: 264px; aspect-ratio: 1; margin: 6px 0; }
.ending-ring ul { margin: 0; padding: 0; list-style: none; }
.ending-ring li { position: absolute; left: 50%; top: 50%; translate: -50% -50%; transform: rotate(calc(var(--i) * 45deg)) translateY(-102px) rotate(calc(var(--i) * -45deg)); }
.ending-face { width: 58px; height: 58px; border-radius: 50%; box-shadow: 0 0 0 2px var(--gold), 0 0 0 5px var(--lacquer), 0 6px 12px rgb(0 0 0 / .3); }
#game-dialog .story-ending-title {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  display: grid;
  place-items: center;
  width: 120px;
  aspect-ratio: 1;
  border: 5px double var(--lacquer);
  border-radius: 50%;
  color: var(--lacquer);
  font: 900 23px/1.15 var(--font-display);
  letter-spacing: .06em;
  text-align: center;
  rotate: -10deg;
}

/* ---------- boss dialogue ---------- */

.talk {
  position: fixed;
  inset: 0;
  z-index: var(--z-fx);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  justify-items: center;
  padding: max(14px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  background: radial-gradient(60vmax 46vmax at 50% 72%, rgb(255 140 60 / .22), transparent 70%), rgb(5 12 9 / .88);
  backdrop-filter: blur(3px);
  cursor: pointer;
}
.talk-ribbon {
  max-width: calc(100% - 96px);
  padding: 7px 18px;
  border: 1px solid rgb(233 185 91 / .45);
  border-radius: var(--r-pill);
  background: rgb(0 0 0 / .4);
  color: var(--gold-hi);
  font: 800 15px/1.3 var(--font-display);
  letter-spacing: .08em;
  text-align: center;
}
.talk--win .talk-ribbon { border-color: var(--gold-hi); background: linear-gradient(#ffe7a8, var(--gold) 55%, #c98f33); color: #3a1a06; }
.talk--lose .talk-ribbon { border-color: #e0473b; background: var(--lacquer-lo); color: #ffd9d2; }
.talk-skip { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 16px; }
.talk-portrait {
  align-self: end;
  width: min(58vw, 290px, (100dvh - 330px) * .84);
  aspect-ratio: 143 / 170;
  margin-bottom: 14px;
  border-radius: 140px 140px 14px 14px / 110px 110px 14px 14px;
  box-shadow: 0 0 0 4px var(--gold), 0 0 0 9px var(--lacquer), 0 0 60px rgb(255 150 60 / .35), 0 24px 50px rgb(0 0 0 / .6);
  animation: talk-enter 480ms var(--ease-out) both;
}
.talk--lose .talk-portrait { rotate: 3deg; }
@keyframes talk-enter { from { opacity: 0; transform: translateX(48px) scale(.94); } }
.talk-box {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(720px, 100%);
  min-height: 136px;
  padding: 28px 22px 14px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(var(--paper), var(--paper-lo));
  box-shadow: 0 0 0 3px var(--gold-lo), 0 0 0 8px var(--lacquer), var(--shadow-lift);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.talk-name {
  position: absolute;
  top: -18px;
  left: 18px;
  max-width: calc(100% - 36px);
  padding: 5px 14px;
  border: 2px solid var(--gold);
  border-radius: 8px;
  background: var(--lacquer);
  color: var(--gold-hi);
  font: 900 15px/1.25 var(--font-display);
  letter-spacing: .06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.talk-line { font: 700 clamp(18px, 2.4vw, 22px)/1.65 var(--font-display); white-space: pre-line; }
.talk-rest { visibility: hidden; }
.talk-more { justify-self: end; margin-top: 6px; color: var(--lacquer); font: 700 12px/1 var(--font-num); animation: talk-nudge 900ms ease-in-out infinite; }
.talk-actions { display: grid; justify-items: center; gap: 10px; width: min(720px, 100%); margin-top: 20px; cursor: default; }
.talk-hint { color: var(--gold-hi); font: 700 14px/1.5 var(--font-body); text-align: center; text-wrap: pretty; }
.talk--win .talk-portrait, .talk--lose .talk-portrait { width: min(58vw, 290px, (100dvh - 420px) * .84); }
@keyframes talk-nudge { 50% { transform: translateY(3px); } }

/* ---------- boss bark during a story game ---------- */

.story-bark {
  position: fixed;
  top: max(64px, env(safe-area-inset-top));
  left: 50%;
  z-index: calc(var(--z-fx) + 5);
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: min(440px, 100vw - 32px);
  padding: 4px 16px 4px 4px;
  border-radius: 999px 999px 999px 14px;
  background: linear-gradient(var(--paper), var(--paper-lo));
  box-shadow: 0 0 0 2px var(--gold-lo), 0 0 0 5px var(--lacquer), 0 14px 30px rgb(0 0 0 / .55);
  color: var(--ink);
  pointer-events: none;
  animation: bark-life 2500ms var(--ease-out);
}
.story-bark-face { flex: none; width: 38px; height: 38px; border-radius: 50%; box-shadow: 0 0 0 2px var(--gold); }
.story-bark p { display: grid; gap: 1px; }
.story-bark b { font: 800 11px/1.3 var(--font-body); color: var(--lacquer); letter-spacing: .06em; }
.story-bark span { font: 700 14px/1.4 var(--font-display); }
@keyframes bark-life {
  0% { opacity: 0; transform: translateY(-12px) scale(.9); }
  8% { opacity: 1; transform: none; }
  88% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-6px); }
}
@media (min-width: 761px) {
  .story-bark { left: var(--bar-left, 16px); translate: none; transform-origin: 0 0; }
}

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  .story { grid-template-columns: minmax(0, 1fr); gap: 26px; width: 100%; margin-top: 0; }
  .story-map { --pin: 44px; width: 100%; height: auto; border-radius: 0; box-shadow: 0 0 0 2px var(--gold-lo), 0 18px 40px rgb(0 0 0 / .5); }
  .passport { margin: 0 16px; }
  .passport-next { display: none; }
  .screen--story { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .story-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-banner);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    border-top: 2px solid var(--gold-lo);
    background: linear-gradient(#4a1410, #2f0e0b);
    box-shadow: 0 -10px 28px rgb(0 0 0 / .5);
    color: var(--cream);
  }
  .story-dock p { display: grid; gap: 2px; min-width: 0; }
  .story-dock span { font-size: 13px; color: var(--gold-hi); }
  .story-dock b { font: 900 18px/1.3 var(--font-display); overflow-wrap: anywhere; }
  .story-dock .button { flex: none; min-height: 48px; padding: 0 20px; }
  .story-toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

@media (max-width: 560px) {
  .story-card { grid-template-columns: 100px 1fr; grid-template-areas: "art head" "body body"; gap: 16px; }
  .story-card .detail-portrait { margin-bottom: 0; padding: 4px; }
  .story-card .detail-region { bottom: -10px; padding: 1px 8px; font-size: 13px; }
  .story-card-head { padding-right: 24px; }
  .story-card-body .button--primary { justify-self: stretch; }
  .passport { padding: 20px 16px; }
  .passport-next .button { padding: 0 16px; }
}

@media (max-width: 380px) {
  .story-progress-track { display: none; }
}
