/* AidaIDE phone shell — product-first, brand-led */
:root {
    --m-top: 56px;
    --m-bot: 66px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bot: env(safe-area-inset-bottom, 0px);
    --m-pad: 18px;
    --m-radius: 16px;
    --m-yellow: #e8d44d;
    --m-cyan: #4ecdc4;
    --m-ink: #041014;
    --font-ui: "Inter", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body.m-site {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
body.m-site a { color: var(--cyan); text-decoration: none; }

/* Atmospheric canvas */
body.m-site::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 90% 55% at 10% -10%, color-mix(in srgb, var(--yellow) 22%, transparent), transparent 55%),
        radial-gradient(ellipse 80% 50% at 100% 8%, color-mix(in srgb, var(--cyan) 18%, transparent), transparent 50%),
        radial-gradient(ellipse 70% 40% at 50% 110%, color-mix(in srgb, var(--cyan) 10%, transparent), transparent 55%);
}
html[data-theme="light"] body.m-site::before {
    background:
        radial-gradient(ellipse 90% 55% at 8% -8%, color-mix(in srgb, var(--yellow) 14%, transparent), transparent 55%),
        radial-gradient(ellipse 80% 50% at 100% 0%, color-mix(in srgb, var(--cyan) 12%, transparent), transparent 52%);
}

#mApp {
    position: relative;
    z-index: 1;
    height: 100%;
    display: grid;
    grid-template-rows: calc(var(--m-top) + var(--safe-top)) 1fr calc(var(--m-bot) + var(--safe-bot));
}

/* ——— Topbar ——— */
.m-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: var(--safe-top) var(--m-pad) 0;
    height: calc(var(--m-top) + var(--safe-top));
    background: color-mix(in srgb, var(--nav-bg) 88%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    z-index: 20;
}
.m-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 750;
    font-size: 1.05rem;
    letter-spacing: -0.03em;
    color: var(--text);
    text-decoration: none;
}
.m-brand img {
    width: 28px;
    height: 28px;
    display: block;
}
.m-brand .ide { color: var(--cyan); }
.m-top-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.m-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-card) 80%, transparent);
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
}

.m-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px var(--m-pad) 32px;
}

/* ——— Motion (transform only — never hide content with opacity:0) ——— */
@keyframes m-rise {
    from { transform: translateY(10px); }
    to { transform: translateY(0); }
}
@keyframes m-blink {
    0%, 45% { opacity: 1; }
    50%, 100% { opacity: 0; }
}
.m-anim {
    animation: m-rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.m-anim-d1 { animation-delay: 0.04s; }
.m-anim-d2 { animation-delay: 0.1s; }
.m-anim-d3 { animation-delay: 0.16s; }
.m-anim-d4 { animation-delay: 0.22s; }
@media (prefers-reduced-motion: reduce) {
    .m-anim, .m-term-cursor { animation: none !important; }
}

/* ——— Hero (one composition) ——— */
.m-hero {
    padding: 12px 0 0;
    display: flex;
    flex-direction: column;
}
.m-hero-mark { display: none; }
.m-hero-brand {
    font-size: clamp(2.15rem, 10vw, 2.65rem);
    font-weight: 800;
    letter-spacing: -0.055em;
    line-height: 0.95;
    color: var(--text);
    margin: 2px 0 8px;
}
.m-hero-brand .ide { color: var(--cyan); }
.m-hero-line {
    font-size: clamp(1.05rem, 4.4vw, 1.2rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.25;
    color: var(--text);
    margin: 0 0 6px;
    max-width: 20ch;
}
.m-hero-sub {
    color: var(--text-dim);
    font-size: 0.92rem;
    line-height: 1.45;
    margin: 0 0 14px;
    max-width: 32ch;
}
html[data-theme="light"] .m-hero-brand,
html[data-theme="light"] .m-hero-line,
html[data-theme="light"] .m-title {
    color: #0f172a;
}
html[data-theme="light"] .m-hero-sub,
html[data-theme="light"] .m-sub,
html[data-theme="light"] .m-section > p {
    color: #334155;
}

.m-title {
    font-size: clamp(1.55rem, 7vw, 1.95rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.12;
    margin: 14px 0 8px;
    color: var(--text);
}
.m-sub {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin: 0 0 16px;
    line-height: 1.5;
    max-width: 36ch;
}
.m-kicker {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cyan);
}

/* ——— CTAs: always stacked full-width on phone ——— */
.m-cta-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0 0 16px;
}
.m-cta-row.two { grid-template-columns: 1fr; }
.m-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    border-radius: 14px;
    font-weight: 750;
    font-size: 0.98rem;
    letter-spacing: -0.01em;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, filter 0.15s ease;
}
.m-cta:active { transform: scale(0.98); }
.m-cta-primary {
    background: var(--m-yellow);
    color: var(--m-ink);
    box-shadow: 0 8px 22px color-mix(in srgb, var(--yellow) 28%, transparent);
}
body.m-site a.m-cta-primary { color: var(--m-ink); }
html[data-theme="light"] .m-cta-primary {
    background: #c9a91a;
    color: #14120a;
}
html[data-theme="light"] body.m-site a.m-cta-primary { color: #14120a; }
.m-cta-secondary {
    background: color-mix(in srgb, var(--bg-card) 55%, transparent);
    color: var(--text);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
    min-height: 46px;
    font-weight: 650;
    font-size: 0.92rem;
}
body.m-site a.m-cta-secondary { color: var(--text); }
body.m-site a.m-brand { color: var(--text); }
body.m-site a.m-pill { color: var(--text-dim); }
body.m-site a.m-rail a,
body.m-site .m-rail a { color: var(--text); }

/* ——— Product stage (terminal) ——— */
.m-stage {
    margin: 0 0 24px;
    width: 100%;
    border-radius: var(--m-radius);
    border: 1px solid color-mix(in srgb, var(--border) 85%, var(--cyan));
    background: #070a14;
    overflow: hidden;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
}
html[data-theme="light"] .m-stage {
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}
.m-stage-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.m-stage-bar span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: block;
}
.m-stage-bar span:nth-child(1) { background: #ff5f57; }
.m-stage-bar span:nth-child(2) { background: #febc2e; }
.m-stage-bar span:nth-child(3) { background: #28c840; }
.m-stage-bar em {
    margin-left: auto;
    font-style: normal;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: #7f8aa8;
    letter-spacing: 0.02em;
}
.m-stage-body {
    padding: 12px 12px 14px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.5;
    color: #c9d2e4;
}
.m-stage-body .prompt { color: var(--m-cyan); }
.m-stage-body .err { color: #ff8f86; }
.m-stage-body .ok { color: #7dffa3; }
.m-stage-body .ai {
    margin: 8px 0;
    padding: 9px 10px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--m-cyan) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--m-cyan) 28%, transparent);
    color: #d7fff9;
}
.m-stage-body .ai strong {
    display: block;
    color: var(--m-yellow);
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 3px;
}
.m-stage-body code {
    font-family: inherit;
    font-size: inherit;
    color: #fff;
}
.m-term-cursor {
    display: inline-block;
    width: 0.55ch;
    height: 1.05em;
    margin-left: 2px;
    vertical-align: -0.15em;
    background: var(--m-yellow);
    animation: m-blink 1.1s steps(1) infinite;
}

/* ——— Sections below fold ——— */
.m-section {
    margin: 4px 0 22px;
}
.m-section h2 {
    font-size: 1.12rem;
    font-weight: 750;
    letter-spacing: -0.03em;
    margin: 0 0 6px;
    color: var(--text);
}
.m-section > p {
    color: var(--text-dim);
    font-size: 0.92rem;
    line-height: 1.45;
    margin: 0 0 12px;
}

.m-rail {
    display: grid;
    gap: 0;
    border-top: 1px solid var(--border);
}
.m-rail a {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    min-height: 56px;
}
.m-rail a strong {
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.m-rail a span {
    grid-column: 1;
    color: var(--text-dim);
    font-size: 0.84rem;
    line-height: 1.35;
}
.m-rail a i {
    grid-row: 1 / span 2;
    grid-column: 2;
    color: var(--text-dim);
    font-style: normal;
    font-size: 1.05rem;
}

.m-points {
    list-style: none;
    display: grid;
    gap: 10px;
    margin: 0;
}
.m-points li {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    align-items: start;
    color: var(--text-dim);
    font-size: 0.93rem;
    line-height: 1.4;
}
.m-points li::before {
    content: "";
    width: 7px;
    height: 7px;
    margin-top: 0.42em;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 16%, transparent);
}

/* ——— Pricing ——— */
.m-plan {
    padding: 18px 0;
    border-top: 1px solid var(--border);
}
.m-plan:last-of-type { border-bottom: 1px solid var(--border); }
.m-plan.featured {
    margin: 0 -2px;
    padding: 18px 14px;
    border: 1px solid color-mix(in srgb, var(--yellow) 45%, var(--border));
    border-radius: var(--m-radius);
    background: color-mix(in srgb, var(--bg-card) 70%, transparent);
}
.m-plan h2 {
    font-size: 1.02rem;
    font-weight: 750;
    margin: 0 0 6px;
    color: var(--text);
}
.m-price {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text);
    line-height: 1;
    margin: 0 0 8px;
}
.m-price span {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 0;
}
.m-plan > p {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin: 0 0 12px;
    line-height: 1.45;
}
.m-plan .m-points { margin-bottom: 14px; }

/* ——— Bottom nav ——— */
.m-botnav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--m-bot) + var(--safe-bot));
    padding: 5px 2px var(--safe-bot);
    background: color-mix(in srgb, var(--nav-bg) 92%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
    z-index: 20;
}
.m-botnav a {
    background: transparent;
    border: 0;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 0.64rem;
    font-weight: 650;
    letter-spacing: 0.01em;
    text-decoration: none;
    min-height: 48px;
    border-radius: 12px;
    position: relative;
}
.m-botnav a svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.m-botnav a.on { color: var(--cyan); }
.m-botnav a.on::before {
    content: "";
    position: absolute;
    top: 2px;
    width: 16px;
    height: 2px;
    border-radius: 99px;
    background: var(--cyan);
}

.m-footer-note {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.76rem;
    margin-top: 4px;
    padding-bottom: 4px;
    opacity: 0.85;
}

/* Theme switch sizing in topbar */
body.m-site .m-top-actions .aida-theme-switch { margin: 0; }
body.m-site .m-top-actions .aida-theme-switch button {
    padding: 6px 9px;
    font-size: 0.7rem;
}
body.m-site .aida-theme-toggle.show-fallback {
    bottom: calc(var(--m-bot) + var(--safe-bot) + 12px);
}

/* Marketplace / workspace listing cards */
.m-listing {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    color: inherit;
    text-decoration: none;
    margin-bottom: 10px;
}
.m-listing .ml-name { font-weight: 700; font-size: 0.98rem; }
.m-listing .ml-meta { color: var(--text-dim); font-size: 0.8rem; margin-top: 4px; }
.m-listing .ml-tier {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--cyan);
    margin-top: 8px;
}
.m-search {
    width: 100%;
    min-height: 46px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    padding: 10px 14px;
    font: inherit;
    margin: 0 0 14px;
}
.m-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.m-actions button, .m-actions a.m-btn {
    flex: 1 1 140px;
    min-height: 44px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 650;
    font-size: 0.88rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.m-actions .primary { background: var(--m-yellow); color: var(--m-ink); border-color: transparent; }
.m-readme {
    white-space: pre-wrap;
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1.5;
}
.m-creator {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 10px;
}
.m-creator .av {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan), #a855f7);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #000; flex-shrink: 0;
}
.m-creator .who { flex: 1; min-width: 0; }
.m-creator .nm { font-weight: 650; }
.m-creator .mt { color: var(--text-dim); font-size: 0.78rem; }
.m-follow {
    border: 1px solid var(--cyan);
    background: transparent;
    color: var(--cyan);
    border-radius: 8px;
    padding: 6px 10px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 650;
    cursor: pointer;
}
.m-follow.done { color: var(--green, #4ade80); border-color: var(--green, #4ade80); }

