:root {
  --bg: #0b1220;
  --panel: #121a28;
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef3fb;
  --muted: #93a0b5;
  --accent: #4aa8ff;
  --mint: #5eead4;
  --ok: #7fd99a;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --radius: 18px;
  --tap: 48px;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(700px 380px at 0% 0%, rgba(74, 168, 255, 0.16), transparent 60%),
    radial-gradient(500px 300px at 100% 10%, rgba(94, 234, 212, 0.1), transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: calc(14px + var(--safe-top)) 14px calc(24px + var(--safe-bottom));
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
h1 {
  font-size: clamp(1.55rem, 6vw, 1.9rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
h1 em { font-style: normal; color: var(--mint); }
.pill {
  flex-shrink: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ok);
  margin-top: 4px;
}
.lead {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin-bottom: 14px;
}
.lead b { color: var(--text); font-weight: 600; }

.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 50%), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 14px;
  margin-bottom: 12px;
}
.seg-btn {
  min-height: 56px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1.2;
}
.seg-btn small {
  display: block;
  font-weight: 500;
  font-size: 0.72rem;
  opacity: 0.85;
  margin-top: 2px;
}
.seg-btn.active {
  background: rgba(94, 234, 212, 0.14);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.35);
}

.tips-box {
  padding: 12px;
  border-radius: 12px;
  background: rgba(74, 168, 255, 0.08);
  border: 1px solid rgba(74, 168, 255, 0.22);
  color: #cfe6ff;
  font-size: 0.84rem;
  line-height: 1.45;
  margin-bottom: 12px;
}
.tips-box b { color: var(--accent); }

.engine-actions {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 8px;
}
.btn {
  min-height: var(--tap);
  border-radius: 14px;
  border: 1px solid var(--line);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0 12px;
  display: grid;
  place-items: center;
  text-decoration: none;
  text-align: center;
  font-size: 0.9rem;
}
.btn.primary {
  border: 0;
  color: #041018;
  background: linear-gradient(135deg, #3d97e8, #2fbfa8);
}
.btn.ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.embed-panel { padding-bottom: 10px; }
.embed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.embed-head h2 {
  font-size: 0.95rem;
  font-weight: 700;
}
.live {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  color: var(--mint);
  border: 1px solid rgba(94, 234, 212, 0.3);
  border-radius: 999px;
  padding: 5px 9px;
}

.frame-wrap {
  position: relative;
  height: min(72vh, 720px);
  min-height: 420px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #070b12;
}
.frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.frame-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
  background: #0b1220;
  color: var(--muted);
}

.howto h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.howto ol {
  padding-left: 1.2rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 10px;
}
.howto li { margin-bottom: 6px; }
.muted {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  margin-top: 6px;
}

.foot {
  padding: 8px 4px 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}
.foot a { color: var(--accent); }

@media (min-width: 720px) {
  .frame-wrap { height: 780px; }
}
