:root {
  color-scheme: light;
  --bg: #f0f0f0;
  --panel: #ffffff;
  --text: #1a1a1a;
  --muted: #888888;
  --line: #e0e0e0;
  --accent: #1a1a1a;
  --accent-hover: #333333;
  --error: #b3261e;
  --radius: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(960px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 0 24px;
}

.shell.is-locked {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

/* ── 顶栏 ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.brand-text small {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.ghost-button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  font-size: 13px;
}

.ghost-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── 解析区 ── */
.parser-section {
  padding: 0 0 32px;
}

.parser-window {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.parser-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: #111;
  color: #fff;
}

.screen-empty {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  padding: 24px;
}

.screen-logo {
  color: #666;
  font-size: 13px;
  font-weight: 600;
}

.screen-empty strong {
  font-size: clamp(16px, 3vw, 24px);
  font-weight: 600;
  color: #999;
}

.video-iframe {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.parser-screen.is-playing .screen-empty {
  display: none;
}

.parser-screen.is-playing .video-iframe {
  display: block;
}

.video-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px 100px 100px;
  gap: 8px;
  margin-top: 12px;
}

#retryBtn {
  border-color: #888;
  background: #fff;
  color: #333;
  font-weight: 600;
  font-size: 14px;
}

#retryBtn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.video-tool input,
.video-tool select,
.video-tool button,
.gate-card input,
.gate-card button {
  height: 44px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.video-tool input,
.video-tool select,
.gate-card input {
  width: 100%;
  background: #fafafa;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.video-tool input:focus,
.video-tool select:focus,
.gate-card input:focus {
  border-color: var(--accent);
}

.video-tool button,
.gate-card button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.video-tool button:hover,
.gate-card button:hover {
  background: var(--accent-hover);
}

.tool-note {
  min-height: 20px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* ── 平台卡片 ── */
.platform-section {
  padding: 0 0 40px;
}

.platform-section h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
}

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

.platform-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: border-color 150ms, transform 150ms;
}

.platform-card:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.platform-name {
  font-size: 15px;
  font-weight: 700;
}

.platform-tag {
  flex-shrink: 0;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

/* ── 底部 ── */
.footer {
  display: flex;
  justify-content: center;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

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

.footer a:hover {
  text-decoration: underline;
}

/* ── 验证码门 ── */
.gate {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(240, 240, 240, 0.95);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.gate.is-show {
  display: grid;
}

.gate.is-open {
  display: none;
}

.gate-card {
  width: min(100%, 380px);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.1);
}

.gate-qr {
  width: min(100%, 200px);
  aspect-ratio: 1;
  justify-self: center;
  display: block;
  border: 8px solid #fff;
  background: #fff;
  border-radius: 6px;
}

.gate-badge {
  width: max-content;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.gate-card h2 {
  font-size: 22px;
}

.gate-card p {
  color: var(--muted);
  font-size: 14px;
}

.gate-error {
  min-height: 20px;
  color: var(--error);
  font-size: 13px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 768px) {
  .platform-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .shell {
    width: calc(100% - 20px);
    padding-top: 10px;
  }

  .video-tool {
    grid-template-columns: 1fr 1fr;
  }

  .platform-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
  }
}
