:root {
  --glass: rgba(255, 255, 255, 0.12);
  --glass-hover: rgba(255, 255, 255, 0.24);
  --glass-border: rgba(255, 255, 255, 0.32);
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.74);
  --ink: #3a2f66;
  --paper-ink: #3f3024;
  --ui-font: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --letter-font: "LXGW WenKai", "LXGW WenKai Screen", "KaiTi", "STKaiti", "楷体", "Kaiti SC", serif;
  --title-font: "STXingkai", "华文行楷", "Xingkai SC", "LXGW WenKai", "KaiTi", "STKaiti", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1c3d;
  color: var(--text);
  font-family: var(--ui-font);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none;
  outline: none;
  cursor: grab;
}
#scene.dragging { cursor: grabbing; }
#scene.pointer { cursor: pointer; }
#scene.aiming { cursor: crosshair; }

.hidden { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; padding: 0; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.8); outline-offset: 2px; }

svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  box-shadow: 0 8px 30px rgba(10, 30, 90, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b8bfd8;
  flex: none;
}

/* ------------------------------------------------------------------ 加载 */

.loader {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 26px;
  background: radial-gradient(ellipse at 50% 62%, #7a64c6 0%, #3a4aa0 38%, #13265a 72%, #0b1c3d 100%);
  transition: opacity 1.4s ease, visibility 1.4s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader-orb {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #cfeaff 28%, #c9a8ff 58%, rgba(255, 180, 220, 0) 72%);
  box-shadow: 0 0 70px 20px rgba(190, 200, 255, 0.45);
  animation: orb 2.6s ease-in-out infinite;
}
.loader p {
  margin: 0;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--text-dim);
  font-size: 14px;
}
.loader p::after { content: '…'; animation: blink 1.4s steps(2) infinite; }

@keyframes orb {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-12px) scale(1.07); }
}
@keyframes blink { 50% { opacity: 0.2; } }

/* ------------------------------------------------------------------ 开场 */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
}

.intro {
  background: radial-gradient(ellipse at center, rgba(12, 22, 64, 0.05) 0%, rgba(10, 16, 50, 0.5) 100%);
  transition: opacity 1.1s ease, visibility 1.1s;
}
.intro.leaving { opacity: 0; visibility: hidden; }

.intro-card {
  position: relative;
  width: min(560px, 94vw);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.32) transparent;
  padding: 30px 40px 26px;
  border-radius: 28px;
  text-align: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 30px 90px rgba(10, 20, 70, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  animation: floatIn 1.4s cubic-bezier(.2, .8, .2, 1) both;
}
.intro-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--spin, 0deg), rgba(255, 200, 235, 0.9), rgba(190, 225, 255, 0.2), rgba(215, 195, 255, 0.9), rgba(255, 240, 200, 0.2), rgba(255, 200, 235, 0.9));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  animation: spin 9s linear infinite;
}
@property --spin { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes spin { to { --spin: 360deg; } }

.intro-kicker { font-size: 11px; letter-spacing: 0.55em; color: var(--text-dim); margin-bottom: 8px; }

.intro-title {
  margin: 0;
  font-family: var(--title-font);
  font-weight: 400;
  font-size: clamp(46px, 8vw, 70px);
  letter-spacing: 0.12em;
  text-indent: 0.12em;
  background: linear-gradient(100deg, #fff 0%, #ffd3ec 22%, #c7e6ff 46%, #e4d4ff 70%, #fff 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 7s linear infinite;
  filter: drop-shadow(0 4px 24px rgba(200, 180, 255, 0.55));
}
@keyframes shimmer { to { background-position: -250% 0; } }

.intro-sub { color: rgba(255, 255, 255, 0.88); line-height: 1.95; font-size: 15px; margin: 10px 0 14px; }

.gpu-report {
  margin: 0 auto 14px;
  padding: 10px 16px;
  border-radius: 16px;
  background: rgba(8, 18, 50, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.14);
  text-align: left;
  font-size: 13px;
}
.gpu-line { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: 0.04em; }
.gpu-detail { color: var(--text-dim); margin-top: 6px; line-height: 1.75; word-break: break-word; }
.gpu-detail:empty { display: none; }
.gpu-report.ok .dot, .gpu-badge.ok .dot { background: #72ffbd; box-shadow: 0 0 10px #72ffbd; }
.gpu-report.warn .dot, .gpu-badge.warn .dot { background: #ffd36e; box-shadow: 0 0 10px #ffd36e; }
.gpu-report.bad .dot, .gpu-badge.bad .dot { background: #ff6f8e; box-shadow: 0 0 10px #ff6f8e; }

.intro-controls {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
}
.intro-controls b {
  color: #fff;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 5px 0 2px;
}

.btn-primary {
  padding: 14px 44px;
  border-radius: 999px;
  font-size: 17px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: #2b2150;
  background: linear-gradient(100deg, #ffe0f0, #d9ecff, #e9dcff);
  box-shadow: 0 10px 40px rgba(210, 180, 255, 0.55), inset 0 1px 0 #fff;
  transition: transform .25s, box-shadow .25s, opacity .3s;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 50px rgba(220, 190, 255, 0.8), inset 0 1px 0 #fff; }
.btn-primary:disabled { opacity: 0.55; cursor: progress; }

.fatal { z-index: 70; background: rgba(8, 12, 36, 0.85); }
.fatal h2 { margin: 0 0 12px; font-family: var(--title-font); font-weight: 400; font-size: 34px; letter-spacing: 0.12em; }
.fatal p { line-height: 1.9; color: rgba(255, 255, 255, 0.86); }
.fatal-tip { font-size: 13px; color: var(--text-dim) !important; }

@keyframes floatIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* ------------------------------------------------------------------ HUD */

.hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 22px;
  pointer-events: none;
  animation: fadeDown 1.2s ease both;
}
.hud-top > * { pointer-events: auto; }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; }
.brand-icon svg { width: 22px; height: 22px; }
.brand-title {
  font-family: var(--title-font);
  font-size: 25px;
  letter-spacing: 0.16em;
  text-shadow: 0 2px 18px rgba(120, 100, 255, 0.55), 0 0 2px rgba(40, 40, 120, 0.4);
}
.brand-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; letter-spacing: 0.08em; text-shadow: 0 1px 8px rgba(20, 30, 90, 0.5); }

.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.seg { display: flex; padding: 4px; border-radius: 999px; }
.seg button {
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  transition: background .35s, color .35s, box-shadow .35s;
}
.seg button:hover { color: #fff; }
.seg button.active { background: rgba(255, 255, 255, 0.88); color: var(--ink); box-shadow: 0 2px 14px rgba(255, 255, 255, 0.45); }

.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; transition: transform .2s, background .2s; }
.icon-btn:hover { transform: translateY(-1px); background: var(--glass-hover); }
.icon-btn svg { width: 20px; height: 20px; }
#btnSound .snd-off { display: none; }
#btnSound.muted .snd-on { display: none; }
#btnSound.muted .snd-off { display: block; }

.sea { display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 42px; border-radius: 999px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.sea svg { width: 20px; height: 20px; color: #fff; flex: none; }
.sea input[type=range] { width: 92px; height: 20px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.sea input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, rgba(191, 232, 255, 0.9), rgba(255, 179, 220, 0.9)); }
.sea input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px rgba(255, 255, 255, 0.9); }
.sea input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, rgba(191, 232, 255, 0.9), rgba(255, 179, 220, 0.9)); }
.sea input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: none; border-radius: 50%; background: #fff; box-shadow: 0 0 10px rgba(255, 255, 255, 0.9); }

.write-btn {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  border-radius: 999px;
  font-size: 16px;
  letter-spacing: 0.26em;
  color: #fff;
  background: linear-gradient(120deg, rgba(255, 190, 225, 0.38), rgba(190, 220, 255, 0.34), rgba(215, 195, 255, 0.38));
  border: 1px solid rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  text-shadow: 0 1px 10px rgba(80, 60, 160, 0.5);
  animation: breathe 4.5s ease-in-out infinite, rise .8s ease both;
  transition: transform .25s;
}
.write-btn svg { width: 20px; height: 20px; }
.write-btn:hover { transform: translateX(-50%) translateY(-3px); }
@keyframes breathe {
  0%, 100% { box-shadow: 0 10px 40px rgba(200, 170, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
  50% { box-shadow: 0 10px 60px rgba(255, 185, 230, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
}
@keyframes rise { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }

.hold-bar {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px;
  border-radius: 999px;
  animation: rise .5s ease both;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 14px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transition: background .2s, transform .2s;
}
.chip:hover { background: rgba(255, 255, 255, 0.3); transform: translateY(-1px); }
.chip.primary { background: rgba(255, 255, 255, 0.9); color: var(--ink); }
.chip.primary:hover { background: #fff; }
kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 1px 6px;
  margin-left: 8px;
  border-radius: 5px;
  border: 1px solid currentColor;
  opacity: 0.65;
}
.hold-hint { font-size: 13px; color: var(--text-dim); padding: 0 4px; white-space: nowrap; }

.crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.55), inset 0 0 8px rgba(255, 255, 255, 0.35);
  z-index: 9;
  pointer-events: none;
  animation: pulse 2.4s ease-in-out infinite;
}
.crosshair::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px;
  border-radius: 50%;
  background: #fff;
}
@keyframes pulse { 50% { transform: scale(1.12); opacity: 0.8; } }

.power-ring {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 112px;
  height: 112px;
  margin: -56px 0 0 -56px;
  z-index: 9;
  pointer-events: none;
}
.power-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.power-ring circle { stroke-width: 5; fill: none; }
.power-ring .track { stroke: rgba(255, 255, 255, 0.18); }
.power-ring .bar { stroke: url(#powerGrad); stroke-dasharray: 263.9; stroke-dashoffset: 263.9; filter: drop-shadow(0 0 6px rgba(255, 200, 240, 0.9)); }
.power-ring span {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.24em;
  color: #fff;
  text-shadow: 0 1px 8px rgba(40, 30, 110, 0.7);
  white-space: nowrap;
}

.hover-tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 11;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.08em;
  pointer-events: none;
  white-space: nowrap;
  background: rgba(20, 30, 76, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 20px rgba(10, 20, 60, 0.3);
}

.gpu-badge {
  position: fixed;
  left: 18px;
  bottom: 16px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 44vw;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-dim);
  background: rgba(10, 20, 55, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.gpu-badge span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gpu-badge .dot { width: 7px; height: 7px; }

.hint {
  position: fixed;
  right: 20px;
  bottom: 16px;
  z-index: 8;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-dim);
  text-align: right;
  text-shadow: 0 1px 8px rgba(10, 20, 60, 0.6);
  transition: opacity 2s ease;
  pointer-events: none;
}
.hint.faded { opacity: 0; }

/* ------------------------------------------------------------------ 触摸操作层 */

.touch-pad {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}
.stick-zone {
  position: absolute;
  left: 22px;
  bottom: 72px;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  pointer-events: auto;
  touch-action: none;
  transition: background 0.2s;
}
.stick-zone.active { background: rgba(255, 255, 255, 0.2); }
.stick-knob {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.95), rgba(200, 216, 255, 0.72) 58%, rgba(170, 182, 255, 0.5));
  box-shadow: 0 4px 18px rgba(20, 40, 110, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 0.1s ease-out;
}
.stick-zone.active .stick-knob { transition: none; }
.fly-btns {
  position: absolute;
  right: 22px;
  bottom: 76px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  pointer-events: auto;
}
.fly-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  touch-action: none;
  transition: background 0.2s, transform 0.15s;
}
.fly-btn svg { width: 26px; height: 26px; }
.fly-btn.active { background: rgba(255, 255, 255, 0.3); transform: scale(0.92); }

@media (max-width: 480px) {
  .stick-zone { left: 14px; bottom: 62px; width: 112px; height: 112px; }
  .fly-btns { right: 14px; bottom: 66px; gap: 12px; }
  .fly-btn { width: 52px; height: 52px; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 104px;
  transform: translate(-50%, 16px);
  z-index: 20;
  max-width: min(640px, 90vw);
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.06em;
  text-align: center;
  background: rgba(22, 30, 76, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 34px rgba(10, 20, 60, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s ease, transform .5s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ 弹窗 */

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  perspective: 1200px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(24, 22, 70, 0.3), rgba(8, 10, 36, 0.72));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .5s ease;
}
.modal.show .modal-backdrop { opacity: 1; }
.modal.closing .modal-backdrop { opacity: 0; }

.paper {
  position: relative;
  width: min(640px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 46px 56px 30px;
  color: #4b3a2a;
  background:
    radial-gradient(ellipse at 18% 8%, rgba(255, 255, 255, 0.75), transparent 55%),
    radial-gradient(ellipse at 85% 95%, rgba(214, 170, 120, 0.3), transparent 60%),
    linear-gradient(175deg, #fcf5e3 0%, #f5e6c8 60%, #eedcb8 100%);
  border-radius: 5px 7px 6px 4px / 6px 4px 7px 5px;
  box-shadow:
    0 40px 90px rgba(5, 10, 40, 0.55),
    0 0 90px rgba(255, 220, 190, 0.28),
    inset 0 0 0 1px rgba(170, 125, 75, 0.2),
    inset 0 0 60px rgba(190, 140, 80, 0.18);
  user-select: text;
  opacity: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(150, 110, 70, 0.4) transparent;
}
.paper::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.33 0 0 0 0 0.2 0 0 0 0.28 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.6;
  mix-blend-mode: multiply;
}
.modal.show .paper { animation: unroll 1.05s cubic-bezier(.2, .9, .25, 1) forwards; }
.modal.closing .paper { animation: rollup .45s ease-in forwards; }

@keyframes unroll {
  0% { opacity: 0; clip-path: inset(46% 0 46% 0 round 6px); transform: translateY(34px) scale(0.92) rotateX(20deg); filter: blur(5px) brightness(1.5); }
  35% { opacity: 1; }
  100% { opacity: 1; clip-path: inset(0 0 0 0 round 6px); transform: none; filter: none; }
}
@keyframes rollup {
  from { opacity: 1; clip-path: inset(0 0 0 0 round 6px); transform: none; }
  to { opacity: 0; clip-path: inset(48% 0 48% 0 round 6px); transform: translateY(-22px) scale(0.94); }
}

.seal {
  position: absolute;
  top: 22px;
  right: 26px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--title-font);
  font-size: 24px;
  color: rgba(255, 232, 238, 0.9);
  background: radial-gradient(circle at 35% 30%, #f28aa6, #c63f66 58%, #8c2142);
  box-shadow: 0 4px 10px rgba(120, 20, 50, 0.35), inset 0 -3px 6px rgba(0, 0, 0, 0.25), inset 0 3px 6px rgba(255, 255, 255, 0.3);
  transform: rotate(-12deg);
  opacity: 0.88;
  user-select: none;
}

.paper-deco {
  text-align: center;
  font-family: var(--letter-font);
  color: #a07a55;
  letter-spacing: 0.35em;
  font-size: 14px;
  margin-bottom: 22px;
  user-select: none;
}
.letter-to { font-family: var(--letter-font); font-size: 21px; margin: 0 0 4px; color: var(--paper-ink); line-height: 40px; }
.letter-to:empty { display: none; }

.letter-body {
  font-family: var(--letter-font);
  font-size: 20px;
  line-height: 40px;
  color: var(--paper-ink);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 39px, rgba(160, 115, 70, 0.22) 39px, rgba(160, 115, 70, 0.22) 40px);
}
.letter-body .ln {
  margin: 0;
  min-height: 40px;
  white-space: pre-wrap;
  word-break: break-word;
  text-indent: 0;
  opacity: 0;
  animation: inkIn 1s ease forwards;
}
@keyframes inkIn {
  from { opacity: 0; filter: blur(3px); transform: translateY(5px); }
  to { opacity: 1; filter: none; transform: none; }
}
.letter-sign { font-family: var(--letter-font); font-size: 20px; text-align: right; margin-top: 16px; color: var(--paper-ink); opacity: 0; animation: inkIn 1s ease forwards; }
.letter-meta { text-align: right; font-size: 13px; color: #9a7b5c; margin-top: 4px; font-family: var(--letter-font); letter-spacing: 0.1em; opacity: 0; animation: inkIn 1s ease forwards; }
.letter-count { text-align: center; font-size: 13px; color: #b07a95; margin-top: 18px; letter-spacing: 0.16em; font-family: var(--letter-font); }
.letter-count:empty { display: none; }

.paper-actions { display: flex; justify-content: center; gap: 12px; margin-top: 24px; flex-wrap: wrap; user-select: none; }
.btn-ghost {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid rgba(120, 85, 50, 0.35);
  color: #6b5037;
  font-size: 14px;
  letter-spacing: 0.12em;
  transition: background .2s, border-color .2s;
}
.btn-ghost:hover { background: rgba(160, 115, 70, 0.1); border-color: rgba(120, 85, 50, 0.6); }
.btn-ghost.active { background: rgba(198, 63, 102, 0.1); border-color: rgba(198, 63, 102, 0.5); color: #a83a5c; }
.btn-ink {
  padding: 10px 24px;
  border-radius: 999px;
  background: linear-gradient(120deg, #5b4a8a, #7d5cab);
  color: #fff;
  font-size: 14px;
  letter-spacing: 0.15em;
  box-shadow: 0 6px 18px rgba(90, 70, 140, 0.35);
  transition: transform .2s, box-shadow .2s;
}
.btn-ink:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(90, 70, 140, 0.45); }

.compose-paper textarea {
  display: block;
  width: 100%;
  min-height: 280px;
  max-height: 46vh;
  resize: vertical;
  border: none;
  outline: none;
  padding: 0;
  font-family: var(--letter-font);
  font-size: 20px;
  line-height: 40px;
  color: var(--paper-ink);
  background: transparent repeating-linear-gradient(to bottom, transparent 0, transparent 39px, rgba(160, 115, 70, 0.22) 39px, rgba(160, 115, 70, 0.22) 40px);
  background-attachment: local;
  user-select: text;
}
.compose-paper textarea::placeholder, .compose-paper input::placeholder { color: rgba(120, 90, 60, 0.45); }
.compose-to { display: flex; align-items: baseline; font-family: var(--letter-font); font-size: 20px; color: var(--paper-ink); margin-bottom: 4px; }
.compose-to input { flex: 1; min-width: 0; }
.compose-paper input {
  font-family: var(--letter-font);
  font-size: 18px;
  border: none;
  border-bottom: 1px dashed rgba(120, 85, 50, 0.5);
  background: transparent;
  outline: none;
  padding: 3px 2px;
  width: 160px;
  color: var(--paper-ink);
  user-select: text;
}
.compose-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  font-size: 14px;
  color: #7a5c40;
  flex-wrap: wrap;
  font-family: var(--letter-font);
}
.compose-row label { display: flex; align-items: baseline; font-size: 16px; }
.count { font-size: 12px; color: #a08060; font-family: var(--ui-font); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--c) 45%, color-mix(in srgb, var(--c) 58%, #5a4a8a) 100%);
  box-shadow: 0 2px 6px rgba(90, 70, 50, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  transition: transform .2s, box-shadow .2s;
}
.swatch:hover { transform: scale(1.1); }
.swatch.active { transform: scale(1.18); box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(122, 90, 168, 0.75), 0 4px 10px rgba(90, 70, 50, 0.3); }
.compose-error { min-height: 20px; margin: 10px 0 0; text-align: center; font-size: 13px; color: #c0506f; font-family: var(--ui-font); }
.shake { animation: shake .42s ease; }
@keyframes shake {
  20% { translate: -8px 0; }
  40% { translate: 7px 0; }
  60% { translate: -5px 0; }
  80% { translate: 3px 0; }
}

.panel {
  position: relative;
  width: min(680px, 94vw);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  padding: 22px 24px 24px;
  border-radius: 24px;
  background: linear-gradient(165deg, rgba(40, 46, 110, 0.62), rgba(24, 28, 76, 0.62));
  border: 1px solid rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 30px 90px rgba(0, 0, 20, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  opacity: 0;
  transform: translateY(22px) scale(0.97);
  transition: opacity .45s ease, transform .45s cubic-bezier(.2, .8, .2, 1);
}
.modal.show .panel { opacity: 1; transform: none; }
.modal.closing .panel { opacity: 0; transform: translateY(14px) scale(0.98); }
.panel header { display: flex; justify-content: space-between; align-items: center; }
.panel h2 { margin: 0; font-family: var(--title-font); font-weight: 400; font-size: 30px; letter-spacing: 0.16em; }
.panel .icon-btn { background: rgba(255, 255, 255, 0.1); }

.tabs { display: flex; gap: 8px; margin: 16px 0 14px; }
.tabs button { padding: 7px 16px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); font-size: 13px; color: var(--text-dim); transition: background .3s, color .3s; }
.tabs button.active { background: rgba(255, 255, 255, 0.88); color: var(--ink); }

.collection-list { overflow-y: auto; display: grid; gap: 12px; padding: 2px 4px 2px 2px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.3) transparent; }
.c-item {
  position: relative;
  padding: 14px 18px 16px;
  border-radius: 16px;
  background: linear-gradient(170deg, #fbf3e0, #f1e1c1);
  color: #4b3a2a;
  cursor: pointer;
  text-align: left;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 6px 18px rgba(0, 0, 30, 0.2);
}
.c-item:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 30, 0.28); }
.c-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: #8a6a4a; font-family: var(--letter-font); }
.c-text {
  font-family: var(--letter-font);
  font-size: 16px;
  line-height: 1.9;
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  user-select: text;
}
.c-item.open .c-text { display: block; -webkit-line-clamp: unset; }
.c-actions { display: none; justify-content: flex-end; margin-top: 8px; }
.c-item.open .c-actions { display: flex; }
.c-remove { font-size: 12px; color: #a0785a; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(160, 120, 90, 0.4); }
.c-remove:hover { background: rgba(160, 120, 90, 0.1); }
.empty { text-align: center; color: var(--text-dim); padding: 44px 0; font-size: 14px; line-height: 2; }

.help-body { overflow-y: auto; margin-top: 16px; }
.help-grid { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; align-items: center; font-size: 14px; }
.help-grid kbd { margin: 0; font-size: 12px; padding: 4px 10px; border-radius: 8px; opacity: 1; border-color: rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.08); justify-self: start; white-space: nowrap; }
.help-grid span { color: rgba(255, 255, 255, 0.86); }
.help-note { margin: 18px 0 0; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.07); font-size: 13px; line-height: 1.85; color: var(--text-dim); }

/* ------------------------------------------------------------------ 滚动条 */

.intro-card, .help-body, .collection-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.32) transparent;
}
.intro-card::-webkit-scrollbar, .help-body::-webkit-scrollbar, .collection-list::-webkit-scrollbar { width: 9px; }
.intro-card::-webkit-scrollbar-track, .help-body::-webkit-scrollbar-track, .collection-list::-webkit-scrollbar-track { background: transparent; }
.intro-card::-webkit-scrollbar-thumb, .help-body::-webkit-scrollbar-thumb, .collection-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 9px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.intro-card::-webkit-scrollbar-thumb:hover, .help-body::-webkit-scrollbar-thumb:hover, .collection-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.paper {
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 105, 70, 0.4) transparent;
}
.paper::-webkit-scrollbar { width: 9px; }
.paper::-webkit-scrollbar-track { background: transparent; }
.paper::-webkit-scrollbar-thumb {
  background: rgba(140, 105, 70, 0.35);
  border-radius: 9px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.paper::-webkit-scrollbar-thumb:hover {
  background: rgba(140, 105, 70, 0.55);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ------------------------------------------------------------------ 适配 */

@media (max-width: 860px) {
  .hud-top { flex-direction: column; align-items: stretch; padding: 12px 14px; }
  .top-actions { justify-content: flex-start; }
  .sea-label, .hold-hint, .hint { display: none; }
  .gpu-badge { max-width: 70vw; }
}

@media (max-width: 560px) {
  .intro-card { padding: 28px 22px 24px; }
  .paper { padding: 36px 24px 24px; }
  .letter-body, .compose-paper textarea { font-size: 18px; }
  .seal { width: 44px; height: 44px; font-size: 20px; top: 14px; right: 14px; }
  .brand-sub { display: none; }
  .write-btn { bottom: 22px; padding: 12px 24px; }
  .chip { padding: 9px 13px; font-size: 13px; }
  kbd { display: none; }
}

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