:root {
  color-scheme: dark;
  --bg: #0c0b13;
  --panel: #211c30;
  --field: #110f1c;
  --text: #f5f0fc;
  --muted: #c0b7cf;
  --faint: #a99fb8;
  --lavender: #dac7ff;
  --mint: #9ce6d8;
  --line: rgba(213, 197, 241, .16);
  --glass-fill: linear-gradient(126deg, rgb(48 39 66 / .82), rgb(25 23 39 / .88) 58%, rgb(22 30 40 / .84));
  --glass-edge: linear-gradient(137deg, #d5b7f39c, #64547a80 25%, #41374975 56%, #7baaa990 92%, #b8d4d075);
  --rail: 210px;
  --gutter: clamp(20px, 3.3vw, 58px);
  --curve: cubic-bezier(.19,.78,.22,1);
  font: 16px/1.45 Inter, "Segoe UI Variable", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; color: var(--text); background: var(--bg);
  isolation: isolate; -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; z-index: -1; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 34% -12%, #51346682 0%, transparent 46%),
    radial-gradient(ellipse at 97% 10%, #345d705c 0%, transparent 35%),
    radial-gradient(ellipse at 77% 96%, #35264775 0%, transparent 41%),
    linear-gradient(118deg, #100d19 0%, #100e1a 54%, #0b1018 100%);
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; background: transparent; border: 0; }
a, .link { color: var(--lavender); text-decoration: none; font-size: .9rem; font-weight: 570; }
a:hover, .link:hover { text-decoration: underline; text-underline-offset: 3px; }
:where(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--mint); outline-offset: 3px;
}
button:disabled, input:disabled, select:disabled { opacity: .52; cursor: not-allowed; }
button, .lora-card, a { transition: background-color .2s, border-color .2s, color .2s, box-shadow .2s, transform .22s var(--curve); }
::selection { color: #170e26; background: #d9bdfb; }

/* A three-petal optical mark, shared by both entrances to the studio. */
.brand { display: inline-flex; align-items: center; gap: .14em; white-space: nowrap; font-size: 1.55rem; font-weight: 650; letter-spacing: -.065em; }
.brand .thin { color: #ddd2e9; font-weight: 335; }
.iris {
  display: inline-grid; place-items: center; position: relative; flex: none;
  width: 36px; height: 38px; margin-right: .25em;
  filter: drop-shadow(0 0 6px #bc87f452);
}
.iris::before, .iris::after, .iris i {
  content: ""; position: absolute; width: 13px; height: 31px; border-radius: 55%;
  border: 1.5px solid #e0bcff; border-right-color: #aaa7f3; border-bottom-color: #9deadc;
  box-shadow: inset 1px 0 3px #b688ee80;
}
.iris::before { transform: rotate(61deg); }
.iris::after { transform: rotate(-61deg); }

.sidebar {
  position: fixed; z-index: 2; inset: 0 auto 0 0; width: var(--rail);
  padding: 23px 15px 20px; display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: linear-gradient(154deg, #31233e99, #191522db 31%, #12131ded 73%, #1b253099);
  box-shadow: inset -1px 0 0 #fff1, 5px 0 24px #0001;
}
.sidebar .brand { padding: 1px 11px 33px; }
.sidebar nav, .sidebar-foot { display: grid; gap: 5px; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.sidebar button {
  display: flex; align-items: center; gap: 13px; text-align: left; min-height: 43px;
  border: 1px solid transparent; border-radius: 11px; color: #c3bacf; padding: 8px 13px; font-size: .93rem;
}
.sidebar button:hover { color: #faf6ff; background-color: #bda5f00d; }
.sidebar button.active {
  color: #f6eaff; border-color: #bba1d052; font-weight: 600;
  background: linear-gradient(102deg, #9471b14a, #72688b26 73%, #8697aa1c);
  box-shadow: inset 0 1px 0 #f7e7ff2b, inset 0 -1px 0 #b89adb12, 0 3px 13px #05030940;
}
.icon { display: inline-block; flex: none; width: 18px; height: 18px; position: relative; color: #c4b6d7; }
.active .icon { color: #e8d5ff; }
.icon::before, .icon::after { content: ""; position: absolute; }
.sparkle::before, .sparkle::after { background: currentColor; clip-path: polygon(50% 0,63% 37%,100% 50%,63% 61%,50% 100%,38% 61%,0 50%,37% 37%); }
.sparkle::before { inset: 2px 3px 0 0; }
.sparkle::after { width: 6px; height: 6px; top: 0; right: 0; }
.wave { background: linear-gradient(currentColor,currentColor) 50% 50% / 2px 16px no-repeat; }
.wave::before, .wave::after { width: 2px; height: 8px; left: 3px; top: 5px; background: currentColor; border-radius: 2px; }
.wave::after { left: auto; right: 3px; height: 11px; top: 3.5px; }
.grid::before { width: 5px; height: 5px; top: 2px; left: 1px; border-radius: 1px; background: currentColor; box-shadow: 8px 0, 0 8px, 8px 8px; }
.folder::before { inset: 5px 0 1px; border: 1.5px solid; border-radius: 2px 3px 3px 3px; }
.folder::after { width: 7px; top: 3px; left: 1px; height: 3px; border: solid currentColor; border-width: 1.5px 1.5px 0; border-radius: 2px 2px 0 0; }
.sliders { background: linear-gradient(currentColor,currentColor) center 30% / 16px 1.5px no-repeat, linear-gradient(currentColor,currentColor) center 72% / 16px 1.5px no-repeat; }
.sliders::before, .sliders::after { width: 4px; height: 4px; border: 1.4px solid; border-radius: 50%; background: #211c2d; }
.sliders::before { left: 3px; top: 2.5px; }.sliders::after { right: 3px; bottom: 2.5px; }
.power::before { inset: 3px 2px 1px; border: 1.5px solid; border-top-color: transparent; border-radius: 50%; }
.power::after { width: 1.5px; height: 9px; background: currentColor; top: 1px; left: 8px; }
.work { margin-left: var(--rail); min-height: 100vh; }
header {
  min-height: 62px; padding: 8px var(--gutter); display: flex; gap: 15px; align-items: center;
  border-bottom: 1px solid var(--line); background: linear-gradient(100deg, #2620333d, #1d263440);
}
.crumb { margin-right: auto; color: var(--faint); font-size: .9rem; }
.crumb span { margin: 0 9px; color: #9385a5; } .crumb b { font-weight: 530; color: #eae2f5; }
.status {
  display: inline-flex; align-items: center; gap: 8px; font-size: .81rem; padding: 5px 11px;
  border: 1px solid #a2ccbf40; border-radius: 50px; color: #d1e7e1;
  background: linear-gradient(122deg, #4d827433, #25443b30); box-shadow: inset 0 1px 0 #e4fff315;
}
#led { width: 6px; height: 6px; border-radius: 50%; background: #a79bac; }
#led.green { background: #90e5bb; box-shadow: 0 0 7px #74e2ac92; }
#led.amber { background: #ffc978; box-shadow: 0 0 7px #f6b76988; }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #ceb3ea75; border-radius: 50%; color: #f1defd; font-size: .85rem; background: linear-gradient(145deg,#7c5c8c7d,#49385f65 60%,#42636677); }

.page { max-width: 1680px; margin: auto; padding: 22px var(--gutter) 44px; }
.heading, .panel-head, .preview-foot, .file-row, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.heading { min-height: 82px; margin-bottom: 17px; }
.heading h1, .auth h1 {
  margin: 0; font-size: clamp(2.4rem, 3.65vw, 3.9rem); line-height: 1.09;
  letter-spacing: -.065em; font-weight: 530;
}
h1 em { font-family: "Instrument Serif", "Times New Roman", Georgia, serif; font-weight: 400; letter-spacing: -.052em; color: #d6baff; }
.heading p, .auth p { color: var(--muted); margin: 7px 0 0; }
.filament { display: block; width: min(30%, 335px); height: 74px; object-fit: contain; opacity: .95; pointer-events: none; filter: drop-shadow(0 0 6px #be9ffd38); }
.editor { display: grid; grid-template-columns: minmax(288px,.87fr) minmax(280px,1.3fr); gap: 20px; }
.editor > *, .file-row > div, .lora-actions > *, .two > * { min-width: 0; }
.panel, .lora-card, dialog, .auth-card, .recent {
  position: relative; isolation: isolate; border-radius: 19px; border: 1px solid transparent;
  background: var(--glass-fill) padding-box, var(--glass-edge) border-box;
  box-shadow: inset 0 1px 0 #fff1, inset 0 -1px 0 #bcb3df0c, 0 14px 38px -20px #03020abb;
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel, dialog, .auth-card, .sidebar { -webkit-backdrop-filter: blur(15px) saturate(115%); backdrop-filter: blur(15px) saturate(115%); }
}
.panel { padding: 20px; }
.panel::before, .auth-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(ellipse at 6% -5%, #cda7ff17, transparent 51%),
    radial-gradient(ellipse at 106% 105%, #7ccbc71a, transparent 36%);
  box-shadow: inset 0 1px 0 #f5e3ff25, inset 1px 0 1px #dec8ff0f;
}
.panel::after {
  content: ""; pointer-events: none; position: absolute; top: -1px; left: 6%; right: 21%; height: 1px;
  background: linear-gradient(90deg,transparent,#e9d6ff88 24%,#bcabff24 65%,transparent);
}
.preview::after { left: 35%; right: 5%; background:linear-gradient(90deg,transparent,#c3eceb85 69%,transparent); }
.reflecting::before {
  background: radial-gradient(250px 150px at var(--light-x, 0px) var(--light-y, 0px), #cfc0ff16, transparent),
    radial-gradient(ellipse at 6% -5%, #cda7ff17, transparent 51%),
    radial-gradient(ellipse at 106% 105%, #7ccbc71a, transparent 36%);
}
h2 { margin: 0; font-size: 1.12rem; line-height: 1.35; letter-spacing: -.035em; font-weight: 620; }
.controls, .auth form { display: flex; flex-direction: column; gap: 13px; }
.controls > h2:first-child, .activity > h2, .files > h2, .preview > .panel-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.controls h2:not(:first-child) { margin-top: 11px; }
label { display: flex; flex-direction: column; gap: 6px; color: #e9e2f2; font-size: .89rem; font-weight: 535; }
input:not([type=radio]), select, textarea {
  width: 100%; min-width: 0; color: var(--text); border: 1px solid #9e91b345; border-radius: 9px;
  background-color: var(--field); padding: 9px 11px; font-size: .92rem; line-height: 1.42;
  box-shadow: inset 0 1px 4px #05020e45; transition: border-color .18s, box-shadow .18s;
}
input:not([type=radio]):focus, select:focus, textarea:focus { border-color: #bca2e8; box-shadow: 0 0 0 3px #aa83e41a; }
input::placeholder, textarea::placeholder { color: #a297b2; }
textarea { resize: vertical; min-height: 53px; }
select {
  appearance: none; padding-right: 29px; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, #c7bad8 50%), linear-gradient(135deg, #c7bad8 50%, transparent 50%);
  background-size: 5px 5px; background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-repeat: no-repeat;
}
select option { background: #181421; }
input[type=file]::file-selector-button { color: #e8d9ff; background: #392b48; border: 1px solid #625472; border-radius: 5px; padding: 5px 9px; margin-right: 9px; }
.two { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); gap: 12px; }
.prompt-label { display: flex; align-items: center; gap: 7px; }
#nagTag { font: 600 .69rem/1.35 "IBM Plex Mono",Consolas,monospace; letter-spacing: .05em; color: #ccd6ff; border: 1px solid #acb3ff4f; background: #858ad71b; border-radius: 5px; padding: 1px 5px; }
.primary, .outline { position: relative; overflow: hidden; border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; font-size: .94rem; font-weight: 615; }
.primary {
  color: #251a36; background: linear-gradient(103deg, #e2c5ff, #cbb3fb 45%, #b8c8f6 82%, #b9dedf) padding-box,
    linear-gradient(160deg, #fff1ff, #bc9dda 45%, #d6ffff) border-box;
  box-shadow: inset 0 1px 1px #fff9, inset 0 -2px 3px #7d6e9c45, 0 4px 19px #ab75f625;
}
.primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(108deg,transparent 35%,#fff7 49%,transparent 62%); transform: translateX(-120%);
}
.primary:hover:not(:disabled), .primary:focus-visible { transform: translateY(-1px); box-shadow: inset 0 1px 1px #fff9,0 6px 22px #b38af34d; }
.primary:active:not(:disabled) { transform: translateY(1px); }
.outline { color: #e5d9ef; border-color: #bda6cd51; background: linear-gradient(140deg,#75637b30,#5b4e6b24); box-shadow: inset 0 1px 0 #fff1; }
.outline:hover { border-color: #caafe091; background-color: #7e63952e; }
.controls .primary { margin-top: auto; min-height: 43px; }
.feedback, small, .dim { color: var(--muted); font-size: .875rem; }
.feedback { margin: 0; overflow-wrap: anywhere; }.feedback:empty { display:none; }

.preview { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.preview .panel-head { padding: 2px 3px 11px; }
.canvas {
  flex: 1; position: relative; overflow: hidden; min-height: 290px; border-radius: 11px;
  border: 1px solid #e7dff128; background: #121119;
}
.canvas img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.canvas:has(.demo) { background: #534064; }
.canvas:has(.demo)::before { content: ""; position: absolute; inset: -18px; background: url('/etude.webp') center / cover; filter: blur(19px); }
.canvas img.demo { width: auto; height: 100%; max-width: 100%; margin: auto; mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent); }
.preview-foot { padding: 2px 4px; min-height: 26px; font-size: .86rem; flex-wrap: wrap; }
.preview-foot b { font-weight: 560; overflow-wrap: anywhere; }.preview-foot span { color: var(--muted); }
.recent { margin-top: 20px; padding: 17px 20px; }
.recent .panel-head { margin-bottom: 8px; }.recent p { margin: 0; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }.thumbs button { padding: 0; border-radius: 8px; }
.thumbs img { display: block; width: 78px; height: 78px; object-fit: cover; border: 1px solid #ffffff38; border-radius: 8px; }

.seg { display: flex; gap: 6px; background: #13111b; border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.seg label { flex: 1; display: flex; flex-direction: row; align-items: center; justify-content: center; cursor: pointer; padding: 8px; border: 1px solid transparent; border-radius: 8px; }
.seg label:has(:checked) { background: linear-gradient(140deg,#745b925c,#43435d66); border-color: #c1a5e04d; }
.seg input { accent-color: #cbb3f7; }
#cloudBox, #modalContent { display: grid; gap: 10px; }
.activity { align-self: start; }
.job, .file-row { padding: 13px 0; border-bottom: 1px solid var(--line); }
.job:last-child, .file-row:last-child { border: 0; }
.job b, .job small, .file-row small { display: block; }.job small, .file-row small { margin-top: 3px; }
.file-row > div, .job, #modalContent { overflow-wrap: anywhere; }
.job a, .job button { margin: 5px 7px 0 0; }.files h2:not(:first-child) { margin-top: 26px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 17px; }
.lora-card { overflow: hidden; }
.cover {
  aspect-ratio: 4/3; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(ellipse at 17% 20%,#76539c85,transparent 65%),linear-gradient(140deg,#3b334c,#243d49);
  color: #e3d4ed; font: italic 3rem/1 Georgia,serif;
}
.cover img { width: 100%; height: 100%; min-height: 0; object-fit: cover; object-position: 50% 35%; transition: transform .5s var(--curve); }
.lora-body { padding: 15px; }.lora-body h2 { overflow-wrap: anywhere; }
.chip { display: inline-block; max-width: 100%; overflow-wrap: anywhere; background: #b79bdf14; border: 1px solid #bc9ddd30; border-radius: 5px; padding: 2px 7px; margin: 7px 4px 5px 0; color: #e2d5ef; font: .79rem/1.5 "IBM Plex Mono",Consolas,monospace; }
.lora-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.settings { max-width: 700px; }.settings button { align-self: start; }
.auth {
  min-height: 100vh; min-height: 100svh; display: grid; place-items: center start; isolation: isolate; position: relative;
  padding: clamp(22px,6vw,90px); overflow: hidden;
}
.auth-art { position: absolute; z-index: -1; inset: 0 0 0 35%; background: url('/etude.webp') center 36% / cover; mask-image: linear-gradient(90deg,transparent,#000 34%); }
.auth-card { width: min(495px,100%); padding: clamp(23px,3.1vw,48px); background: linear-gradient(135deg,#383046d9,#1b1928e8 63%,#262f3cde) padding-box,var(--glass-edge) border-box; }
.auth .brand { margin-bottom: 33px; }.auth h1 { font-size: clamp(2.2rem,3.3vw,3.2rem); }.auth p { margin-bottom: 23px; }
.auth form .primary { margin-top: 7px; }
#toast { position: fixed; z-index: 8; bottom: 18px; right: 18px; max-width: min(450px,90vw); padding: 12px 17px; background: #30273e; border: 1px solid #9983aa; border-radius: 11px; box-shadow: 0 8px 20px #09051070; font-size: .93rem; }
dialog { width: min(470px,92vw); color: var(--text); padding: 23px; background: linear-gradient(135deg,#342b43f5,#211d2ff5) padding-box,var(--glass-edge) border-box; }
dialog::backdrop { background: #08070bc2; }.dialog-actions { justify-content: flex-end; margin-top: 18px; }dialog h2 { margin-bottom: 16px; }

@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes glint { to { transform: translateX(120%); } }
@keyframes ribbonFloat { from { transform: translateY(-2px) rotate(-1deg); } to { transform: translateY(2px) rotate(1deg); } }
@media (prefers-reduced-motion: no-preference) {
  .page:not([hidden]) > .heading, .page:not([hidden]) .editor, .page:not([hidden]) > .panel,
  .page:not([hidden]) > .cards, .auth-card, dialog[open], #toast:not([hidden]) { animation: arrive .36s var(--curve) both; }
  .filament { animation: ribbonFloat 7s ease-in-out infinite alternate; }
  .primary:hover:not(:disabled)::after, .primary:focus-visible::after { animation: glint .65s var(--curve); }
}
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  .lora-card:hover { transform: translateY(-3px); box-shadow: inset 0 1px 0 #fff3,0 12px 23px #110c244d; }
  .lora-card:hover .cover img { transform: scale(1.035); }
}
@media (min-width:1530px) { .panel { padding: 23px; }.preview { padding: 18px; }.canvas { min-height: 460px; } }
@media (max-width:1060px) {
  :root { --rail:175px; --gutter:20px; }.editor { gap: 14px; grid-template-columns: minmax(265px,.95fr) minmax(230px,1.1fr); }
  .sidebar { padding-inline: 10px; }.panel { padding: 16px; }.preview { padding: 13px; }
}
@media (max-width:780px) {
  :root { --gutter:16px; }
  .sidebar { position: static; width: auto; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px var(--gutter) 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { padding: 0; font-size: 1.26rem; }.sidebar .iris { width: 29px; height: 31px; transform: scale(.84); }
  .sidebar nav { display: flex; order: 2; width: 100%; gap: 4px; }
  .sidebar nav button { flex: 1; justify-content: center; }
  .sidebar button { min-height: 36px; padding: 6px; gap: 6px; font-size: .86rem; }
  .sidebar nav .icon { width: 16px; transform: scale(.84); }.sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; }.sidebar-foot .icon { display: none; }
  .work { margin: 0; }header { min-height: 43px; padding-block: 5px; }
  .page { padding-top: 15px; }.heading { min-height: 65px; margin-bottom: 13px; }.heading h1 { font-size: clamp(2.2rem,6.4vw,2.9rem); }
  .editor { grid-template-columns: minmax(0,1fr); }.canvas { min-height: 0; height: clamp(300px,88vw,465px); flex: auto; }
  .filament { width: 23%; height: 55px; }.cards { grid-template-columns: repeat(auto-fit,minmax(min(195px,100%),1fr)); }
  .recent { padding: 15px; }.file-row { gap: 8px; }.panel-head { flex-wrap: wrap; }
  .auth { place-items:center; }.auth-art { inset:0; mask-image:linear-gradient(160deg,#0009,#0002); }
}
@media (max-width:435px) {
  .sidebar nav .icon { display:none; }.status { padding: 4px 8px; }.filament { display:none; }
  .cards { grid-template-columns:repeat(auto-fit,minmax(min(150px,100%),1fr)); gap:10px; }.lora-body { padding:10px; }
  .lora-actions a, .lora-actions .link, .lora-actions .outline { font-size:.8rem; }.lora-actions .outline { padding:7px; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior:auto !important; }
  .primary:hover:not(:disabled), .primary:focus-visible, .primary:active:not(:disabled) { transform: none; }
}
@media (forced-colors:active) {
  .panel,.lora-card,.sidebar button.active,.chip,.canvas,.auth-card { border:1px solid CanvasText; }
  .iris { filter:none; }.iris::before,.iris::after,.iris i { border-color:CanvasText; }
}

