/* ==========================================================================
   Codie 2 — editor + auth styles
   Brand: sunset gradient (orange → pink → violet) on deep plum-black.
   ========================================================================== */

:root {
	--bg: #14111c;
	--bg-2: #1a1624;
	--panel: #201b2c;
	--panel-2: #282236;
	--line: rgba(255, 255, 255, .07);
	--line-2: rgba(255, 255, 255, .12);
	--txt: #ece8f4;
	--muted: #9a93ab;
	--dim: #6d6680;
	--orange: #ff9a3c;
	--pink: #ff4f7b;
	--violet: #8b5cf6;
	--green: #34d399;
	--yellow: #fbbf24;
	--red: #f87171;
	--blue: #60a5fa;
	--grad: linear-gradient(120deg, #ff9a3c 0%, #ff4f7b 50%, #8b5cf6 100%);
	--radius: 12px;
	--top-h: 52px;
	--ease: cubic-bezier(.22, 1, .36, 1);
	--f-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
	--f-brand: "Montserrat", var(--f-ui);
	--f-code: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
	--code-size: 14px;
	--split: 40%;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--txt); font: 14px/1.45 var(--f-ui); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
kbd { display: inline-block; min-width: 1.6em; padding: .1em .45em; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line-2); border-bottom-width: 2px; font: 600 11px/1.4 var(--f-code); text-align: center; color: var(--txt); }
code { font-family: var(--f-code); font-size: .92em; padding: .1em .35em; border-radius: 5px; background: rgba(255, 255, 255, .07); }
[hidden] { display: none !important; }
::selection { background: rgba(255, 79, 123, .35); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #3a3348 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3a3348; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #524866; }

/* ---------- buttons ---------- */
.ibtn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--muted); transition: background .2s, color .2s; flex: none; }
.ibtn:hover { background: var(--panel-2); color: var(--txt); }
.ibtn.is-on { color: var(--orange); }
.ibtn--sm { width: 28px; height: 28px; border-radius: 7px; font-size: 13px; }
.btn { display: inline-flex; align-items: center; gap: .5rem; height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 600; transition: transform .2s var(--ease), filter .2s, background .2s; white-space: nowrap; }
.btn--grad { background: var(--grad); color: #fff; box-shadow: 0 8px 20px -8px rgba(255, 79, 123, .7); }
.btn--grad:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn--ghost { background: var(--panel-2); color: var(--txt); }
.btn--ghost:hover { background: #332b44; }
.btn--danger { background: rgba(248, 113, 113, .15); color: var(--red); }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

/* ==========================================================================
   IDE
   ========================================================================== */
.ide { overflow: hidden; display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* boot */
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 26px; background: radial-gradient(circle at 50% 40%, #2a1d3a, var(--bg) 70%); transition: opacity .5s, visibility .5s; }
.boot img { animation: bootPulse 1.6s ease-in-out infinite; }
.boot__bar { width: 160px; height: 3px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.boot__bar span { display: block; width: 40%; height: 100%; background: var(--grad); animation: bootBar 1.1s ease-in-out infinite; }
@keyframes bootBar { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes bootPulse { 50% { transform: scale(.96); opacity: .8; } }
.ide:not(.is-loading) .boot { opacity: 0; visibility: hidden; }

/* top bar */
.top { position: relative; z-index: 20; height: var(--top-h); flex: none; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 14px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--grad); opacity: .55; }
.top__brand { display: flex; align-items: center; padding-right: 8px; margin-right: 2px; border-right: 1px solid var(--line); height: 30px; }
.top__brand img { height: 26px; width: auto; display: block; }
.top__project { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 0 1 340px; }
.top__name { min-width: 60px; width: 100%; max-width: 240px; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid transparent; background: transparent; font-family: var(--f-brand); font-weight: 700; font-size: 14px; color: var(--txt); text-overflow: ellipsis; transition: border-color .2s, background .2s; }
.top__name:hover { background: var(--panel); }
.top__name:focus { outline: none; border-color: var(--pink); background: var(--panel); }

.save { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12px; color: var(--muted); white-space: nowrap; background: var(--panel); flex: none; }
.save[data-state="saved"] i { color: var(--green); }
.save[data-state="dirty"] i, .save[data-state="saving"] i { color: var(--yellow); }
.save[data-state="saving"] i { animation: spin 1s linear infinite; }
.save[data-state="error"] { color: var(--red); background: rgba(248, 113, 113, .12); }
@keyframes spin { to { transform: rotate(360deg); } }

.top__actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.top__sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 6px; }
.tbtn { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 13px; transition: background .2s, color .2s; }
.tbtn i { font-size: 15px; }
.tbtn:hover { background: var(--panel-2); color: var(--txt); }
.tbtn__badge { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--pink); color: #fff; font: 700 10px/16px var(--f-ui); text-align: center; }

.top__run { display: flex; align-items: center; gap: 10px; padding-left: 8px; }
.runbtn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 16px 0 12px; border-radius: 9px; background: var(--grad); color: #fff; font-weight: 700; font-size: 13px; box-shadow: 0 6px 18px -6px rgba(255, 79, 123, .8); transition: filter .2s, transform .2s var(--ease); }
.runbtn i { font-size: 17px; }
.runbtn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.runbtn.is-flash { animation: flash .5s; }
@keyframes flash { 50% { transform: scale(.94); } }

.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12px; color: var(--muted); user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__ui { position: relative; width: 30px; height: 18px; border-radius: 99px; background: var(--panel-2); transition: background .2s; }
.switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); transition: transform .25s var(--ease), background .2s; }
.switch input:checked + .switch__ui { background: rgba(52, 211, 153, .25); }
.switch input:checked + .switch__ui::after { transform: translateX(12px); background: var(--green); }
.switch input:focus-visible + .switch__ui { outline: 2px solid var(--pink); outline-offset: 2px; }

.top__user { position: relative; padding-left: 6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; font: 700 12px/34px var(--f-brand); text-align: center; letter-spacing: .02em; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); width: 230px; padding: 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .6); animation: pop .18s var(--ease); }
.menu__head { display: grid; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu__head small { color: var(--dim); font-size: 11px; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--txt); font-size: 13px; text-align: left; }
.menu button:hover, .menu a:hover { background: var(--panel-2); }
.menu i { color: var(--muted); width: 16px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* workspace */
.ws { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--split) 8px 1fr; }
.ide[data-layout="v"] .ws { grid-template-columns: 1fr; grid-template-rows: var(--split) 8px 1fr; }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.ide.is-max .pane--code, .ide.is-max .gutter { display: none; }
.ide.is-max .ws { grid-template-columns: 1fr; }
.ide.is-max[data-layout="v"] .ws { grid-template-rows: 1fr; }

/* gutter */
.gutter { position: relative; background: var(--bg-2); cursor: col-resize; touch-action: none; }
.gutter span { position: absolute; left: 50%; top: 50%; width: 4px; height: 36px; margin: -18px 0 0 -2px; border-radius: 4px; background: var(--line-2); transition: background .2s, height .2s; }
.gutter:hover span, .gutter.is-drag span { background: var(--grad); height: 64px; margin-top: -32px; }
.ide[data-layout="v"] .gutter { cursor: row-resize; }
.ide[data-layout="v"] .gutter span { width: 36px; height: 4px; margin: -2px 0 0 -18px; }
.ide[data-layout="v"] .gutter:hover span { width: 64px; height: 4px; margin: -2px 0 0 -32px; }
.ide.is-dragging iframe { pointer-events: none; }
.ide.is-dragging { user-select: none; }

/* tabs */
.tabs { flex: none; display: flex; align-items: center; gap: 2px; height: 40px; padding: 0 6px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 8px; font: 500 13px var(--f-code); color: var(--muted); transition: background .2s, color .2s; }
.tab:hover { color: var(--txt); background: var(--panel); }
.tab.is-on { color: var(--txt); background: var(--panel); }
.tab.is-on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -5px; height: 2px; border-radius: 2px; background: var(--grad); }
.dot { width: 8px; height: 8px; border-radius: 3px; }
.dot--html { background: #ff7a45; }
.dot--css { background: #4f9dff; }
.dot--js { background: #f7d046; }
.tab__dirty { width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); display: none; }
.tab.is-dirty .tab__dirty { display: block; }
.tabs__fill { flex: 1; }
.tabs__size { min-width: 22px; text-align: center; font: 500 12px var(--f-code); color: var(--dim); }

.editors { position: relative; flex: 1; min-height: 0; }
.editor { position: absolute; inset: 0; visibility: hidden; }
.editor.is-on { visibility: visible; }
.editor .CodeMirror { height: 100%; font-family: var(--f-code); font-size: var(--code-size); line-height: 1.6; }

.status { flex: none; display: flex; align-items: center; gap: 16px; height: 26px; padding: 0 12px; background: var(--bg-2); border-top: 1px solid var(--line); font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; }
.status__fill { flex: 1; }
.status__tip code { font-size: 11px; }
.status__tip kbd { font-size: 10px; padding: 0 .35em; }
.status__tip i { color: var(--orange); }

/* preview */
.pane--out { background: #0f0d15; }
.pbar { flex: none; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 6px 0 12px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.pbar__dots { display: flex; gap: 6px; margin-right: 6px; }
.pbar__dots i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.pbar__dots i:nth-child(2) { background: #febc2e; }
.pbar__dots i:nth-child(3) { background: #28c840; }
.pbar__url { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px; border-radius: 99px; background: var(--panel); color: var(--muted); font: 12px var(--f-code); overflow: hidden; white-space: nowrap; }
.pbar__url i { color: var(--green); font-size: 11px; }
.pbar__url span { overflow: hidden; text-overflow: ellipsis; }
.pbar__size { font: 11px var(--f-code); color: var(--dim); min-width: 74px; text-align: center; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--panel); gap: 2px; }
.seg button { display: inline-grid; place-items: center; height: 26px; min-width: 30px; padding: 0 8px; border-radius: 7px; color: var(--muted); font-size: 13px; transition: background .2s, color .2s; }
.seg button:hover { color: var(--txt); }
.seg button.is-on { background: var(--panel-2); color: var(--txt); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset; }
.seg--wide { display: flex; margin: 0 20px 12px; }
.seg--wide button { flex: 1; height: 32px; font-weight: 600; }

.stage { position: relative; flex: 1; min-height: 0; overflow: auto; display: flex; justify-content: center; align-items: flex-start; background: #0f0d15; background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px); background-size: 18px 18px; }
.frame { width: 100%; height: 100%; background: #fff; transition: width .45s var(--ease), border-radius .45s var(--ease), margin .45s var(--ease), box-shadow .45s; transform-origin: top center; }
.frame[data-device="tablet"], .frame[data-device="mobile"] { flex: none; margin: 18px auto; border-radius: 22px; overflow: hidden; box-shadow: 0 0 0 10px #232032, 0 0 0 11px #3a3450, 0 30px 60px -10px rgba(0, 0, 0, .7); height: calc(100% - 36px); }
.frame[data-device="tablet"] { width: 768px; }
.frame[data-device="mobile"] { width: 390px; border-radius: 30px; }
.frame iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.stage__busy { position: absolute; left: 0; top: 0; height: 2px; width: 100%; background: var(--grad); transform: scaleX(0); transform-origin: left; opacity: 0; pointer-events: none; }
.stage__busy.is-on { opacity: 1; animation: busy .7s var(--ease) forwards; }
@keyframes busy { from { transform: scaleX(.1); } to { transform: scaleX(1); opacity: 0; } }

/* console */
.console { flex: none; display: flex; flex-direction: column; background: var(--bg-2); border-top: 1px solid var(--line); height: 34px; transition: height .3s var(--ease); }
.console[data-open="true"] { height: 34%; min-height: 150px; }
.console__head { flex: none; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; }
.console__head:hover { color: var(--txt); }
.console__fill { flex: 1; }
.console__chev { transition: transform .3s var(--ease); }
.console[data-open="true"] .console__chev { transform: rotate(180deg); }
.cbadge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--panel-2); color: var(--txt); font: 700 10.5px/18px var(--f-ui); text-align: center; }
.cbadge--err { background: rgba(248, 113, 113, .2); color: var(--red); }
.cbadge--warn { background: rgba(251, 191, 36, .18); color: var(--yellow); }
.console__body { flex: 1; min-height: 0; overflow: auto; padding: 4px 0; font: 12.5px/1.55 var(--f-code); }
.console[data-open="false"] .console__body, .console[data-open="false"] .console__input { display: none; }
.cl { display: flex; gap: 8px; padding: 3px 12px; border-bottom: 1px solid rgba(255, 255, 255, .03); white-space: pre-wrap; word-break: break-word; color: #d9d4e4; }
.cl__icon { flex: none; width: 14px; color: var(--dim); }
.cl__msg { flex: 1; min-width: 0; }
.cl__src { flex: none; color: var(--dim); font-size: 11px; }
.cl--warn { background: rgba(251, 191, 36, .06); color: #fde68a; }
.cl--warn .cl__icon { color: var(--yellow); }
.cl--error { background: rgba(248, 113, 113, .07); color: #fecaca; }
.cl--error .cl__icon { color: var(--red); }
.cl--info .cl__icon { color: var(--blue); }
.cl--result .cl__icon { color: var(--violet); }
.cl--input { color: var(--muted); }
.cl--sys { color: var(--dim); font-style: italic; }
.cl .s { color: #a5e3a5; }
.cl .n { color: #f9b26c; }
.cl .k { color: #c4a5ff; }
.console__input { flex: none; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-top: 1px solid var(--line); color: var(--violet); }
.console__input input { flex: 1; height: 100%; border: 0; background: transparent; font: 12.5px var(--f-code); color: var(--txt); outline: none; }

/* mobile view switch */
.mswitch { display: none; }

/* ---------- dialogs ---------- */
.dlg { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line-2); border-radius: 18px; background: var(--panel); color: var(--txt); box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .8); overflow: hidden; }
.dlg[open] { display: flex; flex-direction: column; animation: dlgIn .28s var(--ease); }
.dlg::backdrop { background: rgba(8, 6, 14, .65); backdrop-filter: blur(4px); animation: fade .25s; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
.dlg form { display: contents; }
.dlg--wide { width: min(980px, calc(100vw - 32px)); height: min(720px, calc(100vh - 48px)); }
.dlg--sm { width: min(420px, calc(100vw - 32px)); }
.dlg--side { margin: 0 0 0 auto; width: min(440px, 100vw); height: 100vh; max-height: 100vh; border-radius: 18px 0 0 18px; border-right: 0; }
.dlg--side[open] { animation: sideIn .35s var(--ease); }
@keyframes sideIn { from { transform: translateX(40px); opacity: 0; } }
.dlg__head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 20px 14px; }
.dlg__head h2 { margin: 0; font: 800 20px/1.2 var(--f-brand); letter-spacing: -.01em; }
.dlg__head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.dlg__foot { flex: none; display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px 20px; }
.dlg__tools { flex: none; display: flex; gap: 8px; padding: 0 20px 14px; border-bottom: 1px solid var(--line); }
.search { flex: 1; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); color: var(--muted); }
.search:focus-within { border-color: var(--pink); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--txt); }
.dlg--side .search { flex: none; margin: 0 20px 12px; }

.fld { position: relative; display: block; }
.fld--dark { margin: 0 20px 16px; }
.fld--dark span { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.fld--dark input { width: 100%; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--txt); outline: none; }
.fld--dark input:focus { border-color: var(--pink); }

.tpl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 20px; }
.tpl label { cursor: pointer; }
.tpl input { position: absolute; opacity: 0; }
.tpl span { display: grid; gap: 4px; height: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); transition: border-color .2s, background .2s; }
.tpl i { font-size: 20px; color: var(--orange); }
.tpl small { color: var(--muted); font-size: 12px; }
.tpl input:checked + span { border-color: var(--pink); background: rgba(255, 79, 123, .07); }
.tpl input:focus-visible + span { outline: 2px solid var(--pink); }

/* projects list */
.plist { flex: 1; overflow: auto; padding: 16px 20px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; align-content: start; }
.pcard { position: relative; display: flex; flex-direction: column; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; transition: border-color .2s, transform .25s var(--ease); }
.pcard:hover { border-color: var(--line-2); transform: translateY(-2px); }
.pcard.is-current { border-color: rgba(255, 79, 123, .6); }
.pcard__open { display: block; text-align: left; padding: 0; }
.pcard__thumb { position: relative; height: 92px; overflow: hidden; background: var(--grad); }
.pcard__thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 40%, rgba(20, 17, 28, .55)); }
.pcard__thumb b { position: absolute; left: 14px; bottom: 10px; z-index: 1; font: 800 28px/1 var(--f-brand); color: rgba(255, 255, 255, .95); text-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.pcard__thumb i { position: absolute; right: -10px; top: -14px; font-size: 90px; color: rgba(255, 255, 255, .14); }
.pcard__body { padding: 12px 14px 4px; }
.pcard__name { display: block; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard__meta { display: block; margin-top: 2px; font-size: 12px; color: var(--dim); }
.pcard__acts { display: flex; gap: 2px; padding: 6px 8px 8px; }
.pcard__acts .ibtn { width: 30px; height: 30px; font-size: 13px; }
.pcard__acts .ibtn--del:hover { color: var(--red); background: rgba(248, 113, 113, .12); }
.pcard__tag { position: absolute; top: 8px; left: 8px; z-index: 2; padding: 2px 8px; border-radius: 99px; background: rgba(20, 17, 28, .7); font-size: 10.5px; font-weight: 700; color: #fff; }
.empty { grid-column: 1 / -1; padding: 50px 20px; text-align: center; color: var(--muted); }
.empty i { display: block; font-size: 40px; margin-bottom: 8px; color: var(--dim); }

/* assets */
.drop { position: relative; display: grid; justify-items: center; gap: 4px; margin: 0 20px; padding: 22px 16px; border-radius: 14px; border: 1.5px dashed var(--line-2); background: var(--bg-2); text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.drop:hover, .drop.is-over { border-color: var(--pink); background: rgba(255, 79, 123, .06); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop i { font-size: 30px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.drop small { color: var(--muted); font-size: 12px; max-width: 300px; }
.meter { height: 4px; margin: 14px 20px 4px; border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--grad); transition: width .4s var(--ease); }
.meter__txt { margin: 0 20px 10px; font-size: 11.5px; color: var(--dim); }
.alist { flex: 1; overflow: auto; padding: 0 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.acard { border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
.acard__thumb { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; background-color: #fff; background-image: linear-gradient(45deg, #eee 25%, transparent 25%), linear-gradient(-45deg, #eee 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #eee 75%), linear-gradient(-45deg, transparent 75%, #eee 75%); background-size: 14px 14px; background-position: 0 0, 0 7px, 7px -7px, -7px 0; }
.acard__thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.acard__thumb i { font-size: 34px; color: #8b8597; }
.acard__thumb.is-file { background: var(--panel-2); }
.acard__name { display: block; padding: 8px 10px 0; font: 500 11.5px var(--f-code); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acard__size { display: block; padding: 0 10px; font-size: 11px; color: var(--dim); }
.acard__acts { display: flex; gap: 2px; padding: 4px 6px 6px; }
.acard__acts .ibtn { width: 28px; height: 28px; font-size: 13px; }
.acard__acts .ibtn--del:hover { color: var(--red); }
.acard__acts .ibtn--ins { margin-right: auto; width: auto; padding: 0 8px; gap: 4px; display: inline-flex; font-size: 12px; font-weight: 600; color: var(--orange); }
.hint { flex: none; margin: 12px 20px 20px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); color: var(--muted); font-size: 12px; }
.hint i { color: var(--blue); }

/* reference */
.rlist { flex: 1; overflow: auto; padding: 0 20px 20px; }
.ritem { border-radius: 10px; margin-bottom: 6px; background: var(--bg-2); border: 1px solid var(--line); }
.ritem summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; font: 600 13px var(--f-code); color: var(--orange); }
.ritem summary::-webkit-details-marker { display: none; }
.ritem summary small { font: 12px var(--f-ui); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.ritem[open] summary small { display: none; }
.ritem__body { padding: 0 12px 12px; font-size: 13px; color: var(--muted); }
.ritem__body p { margin: 0 0 8px; color: var(--txt); }
.ritem__body h4 { margin: 10px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
.ritem pre { margin: 0; padding: 10px 12px; border-radius: 8px; background: #0f0d15; color: #e4def0; font: 12px/1.5 var(--f-code); white-space: pre-wrap; word-break: break-word; }
.ritem__acts { display: flex; gap: 6px; margin-top: 8px; }
.ritem__acts .btn { height: 30px; padding: 0 10px; font-size: 12px; }

/* shortcuts */
.keys { margin: 0; padding: 0 20px 20px; display: grid; gap: 2px; }
.keys div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); font-size: 13px; text-align: right; }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 380px; padding: 11px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .6); font-size: 13px; pointer-events: auto; animation: toastIn .35s var(--ease); }
.toast i { font-size: 16px; }
.toast--ok i { color: var(--green); }
.toast--err i { color: var(--red); }
.toast--info i { color: var(--blue); }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.dropmask { position: fixed; inset: 0; z-index: 150; display: none; place-items: center; background: rgba(20, 17, 28, .75); backdrop-filter: blur(3px); }
.dropmask.is-on { display: grid; }
.dropmask div { display: grid; justify-items: center; gap: 8px; padding: 40px 60px; border-radius: 20px; border: 2px dashed var(--pink); color: var(--txt); font-size: 16px; }
.dropmask i { font-size: 44px; color: var(--pink); }

/* ---------- CodeMirror theme: codie dark ---------- */
.cm-s-codie.CodeMirror { background: var(--bg); color: #e6e1f0; }
.cm-s-codie .CodeMirror-gutters { background: var(--bg); border-right: 1px solid var(--line); }
.cm-s-codie .CodeMirror-linenumber { color: #4f4862; padding: 0 10px 0 6px; }
.cm-s-codie .CodeMirror-activeline-background { background: rgba(255, 255, 255, .035); }
.cm-s-codie .CodeMirror-activeline-gutter .CodeMirror-linenumber { color: #c9c2d8; }
.cm-s-codie .CodeMirror-cursor { border-left: 2px solid var(--pink); }
.cm-s-codie div.CodeMirror-selected, .cm-s-codie.CodeMirror-focused div.CodeMirror-selected { background: rgba(139, 92, 246, .3); }
.cm-s-codie .cm-tag { color: #ff7a8a; }
.cm-s-codie .cm-attribute { color: #ffb86b; }
.cm-s-codie .cm-string, .cm-s-codie .cm-string-2 { color: #a6e3a1; }
.cm-s-codie .cm-keyword { color: #c792ea; }
.cm-s-codie .cm-def { color: #82aaff; }
.cm-s-codie .cm-variable { color: #e6e1f0; }
.cm-s-codie .cm-variable-2 { color: #89ddff; }
.cm-s-codie .cm-variable-3, .cm-s-codie .cm-type { color: #ffcb6b; }
.cm-s-codie .cm-property { color: #82aaff; }
.cm-s-codie .cm-number { color: #f78c6c; }
.cm-s-codie .cm-atom { color: #f78c6c; }
.cm-s-codie .cm-builtin { color: #ffcb6b; }
.cm-s-codie .cm-qualifier { color: #ffcb6b; }
.cm-s-codie .cm-comment { color: #6b6380; font-style: italic; }
.cm-s-codie .cm-meta { color: #89ddff; }
.cm-s-codie .cm-bracket { color: #8a8299; }
.cm-s-codie .cm-operator { color: #89ddff; }
.cm-s-codie .cm-error { color: #fff; background: rgba(248, 113, 113, .5); }
.cm-s-codie .CodeMirror-matchingbracket { color: #fff !important; background: rgba(255, 154, 60, .25); outline: 1px solid rgba(255, 154, 60, .5); }
.cm-s-codie .CodeMirror-matchingtag { background: rgba(255, 154, 60, .15); }
.cm-s-codie .CodeMirror-foldgutter-open, .cm-s-codie .CodeMirror-foldgutter-folded { color: #4f4862; }
.CodeMirror-foldmarker { color: var(--orange); text-shadow: none; font-family: var(--f-code); }

/* codie light */
.cm-s-codie-light.CodeMirror { background: #fdfcff; color: #2b2438; }
.cm-s-codie-light .CodeMirror-gutters { background: #f6f3fb; border-right: 1px solid #ebe6f3; }
.cm-s-codie-light .CodeMirror-linenumber { color: #b4abc3; padding: 0 10px 0 6px; }
.cm-s-codie-light .CodeMirror-activeline-background { background: #f6f1ff; }
.cm-s-codie-light .CodeMirror-cursor { border-left: 2px solid #e5306a; }
.cm-s-codie-light div.CodeMirror-selected { background: #e7dcff; }
.cm-s-codie-light .cm-tag { color: #d6336c; }
.cm-s-codie-light .cm-attribute { color: #c2410c; }
.cm-s-codie-light .cm-string, .cm-s-codie-light .cm-string-2 { color: #15803d; }
.cm-s-codie-light .cm-keyword { color: #7c3aed; }
.cm-s-codie-light .cm-def, .cm-s-codie-light .cm-property { color: #2563eb; }
.cm-s-codie-light .cm-number, .cm-s-codie-light .cm-atom { color: #c2410c; }
.cm-s-codie-light .cm-comment { color: #9a91aa; font-style: italic; }
.cm-s-codie-light .cm-variable-2, .cm-s-codie-light .cm-meta, .cm-s-codie-light .cm-operator { color: #0e7490; }
.cm-s-codie-light .cm-variable-3, .cm-s-codie-light .cm-builtin, .cm-s-codie-light .cm-qualifier { color: #b45309; }
.cm-s-codie-light .CodeMirror-matchingbracket { color: #000 !important; background: #ffe2c2; }

/* hints + dialog */
.CodeMirror-hints { z-index: 300; padding: 4px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); box-shadow: 0 16px 40px -8px rgba(0, 0, 0, .6); font: 12.5px var(--f-code); max-height: 16em; }
.CodeMirror-hint { padding: 3px 8px; border-radius: 6px; color: var(--txt); }
li.CodeMirror-hint-active { background: var(--grad); color: #fff; }
.CodeMirror-dialog { background: var(--panel); color: var(--txt); font-family: var(--f-ui); padding: 6px 12px; }
.CodeMirror-dialog input { color: var(--txt); font-family: var(--f-code); }
.CodeMirror-dialog-top { border-bottom: 1px solid var(--line-2); }
.cm-searching { background: rgba(251, 191, 36, .35); }
/* Emmet abbreviation marker */
.emmet-abbreviation { text-decoration: underline wavy rgba(255, 154, 60, .7); text-underline-offset: 3px; }
.emmet-abbreviation-preview { z-index: 50; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); font: 12px var(--f-code); color: var(--muted); box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .6); }
.emmet-abbreviation-preview .CodeMirror { height: auto; background: transparent; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
	.tbtn span { display: none; }
	.tbtn { padding: 0 9px; }
	.status__tip { display: none; }
}
@media (max-width: 860px) {
	:root { --top-h: 50px; }
	.top { gap: 6px; padding: 0 6px 0 10px; }
	.top__brand { border: 0; padding: 0; }
	.top__brand img { height: 22px; }
	.top__project { flex: 1; }
	.save span, .top__sep, #btnFormat, #btnRef, .switch__txt, .pbar__dots, .pbar__size, #btnLayout { display: none; }
	.save { padding: 0 8px; }
	.runbtn span { display: none; }
	.runbtn { padding: 0 11px; }
	.ws, .ide[data-layout="v"] .ws { grid-template-columns: 1fr; grid-template-rows: 1fr; }
	.gutter { display: none; }
	.pane { grid-area: 1 / 1; }
	.ide[data-view="code"] .pane--out, .ide:not([data-view]) .pane--out { display: none; }
	.ide[data-view="out"] .pane--code { display: none; }
	.mswitch { flex: none; position: relative; z-index: 30; display: flex; gap: 6px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); height: calc(52px + env(safe-area-inset-bottom)); background: var(--bg-2); border-top: 1px solid var(--line); }
	.mswitch button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; color: var(--muted); font-weight: 600; }
	.mswitch button.is-on { background: var(--panel-2); color: var(--txt); }
	.tabs__size, #wrapToggle { display: none; }
	.alist { grid-template-columns: 1fr 1fr; }
	.dlg--side { width: 100vw; border-radius: 0; }
	.tpl { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
	.top__actions .tbtn:not(#btnSave):not(#btnAssets) { display: none; }
	.top__user { padding-left: 0; }
	.dlg__tools { flex-wrap: wrap; }
	.dlg__tools .search { flex-basis: 100%; }
}

/* ==========================================================================
   AUTH (login / register)
   ========================================================================== */
.auth { min-height: 100vh; overflow-x: hidden; background: #160f22; font-family: var(--f-ui); }
.auth__bg { position: fixed; inset: 0; overflow: hidden; background: url("../images/bg.png") center / cover no-repeat; }
.auth__bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, rgba(22, 15, 34, .2) 0%, rgba(22, 15, 34, .55) 55%, rgba(22, 15, 34, .9) 100%); }
.auth__bg span { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: float 14s ease-in-out infinite; }
.auth__bg span:nth-child(1) { width: 380px; height: 380px; left: 8%; top: 12%; background: #ffb347; }
.auth__bg span:nth-child(2) { width: 300px; height: 300px; left: 40%; bottom: -60px; background: #ff4f7b; animation-delay: -5s; }
.auth__bg span:nth-child(3) { width: 260px; height: 260px; right: 6%; top: 8%; background: #8b5cf6; animation-delay: -9s; }
@keyframes float { 50% { transform: translate(40px, -30px) scale(1.1); } }
.auth__wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 40px; width: min(1180px, 100%); margin: 0 auto; padding: 40px 32px; }
.auth__intro { color: #fff; }
.auth__logo { width: 130px; height: auto; margin-bottom: 28px; filter: drop-shadow(0 12px 30px rgba(0, 0, 0, .25)) brightness(0) invert(1); }
.auth__intro h1 { margin: 0 0 28px; font: 800 clamp(2.4rem, 5vw, 4.4rem)/1.02 var(--f-brand); letter-spacing: -.03em; text-shadow: 0 4px 30px rgba(0, 0, 0, .15); }
.auth__intro h1 span { background: linear-gradient(90deg, #fff, #ffe0b8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth__perks { list-style: none; margin: 0 0 36px; padding: 0; display: grid; gap: 12px; font-size: 15px; }
.auth__perks li { display: flex; align-items: center; gap: 12px; }
.auth__perks i { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, .18); backdrop-filter: blur(6px); }
.auth__back { display: inline-flex; align-items: center; gap: 8px; color: rgba(255, 255, 255, .8); text-decoration: none; font-size: 13px; font-weight: 600; }
.auth__back:hover { color: #fff; }
.auth__card { padding: 36px; border-radius: 26px; background: rgba(20, 15, 30, .72); backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3); border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .7); color: var(--txt); animation: dlgIn .6s var(--ease); }
.auth__card h2 { margin: 0; font: 800 28px/1.15 var(--f-brand); letter-spacing: -.02em; }
.auth__sub { margin: 6px 0 22px; color: var(--muted); }
.auth__form { display: grid; gap: 14px; }
.auth__row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth .fld > span { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: #cfc8dc; }
.auth .fld > span small { font-weight: 400; color: var(--dim); }
.auth .fld > i { position: absolute; left: 14px; bottom: 14px; color: var(--dim); font-size: 15px; pointer-events: none; }
.auth .fld input { width: 100%; height: 46px; padding: 0 44px 0 40px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .05); color: #fff; outline: none; transition: border-color .2s, background .2s; }
.auth .fld input:focus { border-color: var(--pink); background: rgba(255, 255, 255, .08); }
.fld__eye { position: absolute; right: 6px; bottom: 6px; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); }
.fld__eye:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.auth__btn { margin-top: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 50px; border-radius: 12px; background: var(--grad); color: #fff; font: 700 15px var(--f-brand); box-shadow: 0 14px 30px -10px rgba(255, 79, 123, .8); transition: filter .2s, transform .2s var(--ease); }
.auth__btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.auth__btn i { transition: transform .3s var(--ease); }
.auth__btn:hover i { transform: translateX(4px); }
form.is-busy .auth__btn { opacity: .7; pointer-events: none; }
form.is-busy .auth__btn i::before { content: "\f130"; display: inline-block; animation: spin 1s linear infinite; }
.auth__switch { margin: 20px 0 0; text-align: center; color: var(--muted); font-size: 13.5px; }
.auth__switch a { color: #ffb38a; font-weight: 600; text-decoration: none; }
.auth__switch a:hover { text-decoration: underline; }
.auth__note { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.auth__note--err { background: rgba(248, 113, 113, .14); color: #fecaca; }
.auth__note--ok { background: rgba(52, 211, 153, .14); color: #a7f3d0; }
@media (max-width: 900px) {
	.auth__wrap { grid-template-columns: 1fr; padding: 28px 18px; gap: 26px; }
	.auth__intro { text-align: center; }
	.auth__logo { width: 90px; margin-bottom: 16px; }
	.auth__intro h1 { font-size: 2.2rem; margin-bottom: 0; }
	.auth__perks, .auth__back { display: none; }
	.auth__card { padding: 26px 20px; }
	.auth__row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
