  :root {
    --bg: #0a0a0f;
    --surface: #111118;
    --border: rgba(255,255,255,0.08);
    --text: #e8e8f0;
    --muted: rgba(232,232,240,0.45);
    --accent: #7c6aff;
    --accent2: #ff6a7c;
    --mono: 'Space Mono', monospace;
    --serif: 'Noto Serif JP', serif;
    --sans: 'Zen Kaku Gothic New', sans-serif;
  }

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

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
  }

  /* ===== EDITOR PANEL ===== */
  #app {
    display: grid;
    grid-template-columns: 380px 1fr;
    height: 100vh;
  }

  #editor-panel {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #editor-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
  }

  .logo {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.05em;
    flex-shrink: 0;
  }

  .badge {
    font-family: var(--mono);
    font-size: 10px;
    background: rgba(124,106,255,0.15);
    color: var(--accent);
    border: 1px solid rgba(124,106,255,0.3);
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.08em;
    flex-shrink: 0;
  }

  /* ===== MODE SWITCHER ===== */
  #mode-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
  }

  .mode-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(255,255,255,0.35);
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
    user-select: none;
  }
  .mode-btn svg {
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.15s;
  }
  .mode-btn:hover {
    color: rgba(255,255,255,0.75);
    background: rgba(255,255,255,0.06);
  }
  .mode-btn:hover svg { opacity: 1; }
  .mode-btn.active {
    color: #fff;
    background: rgba(124,106,255,0.25);
    box-shadow: inset 0 0 0 1px rgba(124,106,255,0.4);
  }
  .mode-btn.active svg { opacity: 1; }

  /* ===== FLOATING BACK BUTTON (present / mobile mode) ===== */
  #float-back {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 9999;
    background: rgba(20,20,30,0.82);
    border: 1px solid rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.85);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 7px 14px 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    gap: 6px;
    align-items: center;
    transition: background 0.15s, color 0.15s;
    user-select: none;
  }
  #float-back:hover {
    background: rgba(124,106,255,0.3);
    color: #fff;
    border-color: rgba(124,106,255,0.5);
  }
  body.mode-present #float-back,
  body.mode-mobile  #float-back { display: flex; }

  /* ===== CONTAINER QUERY for mobile frame font scaling ===== */
  .lp-section {
    container-type: inline-size;
    container-name: lp-section;
  }
  body.mode-present #editor-panel { display: none; }
  body.mode-present #app { grid-template-columns: 1fr; }
  body.mode-present #lp-preview { position: fixed; inset: 0; z-index: 200; }

  /* Escape hint */
  #present-hint {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    color: rgba(255,255,255,0.25);
    background: rgba(0,0,0,0.5);
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.08);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
  }
  body.mode-present #present-hint { opacity: 1; }

  /* ===== MODE: MOBILE PREVIEW ===== */
  body.mode-mobile #editor-panel { display: none; }
  body.mode-mobile #app { grid-template-columns: 1fr; }
  body.mode-mobile #lp-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #050508;
  }
  body.mode-mobile #lp-sections-outer { visibility: hidden; pointer-events: none; }

  #mobile-frame {
    display: none;
    position: relative;
    width: 375px;
    height: 812px;
    border-radius: 48px;
    overflow: hidden;
    box-shadow:
      0 0 0 10px #1a1a22,
      0 0 0 12px #2a2a36,
      0 0 60px rgba(0,0,0,0.8),
      0 0 120px rgba(124,106,255,0.12);
    flex-shrink: 0;
  }
  body.mode-mobile #mobile-frame { display: block; }

  /* Notch */
  #mobile-frame::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 34px;
    background: #1a1a22;
    border-radius: 0 0 22px 22px;
    z-index: 10;
  }

  /* Mobile inner reuses #lp-preview children */
  #mobile-inner {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
  }

  /* Viewport label */
  #mobile-label {
    display: none;
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--mono);
    font-size: 10px;
    color: rgba(255,255,255,0.2);
    letter-spacing: 0.12em;
    white-space: nowrap;
  }
  body.mode-mobile #mobile-label { display: block; }

  #editor-textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: var(--text);
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.8;
    padding: 20px;
    tab-size: 2;
    overflow-y: auto;
  }

  #editor-textarea::-webkit-scrollbar { width: 4px; }
  #editor-textarea::-webkit-scrollbar-track { background: transparent; }
  #editor-textarea::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  #editor-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
  }

  #parse-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 11px;
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: opacity 0.2s, transform 0.1s;
  }
  #parse-btn:hover { opacity: 0.85; }
  #parse-btn:active { transform: scale(0.97); }

  #status {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted);
  }

  /* ===== LP PREVIEW ===== */
  #lp-preview {
    position: relative;
    overflow: hidden;
  }

  /* Navbar */
  #lp-nav {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
    backdrop-filter: blur(0px);
    transition: background 0.3s;
  }

  #lp-nav.scrolled {
    background: rgba(10,10,15,0.92);
    backdrop-filter: blur(12px);
  }

  .nav-logo {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.1em;
  }

  .nav-links {
    display: flex;
    gap: 32px;
    list-style: none;
  }

  .nav-links a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 13px;
    letter-spacing: 0.05em;
    transition: color 0.2s;
  }
  .nav-links a:hover { color: #fff; }

  /* Sections */
  #lp-sections {
    width: 100%;
    height: 100%;
  }

  .lp-section {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 60px 60px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s cubic-bezier(0.22,1,0.36,1), transform 0.6s cubic-bezier(0.22,1,0.36,1);
    pointer-events: none;
    overflow: hidden;
  }

  .lp-section.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .lp-section.exit-up {
    opacity: 0;
    transform: translateY(-40px);
    transition: opacity 0.4s, transform 0.4s;
  }

  /* Section BG */
  .section-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
  }

  .section-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.35) 100%);
  }

  .section-content {
    position: relative;
    z-index: 1;
    max-width: 960px;
    text-align: center;
  }

  /* Section type styles */
  .section-type-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.15em;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    margin-bottom: 24px;
    display: block;
  }

  .section-heading {
    font-family: var(--serif);
    font-size: clamp(18px, 7cqw, 52px);
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
  }

  .section-subheading {
    font-family: var(--sans);
    font-size: clamp(12px, 3.5cqw, 20px);
    font-weight: 300;
    color: rgba(255,255,255,0.8);
    margin-bottom: 20px;
    letter-spacing: 0.03em;
  }

  .section-body {
    font-size: clamp(11px, 3cqw, 15px);
    line-height: 1.9;
    color: rgba(255,255,255,0.7);
    margin-bottom: 32px;
    max-width: 560px;
    margin: 0 auto 32px;
  }

  .section-buttons {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .btn-primary {
    background: var(--accent);
    color: #fff;
    padding: 14px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.05em;
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-block;
    box-shadow: 0 4px 20px rgba(124,106,255,0.4);
  }
  .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(124,106,255,0.6);
  }

  .btn-secondary {
    background: transparent;
    color: rgba(255,255,255,0.85);
    padding: 14px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.05em;
    border: 1px solid rgba(255,255,255,0.25);
    transition: border-color 0.2s, color 0.2s;
    display: inline-block;
  }
  .btn-secondary:hover {
    border-color: rgba(255,255,255,0.6);
    color: #fff;
  }

  /* Section type: feature */
  .lp-section.type-feature .section-bg::after {
    background: linear-gradient(135deg, rgba(15,10,40,0.8) 0%, rgba(30,10,30,0.6) 100%);
  }

  /* Section type: cta */
  .lp-section.type-cta .section-content {
    padding: 60px;
    background: rgba(124,106,255,0.08);
    border: 1px solid rgba(124,106,255,0.2);
    border-radius: 20px;
    backdrop-filter: blur(10px);
  }

  /* Navigation controls */
  #dot-nav {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    border: none;
    outline: none;
  }
  .dot:hover { background: rgba(255,255,255,0.6); transform: scale(1.2); }
  .dot.active { background: #fff; transform: scale(1.3); }

  #arrow-prev, #arrow-next {
    position: absolute;
    bottom: 32px;
    z-index: 100;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s, transform 0.2s;
    user-select: none;
  }
  #arrow-prev { right: 84px; }
  #arrow-next { right: 32px; }
  #arrow-prev:hover, #arrow-next:hover {
    background: rgba(255,255,255,0.18);
    transform: scale(1.05);
  }

  /* Section counter */
  #section-counter {
    position: absolute;
    bottom: 38px;
    left: 40px;
    z-index: 100;
    font-family: var(--mono);
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.1em;
  }

  /* Swipe hint */
  #swipe-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    font-family: var(--mono);
    font-size: 10px;
    color: rgba(255,255,255,0.2);
    letter-spacing: 0.12em;
    animation: pulse 2s ease-in-out infinite;
  }
  @keyframes pulse {
    0%,100% { opacity: 0.3; }
    50% { opacity: 0.7; }
  }

  /* Empty state */
  #empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--muted);
  }

  .empty-icon {
    font-size: 40px;
    opacity: 0.3;
  }

  .empty-title {
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.1em;
  }

  .empty-sub {
    font-size: 12px;
    opacity: 0.6;
    text-align: center;
    line-height: 1.7;
    max-width: 260px;
  }

  /* Syntax highlighting in textarea */
  .cm-comment { color: #5c6e82; }

  /* BG placeholders (gradient by type) */
  .bg-hero { background: linear-gradient(135deg, #0d0d1a 0%, #1a0d2e 50%, #0d1a1a 100%); }
  .bg-feature { background: linear-gradient(135deg, #0a0a14 0%, #14081a 100%); }
  .bg-cta { background: linear-gradient(135deg, #08100a 0%, #0a0814 100%); }
  .bg-default { background: linear-gradient(135deg, #0c0c18 0%, #18080c 100%); }

  /* Animated particles for hero */
  .particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
  }
  .particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(124,106,255,0.4);
    border-radius: 50%;
    animation: float linear infinite;
  }
  @keyframes float {
    from { transform: translateY(100vh) translateX(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    to { transform: translateY(-10vh) translateX(var(--drift)); opacity: 0; }
  }

  /* Section animations stagger */
  .lp-section.active .section-type-label { animation: fadeUp 0.5s 0.1s both; }
  .lp-section.active .section-heading   { animation: fadeUp 0.5s 0.2s both; }
  .lp-section.active .section-subheading{ animation: fadeUp 0.5s 0.3s both; }
  .lp-section.active .section-body      { animation: fadeUp 0.5s 0.35s both; }
  .lp-section.active .section-buttons   { animation: fadeUp 0.5s 0.45s both; }

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