/* ============================================================================
 * RunningHub 门户 · 日光工作台（Daylight Studio）
 * ----------------------------------------------------------------------------
 * 视觉母题：月相推进 —— 完成度从新月走到满月
 *   · 主色：海蓝 #0b74b8 → #09608f（承自品牌）
 *   · 强调：琥珀 #96600a —— 只在「待处理 / 需注意」时出现，是唯一的暖色
 *   · 层次：靠「页面底 vs 白卡」的色差与柔和投影，不靠发光和星空
 *
 * 旧版是深色星空 + 极光 + 流星雨 + 月亮四套动效叠加，在浅色屏上像夜店。
 * 这版只保留一条主线：进度 = 月相。动效只在「正在跑」和「完成」两处出现。
 * ==========================================================================*/

:root {
  /* 不写的话系统深色模式下原生控件会渲染成深色，跟亮色主题对撞 */
  color-scheme: light;

  /* 台面环境 */
  --bg0: #efeeea;
  --bg1: #f7f6f4;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-solid: #ffffff;
  --ink: #1a1c20;
  --muted: #6b7280;
  --line: rgba(28, 32, 40, 0.10);
  --line-2: rgba(28, 32, 40, 0.18);

  /* 品牌光：对比度按白底 AA（4.5:1）校过 */
  --sky: #0b74b8;      /* 4.9:1 */
  --sky-deep: #09608f;
  --sky-light: #7fc4ea;
  --lamp: #96600a;     /* 5.3:1 */
  --lamp-2: #8a5209;
  --ink-on-sky: #ffffff;

  --danger: #c0353e;   /* 5.5:1 */
  --ok: #0a7d54;       /* 5.1:1 */

  --font: "RH Geist", "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Noto Sans SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "RH Grotesk", "Avenir Next", "PingFang SC", var(--font);
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r: 14px;
  --edge: 0 0 0 1px var(--line);
  --sh-card: 0 1px 2px rgba(24, 28, 36, 0.04), 0 8px 24px rgba(24, 28, 36, 0.06);
  --sh-card-lg: 0 2px 4px rgba(24, 28, 36, 0.04), 0 18px 44px rgba(24, 28, 36, 0.09);

  /* ui-kit 组件读的是 --ink2/--mut/--line2 这套名字，本页叫 --muted/--line-2，
     不补别名对话框会回落到 ui-kit.css 的暗色默认值。 */
  --ink2: var(--muted);
  --mut: var(--muted);
  --line2: var(--line-2);
  --panel2: var(--bg1);
  --panel3: var(--bg1);
  --acc: var(--sky);
  --err: var(--danger);
  --on-acc: #fff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg0);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── 台面背景：顶部天光 + 右上暖光斑 + 底部回光 ───────────────────── */
.studio-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(110% 70% at 50% -16%, rgba(11, 116, 184, 0.10), transparent 62%),
    radial-gradient(48% 36% at 90% 4%, rgba(150, 96, 10, 0.07), transparent 64%),
    radial-gradient(88% 44% at 50% 108%, rgba(11, 116, 184, 0.06), transparent 68%),
    linear-gradient(180deg, #fbfaf9 0%, var(--bg1) 46%, var(--bg0) 100%);
}
/* 台面：一条极淡的地平线 + 透视网格 */
.studio-floor {
  position: fixed; left: -10%; right: -10%; bottom: 0; height: 42vh;
  z-index: 0; pointer-events: none; overflow: hidden;
  background: linear-gradient(180deg, transparent, rgba(11, 116, 184, 0.035) 40%, transparent);
}
.studio-floor::before {
  content: "";
  position: absolute; left: 50%; top: 4vh;
  width: 240%; height: 70vh;
  transform: translateX(-50%) perspective(320px) rotateX(76deg);
  transform-origin: 50% 0;
  background:
    repeating-linear-gradient(90deg, rgba(60, 90, 125, 0.10) 0 1px, transparent 1px 62px),
    repeating-linear-gradient(0deg, rgba(60, 90, 125, 0.08) 0 1px, transparent 1px 62px);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.85), transparent 60%);
          mask-image: linear-gradient(180deg, rgba(0,0,0,.85), transparent 60%);
  opacity: 0.55;
}
.noise {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.shell {
  position: relative; z-index: 2;
  width: min(520px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 0 64px;
}

/* ── 品牌条 ─────────────────────────────────────────────────────── */
.brand-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 20px;
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.mark {
  width: 44px; height: 44px; border-radius: 12px; display: block; flex: none;
  box-shadow: var(--edge), 0 6px 18px rgba(11, 116, 184, 0.16);
}
.brand h1 {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700; letter-spacing: -0.015em;
  margin: 0; line-height: 1;
  color: var(--ink);
}
.tag {
  margin: 6px 0 0; color: var(--muted); font-size: 12.5px;
  letter-spacing: 0.02em;
}

/* ── 面板：白卡 + 柔和投影 ─────────────────────────────────────── */
.announce, .card, .workspace {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r) var(--r) var(--r) 5px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--sh-card);
}
.announce { margin-bottom: 14px; padding: 14px 16px; }
.announce-label {
  font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--sky); margin-bottom: 8px; font-weight: 700;
  font-family: var(--mono);
}
/* 公告条目：portal.js 生成的是 .announce-item > .a-title / .a-body */
.announce-item { margin-bottom: 10px; padding-left: 12px; position: relative; }
.announce-item:last-child { margin-bottom: 0; }
.announce-item::before {
  content: ""; position: absolute; left: 0; top: 6px;
  width: 0; height: 0;
  border-left: 6px solid var(--lamp);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  opacity: 0.85;
}
.announce-item .a-title,
.announce-item h3 {
  font-size: 13px; font-weight: 600; color: var(--ink); margin: 0 0 3px;
  line-height: 1.5;
}
.announce-item .a-title .pin { color: var(--lamp); margin-right: 4px; }
.announce-item .a-body,
.announce-item p {
  margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.65;
  white-space: pre-wrap;
}

.card, .workspace { padding: 24px 22px 22px; }
.login h2 {
  font-family: var(--font-display);
  font-size: 22px; margin: 0 0 8px; letter-spacing: -0.01em; font-weight: 700;
  color: var(--ink);
}
.hint { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.65; }

/* ── 表单 ───────────────────────────────────────────────────────── */
.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 7px;
  letter-spacing: 0.06em; font-weight: 600;
}
.input-glow { position: relative; border-radius: 10px; }
/* 聚焦时一道光扫过输入框 */
.input-glow::before {
  content: ""; position: absolute; inset: -1px; border-radius: 11px;
  background: linear-gradient(100deg, transparent 20%, var(--sky) 45%, var(--lamp) 60%, transparent 80%);
  background-size: 260% 100%;
  opacity: 0; transition: opacity .22s;
  animation: rimSweep 3.4s linear infinite;
  z-index: 0;
}
.input-glow:focus-within::before { opacity: 0.7; }
@keyframes rimSweep {
  from { background-position: 0% 50%; }
  to   { background-position: 260% 50%; }
}
input, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel-solid);
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  position: relative; z-index: 1;
  transition: border-color .18s, box-shadow .18s;
  resize: vertical;
}
textarea { min-height: 76px; line-height: 1.55; font-size: 13px; }
input::placeholder, textarea::placeholder { color: #a8adb6; }
input:focus, textarea:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(11, 116, 184, 0.14);
}
input:disabled, textarea:disabled { opacity: 0.55; background: var(--bg1); }
.mono { font-family: var(--mono); letter-spacing: 0.04em; }

button {
  font-family: inherit;
  border: none; cursor: pointer;
  border-radius: 10px;
  font-weight: 600; font-size: 14px;
  padding: 12px 16px;
  transition: transform .14s, filter .18s, box-shadow .18s, background .18s;
}
button:active { transform: scale(0.985); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.primary {
  width: 100%;
  color: var(--ink-on-sky);
  background: linear-gradient(135deg, var(--sky), var(--sky-deep) 82%);
  box-shadow: 0 6px 18px rgba(11, 116, 184, 0.20);
}
.primary:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 8px 22px rgba(11, 116, 184, 0.26);
}
.danger {
  width: 100%;
  background: rgba(192, 53, 62, 0.07);
  color: var(--danger);
  border: 1px solid rgba(192, 53, 62, 0.28);
}
.danger:hover:not(:disabled) { background: rgba(192, 53, 62, 0.12); }
.ghost {
  background: var(--panel-solid); color: var(--muted);
  border: 1px solid var(--line-2); padding: 8px 13px; font-size: 12.5px;
  border-radius: 8px;
}
.ghost:hover { color: var(--ink); border-color: var(--muted); }
.err { color: var(--danger); font-size: 12.5px; margin: 10px 0 0; line-height: 1.6; }

/* ── 卡面信息 ───────────────────────────────────────────────────── */
.meta-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.pill {
  font-size: 11.5px;
  padding: 5px 11px;
  border-radius: 7px 7px 7px 2px;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--muted);
}
.pill-tier {
  color: var(--sky-deep);
  border-color: rgba(11, 116, 184, 0.24);
  background: rgba(11, 116, 184, 0.07);
}

/* ── 进度台：月相 ───────────────────────────────────────────────── */
.progress-stage {
  position: relative;
  margin: 6px 0 16px;
  padding: 18px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.moon-wrap {
  position: relative;
  width: 200px; height: 200px;
  display: grid; place-items: center;
  /* 下方要放「40% 上弦月」读数，别让 counts 顶上来 */
  margin-bottom: 46px;
}
/* 月晕：一层很淡的蓝，只在跑动时呼吸 */
.moon-halo {
  position: absolute; inset: -14px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(11, 116, 184, 0.18), rgba(11, 116, 184, 0.05) 58%, transparent 74%);
  opacity: 0.75;
  transition: opacity .6s;
}
.moon-wrap.is-running .moon-halo { animation: haloBreathe 3.2s ease-in-out infinite; }
@keyframes haloBreathe {
  0%, 100% { opacity: 0.45; transform: scale(0.97); }
  50%      { opacity: 0.9;  transform: scale(1.04); }
}

.moon-orbit {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: visible;
}
.orbit-track {
  fill: none;
  stroke: rgba(60, 90, 125, 0.14);
  stroke-width: 1.4;
  stroke-dasharray: 3 6;
}
.orbit-arc {
  fill: none;
  stroke: var(--sky);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset .9s cubic-bezier(.22, 1, .36, 1);
  opacity: 0.85;
}

.moon {
  position: relative;
  width: 152px; height: 152px;
  display: block;
  filter: drop-shadow(0 6px 18px rgba(11, 116, 184, 0.20));
}
/* 暗面：跟背景同色系，靠它把月亮「啃」出月相。
   边缘做 1px 柔化 —— 纯色硬边像剪纸，柔化后才像真实的明暗交界。 */
.crater { fill: rgba(255, 255, 255, 0.16); }
.moon-shadow {
  fill: #e7e5df;
  filter: blur(1.1px);
  transition: transform 1s cubic-bezier(.22, 1, .36, 1);
}
.moon-rim {
  fill: none;
  stroke: rgba(11, 116, 184, 0.28);
  stroke-width: 1;
}
.moon-wrap.lit .moon-rim { stroke: rgba(11, 116, 184, 0.45); }

/* 读数放在月亮下方：月相要完整可见，压在月亮上会互相干扰 */
.moon-center {
  position: absolute;
  left: 50%; top: 100%;
  transform: translateX(-50%);
  margin-top: 8px;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 9px;
  pointer-events: none;
  white-space: nowrap;
}
.pct {
  font-size: 27px; font-weight: 700; line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.phase {
  font-size: 11px; font-weight: 600;
  padding: 2px 9px;
  border-radius: 5px;
  color: var(--lamp-2);
  background: rgba(150, 96, 10, 0.10);
  border: 1px solid rgba(150, 96, 10, 0.22);
  white-space: nowrap;
  align-self: center;
}

.counts {
  display: flex; align-items: baseline; gap: 4px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.counts .sep { color: var(--muted); margin: 0 2px; }
.counts .unit { font-size: 12px; color: var(--muted); margin-left: 3px; }

/* 运行中：计时 + 轮播提示 */
.run-live {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 10px 0 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(11, 116, 184, 0.07);
  border: 1px solid rgba(11, 116, 184, 0.16);
  font-size: 11.5px;
  color: var(--sky-deep);
}
.run-live[hidden] { display: none; }
.run-live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--sky);
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.15); }
}
.run-live-elapsed { color: var(--muted); font-variant-numeric: tabular-nums; }

.actions { display: grid; gap: 9px; }
.run-panel { margin-top: 2px; }

/* ── 邀请码获取指引 ─────────────────────────────────────────────
   用户最容易卡住的一步，给足视觉权重：底色、边框、字号都往上抬一档。 */
.howto {
  margin-bottom: 16px;
  padding: 15px 16px 14px;
  border: 1px solid color-mix(in srgb, var(--sky) 22%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--sky) 7%, var(--panel-solid));
}
.howto-title {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 9px;
  color: var(--sky-deep);
}
.howto-steps { margin: 0; padding-left: 19px; display: grid; gap: 7px; }
.howto-steps li { font-size: 12.5px; line-height: 1.7; color: var(--ink); }
.howto-steps li b { color: inherit; font-weight: 700; }
.howto-steps a {
  color: var(--sky-deep);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--sky) 40%, transparent);
}
.howto-steps a:hover { border-bottom-color: var(--sky-deep); }
.howto-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.howto-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 11px;
  padding: 8px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  background: var(--sky);
  text-decoration: none;
  transition: background .16s;
}
.howto-cta:hover { background: var(--sky-deep); color: #fff; }
.howto-cta::after { content: "↗"; font-size: 13px; line-height: 1; }

/* ── 识别结果 / 运行备注 ─────────────────────────────────────── */
.parse-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -4px 0 10px;
  padding: 5px 11px;
  border-radius: 7px;
  background: rgba(11, 116, 184, 0.07);
  border: 1px solid rgba(11, 116, 184, 0.16);
  font-size: 12.5px;
  color: var(--muted);
}
.parse-pill[hidden] { display: none; }
.parse-pill b { color: var(--sky-deep); font-weight: 700; }
.run-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.run-note.warn { color: var(--lamp-2); }
.run-note[hidden] { display: none; }

.workspace.enter { animation: stageIn .5s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes stageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ── 完成层 ─────────────────────────────────────────────────────── */
.celebrate {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background: radial-gradient(75% 60% at 50% 42%, rgba(255, 255, 255, 0.88), rgba(240, 240, 238, 0.96));
  backdrop-filter: blur(7px);
  animation: celebFade .4s ease both;
}
.celebrate[hidden] { display: none !important; }
@keyframes celebFade { from { opacity: 0; } to { opacity: 1; } }
.celebrate-card {
  position: relative; z-index: 2;
  width: min(360px, calc(100% - 36px));
  text-align: center;
  padding: 28px 24px 22px;
  border-radius: 18px 18px 18px 5px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  box-shadow: var(--sh-card-lg);
  animation: cardRise .6s cubic-bezier(.22, 1, .36, 1) .15s both;
}
@keyframes cardRise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
.celebrate-logo {
  width: 54px; height: 54px; border-radius: 14px; margin-bottom: 12px;
  box-shadow: var(--edge), 0 8px 22px rgba(11, 116, 184, 0.20);
}
.celebrate-kicker {
  margin: 0; font-size: 10.5px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--lamp-2); font-weight: 700;
  font-family: var(--mono);
}
.celebrate-title {
  font-family: var(--font-display);
  font-size: 30px; margin: 8px 0 12px; letter-spacing: -0.015em; font-weight: 700;
  color: var(--ink);
}
.celebrate-reward { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.celebrate-receipt { margin: 0 0 20px; color: var(--ink2); font-size: 13px; }
.celebrate-btn { max-width: 190px; margin: 0 auto; }

/* ── 窄屏 ───────────────────────────────────────────────────────── */
@media (max-width: 380px) {
  .shell { width: calc(100% - 20px); padding-top: 22px; }
  .card, .workspace { padding: 18px 16px 17px; }
  .moon-wrap { width: 168px; height: 168px; }
  .moon { width: 128px; height: 128px; }
  .pct { font-size: 26px; }
  .brand h1 { font-size: 23px; }
  .mark { width: 40px; height: 40px; }
}
/* 手机上把「邀请码从哪拿」保在首屏，进度盘让位 */
@media (max-width: 560px) {
  /* margin-bottom 要给下方读数留位：读数高度固定约 31px，与月亮尺寸无关 */
  .moon-wrap { width: 150px; height: 150px; margin-bottom: 38px; }
  .moon { width: 116px; height: 116px; }
  .pct { font-size: 24px; }
  .progress-stage { padding: 10px 0 2px; margin-bottom: 12px; }
  .howto { padding: 13px 14px 12px; margin-bottom: 13px; }
  .howto-steps { gap: 6px; }
  .howto-steps li { font-size: 12px; line-height: 1.65; }
  .howto-cta { width: 100%; justify-content: center; }
}
@media (max-height: 700px) {
  .moon-wrap { width: 160px; height: 160px; }
  .moon { width: 122px; height: 122px; }
}

/* ── 降低动效偏好：真正停掉所有连续动画 ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .input-glow::before,
  .moon-wrap.is-running .moon-halo,
  .run-live-dot,
  .workspace.enter,
  .celebrate,
  .celebrate-card { animation: none !important; }
  .orbit-arc, .moon-shadow, .primary, button, input, textarea { transition: none !important; }
}
