/* Lenci · My models (/models). Builds on studio.css tokens (canvas, panels, energy gradient, Sora / Inter / Cairo).
   Top bar → one column of cards (header, the prompter, the model grid). Logical properties throughout, so Arabic mirrors by itself. */
:root { --mdl: linear-gradient(135deg, #22d3ee 0%, #8b5cf6 55%, #d946ef 100%); --mdl-h: linear-gradient(90deg, #a5f3fc 0%, #c9b8ff 55%, #f5c2ff 100%); --glass: linear-gradient(180deg, rgba(23,23,35,.9), rgba(14,14,22,.94)); --ok: #86efac; --bad: #fca5a5; }
html, body { height: auto; min-height: 100%; }
body { overflow: auto; overflow-x: hidden; background: radial-gradient(1100px 650px at 85% -10%, rgba(34,211,238,.10), transparent 60%), radial-gradient(900px 600px at -10% 100%, rgba(139,92,246,.09), transparent 60%), var(--canvas); }
.mdl-app { display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); min-height: 100vh; height: auto; }
.mdl-app .muted, .mdl-app .muted * { color: var(--muted); }
.mdl-app a.ghost { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.mdl-app .ghost.small { padding: 5px 10px; font-size: 11px; }
.mdl-app .ghost.danger { color: #fecaca; border-color: rgba(248,113,113,.5); }
.mdl-app .primary.small { padding: 8px 14px; font-size: 11.5px; border-radius: 10px; }
button.busy { opacity: .55; cursor: progress; }

/* top bar */
.mdl-brand { text-decoration: none; color: inherit; }
.mdl-sep { color: var(--muted); font-size: 18px; line-height: 1; margin-top: -2px; }
.mdl-wordmark { font-family: var(--display); font-weight: 700; font-size: 21px; letter-spacing: -0.02em; line-height: 1; background: var(--mdl-h); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mdl-pro { color: #c9f3ff; border-color: rgba(34,211,238,.5); background: linear-gradient(180deg, rgba(34,211,238,.14), rgba(139,92,246,.08)); }
.mdl-back::before { content: ""; width: 7px; height: 7px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-inline-end: 2px; flex: none; }
[dir="rtl"] .mdl-back::before { transform: rotate(-135deg); }
.mdl-hint { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: none; }

/* main */
.mdl-main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 24px 70px; min-width: 0; display: grid; gap: 16px; align-content: start; }
.mdl-page { display: grid; gap: 16px; min-width: 0; animation: mdlIn .35s var(--ease) both; }
@keyframes mdlIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.mdl-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.mdl-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.mdl-h1 { margin: 0; font-family: var(--display); font-size: 26px; letter-spacing: -.02em; line-height: 1.15; }
.mdl-sub { margin: 6px 0 0; max-width: 70ch; font-size: 13.5px; }
.mdl-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mdl-card { min-width: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--glass); box-shadow: var(--edge), 0 14px 34px rgba(0,0,0,.3); padding: 18px 20px; display: grid; gap: 12px; align-content: start; }
.mdl-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mdl-card h2 { margin: 0; font-family: var(--display); font-size: 15.5px; letter-spacing: -.01em; }
.mdl-card-head p { margin: 4px 0 0; font-size: 12.5px; }
.mdl-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.mdl-status { margin: 0; min-height: 18px; font-size: 12.5px; color: var(--muted); flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.mdl-status.err { color: var(--bad); } .mdl-status.ok { color: var(--ok); }

/* gate + empty */
.mdl-gate, .mdl-empty { position: relative; display: grid; justify-items: center; text-align: center; gap: 10px; padding: 46px 22px; border: 1px solid var(--line); border-radius: 24px; background: var(--glass); overflow: hidden; }
.mdl-gate h1, .mdl-empty h2 { margin: 0; font-family: var(--display); letter-spacing: -.02em; }
.mdl-gate h1 { font-size: 28px; } .mdl-empty h2 { font-size: 19px; }
.mdl-gate p, .mdl-empty p { margin: 0; max-width: 56ch; }
.mdl-loaderr { padding: 30px 22px; border-color: rgba(248,113,113,.35); }   /* the list could not be loaded: Retry, never the empty state */
.mdl-orb { width: 74px; height: 74px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6, transparent 40%), var(--mdl); box-shadow: 0 0 40px rgba(139,92,246,.45), 0 0 90px rgba(34,211,238,.2); margin-bottom: 6px; }
.mdl-orb.small { width: 52px; height: 52px; opacity: .85; }

/* fields + chips */
.mdl-field { display: grid; gap: 6px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.mdl-field > span { font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
[dir="rtl"] .mdl-field > span { letter-spacing: 0; text-transform: none; font-size: 12px; }
.mdl-field input, .mdl-field textarea, .mdl-field select { width: 100%; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(8,8,14,.7); color: var(--ink); font: inherit; font-size: 13px; }
.mdl-field textarea { resize: vertical; min-height: 64px; }
.mdl-field input:focus, .mdl-field textarea:focus, .mdl-field select:focus { outline: none; border-color: rgba(139,92,246,.7); box-shadow: 0 0 0 3px rgba(139,92,246,.2); }
.mdl-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.mdl-row.center { justify-content: center; align-items: center; }
.mdl-grow { flex: 1 1 220px; }
.mdl-chipgroups { display: grid; gap: 10px; }
.mdl-chipgroup { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.mdl-chipgroup > b { flex: none; font-family: var(--display); font-weight: 600; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); min-width: 56px; }
[dir="rtl"] .mdl-chipgroup > b { letter-spacing: 0; text-transform: none; font-size: 11.5px; }
.mdl-chipgroup .chip { text-transform: none; font-size: 11px; letter-spacing: 0; padding: 6px 11px; }
.mdl-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mdl-fields .wide { grid-column: 1 / -1; }
.mdl-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink); padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255,255,255,.03); }
.mdl-check input { width: 18px; height: 18px; flex: none; margin-top: 1px; accent-color: #d946ef; }
.mdl-check.bad { border-color: rgba(248,113,113,.6); }

/* the model grid */
.mdl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.mdl-grid:empty { display: none; }
.mdl-model { position: relative; display: grid; grid-template-rows: auto 1fr; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--glass); box-shadow: var(--edge), 0 12px 30px rgba(0,0,0,.3); transition: border-color var(--t), transform var(--t) var(--ease); min-width: 0; }
.mdl-model:hover { border-color: rgba(255,255,255,.18); transform: translateY(-2px); }
.mdl-model.fresh { border-color: rgba(217,70,239,.6); box-shadow: 0 0 0 1px rgba(217,70,239,.3), 0 0 26px rgba(139,92,246,.35); }
.mdl-photo { position: relative; aspect-ratio: 3 / 4; background: #15151d; overflow: hidden; }
.mdl-photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 10%; }
.mdl-badges { position: absolute; top: 8px; inset-inline-start: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.mdl-badge { font-family: var(--display); font-weight: 700; font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 7px; border-radius: 999px; background: rgba(10,10,15,.72); color: #e9e4ff; border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(6px); }
.mdl-badge.ai { color: #0d0d14; background: linear-gradient(90deg, #a5f3fc, #c9b8ff); border-color: transparent; }
[dir="rtl"] .mdl-badge { letter-spacing: 0; text-transform: none; }
.mdl-body { display: grid; gap: 6px; padding: 12px 12px 10px; min-width: 0; }
.mdl-name { margin: 0; font-family: var(--display); font-size: 14px; letter-spacing: -.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdl-meta { display: flex; gap: 4px 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.mdl-model .mdl-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.mdl-model .mdl-acts .ghost, .mdl-model .mdl-acts .primary { padding: 6px 10px; font-size: 10.5px; letter-spacing: .02em; border-radius: 9px; }
.mdl-model .mdl-acts .primary { text-transform: none; }
.mdl-count { font-variant-numeric: tabular-nums; }

/* the uploader sheet */
.mdl-sheet-card { width: min(100%, 720px); padding: 0; overflow: hidden; display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.mdl-sheet-card .modal-x { z-index: 2; background: rgba(10,10,15,.45); }
.mdl-sheet-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; padding: 22px 24px 14px; padding-inline-end: 56px; background: radial-gradient(90% 120% at 20% -20%, rgba(139,92,246,.25), transparent 70%); border-bottom: 1px solid var(--line); }
.mdl-sheet-head h2 { margin: 0; font-size: 19px; font-family: var(--display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.mdl-sheet-body { padding: 18px 24px; overflow: auto; display: grid; gap: 14px; min-height: 100px; }
.mdl-sheet-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 24px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.mdl-sheet-foot:empty { display: none; }
.mdl-angles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mdl-angle { position: relative; display: grid; gap: 6px; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.025); min-width: 0; }
.mdl-angle.has { border-color: rgba(52,211,153,.45); }
.mdl-angle.need { border-color: rgba(245,176,65,.5); }
.mdl-angle-pic { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: #15151d; cursor: pointer; border: 0; padding: 0; display: block; width: 100%; }
.mdl-angle-pic img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: .45; transition: opacity var(--t); }
.mdl-angle.has .mdl-angle-pic img { opacity: 1; }
.mdl-angle-pic:hover img { opacity: .85; }
.mdl-angle-pic:focus-visible { outline: 2px solid #a78bfa; outline-offset: 2px; }
.mdl-angle-pic .plus { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.6); pointer-events: none; }
.mdl-angle.has .mdl-angle-pic .plus { display: none; }
.mdl-angle-pic input { position: absolute; inset: 0; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.mdl-angle-lab { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; min-width: 0; }
.mdl-angle-lab b { font-family: var(--display); font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdl-angle-lab small { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.mdl-angle .mdl-x { position: absolute; top: 12px; inset-inline-end: 12px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(10,10,15,.75); color: #fff; font-size: 14px; line-height: 1; display: none; z-index: 1; }
.mdl-angle.has .mdl-x { display: grid; place-items: center; }

/* versions */
.mdl-versions { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mdl-version { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.025); }
.mdl-version img { width: 56px; height: 72px; object-fit: cover; border-radius: 8px; background: #15151d; }
.mdl-version > div { min-width: 0; display: grid; gap: 2px; font-size: 12.5px; }
.mdl-version strong { font-family: var(--display); font-size: 13px; }
.mdl-version .muted { font-size: 11.5px; }

/* toast */
.mdl-toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 95; display: flex; align-items: center; gap: 12px; max-width: min(calc(100vw - 24px), 560px); padding: 10px 16px; border-radius: 14px; background: rgba(18,18,28,.97); border: 1px solid var(--line-2); color: var(--ink); font-size: 13px; box-shadow: 0 20px 50px rgba(0,0,0,.55); }
.mdl-toast.show { animation: mdlToast .3s var(--ease) both; }
@keyframes mdlToast { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.mdl-toast span { min-width: 0; overflow-wrap: anywhere; }

/* responsive */
@media (max-width: 900px) {
  .mdl-main { padding: 14px 14px 60px; }
  .mdl-h1 { font-size: 22px; }
  .mdl-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 560px) {
  .mdl-pro, .mdl-back span, .mdl-nav span, .mdl-app .arabic { display: none; }
  .mdl-back, .mdl-nav { padding: 7px 9px; }
  #wardrobe-link::before { content: "👗"; font-size: 12px; }
  .mdl-card { padding: 14px; border-radius: 16px; }
  .mdl-fields { grid-template-columns: minmax(0, 1fr); }
  .mdl-angles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mdl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mdl-model .mdl-acts .ghost, .mdl-model .mdl-acts .primary { padding: 6px 8px; font-size: 10px; }
  .modal { padding: 10px; }
  .mdl-sheet-head { padding: 18px 16px 12px; padding-inline-end: 52px; }
  .mdl-sheet-body, .mdl-sheet-foot { padding-inline: 16px; }
  .mdl-actions { width: 100%; } .mdl-actions .primary, .mdl-actions .ghost { flex: 1 1 auto; justify-content: center; }
  .mdl-chipgroup > b { min-width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .mdl-page, .mdl-toast.show { animation: none !important; } }
