/* 战斧交互式操作手册 —— 全屏沉浸式教学
   真实沙盘铺满整个屏幕，金色仅用于教学引导：聚光灯、光标提示与进度。
   教学卡避开目标区域停靠，随时可折叠成药丸。 */

:root {
  color-scheme: dark;
  --g-bg: #0a0c0e;
  --g-panel: #0f1114;
  --g-panel-solid: #16191d;
  --g-line: rgba(255, 255, 255, .10);
  --g-line-strong: rgba(255, 255, 255, .22);
  --g-text: #f2f4f5;
  --g-muted: #9aa3a9;
  --g-dim: #6b7379;
  --g-accent: #ffc24d;
  --g-accent-soft: rgba(255, 194, 77, .16);
  --g-good: #93c76f;
  --g-good-soft: rgba(147, 199, 111, .18);
  --g-radius: 14px;
  --g-font: "Tomahawk Han", "Tomahawk Sans", "Source Han Sans SC", "Microsoft YaHei UI", sans-serif;
  --g-mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --g-ease: cubic-bezier(.2, 0, 0, 1);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--g-bg);
  color: var(--g-text);
  font-family: var(--g-font);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

button,
input,
summary {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--g-accent);
  outline-offset: 3px;
}

.ui-icon {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.skip-link {
  position: fixed;
  z-index: 300;
  left: 16px;
  top: 12px;
  padding: 10px 14px;
  color: #0a0c0e;
  background: var(--g-text);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ——— 全屏沙盘 ——— */
#sandbox-frame {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ——— 引导层 ——— */
#guide-ui {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

#guide-ui > * {
  pointer-events: auto;
}

#guide-ui > .spotlight,
#guide-ui > .scrim,
#guide-ui > .cursor-hint,
#guide-ui > #top-progress {
  pointer-events: none;
}

/* ——— 顶部进度 ——— */
#top-progress {
  position: fixed;
  z-index: 150;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: rgba(255, 255, 255, .08);
}

#top-progress i {
  width: 100%;
  height: 100%;
  display: block;
  background: var(--g-accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 300ms var(--g-ease);
}

/* ——— 聚光灯 ——— */
.spotlight {
  position: fixed;
  z-index: 40;
  transition: left 280ms var(--g-ease), top 280ms var(--g-ease), width 280ms var(--g-ease), height 280ms var(--g-ease);
}

.spotlight[hidden] {
  display: none;
}

.spot-ring {
  position: absolute;
  inset: 0;
  border: 3px solid var(--g-accent);
  border-radius: 13px;
  box-shadow:
    0 0 0 5px rgba(255, 194, 77, .2),
    0 0 34px rgba(255, 194, 77, .42);
}

.spot-pulse {
  position: absolute;
  inset: -9px;
  border: 2px solid var(--g-accent);
  border-radius: 15px;
  animation: spot-pulse 1.8s cubic-bezier(.2, 0, 0, 1) infinite;
}

.spotlight.spot .spot-ring,
.spotlight.spot .spot-pulse {
  border-radius: 50%;
}

.spotlight.done .spot-ring {
  border-color: var(--g-good);
  box-shadow:
    0 0 0 5px var(--g-good-soft),
    0 0 30px rgba(147, 199, 111, .45);
}

.spotlight.done .spot-pulse {
  border-color: var(--g-good);
  animation: none;
  opacity: 0;
}

.spotlight.denied .spot-ring {
  border-color: #ff6b6b;
  box-shadow:
    0 0 0 5px rgba(255, 107, 107, .22),
    0 0 30px rgba(255, 107, 107, .4);
  animation: ring-shake .38s ease-in-out;
}

/* ——— 暗化遮罩（目标区域留孔） ——— */
.scrim {
  position: fixed;
  z-index: 30;
  border-radius: 18px;
  box-shadow: 0 0 0 9999px rgba(3, 5, 7, .56);
  transition: left 280ms var(--g-ease), top 280ms var(--g-ease), width 280ms var(--g-ease), height 280ms var(--g-ease);
}

.scrim[hidden] {
  display: none;
}

/* ——— 光标提示 ——— */
.cursor-hint {
  position: fixed;
  z-index: 120;
  left: 0;
  top: 0;
  will-change: transform;
  transition: transform 620ms var(--g-ease);
}

.cursor-hint[hidden] {
  display: none;
}

.cursor-bob {
  position: relative;
  animation: cursor-bob 1.5s ease-in-out .8s infinite;
}

.cursor-arrow {
  display: block;
  width: 30px;
  height: 30px;
  fill: #fff;
  stroke: #17140d;
  stroke-width: 1.7;
  filter: drop-shadow(0 3px 7px rgba(0, 0, 0, .5));
}

.cursor-label {
  position: absolute;
  left: 20px;
  top: 14px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 194, 77, .6);
  border-radius: 999px;
  color: var(--g-accent);
  background: #17140d;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .45);
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  animation: label-glow 1.8s ease-in-out infinite;
}

/* ——— 教学卡 ——— */
.coach {
  position: fixed;
  z-index: 100;
  width: 350px;
  max-width: calc(100vw - 48px);
  transition: left 320ms var(--g-ease), top 320ms var(--g-ease), right 320ms var(--g-ease), bottom 320ms var(--g-ease), transform 320ms var(--g-ease);
}

.coach[hidden] {
  display: none;
}

.coach-card {
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  padding: 18px 20px 16px;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: var(--g-radius);
  background: rgba(15, 17, 20, .94);
  backdrop-filter: blur(12px);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .55);
}

.coach-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.coach-kicker {
  margin: 0;
  color: var(--g-dim);
  font: 600 12.5px/1.4 var(--g-mono);
  letter-spacing: .08em;
}

.coach-head-actions {
  display: flex;
  gap: 2px;
  flex: none;
}

.coach-head-actions button,
.coach-head-actions a {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  color: var(--g-dim);
  border-radius: 8px;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  transition-property: color, background-color;
  transition-duration: 130ms;
  transition-timing-function: var(--g-ease);
}

.coach-head-actions button:hover,
.coach-head-actions a:hover {
  color: var(--g-text);
  background: rgba(255, 255, 255, .07);
}

.coach h2 {
  margin: 12px 0 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -.01em;
  text-wrap: balance;
}

.coach-body {
  margin: 9px 0 0;
  color: var(--g-muted);
  font-size: 15.5px;
  line-height: 1.62;
}

.coach-action-box {
  margin-top: 14px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 194, 77, .42);
  border-radius: 10px;
  background: var(--g-accent-soft);
}

.coach-action-box > span {
  color: var(--g-accent);
  font: 650 11.5px/1.4 var(--g-mono);
  letter-spacing: .14em;
}

.coach-action-box p {
  margin: 5px 0 0;
  font-size: 15.5px;
  font-weight: 650;
}

.coach.stuck .coach-action-box {
  animation: coach-nudge 1.1s ease-in-out infinite;
}

.coach-keys {
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.coach-keys[hidden] {
  display: none;
}

.coach-keys kbd {
  padding: 3px 9px;
  border: 1px solid rgba(255, 194, 77, .35);
  border-radius: 6px;
  color: var(--g-accent);
  background: rgba(255, 194, 77, .09);
  font: 600 12.5px/1.5 var(--g-mono);
}

.coach-status {
  margin: 13px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--g-muted);
  font-size: 14px;
}

.coach-status i {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--g-accent);
  animation: status-pulse 1.4s ease-in-out infinite;
}

.coach-status.done {
  color: var(--g-good);
}

.coach-status.done i {
  background: var(--g-good);
  animation: none;
}

.coach-actions {
  margin-top: 15px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.coach-actions button {
  min-height: 40px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--g-muted);
  border: 1px solid var(--g-line-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, .03);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition-property: color, background-color, border-color;
  transition-duration: 130ms;
  transition-timing-function: var(--g-ease);
}

.coach-actions button:hover:not(:disabled) {
  color: var(--g-text);
  background: rgba(255, 255, 255, .08);
}

.coach-actions button:disabled {
  opacity: .4;
  cursor: default;
}

.coach-actions button.primary {
  grid-column: 1 / -1;
  color: #17140d;
  border-color: var(--g-accent);
  background: var(--g-accent);
}

.coach-actions button.primary:hover:not(:disabled) {
  background: #ffd27a;
}

.coach-foot {
  margin-top: 13px;
  padding-top: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--g-line);
}

.coach-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.coach-dots .dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 1px solid var(--g-line-strong);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition-property: background-color, border-color, transform;
  transition-duration: 130ms;
  transition-timing-function: var(--g-ease);
}

.coach-dots .dot:hover {
  border-color: var(--g-muted);
  transform: scale(1.2);
}

.coach-dots .dot.done {
  border-color: var(--g-accent);
  background: var(--g-accent);
}

.coach-dots .dot.active {
  border-color: var(--g-accent);
  box-shadow: 0 0 0 3px var(--g-accent-soft);
  transform: scale(1.25);
}

.coach-collapse {
  position: absolute;
  right: 12px;
  bottom: 9px;
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  color: var(--g-dim);
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

.coach-collapse:hover {
  color: var(--g-text);
  background: rgba(255, 255, 255, .07);
}

.coach-collapse .ui-icon {
  transform: rotate(180deg);
}

.coach-pill {
  position: absolute;
  left: 50%;
  top: 50%;
  min-height: 42px;
  max-width: min(680px, calc(100vw - 48px));
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 194, 77, .55);
  border-radius: 999px;
  color: var(--g-text);
  background: rgba(15, 17, 20, .95);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.coach-pill[hidden] {
  display: none;
}

.coach-pill i {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--g-accent);
  animation: status-pulse 1.4s ease-in-out infinite;
}

.coach-pill span {
  color: var(--g-dim);
  font: 600 13px/1.4 var(--g-mono);
  white-space: nowrap;
}

.coach-pill b {
  color: var(--g-accent);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 460px;
}

/* ——— 全屏层（欢迎 / 完成 / 速查 / 加载） ——— */
.layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 7, 9, .82);
  backdrop-filter: blur(14px);
}

.layer[hidden] {
  display: none;
}

.welcome-card,
.completion-card,
.reference-card {
  width: min(560px, 100%);
  padding: 34px 38px;
  border: 1px solid var(--g-line-strong);
  border-radius: 18px;
  background: rgba(15, 17, 20, .97);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}

.welcome-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.welcome-brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.welcome-brand span {
  display: grid;
  gap: 2px;
  line-height: 1.05;
}

.welcome-brand b {
  font-size: 18px;
  letter-spacing: .12em;
}

.welcome-brand small {
  color: var(--g-dim);
  font: 500 11.5px/1 var(--g-mono);
  letter-spacing: .1em;
}

.welcome-card h1 {
  margin: 22px 0 0;
  font-size: clamp(30px, 4.4vw, 44px);
  line-height: 1.14;
  letter-spacing: -.03em;
}

.welcome-lead {
  margin: 14px 0 0;
  color: var(--g-muted);
  font-size: 16.5px;
  line-height: 1.7;
}

.welcome-actions {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.welcome-actions .primary,
.welcome-actions .ghost,
.completion-actions .primary,
.completion-actions button {
  min-height: 46px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition-property: background-color, border-color, transform;
  transition-duration: 140ms;
  transition-timing-function: var(--g-ease);
}

.welcome-actions .primary,
.completion-actions .primary {
  color: #17140d;
  background: var(--g-accent);
  border: 1px solid var(--g-accent);
}

.welcome-actions .primary:hover,
.completion-actions .primary:hover {
  background: #ffd27a;
}

.welcome-actions .ghost,
.completion-actions button {
  color: var(--g-text);
  border: 1px solid var(--g-line-strong);
  background: transparent;
}

.welcome-actions .ghost:hover,
.completion-actions button:hover {
  background: rgba(255, 255, 255, .06);
}

.welcome-actions .primary:active,
.welcome-actions .ghost:active,
.completion-actions .primary:active,
.completion-actions button:active {
  transform: scale(.97);
}

.welcome-facts {
  margin: 22px 0 0;
  padding: 16px 0 0;
  display: flex;
  gap: 26px;
  border-top: 1px solid var(--g-line);
  list-style: none;
}

.welcome-facts li {
  display: grid;
  gap: 1px;
}

.welcome-facts b {
  color: var(--g-accent);
  font: 650 19px/1 var(--g-mono);
}

.welcome-facts span {
  color: var(--g-dim);
  font-size: 13px;
}

.text-button {
  margin-top: 18px;
  padding: 0;
  color: var(--g-text);
  border-bottom: 1px solid currentColor;
  background: none;
  font-size: 15px;
  cursor: pointer;
}

.welcome-note {
  margin: 14px 0 0;
  color: var(--g-dim);
  font-size: 13.5px;
}

.completion-card {
  width: min(480px, 100%);
  text-align: center;
}

.completion-mark {
  position: relative;
  width: 68px;
  height: 68px;
  display: inline-block;
  border: 2px solid var(--g-good);
  border-radius: 50%;
  box-shadow: 0 0 0 9px var(--g-good-soft);
}

.completion-mark::after {
  position: absolute;
  top: 16px;
  left: 23px;
  width: 17px;
  height: 28px;
  border-right: 3px solid var(--g-good);
  border-bottom: 3px solid var(--g-good);
  content: "";
  transform: rotate(42deg);
}

.completion-card h2 {
  margin: 24px 0 0;
  font-size: 30px;
  letter-spacing: -.02em;
}

.completion-card p {
  margin: 12px auto 0;
  max-width: 30em;
  color: var(--g-muted);
  font-size: 16px;
  line-height: 1.7;
}

.completion-actions {
  margin-top: 24px;
  display: grid;
  gap: 10px;
}

.completion-note {
  margin-top: 18px;
  color: var(--g-dim);
  font-size: 13.5px;
}

/* ——— 快捷键速查 ——— */
.reference-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 26px 32px;
}

.reference-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.reference-head h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -.02em;
}

.reference-head button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  color: var(--g-dim);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.reference-head button:hover {
  color: var(--g-text);
  background: rgba(255, 255, 255, .07);
}

.key-list {
  margin: 18px 0 0;
  border-top: 1px solid var(--g-line);
}

.key-list > div {
  min-height: 68px;
  padding: 10px 0;
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--g-line);
}

.key-list dt,
.key-list dd {
  margin: 0;
}

.key-list dd {
  display: grid;
}

.key-list dd b {
  font-size: 15.5px;
}

.key-list dd span {
  color: var(--g-dim);
  font-size: 14.5px;
}

kbd {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid rgba(255, 194, 77, .35);
  border-radius: 6px;
  color: var(--g-accent);
  background: rgba(255, 194, 77, .09);
  font: 600 13px/1.5 var(--g-mono);
}

.faq {
  margin-top: 22px;
}

.faq h3 {
  margin: 0 0 12px;
  font-size: 19px;
}

.faq details {
  border-bottom: 1px solid var(--g-line);
}

.faq summary {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 15.5px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.faq summary::after {
  color: var(--g-accent);
  content: "+";
  font: 400 22px/1 var(--g-mono);
}

.faq details[open] summary::after {
  content: "−";
}

.faq p {
  margin: -6px 0 18px;
  color: var(--g-muted);
  font-size: 15px;
}

/* ——— 加载与失败 ——— */
.stage-loading {
  gap: 14px;
  align-content: center;
  color: var(--g-muted);
  font-size: 16px;
}

.stage-loading i {
  width: 34px;
  height: 34px;
  border: 2px solid var(--g-line-strong);
  border-top-color: var(--g-accent);
  border-radius: 50%;
  animation: stage-spin 900ms linear infinite;
}

.stage-fallback {
  gap: 8px;
  align-content: center;
  text-align: center;
}

.stage-fallback b {
  font-size: 19px;
}

.stage-fallback p {
  margin: 0;
  color: var(--g-muted);
  font-size: 15px;
}

.stage-fallback code {
  color: var(--g-accent);
  font-family: var(--g-mono);
}

.stage-fallback button {
  margin-top: 10px;
  min-height: 42px;
  padding: 0 20px;
  color: #17140d;
  border-radius: 10px;
  background: var(--g-accent);
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

.noscript-note {
  position: fixed;
  z-index: 400;
  inset: auto 0 0;
  margin: 0;
  padding: 14px 24px;
  color: #17140d;
  background: var(--g-accent);
  font-size: 15px;
}

/* ——— 动画 ——— */
@keyframes spot-pulse {
  from { opacity: .7; transform: scale(1); }
  to { opacity: 0; transform: scale(1.18); }
}

@keyframes ring-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

@keyframes cursor-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes label-glow {
  0%, 100% { box-shadow: 0 5px 16px rgba(0, 0, 0, .45); }
  50% { box-shadow: 0 5px 20px rgba(255, 194, 77, .35), 0 0 0 4px rgba(255, 194, 77, .12); }
}

@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 194, 77, .5); }
  50% { box-shadow: 0 0 0 5px rgba(255, 194, 77, 0); }
}

@keyframes coach-nudge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 194, 77, 0); }
  50% { box-shadow: 0 0 0 6px rgba(255, 194, 77, .22); }
}

@keyframes stage-spin {
  to { transform: rotate(360deg); }
}

/* ——— 窄屏适配 ——— */
@media (max-width: 900px) {
  .coach {
    width: min(340px, calc(100vw - 32px));
  }

  .welcome-card,
  .completion-card,
  .reference-card {
    padding: 26px 24px;
  }

  .welcome-facts {
    gap: 18px;
    flex-wrap: wrap;
  }
}

@media (max-width: 700px) {
  .key-list > div {
    grid-template-columns: 118px 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
