:root {
  --bg: #FAFAFA; --fg: #171717; --fg-2: #4D4D4D; --border: rgba(0, 0, 0, 0.08);
  --primary: #2563EB; --warning: #B54708; --danger: #B42318; --success: #34C759;
  --kbd-bg: #D1D5DB; --kbd-key: #FFFFFF; --kbd-action: #AEB4BC; --kbd-text: #111827; --kbd-text-2: #667085;
  --wa-bg: #EFEAE2; --wa-accent: #00A884;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
/* 中文注解：色值沿用 DRD §5.3 浅色键盘 Token 与 qwenwork 高保真稿。 */

* { box-sizing: border-box; margin: 0; }
body { min-height: 100vh; background: var(--bg); color: var(--fg); font-family: var(--font); }
button { font: inherit; cursor: pointer; }
.stage { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 56px; padding: 32px 16px; }
/* 中文注解：左侧操作说明、右侧手机演示，宽屏并排、窄屏堆叠。 */

.guide { max-width: 360px; display: grid; gap: 16px; }
.guide h1 { font-size: 32px; letter-spacing: -0.02em; }
.lead { color: var(--fg-2); line-height: 1.6; }
.steps { display: grid; gap: 10px; padding-left: 20px; color: var(--fg-2); line-height: 1.6; font-size: 14px; }
kbd { padding: 1px 6px; border-radius: 4px; background: #fff; box-shadow: 0 0 0 1px var(--border), 0 1px 0 rgba(0, 0, 0, 0.12); font-family: inherit; font-size: 12px; color: var(--fg); }
.samples-title { font-size: 13px; font-weight: 600; }
.samples { display: flex; flex-wrap: wrap; gap: 8px; }
.samples button { padding: 6px 14px; border: 0; border-radius: 999px; background: #fff; box-shadow: 0 0 0 1px var(--border); font-size: 13px; }
.samples button:hover { box-shadow: 0 0 0 1px var(--primary); color: var(--primary); }
/* 中文注解：说明区给出电脑键位映射与 DRD §9.2 的三条测试语句。 */

.iphone { width: 393px; height: max(600px, min(852px, calc(100svh - 32px))); padding: 8px; border-radius: 55px; background: #0A0A0A; flex-shrink: 0; box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.15), 0 40px 80px -40px rgba(0, 0, 0, 0.2); }
.iphone-screen { position: relative; height: 100%; border-radius: 47px; overflow: hidden; background: var(--wa-bg); display: flex; flex-direction: column; }
.dynamic-island { position: absolute; top: 11px; left: 50%; transform: translateX(-50%); width: 125px; height: 37px; border-radius: 20px; background: #000; }
.home-indicator { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); width: 134px; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, 0.85); }
.status-bar { height: 54px; padding: 20px 32px 0; display: flex; align-items: center; justify-content: space-between; font-size: 16px; font-weight: 600; flex-shrink: 0; }
.status-icons { font-size: 11px; letter-spacing: 2px; }
/* 中文注解：iPhone 16 外框（393×852pt），仅作演示语境。 */

.host-context { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #EFE7DE; }
.icon { width: 24px; height: 24px; flex-shrink: 0; fill: none; stroke: #111B21; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.host-topbar { display: flex; align-items: center; gap: 14px; padding: 4px 14px 8px 8px; background: #F6F6F6; border-bottom: 1px solid rgba(0, 0, 0, 0.08); }
.host-topbar .back { stroke-width: 2.2; margin-right: -6px; }
.host-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #7B8794, #A0AAB4); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.host-info { flex: 1; min-width: 0; margin-left: -6px; }
.host-name { font-size: 16px; font-weight: 600; color: #111B21; }
.host-status { font-size: 12px; color: #667781; margin-top: 1px; }
.host-messages { flex: 1; min-height: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.host-messages > :first-child { margin-top: auto; }
.bubble { position: relative; max-width: 80%; padding: 6px 8px 7px 9px; border-radius: 8px; font-size: 15px; line-height: 1.35; color: #111B21; box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13); overflow-wrap: anywhere; }
.bubble.in { align-self: flex-start; background: #fff; border-top-left-radius: 0; }
.bubble.out { align-self: flex-end; background: #D9FDD3; border-top-right-radius: 0; }
.bubble::before { content: ""; position: absolute; top: 0; width: 8px; height: 12px; }
.bubble.in::before { left: -7px; background: #fff; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.bubble.out::before { right: -7px; background: #D9FDD3; clip-path: polygon(0 0, 100% 0, 0 100%); }
.bubble-time { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 8px 0 -4px 10px; font-size: 11px; color: #667781; }
.ticks { width: 16px; height: 11px; fill: none; stroke: #53BDEB; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.host-inputbar { display: flex; align-items: flex-end; gap: 12px; padding: 6px 12px 8px; background: #F6F6F6; border-top: 1px solid rgba(0, 0, 0, 0.06); }
.host-inputbar > .icon { margin-bottom: 6px; }
.host-inputbar .plus { stroke-width: 1.9; }
.host-input-field { flex: 1; min-width: 0; min-height: 36px; display: flex; align-items: flex-end; gap: 6px; padding: 7px 8px 7px 12px; border-radius: 18px; background: #fff; border: 1px solid rgba(0, 0, 0, 0.1); }
.host-input-text { flex: 1; min-width: 0; max-height: 80px; overflow-y: auto; font-size: 15px; line-height: 20px; color: #111B21; overflow-wrap: anywhere; }
.host-input-field .sticker { width: 22px; height: 22px; stroke: #54656F; }
.placeholder { color: #8696A0; }
.host-send-btn { display: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: #25D366; place-items: center; flex-shrink: 0; }
.host-send-btn svg { width: 19px; height: 19px; margin-left: 2px; fill: #fff; }
.has-text .host-send-btn { display: grid; }
.has-text .idle-only { display: none; }
.host-caret { display: inline-block; width: 2px; height: 18px; margin: 0 1px; vertical-align: -3px; background: #25D366; animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
/* 中文注解：模拟 WhatsApp 宿主：对话气泡、输入框与插入点光标。 */

.keyboard { flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; padding: 6px 3px 26px; background: var(--kbd-bg); border-top: 1px solid rgba(0, 0, 0, 0.1); color: var(--kbd-text); }
.kbd-status-band, .tone-track { height: 28px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.kbd-status-band { padding: 0 12px; justify-content: space-between; font-size: 12px; }
.kbd-status-brand { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.kbd-status-brand-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.kbd-status-brand-dot.is-success { background: var(--success); }
.kbd-status-brand-dot.is-warning { background: var(--warning); }
.kbd-status-brand-dot.is-danger { background: var(--danger); }
.kbd-status-hint { font-size: 11px; color: var(--kbd-text-2); }
.tone-track { padding: 0 8px; gap: 6px; }
.tone-track-side { flex: 1; text-align: center; padding: 4px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--kbd-text-2); }
.tone-track-side.is-active { background: var(--kbd-key); color: var(--primary); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }
.tone-track-divider { width: 1px; height: 12px; background: rgba(0, 0, 0, 0.15); }
/* 中文注解：状态带 28pt，长按空格时切换为 Daily / Business 语气轨道。 */

.kbd-source-line { height: 30px; padding: 5px 12px; border: 0; outline: 0; resize: none; overflow: hidden; background: transparent; font: inherit; font-size: 14px; color: var(--kbd-text); caret-color: var(--primary); flex-shrink: 0; }
.kbd-source-line::placeholder { color: var(--kbd-text-2); font-size: 12px; }
.kbd-preview-band { min-height: 38px; padding: 5px 12px; display: flex; align-items: center; gap: 10px; font-size: 13px; line-height: 1.3; flex-shrink: 0; transition: opacity 0.15s; }
.kbd-preview-band.is-empty { color: var(--kbd-text-2); font-size: 12px; }
.kbd-preview-band.is-stale { opacity: 0.5; }
.preview-text { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.preview-loading { display: inline-flex; align-items: center; gap: 8px; color: var(--kbd-text-2); font-size: 12.5px; }
.loading-dots { display: inline-flex; gap: 3px; }
.loading-dots span { width: 4px; height: 4px; border-radius: 50%; background: var(--kbd-text-2); animation: pulse 1.2s ease-in-out infinite; }
.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }
.tone-badge { padding: 3px 10px; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); font-size: 11px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.kbd-alert { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; }
.kbd-alert.is-warning { color: var(--warning); }
.kbd-alert.is-danger { color: var(--danger); }
.kbd-alert-msg { flex: 1; min-width: 0; }
.kbd-alert-action { padding: 4px 11px; border: 0; border-radius: 999px; color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; }
.is-warning .kbd-alert-action { background: var(--warning); }
.is-danger .kbd-alert-action { background: var(--danger); }
/* 中文注解：中文缓冲 30pt + 英文预览 38pt（最多两行），异常时替换为原因与唯一动作。 */

.kbd-rows { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; border-radius: 8px; transition: background 0.15s; }
.kbd-row { display: flex; justify-content: center; gap: 5px; padding: 0 3px; }
.kbd-row.row-2 { padding: 0 22px; }
.key { flex: 1 1 0; min-width: 0; height: 42px; display: grid; place-items: center; border-radius: 5px; background: var(--kbd-key); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.28); font-size: 20px; user-select: none; touch-action: none; transition: background 0.08s; }
.key.is-pressed { background: color-mix(in srgb, var(--kbd-key) 65%, var(--kbd-bg)); }
.key.action { flex: 0 0 42px; background: var(--kbd-action); font-size: 16px; }
.key.space-key { flex: 1 1 auto; font-size: 13px; padding: 0 8px; white-space: nowrap; overflow: hidden; }
.key.space-key.is-tone-track { background: linear-gradient(90deg, var(--kbd-key) 44%, color-mix(in srgb, var(--primary) 22%, var(--kbd-key)) 50%, var(--kbd-key) 56%); }
.key.return-key { flex: 0 0 88px; background: var(--kbd-action); font-size: 14px; font-weight: 500; }
.key.return-key.is-primary { background: var(--primary); color: #fff; font-weight: 600; }
.key.return-key.is-disabled { color: color-mix(in srgb, var(--kbd-text) 38%, transparent); cursor: not-allowed; }
.keyboard.is-trackpad .kbd-rows { background: color-mix(in srgb, var(--kbd-key) 30%, transparent); }
.keyboard.is-trackpad .key:not(.action):not(.return-key) { background: transparent; box-shadow: none; color: transparent; }
/* 中文注解：QWERTY 键区与自适应空格、Return；触控板模式时字母键隐去。 */

@media (max-width: 860px) { .stage { flex-direction: column; gap: 32px; } }
@media (max-width: 430px) {
  .stage { padding: 0 0 32px; }
  .guide { padding: 24px 16px 0; }
  .iphone { width: 100%; height: 100svh; padding: 0; border-radius: 0; }
  .iphone-screen { border-radius: 0; }
  .dynamic-island, .home-indicator { display: none; }
}
/* 中文注解：窄屏去掉手机外框，演示区铺满屏幕。 */
