/* ==========================================================================================
   guide.css — 玩法说明 viewer (js/ui/guide.js): the 19 official tutorial pages at 16:9, chapter tabs,
   ‹ › edge buttons, page dots. Sits above modals (it can be opened from the settings dialog).
   ========================================================================================== */

.guide {
  position: fixed; inset: 0; z-index: calc(var(--z-modal) + 4);
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(8, 14, 12, .82), rgba(2, 4, 3, .94));
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: guide-fade 180ms var(--ease-out);
}
@keyframes guide-fade { from { opacity: 0; } }

.guide__box {
  --bk-c: var(--mint-500);
  position: relative; display: flex; flex-direction: column; gap: calc(0.12 * var(--ui-unit, 1rem));
  padding: calc(0.16 * var(--ui-unit, 1rem)) calc(0.22 * var(--ui-unit, 1rem)) calc(0.16 * var(--ui-unit, 1rem));
  background: linear-gradient(180deg, rgba(22, 28, 26, .98), rgba(10, 13, 12, .98));
  border: 1px solid var(--line-2);
  box-shadow: 0 calc(0.2 * var(--ui-unit, 1rem)) calc(0.6 * var(--ui-unit, 1rem)) rgba(0, 0, 0, .7), 0 0 0 1px rgba(78, 216, 175, .06) inset;
  outline: none;
  animation: guide-pop 220ms var(--ease-out);
}
@keyframes guide-pop { from { opacity: 0; transform: translateY(calc(0.12 * var(--ui-unit, 1rem))) scale(.985); } }

/* header: title | chapter tabs | close */
.guide__head { display: flex; align-items: center; gap: calc(0.3 * var(--ui-unit, 1rem)); min-height: calc(0.62 * var(--ui-unit, 1rem)); }
.guide__titles { display: flex; flex-direction: column; gap: calc(0.02 * var(--ui-unit, 1rem)); min-width: calc(2.4 * var(--ui-unit, 1rem)); }
.guide__title { margin: 0; font-size: calc(.3 * var(--utility-text, var(--t))); font-weight: 900; letter-spacing: .12em; color: var(--text-hi); line-height: 1.1; }
.guide__chapters { display: flex; gap: calc(0.06 * var(--ui-unit, 1rem)); margin: 0 auto; }
.guide__chapter {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(0.01 * var(--ui-unit, 1rem));
  min-width: calc(1.5 * var(--ui-unit, 1rem)); height: calc(0.56 * var(--ui-unit, 1rem)); padding: 0 calc(0.22 * var(--ui-unit, 1rem));
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line); color: var(--text-lo);
  clip-path: polygon(calc(0.12 * var(--ui-unit, 1rem)) 0, 100% 0, calc(100% - calc(0.12 * var(--ui-unit, 1rem))) 100%, 0 100%);
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.guide__chapter:hover { color: var(--text-hi); background: rgba(78, 216, 175, .06); }
.guide__chapter.is-on { color: var(--text-on-mint); background: var(--mint-500); border-color: var(--mint-500); }
.guide__chname { font-size: calc(.19 * var(--utility-text, var(--t))); font-weight: 700; letter-spacing: .1em; }
.guide__chmicro { font-family: var(--font-display); font-size: calc(.1 * var(--utility-text, var(--t))); letter-spacing: .24em; opacity: .75; }
.guide__close {
  width: calc(0.56 * var(--ui-unit, 1rem)); height: calc(0.56 * var(--ui-unit, 1rem)); display: grid; place-items: center; flex: none;
  background: rgba(0, 0, 0, .35); border: 1px solid var(--line-2); color: var(--text-md);
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.guide__close .icon { width: calc(0.3 * var(--ui-unit, 1rem)); height: calc(0.3 * var(--ui-unit, 1rem)); }
.guide__close:hover { color: var(--text-hi); border-color: var(--red-premium); background: var(--red-a20); }

/* page stage (16:9) with edge buttons */
.guide__stage { position: relative; }
.guide__page {
  position: relative; overflow: hidden;
  width: min(calc(96vw - calc(0.5 * var(--ui-unit, 1rem))), calc((100vh - calc(2.3 * var(--ui-unit, 1rem))) * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #050807 repeating-linear-gradient(135deg, rgba(78, 216, 175, .04) 0 calc(0.02 * var(--ui-unit, 1rem)), transparent calc(0.02 * var(--ui-unit, 1rem)) calc(0.14 * var(--ui-unit, 1rem)));
  border: 1px solid var(--line);
}
/* the pages are stored squashed to 1024²: stretch back to 16:9 */
.guide__page img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; user-select: none; opacity: 0; transition: opacity 160ms ease; }
.guide__page.is-loaded img { opacity: 1; }
.guide__loading { position: absolute; inset: 0; display: grid; place-items: center; }
.guide__nav {
  position: absolute; top: 0; bottom: 0; z-index: 2; width: calc(1 * var(--ui-unit, 1rem)); display: grid; place-items: center;
  color: rgba(242, 242, 242, .7); background: transparent; border: 0;
  transition: color var(--t-fast), background var(--t-fast);
}
.guide__nav .icon { width: calc(0.52 * var(--ui-unit, 1rem)); height: calc(0.52 * var(--ui-unit, 1rem)); filter: drop-shadow(0 0 calc(0.06 * var(--ui-unit, 1rem)) rgba(0, 0, 0, .9)); }
.guide__prev { left: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .38), transparent); }
.guide__next { right: 0; background: linear-gradient(270deg, rgba(0, 0, 0, .38), transparent); }
.guide__nav:hover { color: var(--mint-400); }
.guide__prev:hover { background: linear-gradient(90deg, rgba(0, 0, 0, .6), transparent); }
.guide__next:hover { background: linear-gradient(270deg, rgba(0, 0, 0, .6), transparent); }

/* footer: chapter + title | dots | count */
.guide__foot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: calc(0.3 * var(--ui-unit, 1rem)); min-height: calc(0.44 * var(--ui-unit, 1rem)); }
.guide__label { display: flex; align-items: center; gap: calc(0.14 * var(--ui-unit, 1rem)); min-width: 0; }
.guide__chtag {
  flex: none; padding: calc(0.02 * var(--ui-unit, 1rem)) calc(0.12 * var(--ui-unit, 1rem)); font-size: calc(.14 * var(--utility-text, var(--t))); font-weight: 700; letter-spacing: .1em;
  color: var(--mint-400); border: 1px solid var(--mint-800); background: var(--mint-a10);
}
.guide__ptitle { font-size: calc(.22 * var(--utility-text, var(--t))); font-weight: 700; letter-spacing: .06em; color: var(--text-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guide__dots { display: flex; align-items: center; gap: calc(0.05 * var(--ui-unit, 1rem)); }
.guide__dot {
  width: calc(0.2 * var(--ui-unit, 1rem)); height: calc(0.08 * var(--ui-unit, 1rem)); padding: 0; border: 0; background: var(--line-2);
  transition: background var(--t-fast), width var(--t-fast);
}
.guide__dot.is-first { margin-left: calc(0.14 * var(--ui-unit, 1rem)); }
.guide__dot:hover { background: var(--line-3); }
.guide__dot.is-on { width: calc(0.42 * var(--ui-unit, 1rem)); background: var(--mint-500); box-shadow: 0 0 calc(0.08 * var(--ui-unit, 1rem)) rgba(23, 249, 183, .5); }
.guide__count { justify-self: end; font-size: calc(.24 * var(--utility-text, var(--t))); color: var(--text-md); letter-spacing: .06em; }

/* text fallback: the official tips when no tutorial page can be shown (none listed, or none of a page's copies loads) */
.guide__stage--text { width: min(92vw, calc(10 * var(--ui-unit, 1rem))); max-height: calc(100vh - calc(2 * var(--ui-unit, 1rem))); overflow: auto; padding: calc(0.1 * var(--ui-unit, 1rem)) calc(0.06 * var(--ui-unit, 1rem)); }
.guide__tips ol { margin: calc(0.14 * var(--ui-unit, 1rem)) 0 0; padding-left: calc(0.34 * var(--ui-unit, 1rem)); display: flex; flex-direction: column; gap: calc(0.08 * var(--ui-unit, 1rem)); }
.guide__tips li { font-size: calc(.18 * var(--utility-text, var(--t))); line-height: 1.6; color: var(--text-md); }
.guide__tips li::marker { color: var(--mint-500); font-family: var(--font-num); }

/* standard trigger */
.guide-btn .btn__icon { color: var(--mint-500); }
