/* MoonGen portal. Full-screen app, independent of the active theme. */
html, body.moongen-portal-body { margin: 0; padding: 0; height: 100%; }
body.moongen-portal-body { background: #0b0d18; overflow: hidden; }
html:has(body.moongen-portal-body) { margin-top: 0 !important; }

.mgp {
	--bg: #0b0d18;
	--panel: #0f1224;
	--surface: #151931;
	--surface-2: #1c2140;
	--surface-3: #242a4f;
	--border: #242949;
	--border-strong: #343b66;
	--text: #eeedf7;
	--muted: #a0a3c4;
	--faint: #6f7399;
	--accent: #f2c96b;
	--accent-text: #f2c96b;
	--accent-ink: #231a05;
	--accent-soft: rgba(242, 201, 107, 0.13);
	--violet: #a99bff;
	--violet-soft: rgba(169, 155, 255, 0.14);
	--teal: #6fe0c0;
	--teal-soft: rgba(111, 224, 192, 0.13);
	--danger: #ff8f86;
	--danger-soft: rgba(255, 143, 134, 0.12);
	--ok: #7fe0b2;
	--shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
	--radius: 16px;
	--side: 252px;
	box-sizing: border-box;
	position: fixed;
	inset: 0;
	display: grid;
	grid-template-columns: var(--side) minmax(0, 1fr);
	background: var(--bg);
	color: var(--text);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	z-index: 1;
}
.mgp[data-theme="light"] {
	--bg: #f5f6fa;
	--panel: #ffffff;
	--surface: #ffffff;
	--surface-2: #f1f2f8;
	--surface-3: #e7e9f2;
	--border: #e4e6ef;
	--border-strong: #cfd3e3;
	--text: #151731;
	--muted: #5b6082;
	--faint: #8a8fae;
	--accent: #f2c96b;
	--accent-text: #9a6a0c;
	--accent-ink: #2a1e04;
	--accent-soft: rgba(242, 201, 107, 0.22);
	--violet: #5b48d6;
	--violet-soft: rgba(91, 72, 214, 0.1);
	--teal: #0f8a6b;
	--teal-soft: rgba(15, 138, 107, 0.1);
	--danger: #c93b30;
	--danger-soft: rgba(201, 59, 48, 0.08);
	--ok: #178a55;
	--shadow: 0 18px 50px rgba(20, 24, 60, 0.14);
}
.mgp *, .mgp *::before, .mgp *::after { box-sizing: border-box; }
.mgp :where(button, input, select, textarea) { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; }
.mgp :where(a) { color: inherit; }
.mgp :where(h1, h2, h3, h4, p) { margin: 0; font-family: inherit; color: inherit; letter-spacing: -0.01em; }
.mgp img, .mgp video { max-width: 100%; }
.mgp svg { flex: none; }
.mgp :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mgp .mgp-composer textarea:focus-visible { outline: none; }
.mgp .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.mgp-boot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.mgp-boot__moon, .mgp-moon { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); box-shadow: inset -7px -4px 0 0 #cf9c33; display: inline-block; flex: none; }
.mgp-noscript { grid-column: 1 / -1; text-align: center; padding: 40px; }

/* ---------------- Sidebar ---------------- */
.mgp-side { background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; padding: 18px 14px 14px; gap: 6px; }
.mgp-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: -0.02em; }
.mgp-brand small { font-size: 11px; font-weight: 600; color: var(--faint); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; margin-left: auto; letter-spacing: 0; }
.mgp-nav { display: flex; flex-direction: column; gap: 2px; }
.mgp-nav__label { font-size: 12px; color: var(--faint); padding: 14px 10px 6px; font-weight: 500; }
.mgp-nav a {
	display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px;
	text-decoration: none; color: var(--muted); font-weight: 500; font-size: 14.5px; transition: background .15s, color .15s;
}
.mgp-nav a:hover { background: var(--surface-2); color: var(--text); }
.mgp-nav a.is-active { background: var(--surface-2); color: var(--text); }
.mgp-nav a.is-active svg { color: var(--accent-text); }
.mgp-nav svg { width: 19px; height: 19px; }
.mgp-side__foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.mgp-wallet { background: linear-gradient(160deg, var(--surface-2), var(--surface)); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.mgp-wallet__label { font-size: 12px; color: var(--muted); }
.mgp-wallet__value { font-size: 22px; font-weight: 700; margin: 2px 0 10px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.mgp-wallet__value span { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.mgp-me { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; text-decoration: none; }
.mgp-me:hover { background: var(--surface-2); }
.mgp-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--violet-soft); color: var(--violet); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.mgp-me__text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.mgp-me__name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mgp-me__email { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- Main ---------------- */
.mgp-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.mgp-top { height: 64px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--border); background: var(--bg); }
.mgp-top__title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mgp-top__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mgp-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; white-space: nowrap; text-decoration: none; }
.mgp-chip b { font-variant-numeric: tabular-nums; }
.mgp-chip .mgp-coin { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: inset -3px -2px 0 #cf9c33; }
.mgp-icon-btn.mgp-menu-btn { display: none; }
.mgp-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; scroll-behavior: smooth; }
.mgp-view { max-width: 1240px; margin: 0 auto; padding: 28px 28px 48px; }
.mgp-view--create { display: flex; flex-direction: column; min-height: 100%; padding-bottom: 0; }

/* ---------------- Buttons ---------------- */
.mgp-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px;
	padding: 9px 16px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
	font-weight: 600; font-size: 14px; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap;
	transition: filter .15s, background .15s, border-color .15s, transform .1s;
}
.mgp-btn:hover { border-color: var(--border-strong); }
.mgp-btn:active { transform: translateY(1px); }
.mgp-btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.mgp-btn--primary:hover { filter: brightness(1.06); border-color: var(--accent); }
.mgp-btn--block { width: 100%; border-radius: 12px; padding: 11px 16px; }
.mgp-btn--ghost { background: transparent; }
.mgp-btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.mgp-btn svg { width: 17px; height: 17px; }
.mgp-icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); padding: 0; }
.mgp-icon-btn svg { width: 19px; height: 19px; }
.mgp-link { background: none; border: 0; padding: 0; color: var(--accent-text); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; }
.mgp-link:hover { text-decoration: underline; }

/* ---------------- Headings ---------------- */
.mgp-hello { font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.mgp-h1 { font-size: clamp(26px, 3.4vw, 40px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.mgp-h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; }
.mgp-sub { color: var(--muted); margin-top: 6px; }
.mgp-section { margin-top: 44px; }
.mgp-section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.mgp-hero { text-align: center; padding: 28px 0 8px; }
.mgp-hero .mgp-h1 { margin: 4px 0 24px; }

/* ---------------- Composer ---------------- */
.mgp-composer { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 14px; box-shadow: var(--shadow); text-align: left; transition: border-color .15s; }
.mgp-composer:focus-within { border-color: var(--border-strong); }
.mgp-composer--hero { max-width: 820px; margin: 0 auto; }
.mgp-composer__top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mgp-seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.mgp-seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.mgp-seg button svg { width: 15px; height: 15px; }
.mgp-seg button.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.mgp-composer textarea {
	width: 100%; resize: none; border: 0; outline: none; background: transparent; color: var(--text);
	font-size: 16px; line-height: 1.55; padding: 10px 8px; min-height: 76px; max-height: 260px;
}
.mgp-composer textarea::placeholder { color: var(--faint); }
.mgp-composer__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mgp-select {
	appearance: none; -webkit-appearance: none; border: 1px solid var(--border); background-color: var(--surface-2); color: var(--text);
	border-radius: 999px; padding: 7px 30px 7px 12px; font-size: 13.5px; font-weight: 500; cursor: pointer; max-width: 100%;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a3c4' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right 11px center;
}
.mgp-select:hover { border-color: var(--border-strong); }
.mgp-select option, .mgp-select optgroup { background: var(--surface); color: var(--text); }
.mgp-composer__cost { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.mgp-composer__cost b { color: var(--text); font-variant-numeric: tabular-nums; }
.mgp-send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: filter .15s, transform .1s; flex: none; }
.mgp-send svg { width: 20px; height: 20px; }
.mgp-send:hover { filter: brightness(1.06); }
.mgp-send:active { transform: scale(.96); }
.mgp-send[disabled] { opacity: .45; cursor: not-allowed; }
.mgp-send.is-busy svg { animation: mgp-spin 0.9s linear infinite; }
.mgp-composer__error { color: var(--danger); font-size: 13px; padding: 0 8px; min-height: 0; }
.mgp-composer__error:not(:empty) { padding: 2px 8px 8px; }
.mgp-composer__hint { font-size: 12.5px; color: var(--faint); padding: 0 8px 4px; }
.mgp-ideas { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px auto 0; max-width: 820px; }
.mgp-idea { border: 1px solid var(--border); background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--muted); cursor: pointer; transition: color .15s, border-color .15s; }
.mgp-idea:hover { color: var(--text); border-color: var(--border-strong); }
.mgp-dock { position: sticky; bottom: 0; margin-top: auto; padding: 24px 0 20px; background: linear-gradient(to bottom, transparent, var(--bg) 34%); z-index: 3; }
.mgp-dock .mgp-composer { max-width: 900px; margin: 0 auto; }

/* ---------------- Tool cards ---------------- */
.mgp-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.mgp-tool { text-decoration: none; display: flex; flex-direction: column; gap: 10px; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.mgp-tool__art { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); transition: transform .2s; }
.mgp-tool:hover .mgp-tool__art { transform: translateY(-2px); }
.mgp-tool__art span { position: absolute; left: 16px; bottom: 12px; font-weight: 800; font-size: 22px; letter-spacing: -0.02em; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.4); }
.mgp-art--image { background: radial-gradient(circle at 72% 32%, #f2c96b 0 12%, transparent 13%), radial-gradient(circle at 78% 26%, #312a6b 0 11%, transparent 12%), linear-gradient(160deg, #3b2d86, #1a1640 55%, #0e0c24); }
.mgp-art--video { background: repeating-linear-gradient(90deg, rgba(255,255,255,.06) 0 2px, transparent 2px 22px), radial-gradient(ellipse at 30% 120%, #ff8a5c 0 30%, transparent 55%), linear-gradient(160deg, #2b1a4f, #6a2b5f 60%, #ff8a5c); }
.mgp-art--library { background: linear-gradient(135deg, #16354a, #0f5b5b 55%, #6fe0c0); }
.mgp-art--credits { background: radial-gradient(circle at 70% 40%, #ffe29a 0 16%, #f2c96b 17% 22%, transparent 23%), linear-gradient(160deg, #4a3510, #1c1606); }
.mgp-tool__title { font-weight: 650; font-size: 16px; display: flex; align-items: center; gap: 4px; }
.mgp-tool__desc { font-size: 13.5px; color: var(--muted); margin-top: -6px; }

/* ---------------- Model tiles ---------------- */
.mgp-models { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.mgp-model { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; text-align: left; transition: border-color .15s, transform .15s; min-height: 132px; }
.mgp-model:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.mgp-model__top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: auto; gap: 8px; }
.mgp-model__mono { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; background: var(--surface-2); color: var(--text); }
.mgp-model__name { font-weight: 650; margin-top: 16px; }
.mgp-model__desc { font-size: 13px; color: var(--muted); }
.mgp-model__price { font-size: 12.5px; color: var(--accent-text); font-weight: 600; margin-top: 2px; }
.mgp-badge { font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 8px; background: var(--surface-2); color: var(--muted); }
.mgp-badge--image { background: var(--teal-soft); color: var(--teal); }
.mgp-badge--video { background: var(--violet-soft); color: var(--violet); }

/* ---------------- Generations ---------------- */
.mgp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.mgp-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.mgp-card__media { position: relative; background: #07080f; aspect-ratio: var(--ar, 1 / 1); overflow: hidden; cursor: zoom-in; border: 0; padding: 0; width: 100%; display: block; }
.mgp-card__media img, .mgp-card__media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mgp-card__kind { position: absolute; top: 10px; left: 10px; }
.mgp-card__state { aspect-ratio: var(--ar, 1 / 1); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 18px; text-align: center; color: var(--muted); font-size: 13px; background: linear-gradient(120deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: mgp-shimmer 2.2s ease-in-out infinite; }
.mgp-card__state--failed { animation: none; background: var(--danger-soft); color: var(--danger); }
.mgp-card__meta { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 5px; }
.mgp-card__prompt { font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mgp-card__sub { font-size: 12px; color: var(--faint); }
.mgp-card__actions { display: flex; gap: 14px; flex-wrap: wrap; }
.mgp-empty { border: 1px dashed var(--border-strong); border-radius: 16px; padding: 36px 20px; text-align: center; color: var(--muted); }
.mgp-empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.mgp-spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--accent); animation: mgp-spin .9s linear infinite; }
@keyframes mgp-spin { to { transform: rotate(360deg); } }
@keyframes mgp-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .mgp-spinner, .mgp-card__state, .mgp-send.is-busy svg { animation-duration: 4s; } }
.mgp-tabs { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.mgp-tabs button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.mgp-tabs button.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.mgp-more { display: flex; justify-content: center; margin-top: 20px; }

/* ---------------- Credits & account ---------------- */
.mgp-balance-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 24px; border-radius: 20px; border: 1px solid var(--border); background: radial-gradient(circle at 92% 20%, var(--accent-soft), transparent 45%), var(--surface); }
.mgp-balance-hero__value { font-size: 40px; font-weight: 750; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.mgp-balance-hero__value span { font-size: 16px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.mgp-packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.mgp-pack { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; cursor: pointer; transition: border-color .15s, transform .15s; }
.mgp-pack:hover { border-color: var(--accent); transform: translateY(-2px); }
.mgp-pack.is-featured { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.mgp-pack.is-loading { opacity: .6; cursor: wait; }
.mgp-pack__tag { position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 700; color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 2px 8px; }
.mgp-pack__name { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.mgp-pack__credits { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; }
.mgp-pack__price { font-size: 16px; font-weight: 650; color: var(--accent-text); }
.mgp-pack__per { font-size: 12.5px; color: var(--faint); }
.mgp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mgp-table th, .mgp-table td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--border); }
.mgp-table th { font-size: 12px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.mgp-num { text-align: right !important; font-variant-numeric: tabular-nums; }
.mgp-plus { color: var(--ok); }
.mgp-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px; }
.mgp-rows { display: flex; flex-direction: column; }
.mgp-rows > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.mgp-rows > div:last-child { border-bottom: 0; }
.mgp-rows dt, .mgp-rows .k { color: var(--muted); font-size: 14px; }
.mgp-notice { background: var(--danger-soft); border: 1px solid var(--danger); color: var(--danger); border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px; }

/* ---------------- Dialogs & toast ---------------- */
.mgp-dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: min(720px, calc(100vw - 24px)); width: 100%; max-height: calc(100dvh - 24px); }
.mgp-dialog::backdrop { background: rgba(4, 5, 12, .72); backdrop-filter: blur(3px); }
.mgp-dialog__inner { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }
.mgp-dialog__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: 12px; }
.mgp-dialog--media { max-width: min(1100px, calc(100vw - 24px)); }
.mgp-lightbox { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.mgp-lightbox__media { background: #07080f; border-radius: 14px; overflow: hidden; display: flex; align-items: center; justify-content: center; max-height: calc(100dvh - 90px); }
.mgp-lightbox__media img, .mgp-lightbox__media video { max-width: 100%; max-height: calc(100dvh - 90px); object-fit: contain; display: block; }
.mgp-lightbox__side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mgp-lightbox__prompt { font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }

.mgp-toast {
	position: fixed; left: 50%; top: 76px; transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
	background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); border-radius: 12px;
	padding: 11px 16px; font-size: 14px; max-width: calc(100vw - 32px); z-index: 50; transition: opacity .2s, transform .2s; box-shadow: var(--shadow);
}
.mgp-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.mgp-toast--error { border-color: var(--danger); }
.mgp-toast--ok { border-color: var(--ok); }

/* ---------------- Auth ---------------- */
.mgp--auth { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.mgp-auth-art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 36px; background: radial-gradient(circle at 72% 30%, rgba(242,201,107,.95) 0 9%, transparent 9.3%), radial-gradient(circle at 76.5% 26.5%, #1b1845 0 8.4%, transparent 8.7%), radial-gradient(ellipse at 50% 120%, #4b2f9a 0, transparent 60%), linear-gradient(180deg, #0b0d18, #15123a); color: #eeedf7; }
.mgp-auth-art::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(1px 1px at 10% 20%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 30% 70%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 55% 15%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 85% 60%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 65% 85%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 20% 45%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 45% 40%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 92% 10%, #fff 50%, transparent 51%); opacity: .55; }
.mgp-auth-art > * { position: relative; }
.mgp-auth-art .mgp-brand { padding: 0; color: #fff; }
.mgp-auth-art h2 { font-size: clamp(28px, 3.6vw, 46px); font-weight: 750; letter-spacing: -0.035em; line-height: 1.05; max-width: 12ch; }
.mgp-auth-art p { color: #c4c6e6; margin-top: 12px; max-width: 42ch; }
.mgp-auth-models { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.mgp-auth-models span { font-size: 12.5px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 4px 10px; color: #dcdcf2; background: rgba(255,255,255,.04); }
.mgp-auth-side { display: flex; align-items: center; justify-content: center; padding: 32px 20px; overflow-y: auto; background: var(--bg); }
.mgp-auth-card { width: 100%; max-width: 400px; }
.mgp-auth-card .mgp-h1 { font-size: 30px; margin-bottom: 4px; }
.mgp-auth-card .mgp-tabs { margin: 22px 0 18px; width: 100%; }
.mgp-auth-card .mgp-tabs button { flex: 1; }
.mgp-quote { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; color: var(--muted); margin-top: 14px; }
.mgp-quote b { color: var(--text); font-weight: 600; }
.mgp-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.mgp-field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.mgp-input { width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 11px 13px; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s; }
.mgp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mgp-input.is-invalid { border-color: var(--danger); }
.mgp-form-error { color: var(--danger); font-size: 13.5px; margin: -4px 0 12px; }
.mgp-form-error:empty { display: none; }
.mgp-fine { font-size: 12.5px; color: var(--faint); margin-top: 14px; text-align: center; }
.mgp-fine a { color: var(--muted); }

/* ---------------- Responsive ---------------- */
.mgp-scrim { display: none; }
@media (max-width: 900px) {
	.mgp { grid-template-columns: minmax(0, 1fr); }
	.mgp-side { position: fixed; top: 0; bottom: 0; left: 0; width: min(86vw, 300px); z-index: 40; transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow); }
	.mgp.is-menu-open .mgp-side { transform: none; }
	.mgp.is-menu-open .mgp-scrim { display: block; position: fixed; inset: 0; background: rgba(4,5,12,.6); z-index: 39; }
	.mgp-icon-btn.mgp-menu-btn { display: inline-flex; }
	.mgp-top { padding: 0 14px; }
	.mgp-top .mgp-btn--buy span { display: none; }
	.mgp-view { padding: 20px 16px 40px; }
	.mgp-view--create { padding-bottom: 0; }
	.mgp--auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; overflow-y: auto; }
	.mgp-auth-art { padding: 22px 20px; min-height: 0; }
	.mgp-auth-art h2 { font-size: 26px; max-width: none; margin-top: 24px; }
	.mgp-auth-art p, .mgp-auth-models { display: none; }
	.mgp-auth-side { align-items: flex-start; overflow: visible; }
	.mgp-lightbox { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
	.mgp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.mgp-card__meta { padding: 9px 10px 11px; }
	.mgp-card__actions { gap: 10px; }
	.mgp-models { grid-template-columns: minmax(0, 1fr); }
	.mgp-top__title { font-size: 15px; }
	.mgp-chip { padding: 5px 10px; }
	.mgp-composer { border-radius: 18px; padding: 10px; }
	.mgp-dock { padding: 14px 0 12px; }
	.mgp-hero { padding-top: 8px; }
}

/* ---------------- Voice-over dialog ---------------- */
.mgp-dialog--voice { max-width: min(860px, calc(100vw - 24px)); }
.mgp-voice { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.mgp-voice__media { position: relative; aspect-ratio: var(--ar, 9 / 16); max-height: 380px; border-radius: 14px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.mgp-voice__video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mgp-voice__form { display: flex; flex-direction: column; min-width: 0; }
.mgp-voice__script { resize: vertical; min-height: 120px; line-height: 1.5; }
.mgp-voice__count { font-size: 12.5px; color: var(--faint); }
.mgp-voice__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }
.mgp-voice__row .mgp-field:first-child { grid-column: 1 / -1; }
.mgp-voice__row .mgp-select { width: 100%; }
.mgp-voice__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.mgp-voice__cost { margin: 0; color: var(--muted); font-size: 14px; }
.mgp-voice__cost b { color: var(--text); }
.mgp-voice__btns { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 680px) {
	.mgp-voice { grid-template-columns: minmax(0, 1fr); }
	.mgp-voice__media { max-height: 200px; aspect-ratio: auto; height: 200px; }
	.mgp-voice__btns { width: 100%; }
	.mgp-voice__btns .mgp-btn { flex: 1; }
}
