/* =========================================================
   一句开玩 · 视觉系统
   品牌紫 #7657EF / 活力橙 #FF784F / 荧光绿 #B9F36B
   暖白 #FFF9F2 / 深墨 #242131 / 浅紫 #EAE5FF
   ========================================================= */

:root {
  --paper: #fff9f2;
  --paper-2: #fffdf9;
  --ink: #242131;
  --ink-soft: #4b4659;
  --muted: #7b7588;
  --purple: #7657ef;
  --purple-deep: #5a3fd6;
  --purple-soft: #eae5ff;
  --orange: #ff784f;
  --lime: #b9f36b;
  --line: rgba(36, 33, 49, 0.11);
  --line-strong: rgba(36, 33, 49, 0.18);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --shadow-card: 0 2px 0 rgba(36, 33, 49, 0.04), 0 18px 50px rgba(78, 54, 160, 0.11);
  --shadow-float: 0 22px 60px rgba(92, 66, 190, 0.18);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--paper);
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.is-playing {
  overflow: hidden;
  touch-action: none;
}

button,
textarea,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(118, 87, 239, 0.45);
  outline-offset: 3px;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.hidden {
  display: none !important;
}

/* ---------- 背景氛围 ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.55;
}

.blob-a {
  width: 46vw;
  height: 46vw;
  max-width: 620px;
  max-height: 620px;
  top: -18vw;
  right: -10vw;
  background: radial-gradient(circle at 40% 40%, #d9d0ff 0%, rgba(234, 229, 255, 0) 70%);
}

.blob-b {
  width: 40vw;
  height: 40vw;
  max-width: 520px;
  max-height: 520px;
  bottom: -16vw;
  left: -12vw;
  background: radial-gradient(circle at 60% 40%, #ffe0cf 0%, rgba(255, 224, 207, 0) 70%);
}

.dot-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(36, 33, 49, 0.14) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 74% 62% at 50% 28%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 74% 62% at 50% 28%, #000 0%, transparent 78%);
  opacity: 0.55;
}

.float-sticker {
  position: absolute;
  font-size: 30px;
  line-height: 1;
  filter: drop-shadow(0 8px 14px rgba(36, 33, 49, 0.1));
  opacity: 0.8;
  animation: bob 6s ease-in-out infinite;
}

.is-subpage .float-sticker {
  display: none;
}

.fs-1 { top: 17%; left: 7%; rotate: -12deg; animation-delay: -0.5s; }
.fs-2 { top: 58%; left: 12%; font-size: 24px; rotate: 9deg; animation-delay: -2.2s; }
.fs-3 { top: 15%; right: 8%; rotate: 10deg; animation-delay: -1.4s; }
.fs-4 { top: 46%; right: 15%; font-size: 22px; rotate: -8deg; animation-delay: -3.1s; }
.fs-5 { top: 76%; right: 8%; font-size: 26px; rotate: 8deg; animation-delay: -2.6s; }
.fs-6 { top: 38%; left: 4%; font-size: 22px; rotate: -6deg; animation-delay: -4s; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); }
  50% { transform: translateY(-10px) rotate(calc(var(--r, 0deg) + 4deg)); }
}

/* ---------- 通用 ---------- */

.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  width: 100%;
  animation: screenIn 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.topbar {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: calc(16px + var(--safe-t)) 22px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 18px;
}

.brand-text {
  white-space: nowrap;
}

.brand-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 5px 10px rgba(118, 87, 239, 0.28));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand:hover .brand-icon {
  transform: rotate(-8deg) scale(1.06);
}

.brand-icon svg {
  width: 100%;
  height: 100%;
}

.brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 3px rgba(185, 243, 107, 0.22);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 13px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(36, 33, 49, 0.08);
  backdrop-filter: blur(10px);
  transition: background 0.2s, transform 0.2s;
}

.ghost-btn svg {
  width: 17px;
  height: 17px;
}

.ghost-btn:hover {
  background: #fff;
  transform: translateY(-1px);
}

.ghost-btn:active {
  transform: translateY(1px);
}

.gpt-return-btn {
  min-width: 42px;
  padding: 0 10px;
}

.gpt-return-btn span {
  color: var(--purple-deep);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 5px 0 var(--purple-deep), 0 14px 26px rgba(118, 87, 239, 0.26);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.2s;
  white-space: nowrap;
}

.cta:hover {
  background: #8265f5;
}

.cta:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--purple-deep), 0 8px 16px rgba(118, 87, 239, 0.22);
}

.cta:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  background: #9b92b5;
  box-shadow: 0 5px 0 #7d7497;
}

.cta-arrow {
  font-size: 19px;
  transition: transform 0.2s;
}

.cta:hover .cta-arrow {
  transform: translateX(3px);
}

.cta.wide {
  width: 100%;
  min-height: 56px;
  font-size: 17px;
}

.soft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple-deep);
  font-weight: 700;
  font-size: 15px;
  border: 1px solid rgba(118, 87, 239, 0.14);
  transition: transform 0.15s, background 0.2s;
}

.soft-btn:active {
  transform: scale(0.97);
}

.text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.text-btn:hover {
  color: var(--ink);
}

/* ---------- 首页 ---------- */

.home {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px calc(34px + var(--safe-b));
  flex: 1;
}

.hero {
  text-align: center;
  padding: 46px 0 30px;
  position: relative;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(36, 33, 49, 0.08);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  backdrop-filter: blur(10px);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 0 rgba(255, 120, 79, 0.5);
  animation: live 2.2s infinite;
}

@keyframes live {
  0% { box-shadow: 0 0 0 0 rgba(255, 120, 79, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(255, 120, 79, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 120, 79, 0); }
}

.hero h1 {
  margin: 20px 0 16px;
  font-size: clamp(50px, 8.4vw, 82px);
  line-height: 1.03;
  font-weight: 900;
  letter-spacing: -0.055em;
  color: var(--ink);
}

.mark {
  position: relative;
  display: inline-block;
  color: var(--purple);
  z-index: 0;
  padding: 0 6px;
}

.mark::before {
  content: "";
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: 6%;
  height: 30%;
  background: var(--lime);
  border-radius: 999px;
  transform: rotate(-1.2deg);
  z-index: -1;
  opacity: 0.9;
}

.mark-dot {
  color: var(--orange);
  margin-left: -0.04em;
}

.hero-sub {
  margin: 0 auto;
  max-width: 440px;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--muted);
}

.hero-sub .hl {
  color: var(--ink);
  font-weight: 700;
  position: relative;
  white-space: nowrap;
}

.hero-sub .hl::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 120, 79, 0.26);
}

/* 输入区 */

.composer-zone {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 8px auto 0;
}

.composer {
  position: relative;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid rgba(36, 33, 49, 0.16);
  border-radius: var(--radius-xl);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.composer:focus-within {
  border-color: rgba(118, 87, 239, 0.55);
  box-shadow: 0 0 0 5px rgba(118, 87, 239, 0.1), var(--shadow-card);
  transform: translateY(-2px);
}

.composer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.composer-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.spark {
  color: var(--orange);
  font-size: 16px;
}

.counter {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.counter i {
  font-style: normal;
  opacity: 0.55;
}

#promptInput {
  display: block;
  width: 100%;
  min-height: 92px;
  max-height: 180px;
  padding: 8px 2px 10px;
  border: 0;
  resize: none;
  background: transparent;
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: 0.005em;
  outline: none;
}

#promptInput::placeholder {
  color: #a8a2b3;
}

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
}

.dice-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: #f6f2ff;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(118, 87, 239, 0.1);
  transition: background 0.2s, transform 0.2s;
}

.dice-btn:hover {
  background: var(--purple-soft);
}

.dice-btn:active .dice {
  animation: diceRoll 0.5s ease;
}

@keyframes diceRoll {
  0% { transform: rotate(0); }
  50% { transform: rotate(160deg) scale(1.15); }
  100% { transform: rotate(360deg); }
}

.peek-card {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 190px;
  padding: 12px 13px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(36, 33, 49, 0.1);
  box-shadow: 0 18px 40px rgba(60, 43, 120, 0.14);
  animation: peekFloat 7s ease-in-out infinite;
}

.peek-left {
  left: -180px;
  top: 22px;
  transform: rotate(-7deg);
}

.peek-right {
  right: -192px;
  top: 108px;
  transform: rotate(6deg);
  animation-delay: -3s;
}

.peek-emoji {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 25px;
  border-radius: 13px;
  background: var(--purple-soft);
  flex: none;
}

.peek-right .peek-emoji {
  background: #e8f7ff;
}

.peek-card b {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

.peek-card small {
  font-size: 10.5px;
  color: var(--muted);
}

.peek-play {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-size: 8px;
  flex: none;
}

@keyframes peekFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -12px; }
}

/* 样例 */

.examples {
  max-width: 900px;
  margin: 54px auto 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 0 4px;
}

.section-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.section-head span {
  font-size: 12px;
  color: var(--muted);
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.example-card {
  --accent: var(--purple);
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 84px;
  padding: 14px;
  text-align: left;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(36, 33, 49, 0.09);
  box-shadow: 0 10px 26px rgba(60, 43, 120, 0.06);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s, border-color 0.22s;
  overflow: hidden;
}

.example-card::after {
  content: "↗";
  position: absolute;
  right: 13px;
  top: 11px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  opacity: 0.5;
  transition: transform 0.2s, opacity 0.2s;
}

.example-card:hover {
  transform: translateY(-3px) rotate(-0.5deg);
  box-shadow: 0 16px 36px rgba(60, 43, 120, 0.12);
  border-color: rgba(118, 87, 239, 0.2);
}

.example-card:hover::after {
  transform: translate(2px, -2px);
  opacity: 1;
}

.example-card:active {
  transform: scale(0.985);
}

.ex-emoji {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 27px;
  background: color-mix(in srgb, var(--accent) 12%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent);
}

.ex-copy {
  min-width: 0;
  padding-right: 10px;
}

.ex-copy b {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ex-copy small {
  display: block;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-section {
  max-width: 900px;
  margin: 44px auto 0;
}

.recent-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: none;
}

.recent-list::-webkit-scrollbar {
  display: none;
}

.recent-item {
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px 10px 10px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(60, 43, 120, 0.05);
  transition: transform 0.18s;
}

.recent-item:hover {
  transform: translateY(-2px);
}

.recent-item .ri-emoji {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--purple-soft);
  display: grid;
  place-items: center;
  font-size: 19px;
}

.recent-item b {
  display: block;
  font-size: 12.5px;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item small {
  font-size: 10px;
  color: var(--muted);
}

.home-foot {
  margin-top: 58px;
  padding-top: 22px;
  border-top: 1px dashed rgba(36, 33, 49, 0.12);
  text-align: center;
  color: var(--muted);
}

.foot-badges {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.foot-badges i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(36, 33, 49, 0.25);
}

.home-foot small {
  display: block;
  margin-top: 8px;
  font-size: 10.5px;
  opacity: 0.75;
}

/* ---------- 生成中 ---------- */

.build {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 38%, #f2edff 0%, #fff9f2 62%);
  padding: 24px;
}

.build-inner {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.build-visual {
  position: relative;
  width: 178px;
  height: 178px;
  margin: 0 auto 30px;
}

.build-box {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118px;
  height: 118px;
  translate: -50% -50%;
  border-radius: 34px;
  background: linear-gradient(145deg, #8a6df7 0%, #7657ef 55%, #5a3fd6 100%);
  box-shadow: 0 24px 50px rgba(90, 63, 214, 0.34), inset 0 2px 0 rgba(255, 255, 255, 0.35);
  animation: boxBob 1.9s ease-in-out infinite;
  border: 2px solid rgba(36, 33, 49, 0.9);
}

.box-lid {
  position: absolute;
  left: 8px;
  right: 8px;
  top: -11px;
  height: 26px;
  border-radius: 11px;
  background: #b9f36b;
  border: 2px solid var(--ink);
  transform: rotate(-2deg);
}

.box-face {
  position: absolute;
  inset: 28px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-top: 8px;
}

.box-eye {
  width: 13px;
  height: 18px;
  border-radius: 999px;
  background: #fff9f2;
  animation: blink 3.4s infinite;
}

.box-mouth {
  position: absolute;
  left: 50%;
  top: 54px;
  width: 26px;
  height: 13px;
  translate: -50% 0;
  border: 3px solid #fff9f2;
  border-top: 0;
  border-radius: 0 0 20px 20px;
}

.box-lightning {
  position: absolute;
  right: -13px;
  top: -20px;
  font-size: 30px;
  filter: drop-shadow(0 4px 8px rgba(36, 33, 49, 0.2));
  animation: zap 1.8s infinite;
}

.orbit {
  position: absolute;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 10px 20px rgba(60, 43, 120, 0.14);
  font-size: 22px;
  border: 1px solid rgba(36, 33, 49, 0.07);
}

.o1 { left: -4px; top: 28px; animation: orbit1 4s ease-in-out infinite; }
.o2 { right: -2px; top: 16px; animation: orbit2 5s ease-in-out infinite; }
.o3 { left: 6px; bottom: 14px; animation: orbit2 4.6s ease-in-out infinite reverse; }
.o4 { right: 4px; bottom: 20px; animation: orbit1 5.2s ease-in-out infinite reverse; }

@keyframes boxBob {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-9px) rotate(1.5deg); }
}

@keyframes blink {
  0%, 88%, 100% { transform: scaleY(1); }
  92% { transform: scaleY(0.12); }
}

@keyframes zap {
  0%, 84%, 100% { transform: scale(1) rotate(0); opacity: 1; }
  88% { transform: scale(1.25) rotate(8deg); opacity: 0.7; }
}

@keyframes orbit1 {
  0%, 100% { transform: translate(0, 0) rotate(-8deg); }
  50% { transform: translate(4px, -10px) rotate(6deg); }
}

@keyframes orbit2 {
  0%, 100% { transform: translate(0, 0) rotate(8deg); }
  50% { transform: translate(-5px, 9px) rotate(-6deg); }
}

.build h2 {
  margin: 0 0 24px;
  font-size: 26px;
  line-height: 1.35;
  letter-spacing: -0.03em;
  font-weight: 900;
}

.build-steps {
  display: inline-flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  min-width: 220px;
}

.build-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--muted);
  transition: color 0.25s;
}

.build-step .tick {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(36, 33, 49, 0.16);
  flex: none;
  display: grid;
  place-items: center;
  transition: background 0.25s, border-color 0.25s;
}

.build-step.is-active {
  color: var(--ink);
  font-weight: 700;
}

.build-step.is-active .tick {
  border-color: var(--purple);
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

.build-step.is-done {
  color: var(--ink-soft);
}

.build-step.is-done .tick {
  background: var(--lime);
  border-color: var(--ink);
}

.build-step.is-done .tick::after {
  content: "✓";
  font-size: 10px;
  font-weight: 900;
  color: var(--ink);
}

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

.parsed-line {
  margin-top: 24px;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
  min-height: 18px;
}

/* ---------- 游戏情报卡 ---------- */

.brief {
  padding: 8px 22px calc(40px + var(--safe-b));
}

.brief-shell {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.back-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 14px;
  margin: 2px 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.game-card {
  border-radius: 32px;
  overflow: hidden;
  background: #fff;
  border: 1.5px solid rgba(36, 33, 49, 0.14);
  box-shadow: 0 30px 80px rgba(60, 43, 120, 0.18);
  animation: cardPop 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes cardPop {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card-cover {
  --c1: #f4e7d7;
  --c2: #e8d1ff;
  --cover-ink: #242131;
  position: relative;
  min-height: 290px;
  padding: 22px;
  background:
    radial-gradient(circle at 78% 12%, color-mix(in srgb, var(--c2) 72%, white) 0%, transparent 46%),
    linear-gradient(150deg, var(--c1) 0%, var(--c2) 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: var(--cover-ink);
}

.cover-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(36, 33, 49, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 33, 49, 0.055) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 88%);
  opacity: 0.7;
}

.generated-badge {
  position: absolute;
  left: 20px;
  top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(36, 33, 49, 0.08);
  backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.generated-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2fbf71;
  box-shadow: 0 0 0 3px rgba(47, 191, 113, 0.16);
}

.cover-hero {
  position: absolute;
  right: 26px;
  top: 44px;
  width: 154px;
  height: 154px;
  display: grid;
  place-items: center;
  font-size: 92px;
  border-radius: 44px;
  background: rgba(255, 255, 255, 0.44);
  border: 2px solid rgba(36, 33, 49, 0.72);
  box-shadow: 8px 8px 0 rgba(36, 33, 49, 0.14);
  rotate: 5deg;
  animation: heroTilt 5s ease-in-out infinite;
}

@keyframes heroTilt {
  0%, 100% { rotate: 5deg; translate: 0 0; }
  50% { rotate: 2deg; translate: 0 -7px; }
}

.cover-deco {
  position: absolute;
  font-size: 30px;
  filter: drop-shadow(0 6px 10px rgba(36, 33, 49, 0.14));
  animation: bob 5s ease-in-out infinite;
}

.cd-1 { left: 18%; top: 18%; rotate: -12deg; font-size: 34px; }
.cd-2 { left: 56%; top: 10%; rotate: 10deg; animation-delay: -1.4s; }
.cd-3 { left: 40%; top: 40%; font-size: 22px; rotate: 8deg; animation-delay: -2.4s; }

.cover-copy {
  position: relative;
  z-index: 1;
  max-width: 76%;
}

.cover-kicker {
  margin: 0 0 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.72;
}

.cover-copy h2 {
  margin: 0 0 8px;
  font-size: 33px;
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.cover-copy > p:last-child {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  opacity: 0.72;
}

.card-body {
  padding: 22px 22px calc(20px + var(--safe-b));
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 999px;
  background: #f5f2ff;
  color: var(--purple-deep);
  font-size: 11px;
  font-weight: 700;
}

.tag.orange {
  background: #fff0e9;
  color: #d9572d;
}

.tag.green {
  background: #f2fbdf;
  color: #4a7218;
}

.brief-blurb {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.parse-panel {
  padding: 14px;
  border-radius: 20px;
  background: #f8f5ff;
  border: 1px solid rgba(118, 87, 239, 0.1);
  margin-bottom: 18px;
}

.parse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.parse-head > span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--purple-deep);
}

.mini-toggle {
  min-height: 30px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.parse-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.parse-item {
  min-width: 0;
}

.parse-item span {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #9a92ad;
  margin-bottom: 3px;
}

.parse-item b {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.parse-full {
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px dashed rgba(118, 87, 239, 0.18);
}

.parse-full p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.rules-box {
  margin-bottom: 20px;
}

.rules-box h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 7px;
}

.rules-box h3 span {
  font-size: 15px;
}

.rules-box ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.rules-box li {
  position: relative;
  padding-left: 22px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.rules-box li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--lime);
  border: 1.5px solid var(--ink);
  rotate: 8deg;
}

.switch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.switch-head b {
  color: var(--ink);
  font-weight: 700;
}

.template-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
  margin: 0 -4px;
}

.template-chips::-webkit-scrollbar {
  display: none;
}

.template-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 13px;
  border-radius: 999px;
  background: #faf8ff;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all 0.18s;
}

.template-chip:hover {
  border-color: rgba(118, 87, 239, 0.35);
}

.template-chip.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.template-chip span {
  font-size: 15px;
}

.ai-dev-panel {
  margin: 20px 0 6px;
  padding: 15px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 120, 79, 0.1), transparent 52%),
    linear-gradient(135deg, #f4f0ff 0%, #fff7ef 100%);
  border: 1px solid rgba(118, 87, 239, 0.14);
}

.ai-dev-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-badge {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--lime);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 5px 0 rgba(36, 33, 49, 0.16);
}

.ai-dev-head b {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.3;
}

.ai-dev-head small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.ai-dev-panel > p {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.ai-steps {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 11px;
  color: var(--purple-deep);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ai-steps i {
  width: 12px;
  height: 1px;
  background: rgba(118, 87, 239, 0.3);
}

.ai-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1edff;
  color: #6b5b9a;
  font-size: 9.5px;
  font-weight: 700;
}

.ai-mode-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.ai-mode-row .ai-mode {
  margin-top: 0;
}

.ai-key-btn {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(36, 33, 49, 0.1);
  background: #fff;
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 700;
}

.key-sheet {
  max-width: 460px;
}

.key-field {
  display: block;
  margin-bottom: 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-soft);
}

.key-field input,
.key-field select {
  display: block;
  width: 100%;
  height: 46px;
  margin-top: 6px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

.key-field input:focus,
.key-field select:focus {
  border-color: rgba(118, 87, 239, 0.5);
  box-shadow: 0 0 0 4px rgba(118, 87, 239, 0.09);
}

.key-note {
  margin: 10px 0 2px;
  text-align: center;
  font-size: 10px;
  line-height: 1.6;
  color: var(--muted);
}

.ai-mode::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b0a8c4;
}

.ai-mode.on {
  background: #effade;
  color: #41681a;
}

.ai-mode.on::before {
  background: #5fb83b;
}

.ai-mode.off {
  background: #fff0e9;
  color: #a5522f;
}

.ai-mode.off::before {
  background: #ff784f;
}

.ai-dev-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 11px;
}

.ai-dev-actions .soft-btn {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  font-size: 12.5px;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  white-space: nowrap;
}

.ai-dev-actions .text-btn {
  min-height: 42px;
  font-size: 12px;
  color: var(--purple-deep);
}

.ai-play-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 9px;
  border-radius: 13px;
  background: var(--lime);
  color: #27330e;
  font-size: 12.5px;
  font-weight: 800;
  border: 1px solid rgba(36, 33, 49, 0.12);
}

.ai-dev-primary {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.ai-dev-primary .cta {
  width: 100%;
  min-height: 46px;
  font-size: 14px;
}

.ai-dev-primary .soft-btn {
  width: 100%;
  min-height: 42px;
  background: #fff;
  color: var(--ink);
  border: 1px solid rgba(36, 33, 49, 0.12);
  font-size: 12.5px;
}

.gpt-sheet {
  max-width: 640px;
  height: 86dvh;
  display: flex;
  flex-direction: column;
}

.gpt-brief {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin: 0 0 12px;
  padding: 14px;
  border-radius: 15px;
  background: #1b1725;
  color: #ece7ff;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  overscroll-behavior: contain;
}

/* GPT 返回页 */

.ai-screen {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
}

.ai-screen-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 249, 242, 0.94);
  backdrop-filter: blur(12px);
}

.ai-screen-top .round-btn {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.ai-screen-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.ai-screen-title b {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-mini-badge {
  flex: none;
  padding: 4px 7px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--lime);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.ai-screen-actions {
  flex: none;
}

.ai-screen-actions .ghost-btn {
  min-height: 38px;
  font-size: 11px;
  background: #fff;
}

.ai-screen-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ai-paste-card {
  width: 100%;
  max-width: 620px;
  padding: 24px;
  border-radius: 26px;
  background: #fff;
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.ai-paste-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: var(--purple-soft);
  color: var(--purple-deep);
  font-size: 25px;
  font-weight: 900;
}

.ai-paste-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.ai-paste-card p {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

#aiHtmlInput {
  display: block;
  width: 100%;
  height: 240px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbf8ff;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  text-align: left;
}

#aiHtmlInput:focus {
  border-color: rgba(118, 87, 239, 0.5);
  box-shadow: 0 0 0 4px rgba(118, 87, 239, 0.09);
}

.ai-paste-actions {
  display: flex;
  gap: 8px;
  margin: 12px 0 6px;
}

.ai-paste-actions .cta {
  flex: 1.35;
  min-height: 48px;
  font-size: 14px;
}

.ai-paste-actions .soft-btn {
  flex: 1;
  min-height: 48px;
  font-size: 12px;
}

.ai-screen-preview {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 10px calc(8px + var(--safe-b));
}

.ai-generating-card {
  max-width: 480px;
}

.ai-gen-orb {
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  border-radius: 23px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #8b6df7, #5a3fd6);
  box-shadow: 0 12px 26px rgba(90, 63, 214, 0.28);
  font-size: 32px;
  animation: aiOrb 1.8s ease-in-out infinite;
}

.ai-generating-card h2 {
  margin-bottom: 8px;
}

.ai-generating-card p {
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.ai-gen-bar {
  height: 8px;
  margin: 0 0 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #ede8ff;
}

.ai-gen-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), #b9a6ff, var(--purple));
  animation: aiBar 1.4s ease-in-out infinite;
}

.ai-generating-card small {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
}

@keyframes aiOrb {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-7px) rotate(2deg); }
}

@keyframes aiBar {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(80%); }
  100% { transform: translateX(240%); }
}

#aiFrame {
  flex: 1;
  width: 100%;
  border: 0;
  border-radius: 18px;
  background: #171322;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
}

.ai-preview-bar {
  display: flex;
  gap: 8px;
  flex: none;
  padding-top: 9px;
}

.ai-preview-bar .cta,
.ai-preview-bar .soft-btn {
  flex: 1;
  min-height: 46px;
  font-size: 12.5px;
}

@media (max-width: 420px) {
  .ai-screen-body {
    padding: 14px;
  }
  .ai-paste-card {
    padding: 18px;
    border-radius: 22px;
  }
  #aiHtmlInput {
    height: 200px;
  }
  .ai-paste-card h2 {
    font-size: 20px;
  }
  .ai-screen-top {
    padding-left: 10px;
    padding-right: 10px;
  }
}

.brief .text-btn {
  width: 100%;
  margin-top: 8px;
}

/* ---------- 游戏页 ---------- */

.play {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--game-bg, #171322);
  color: var(--game-ink, #fff);
  overflow: hidden;
}

.play-shell {
  width: 100%;
  max-width: 760px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: calc(8px + var(--safe-t)) 10px calc(8px + var(--safe-b));
}

.play-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 2px 8px;
  flex: none;
}

.round-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  color: var(--game-ink, #fff);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 18px;
  transition: background 0.2s, transform 0.15s;
  flex: none;
}

.round-btn.small {
  width: 38px;
  height: 38px;
  font-size: 14px;
}

.round-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.round-btn:active {
  transform: scale(0.94);
}

.play-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  padding-left: 2px;
}

.play-title span {
  font-size: 20px;
  flex: none;
}

.play-title b {
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.94;
}

.play-actions {
  display: flex;
  gap: 7px;
  flex: none;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 2px 4px 9px;
  flex-wrap: wrap;
  min-height: 44px;
  flex: none;
}

.hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(8px);
  transition: transform 0.15s;
}

.hud-chip b {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--game-ink, #fff);
  font-weight: 800;
}

.hud-chip em {
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  opacity: 0.62;
}

.hud-chip.pulse {
  animation: hudPulse 0.32s ease;
}

@keyframes hudPulse {
  50% { transform: scale(1.08); }
}

.stage-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 26px;
  overflow: hidden;
  background: var(--game-bg, #171322);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  touch-action: none;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stage-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 60%),
    linear-gradient(to top, rgba(0, 0, 0, 0.22), transparent 26%);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  background: rgba(12, 9, 20, 0.56);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: overlayIn 0.32s ease;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ov-hero {
  width: 92px;
  height: 92px;
  border-radius: 30px;
  display: grid;
  place-items: center;
  font-size: 56px;
  background: rgba(255, 255, 255, 0.14);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.25);
  margin-bottom: 18px;
  animation: bob 4s ease-in-out infinite;
}

.ov-kicker {
  margin: 0 0 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--game-accent, #b9f36b);
  text-transform: uppercase;
}

.overlay h2 {
  margin: 0 0 10px;
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-weight: 900;
  color: #fff;
}

.ov-desc {
  margin: 0 0 24px;
  max-width: 280px;
  font-size: 13.5px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.76);
}

.overlay .cta {
  min-width: 190px;
}

.overlay small {
  margin-top: 14px;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.5);
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  width: 100%;
  max-width: 240px;
}

.pause-actions .cta,
.pause-actions .soft-btn {
  width: 100%;
}

.pause-actions .text-btn {
  color: rgba(255, 255, 255, 0.55);
}

/* 结算 */

.end-overlay {
  padding: 16px;
  background: rgba(11, 8, 18, 0.68);
}

.result-stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--lime);
  color: #24310f;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  rotate: -2deg;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
  margin-bottom: 14px;
}

.result-stamp.lose {
  background: #ffd7c9;
  color: #7b2d14;
}

.end-overlay h2 {
  font-size: 25px;
  margin-bottom: 7px;
}

.result-line {
  margin: 0 0 20px;
  max-width: 300px;
  font-size: 12.5px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.7);
}

.result-prompt {
  margin: -10px 0 18px;
  max-width: 310px;
  font-size: 10.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.42);
}

.score-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 1px;
  width: 100%;
  max-width: 330px;
  margin-bottom: 20px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-row > div {
  flex: 1;
  padding: 12px 6px 10px;
  background: rgba(255, 255, 255, 0.03);
}

.score-row b {
  display: block;
  font-size: 22px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: #fff;
}

.score-row span {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.5);
}

.end-actions {
  display: flex;
  gap: 9px;
  width: 100%;
  max-width: 330px;
  margin-bottom: 12px;
}

.end-actions .cta {
  flex: 1.2;
  min-height: 48px;
  padding: 0 14px;
  font-size: 14px;
}

.end-actions .soft-btn {
  flex: 1;
  min-height: 48px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
}

.end-links {
  display: flex;
  gap: 2px;
}

.end-links button {
  min-height: 36px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.52);
}

.end-links button:hover {
  color: #fff;
}

.confetti-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.confetti-piece {
  position: absolute;
  top: -30px;
  animation-name: confettiFall;
  animation-timing-function: cubic-bezier(0.18, 0.72, 0.38, 1);
  animation-iteration-count: 1;
  animation-fill-mode: both;
  will-change: transform;
}

@keyframes confettiFall {
  0% { transform: translate3d(0, -20px, 0) rotate(0deg); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translate3d(18px, 110vh, 0) rotate(420deg); opacity: 0.9; }
}

.end-overlay > :not(.confetti-field) {
  position: relative;
  z-index: 1;
}

.hint-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding-top: 7px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.48);
  flex: none;
}

.hint-hand {
  font-size: 13px;
  animation: tapHint 1.8s ease-in-out infinite;
}

.play[data-tone="light"] .round-btn {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(36, 33, 49, 0.08);
  color: var(--game-ink);
}

.play[data-tone="light"] .round-btn:hover {
  background: rgba(255, 255, 255, 0.75);
}

.play[data-tone="light"] .hud-chip {
  background: rgba(255, 255, 255, 0.52);
  border-color: rgba(36, 33, 49, 0.08);
  color: rgba(36, 33, 49, 0.56);
}

.play[data-tone="light"] .hud-chip b {
  color: var(--game-ink);
}

.play[data-tone="light"] .hint-bar {
  color: rgba(36, 33, 49, 0.46);
}

.play[data-tone="light"] .overlay {
  background: rgba(255, 249, 242, 0.88);
}

.play[data-tone="light"] .end-overlay {
  background: #fff9f2;
}

.play[data-tone="light"] .overlay h2 {
  color: var(--game-ink);
}

.play[data-tone="light"] .ov-hero {
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(36, 33, 49, 0.12);
  box-shadow: 0 16px 34px rgba(36, 33, 49, 0.12);
}

.play[data-tone="light"] .ov-kicker {
  color: #d95a32;
}

.play[data-tone="light"] .ov-desc {
  color: rgba(36, 33, 49, 0.68);
}

.play[data-tone="light"] .overlay small {
  color: rgba(36, 33, 49, 0.48);
}

.play[data-tone="light"] .score-row {
  background: rgba(36, 33, 49, 0.06);
  border-color: rgba(36, 33, 49, 0.08);
}

.play[data-tone="light"] .score-row > div {
  background: rgba(255, 255, 255, 0.34);
}

.play[data-tone="light"] .score-row b {
  color: var(--game-ink);
}

.play[data-tone="light"] .score-row span {
  color: rgba(36, 33, 49, 0.5);
}

.play[data-tone="light"] .result-line {
  color: rgba(36, 33, 49, 0.66);
}

.play[data-tone="light"] .result-prompt {
  color: rgba(36, 33, 49, 0.42);
}

.play[data-tone="light"] .end-actions .soft-btn {
  background: rgba(36, 33, 49, 0.06);
  border-color: rgba(36, 33, 49, 0.08);
  color: var(--game-ink);
}

.play[data-tone="light"] .end-links button {
  color: rgba(36, 33, 49, 0.5);
}

.play[data-tone="light"] .end-links button:hover {
  color: var(--game-ink);
}

.play[data-tone="light"] .pause-actions .text-btn {
  color: rgba(36, 33, 49, 0.52);
}

@keyframes tapHint {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* ---------- 弹层 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-b));
  z-index: 90;
  translate: -50% 20px;
  opacity: 0;
  pointer-events: none;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 14px 30px rgba(36, 33, 49, 0.28);
  transition: opacity 0.24s, translate 0.24s;
  max-width: calc(100vw - 40px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  translate: -50% 0;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 10px;
  background: rgba(15, 11, 26, 0.46);
  backdrop-filter: blur(4px);
  animation: overlayIn 0.22s ease;
}

.sheet {
  width: 100%;
  max-width: 480px;
  max-height: 88dvh;
  overflow-y: auto;
  padding: 10px 20px calc(16px + var(--safe-b));
  border-radius: 28px 28px 0 0;
  background: var(--paper-2);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.22);
  animation: sheetUp 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-grab {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: rgba(36, 33, 49, 0.16);
  margin: 0 auto 14px;
}

.sheet h3 {
  margin: 0 0 5px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.03em;
  text-align: center;
}

.sheet-sub {
  margin: 0 0 16px;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

.share-preview {
  border-radius: 18px;
  background: linear-gradient(135deg, #f0ebff, #fff0e8);
  border: 1px solid var(--line);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.share-preview .sp-emoji {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-size: 29px;
  background: #fff;
  border: 1px solid var(--line);
  flex: none;
}

.share-preview b {
  display: block;
  font-size: 14px;
  margin-bottom: 3px;
}

.share-preview small {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.5;
}

.sheet-actions {
  display: grid;
  gap: 8px;
}

.sheet-actions button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  transition: background 0.18s, transform 0.15s;
}

.sheet-actions button:hover {
  background: #faf7ff;
}

.sheet-actions button:active {
  transform: scale(0.985);
}

.sheet-actions button span {
  font-size: 19px;
}

.sheet-cancel {
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.history-list {
  display: grid;
  gap: 8px;
  margin-bottom: 6px;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 62px;
  padding: 9px 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  text-align: left;
  width: 100%;
}

.history-row .hr-emoji {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 23px;
  background: var(--purple-soft);
  flex: none;
}

.history-row .hr-copy {
  min-width: 0;
  flex: 1;
}

.history-row b {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-row small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.history-row .hr-play {
  font-size: 12px;
  font-weight: 700;
  color: var(--purple);
  flex: none;
}

.history-empty {
  padding: 26px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-items: center;
  background: var(--paper);
  padding: 30px;
  text-align: center;
  font-weight: 700;
}

/* ---------- 桌面适配 ---------- */

@media (min-width: 640px) {
  .topbar { padding-left: 34px; padding-right: 34px; }
  .home { padding-left: 34px; padding-right: 34px; }
  .hero { padding-top: 58px; }
  .hero-sub { font-size: 16.5px; }
  .composer { padding: 24px 26px 20px; }
  #promptInput { font-size: 18px; min-height: 100px; }
  .example-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .example-card { flex-direction: column; align-items: flex-start; min-height: 150px; padding: 16px; }
  .ex-emoji { width: 50px; height: 50px; font-size: 28px; margin-bottom: 4px; }
  .ex-copy { padding-right: 0; }
  .ex-copy small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .brief { padding-top: 14px; }
  .card-cover { min-height: 320px; padding: 26px; }
  .cover-copy h2 { font-size: 38px; }
  .play-shell { padding: 16px 18px calc(14px + var(--safe-b)); }
  .stage-wrap { border-radius: 30px; }
}

@media (min-width: 1180px) {
  .peek-card { display: flex; }
}

@media (max-width: 1179px) {
  .peek-card { display: none; }
}

@media (max-width: 420px) {
  .brand-text { font-size: 16.5px; }
  .ghost-btn { padding: 0 10px; }
  .hero { padding-top: 36px; }
  .hero h1 { font-size: clamp(46px, 14vw, 60px); }
  .hero-sub { font-size: 14px; }
  .composer { border-radius: 26px; padding: 17px 15px 14px; }
  .composer-foot { gap: 8px; }
  .dice-btn { padding: 0 11px; font-size: 12px; }
  .dice-btn .dice { display: none; }
  .cta { padding: 0 16px; font-size: 14.5px; }
  .examples { margin-top: 42px; }
  .example-card { min-height: 78px; padding: 11px; gap: 10px; border-radius: 18px; }
  .ex-emoji { width: 42px; height: 42px; border-radius: 13px; font-size: 23px; }
  .ex-copy b { font-size: 13px; }
  .ex-copy small { font-size: 10px; }
  .cover-hero { width: 118px; height: 118px; font-size: 70px; right: 16px; top: 48px; }
  .cover-copy h2 { font-size: 28px; }
  .cover-copy { max-width: 100%; }
  .card-body { padding: 18px 17px calc(16px + var(--safe-b)); }
  .parse-grid { gap: 7px; }
  .parse-item b { font-size: 11.5px; }
  .template-chip { font-size: 11px; padding: 0 11px; }
  .play-shell { padding-left: 7px; padding-right: 7px; }
  .stage-wrap { border-radius: 20px; }
  .hud-chip { min-height: 31px; padding: 0 10px; font-size: 10.5px; }
  .hud-chip b { font-size: 13px; }
  .overlay h2 { font-size: 24px; }
  .end-overlay { padding: 12px; }
}

@media (max-width: 640px) {
  .fs-2, .fs-4, .fs-5, .fs-6 { display: none; }
  .fs-1 { top: 11%; left: 4%; font-size: 24px; }
  .fs-3 { top: 12%; right: 5%; font-size: 25px; }
}

@media (max-width: 360px) {
  .example-grid {
    grid-template-columns: 1fr;
  }
  .example-card {
    flex-direction: row;
    align-items: center;
    min-height: 74px;
  }
  .ex-copy small {
    white-space: normal;
  }
}

@media (max-width: 380px) {
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
    gap: 8px;
  }
  .brand {
    gap: 8px;
  }
  .brand-icon {
    width: 34px;
    height: 34px;
  }
  .brand-text {
    font-size: 15px;
  }
  #historyBtn {
    width: 42px;
    padding: 0;
    justify-content: center;
  }
  #historyBtn span {
    display: none;
  }
  .gpt-return-btn {
    min-width: 40px;
    padding: 0 8px;
  }
}

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