@font-face {
  font-family: "Archivo Black";
  src: url("/estudio/archivo-black.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
}

:root {
  color-scheme: dark;
  --bg: #101011;
  --panel: #171719;
  --panel-raised: #1d1d20;
  --line: rgba(255, 255, 255, .09);
  --muted: #9c9ba3;
  --text: #f7f6f8;
  --pink: #ff0062;
  --ui: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -30%, rgba(255, 0, 98, .13), transparent 55%),
    linear-gradient(rgba(16, 16, 17, .86), rgba(16, 16, 17, .94)),
    url("/estudio/IMG_7316-interface.jpg") center / cover fixed,
    var(--bg);
  color: var(--text);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
}

::selection { background: #ff0062; color: #fff; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }

.topbar {
  position: sticky;
  z-index: 3;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px clamp(18px, 3vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(16, 16, 17, .86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .06em;
}

.brand img { width: 38px; height: 38px; object-fit: contain; }
.brand b { color: var(--pink); }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: .16em; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.save-state { margin-right: 8px; color: var(--muted); font-size: 11px; }

.button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  transition: .18s ease;
}

.button:hover { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.06); }
.button-primary { border-color: var(--pink); background: var(--pink); color: #fff; }
.button-primary:hover { border-color: #ff3984; background: #e90059; }
.button-quiet { color: #c4c3c9; }
.studio-back-button { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.history-button { padding-inline: 10px; white-space: nowrap; }
.history-button:disabled { cursor: not-allowed; opacity: .42; }
.export-format-label { color: var(--muted); font-size: 10px; }
.export-format { min-height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: #171719; color: var(--text); font-size: 11px; }
.export-format:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.transparent-export { display: inline-flex; align-items: center; gap: 6px; color: #d4d3d8; font-size: 10px; white-space: nowrap; cursor: pointer; }
.transparent-export input { accent-color: var(--pink); }

.studio-dialog {
  width: min(660px, calc(100vw - 28px));
  max-height: min(780px, calc(100vh - 36px));
  padding: 24px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background: #171719;
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0,0,0,.62);
}
.studio-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-heading .eyebrow { margin-bottom: 7px; }
.dialog-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.04em; }
.dialog-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #111113; color: #ddd; font-size: 23px; line-height: 1; cursor: pointer; }
.dialog-close:hover { border-color: var(--pink); color: white; }
.dialog-description { margin: 12px 0 20px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.save-copy-button { margin-bottom: 16px; }
.project-list { display: grid; gap: 10px; }
.project-empty { padding: 30px 16px; border: 1px dashed rgba(255,255,255,.15); border-radius: 10px; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }
.project-card { display: grid; grid-template-columns: 126px minmax(0,1fr); gap: 15px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #111113; }
.project-thumb { width: 126px; height: 156px; overflow: hidden; border-radius: 6px; background: #252027; object-fit: cover; }
.project-info { min-width: 0; align-self: center; }
.project-name { overflow: hidden; margin: 0 0 5px; font-size: 13px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.project-meta { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.project-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.project-action { min-height: 29px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: #1b1b1e; color: #ddd; font-size: 10px; font-weight: 700; cursor: pointer; }
.project-action.is-primary { border-color: rgba(255,0,98,.65); background: rgba(255,0,98,.13); color: #fff; }
.project-action:hover { border-color: rgba(255,0,98,.65); color: white; }
.project-action.is-danger:hover { border-color: #ff526d; color: #ff9aab; }
.project-rename { width: min(240px, 100%); min-height: 32px; padding: 6px 8px; }
.name-dialog { width: min(420px, calc(100vw - 28px)); }
.name-dialog form { display: block; }
.name-dialog .field-label { margin-top: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.confirm-dialog { width: min(610px, calc(100vw - 28px)); padding: clamp(24px, 5vw, 54px); text-align: center; }
.confirm-brand { display: grid; width: 82px; height: 82px; place-items: center; margin: 0 auto 22px; overflow: hidden; border: 1px solid rgba(255,255,255,.15); border-radius: 22px; background: #111113; }
.confirm-brand img { width: 100%; height: 100%; object-fit: cover; }
.confirm-dialog > .eyebrow { margin-bottom: 12px; }
.confirm-dialog h2 { margin: 0; font: 900 clamp(32px, 7vw, 54px)/.98 var(--display, "Archivo Black", Impact, sans-serif); letter-spacing: -.055em; }
.confirm-dialog h2 span { color: var(--pink); }
.confirm-description { max-width: 430px; margin: 18px auto 0; color: #b6b5bc; font-size: 13px; line-height: 1.65; }
.confirm-actions { flex-wrap: wrap; justify-content: center; margin-top: 26px; }
.confirm-actions .button { min-height: 44px; }
.confirm-actions .button-primary { box-shadow: 0 8px 26px rgba(255,0,98,.24); }

.workspace {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(300px, 1fr) minmax(250px, 300px);
  align-items: start;
  gap: 20px;
  max-width: 1780px;
  margin: 0 auto;
  padding: 26px clamp(14px, 2.2vw, 34px) 42px;
}

.sidebar {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(23, 23, 25, .94);
}

.panel { padding: 22px 20px; }
.panel-divider { border-top: 1px solid var(--line); }
.eyebrow { margin: 0 0 10px; color: var(--pink); font-size: 9px; font-weight: 900; letter-spacing: .16em; }
h1, h2, p { margin-top: 0; }
.panel h1 { margin-bottom: 8px; font-size: 20px; letter-spacing: -.04em; }
.panel h2 { margin-bottom: 18px; font-size: 15px; letter-spacing: -.02em; }
.panel-intro { margin-bottom: 17px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.format-options { display: grid; gap: 8px; }
.format-option {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 13px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141416;
  text-align: left;
  cursor: pointer;
}
.format-option:hover { border-color: rgba(255, 0, 98, .55); }
.format-option.is-selected { border-color: var(--pink); background: rgba(255, 0, 98, .08); box-shadow: inset 0 0 0 1px rgba(255, 0, 98, .14); }
.format-option b, .format-option small { display: block; }
.format-option b { margin-bottom: 4px; font-size: 11px; }
.format-option small { color: var(--muted); font-size: 10px; }
.format-shape { display: block; width: 22px; border: 1px solid rgba(255,255,255,.62); border-radius: 3px; }
.shape-story { height: 36px; }
.shape-portrait { height: 29px; }
.shape-square { height: 22px; }
.shape-landscape { width: 40px; height: 22px; }
.format-option.is-selected .format-shape { border-color: var(--pink); background: linear-gradient(160deg, transparent 30%, var(--pink)); }

.upload-button {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 0 16px;
  border: 1px dashed rgba(255,255,255,.22);
  border-radius: 8px;
  background: #141416;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}
.upload-button:hover { border-color: var(--pink); color: #ff8bb5; }
.upload-button span { color: var(--pink); font-size: 18px; }
.field-label { display: block; margin: 14px 0 7px; color: #d3d2d7; font-size: 10px; font-weight: 700; }
.select-input, .text-input {
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #111113;
  color: var(--text);
  font-size: 11px;
}
.select-input:focus, .text-input:focus { border-color: rgba(255, 0, 98, .76); box-shadow: 0 0 0 3px rgba(255, 0, 98, .1); }
.text-input { resize: vertical; line-height: 1.45; }
.field-hint { margin: 8px 0 19px; color: #85848b; font-size: 10px; line-height: 1.45; }
.edit-group { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); }
.edit-group summary { color: #e2e1e6; font-size: 11px; font-weight: 800; cursor: pointer; }
.edit-group[open] summary { margin-bottom: 8px; }
.text-layer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 9px; color: #d4d3d8; font-size: 10px; font-weight: 700; }
.text-layer-list { display: grid; gap: 6px; }
.text-layer-item { overflow: hidden; min-height: 34px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: #121214; color: #c7c6cc; font-size: 10px; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.text-layer-item:hover, .text-layer-item.is-selected { border-color: var(--pink); background: rgba(255,0,98,.1); color: white; }
.edit-group > .field-hint { margin: 0 0 10px; }
.alignment-control { margin-top: 16px; }
.alignment-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.alignment-option { min-height: 34px; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: #121214; color: #c7c6cc; font-size: 10px; cursor: pointer; }
.alignment-option:hover, .alignment-option.is-selected { border-color: var(--pink); background: rgba(255,0,98,.14); color: white; }
.alignment-option:disabled { cursor: not-allowed; opacity: .5; }
.format-independence { padding-top: 14px; border-top: 1px solid var(--line); }
.project-action:disabled, .button:disabled { cursor: not-allowed; opacity: .5; }
.control-block { margin-top: 17px; }
.control-block label { display: flex; justify-content: space-between; gap: 8px; color: #d4d3d8; font-size: 10px; font-weight: 700; }
.control-block output { color: var(--muted); font-weight: 500; }
input[type="range"] { width: 100%; height: 4px; margin: 12px 0 2px; accent-color: var(--pink); cursor: pointer; }
.toggle-row { position: relative; display: flex; align-items: center; gap: 9px; margin-top: 17px; color: #d4d3d8; font-size: 10px; cursor: pointer; }
.toggle-row input { position: absolute; top: 0; left: 0; width: 30px; height: 17px; margin: 0; opacity: 0; }
.toggle { position: relative; width: 30px; height: 17px; border-radius: 20px; background: #44444a; transition: .2s ease; }
.toggle::after { position: absolute; top: 3px; left: 3px; width: 11px; height: 11px; border-radius: 50%; background: white; content: ""; transition: .2s ease; }
.toggle-row input:checked + .toggle { background: var(--pink); }
.toggle-row input:checked + .toggle::after { transform: translateX(13px); }
.toggle-row input:focus-visible + .toggle { outline: 2px solid white; outline-offset: 2px; }
.color-pair { display: flex; gap: 10px; margin-top: 15px; }
.color-pair label { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 6px; color: #d4d3d8; font-size: 9px; }
.color-pair input { width: 31px; height: 28px; padding: 2px; border: 1px solid var(--line); border-radius: 5px; background: #111113; cursor: pointer; }
.privacy-note { margin: 12px 4px 0; color: #828188; font-size: 10px; line-height: 1.5; text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; clip-path: inset(50%); }

.preview-area { min-width: 0; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 14px; }
.preview-heading .eyebrow { margin-bottom: 5px; }
.preview-heading p:last-child { margin-bottom: 0; color: #b6b5bc; font-size: 11px; font-weight: 700; }
.preview-badge { padding: 6px 9px; border: 1px solid var(--line); border-radius: 20px; color: #b6b5bc; font-size: 8px; font-weight: 900; letter-spacing: .1em; }
.canvas-wrap {
  display: flex;
  min-height: 500px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: #141416;
  background-image: radial-gradient(rgba(255,255,255,.06) .7px, transparent .7px);
  background-size: 12px 12px;
}
#art-canvas {
  display: block;
  width: auto;
  max-width: min(100%, 520px);
  max-height: min(72vh, 880px);
  height: auto;
  border-radius: 2px;
  cursor: grab;
  touch-action: none;
  background: #202024;
  box-shadow: 0 18px 55px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.11);
}
.preview-tip { margin: 11px 2px 0; color: #8d8c93; font-size: 10px; line-height: 1.5; text-align: center; }
.status-message {
  position: fixed;
  z-index: 5;
  right: 24px;
  bottom: 24px;
  max-width: min(400px, calc(100vw - 32px));
  padding: 12px 16px;
  transform: translateY(20px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px;
  background: #252529;
  color: white;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.status-message.is-visible { transform: translateY(0); opacity: 1; }
.status-message.is-error { border-color: rgba(255,70,100,.6); }

@media (min-width: 1500px) {
  .workspace { grid-template-columns: 310px minmax(400px, 1fr) 310px; gap: 26px; }
}
@media (min-width: 1051px) {
  html, body { height: 100%; }
  body { height: 100dvh; overflow: hidden; }
  .topbar { height: 76px; }
  .workspace {
    height: calc(100dvh - 76px);
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
    padding-block: 14px;
  }
  .sidebar {
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: #4a454b transparent;
    scrollbar-width: thin;
  }
  .preview-area {
    display: grid;
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
  }
  .canvas-wrap { height: 100%; min-height: 0; padding: 14px; }
  #art-canvas { max-height: 100%; max-width: 100%; }
}
@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(230px, .75fr) minmax(300px, 1.25fr); }
  .sidebar-right { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .sidebar-right .panel-divider { border-top: 0; border-left: 1px solid var(--line); }
  .privacy-note { grid-column: 1 / -1; padding-bottom: 10px; }
}
@media (max-width: 680px) {
  .topbar { position: static; flex-wrap: wrap; align-items: center; padding-inline: 14px; }
  .brand { margin-top: 2px; font-size: 12px; }
  .brand img { width: 32px; height: 32px; }
  .topbar-actions { width: 100%; max-width: none; flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
  .save-state { display: none; }
  .button { min-height: 36px; padding-inline: 10px; font-size: 10px; }
  .workspace { grid-template-columns: 1fr; gap: 15px; padding: 15px 12px 30px; }
  .preview-area { grid-row: 1; }
  .canvas-wrap { min-height: 350px; padding: 14px; }
  #art-canvas { max-height: 64vh; }
  .sidebar-left, .sidebar-right { grid-column: auto; display: block; }
  .sidebar-right .panel-divider { border-top: 1px solid var(--line); border-left: 0; }
  .preview-heading { margin-top: 0; }
  .studio-dialog { padding: 18px; }
  .project-card { grid-template-columns: 94px minmax(0,1fr); gap: 10px; }
  .project-thumb { width: 94px; height: 118px; }
  .export-format-label { display: none; }
  .transparent-export { font-size: 9px; }
}
@media (min-width: 681px) and (max-width: 1050px) {
  .workspace { height: auto; overflow: visible; }
  .sidebar { height: auto; overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
