/* ==========================================================================
   Agnes Image Studio — Design System
   Single source of truth for color, spacing, radius, type, and components.
   ========================================================================== */

:root {
  /* -- Color: surfaces ----------------------------------------------------- */
  --bg:               hsl(225 15% 5%);
  --bg-deep:          hsl(225 18% 3%);
  --panel:            hsl(225 14% 7%);
  --panel-soft:       hsl(225 12% 9%);
  --panel-strong:     hsl(225 18% 4%);
  --sidebar:          hsl(225 18% 4%);

  /* -- Color: lines & dividers -------------------------------------------- */
  --line:             hsl(225 11% 14%);
  --line-soft:        hsl(225 10% 11%);
  --line-strong:      hsl(225 10% 18%);

  /* -- Color: text -------------------------------------------------------- */
  --text:             hsl(40 18% 90%);
  --text-strong:      hsl(40 30% 96%);
  --text-muted:       hsl(40 8% 65%);
  --text-faint:       hsl(225 8% 42%);

  /* -- Color: brand ------------------------------------------------------- */
  --brand:            hsl(40 79% 60%);
  --brand-soft:       hsl(40 79% 60% / 0.16);
  --brand-deep:       hsl(38 60% 14%);
  --brand-ink:        hsl(38 40% 8%);
  --brand-on:         hsl(40 30% 96%);

  /* -- Color: semantic ---------------------------------------------------- */
  --danger:           hsl(0 72% 60%);
  --success:          hsl(150 55% 50%);

  /* -- Radius ------------------------------------------------------------- */
  --radius-sm:        8px;
  --radius-md:        10px;
  --radius-lg:        14px;
  --radius-xl:        18px;
  --radius-pill:      999px;

  /* -- Spacing ------------------------------------------------------------ */
  --space-1:          4px;
  --space-2:          8px;
  --space-3:          12px;
  --space-4:          16px;
  --space-5:          20px;
  --space-6:          24px;
  --space-7:          32px;
  --space-8:          40px;

  /* -- Layout ------------------------------------------------------------- */
  --sidebar-w:        256px;
  --compose-w:        380px;

  /* -- Type --------------------------------------------------------------- */
  --font-display:     "Bricolage Grotesque", "Noto Sans SC", system-ui, sans-serif;
  --font-body:        "Noto Sans SC", "Inter", system-ui, sans-serif;
  --font-mono:        "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --text-xs:          0.72rem;
  --text-sm:          0.82rem;
  --text-base:        0.92rem;
  --text-md:          1rem;
  --text-lg:          1.125rem;
  --text-xl:          1.4rem;

  /* -- Motion ------------------------------------------------------------- */
  --ease-out:         cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:          cubic-bezier(0.7, 0, 0.84, 0);
  --t-fast:           140ms;
  --t-base:           200ms;
  --t-slow:           280ms;

  color-scheme: dark;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

* { box-sizing: border-box; }

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button, a { color: inherit; text-decoration: none; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
img { max-width: 100%; display: block; }

/* Selection */
::selection { background: var(--brand); color: var(--brand-ink); }

/* Scrollbar (Webkit) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); }

/* ==========================================================================
   App shell
   ========================================================================== */

.app-shell {
  height: 100dvh;
  min-height: 720px;
  display: grid;
  grid-template-columns: var(--sidebar-w) var(--compose-w) minmax(0, 1fr);
  overflow: hidden;
  background:
    radial-gradient(circle at 70% 0%, hsl(225 18% 11%) 0 22%, transparent 42%),
    var(--bg);
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  background: var(--sidebar);
  padding: 18px 12px 16px;
  border-right: 1px solid var(--line);
}

.sidebar-inner {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 16px;
}

.sidebar-nav,
.sidebar-bottom {
  display: grid;
  align-content: start;
  gap: 4px;
}

.sidebar-bottom {
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.nav-label {
  margin: 16px 12px 6px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--text-base);
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out);
}

.nav-item:hover {
  background: hsl(0 0% 100% / 0.03);
  color: var(--text);
}

.nav-item.is-active {
  background: hsl(40 50% 14% / 0.55);
  color: var(--brand);
}

.nav-item.is-active:hover {
  background: hsl(40 55% 16% / 0.6);
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--brand-ink);
  font-size: var(--text-xs);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}


.nav-item.is-active .nav-icon { color: var(--brand); }
.nav-item:hover .nav-icon { color: var(--text); }

.sidebar-toggle {
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--panel-soft);
  color: var(--text-muted);
  z-index: 5;
  transition: color var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out);
}

.sidebar-toggle:hover {
  color: var(--text);
  background: var(--panel);
}

/* ==========================================================================
   Compose panel
   ========================================================================== */

.compose-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 18px;
  padding: 28px 22px 22px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  overflow-y: auto;
}

/* ----- Mode tabs --------------------------------------------------------- */

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg-deep);
}

.mode-tab {
  height: 40px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-base);
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out);
}

.mode-tab.is-active {
  background: var(--panel-soft);
  color: var(--text-strong);
  box-shadow: 0 1px 0 hsl(0 0% 100% / 0.04) inset,
              0 6px 18px hsl(0 0% 0% / 0.3);
}

/* ----- Section title ----------------------------------------------------- */

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--text);
}

.section-title small {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}

.section-icon {
  display: inline-grid;
  place-items: center;
  color: var(--brand);
}

/* ----- Drop zone --------------------------------------------------------- */

.drop-zone {
  position: relative;
  min-height: 168px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-deep);
  color: var(--text-muted);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-base) var(--ease-out),
              background var(--t-base) var(--ease-out);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--brand);
  background: hsl(40 79% 60% / 0.04);
}

.drop-zone p {
  margin: 0;
  font-size: var(--text-sm);
}

.drop-zone .drop-zone-sub {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.upload-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--panel-soft);
  color: var(--text-muted);
  transition: color var(--t-base) var(--ease-out),
              border-color var(--t-base) var(--ease-out);
}

.drop-zone:hover .upload-mark,
.drop-zone.drag-over .upload-mark {
  color: var(--brand);
  border-color: var(--brand);
}

.asset-button {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  transition: border-color var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out);
}

.asset-button:hover {
  border-color: var(--brand);
  color: var(--text-strong);
}

/* ----- Form / fields ----------------------------------------------------- */

.generator-form {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto auto;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--text-sm);
}

.field span {
  font-family: var(--font-body);
  font-weight: 600;
}

.prompt-field { min-height: 0; }

textarea,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: none;
  background: var(--bg-deep);
  color: var(--text);
  transition: border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out);
}

textarea {
  min-height: 0;
  height: 100%;
  resize: none;
  padding: 14px 16px;
  line-height: 1.65;
  font-family: var(--font-body);
  font-size: var(--text-base);
}


textarea.txt2img-height {
  min-height: 200px;
}

textarea::placeholder,
input::placeholder {
  color: var(--text-faint);
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px hsl(40 79% 60% / 0.18);
}

.prompt-count {
  margin-top: -34px;
  padding-right: 8px;
  color: var(--text-faint);
  font-size: var(--text-xs);
  text-align: right;
  pointer-events: none;
}

/* ----- Control row (model / ratio / quality) ---------------------------- */

.control-row {
  display: grid;
  grid-template-columns: 1.5fr 0.85fr 0.85fr;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.control-row.video-control-row {
  grid-template-columns: 1.4fr 0.75fr 0.75fr auto;
}

.select-shell {
  position: relative;
  display: block;
}

.select-shell select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 42px;
  padding: 0 30px 0 14px;
  font-size: var(--text-sm);
  font-weight: 600;
  background: var(--bg-deep);
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-md);
}

.select-shell::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.select-shell select option {
  background: var(--panel);
  color: var(--text);
}

/* ----- Checkbox row ----------------------------------------------------- */

.enhance-row,
.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  user-select: none;
}

.enhance-row input,
.remember-row input {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg-deep);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out);
  flex-shrink: 0;
}

.enhance-row input:checked,
.remember-row input:checked {
  background: var(--brand);
  border-color: var(--brand);
}

.enhance-row input:checked::after,
.remember-row input:checked::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 1.5px solid var(--brand-ink);
  border-bottom: 1.5px solid var(--brand-ink);
  transform: translateY(-1px) rotate(-45deg);
}

/* ----- Generate button -------------------------------------------------- */

.generate-button {
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--brand-ink);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-md);
  box-shadow: 0 8px 24px hsl(40 79% 60% / 0.25);
  transition: background var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out);
}

.generate-button:hover {
  background: hsl(40 84% 65%);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px hsl(40 79% 60% / 0.32);
}

.generate-button:active {
  transform: translateY(0);
}

.generate-button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.generate-button__icon {
  display: inline-grid;
  place-items: center;
  color: var(--brand-ink);
}

.generate-button.is-generating {
  cursor: wait;
  opacity: 0.85;
}

.generate-button.is-generating:hover {
  transform: none;
  box-shadow: 0 8px 24px hsl(40 79% 60% / 0.25);
}

.generate-button__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: generate-spin 0.7s linear infinite;
}

@keyframes generate-spin {
  to { transform: rotate(360deg); }
}

/* ----- Status text ------------------------------------------------------ */
.status {
  min-height: 20px;
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.status.is-error { color: var(--danger); }
.status.is-success { color: var(--success); }

.generation-time {
  margin: 4px 0 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
}

/* ==========================================================================
   Preview panel
   ========================================================================== */

.preview-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(360px, 1fr) auto auto auto;
  gap: 18px;
  padding: 28px 28px 22px;
  background: var(--bg);
  overflow: hidden;
}

.hero-preview {
  min-height: 0;
  padding: 1px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
}

.result-frame {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: calc(var(--radius-xl) - 1px);
  background:
    radial-gradient(circle at 78% 12%, hsl(225 12% 16% / 0.85) 0 18%, transparent 42%),
    linear-gradient(135deg, hsl(225 16% 3%) 0%, hsl(225 14% 12%) 100%);
}

.result-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, hsl(40 40% 50% / 0.04), transparent 60%),
    radial-gradient(circle at 80% 20%, hsl(220 40% 50% / 0.05), transparent 50%);
  pointer-events: none;
}

.result-frame img,
.result-frame video {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: hsl(225 16% 4%);
}

/* ----- Sample board (empty state visual) -------------------------------- */

.sample-board {
  position: absolute;
  inset: 0;
}

.sample-tile,
.sample-main,
.recent-card {
  border: 1.5px solid hsl(225 9% 28%);
  border-radius: var(--radius-md);
  background-size: cover;
  background-position: center;
  box-shadow: 0 14px 30px hsl(0 0% 0% / 0.32);
}

.sample-tile {
  position: absolute;
  width: 13%;
  height: 22%;
  border-width: 1px;
}
.tile-a {
  left: 7%;
  top: 18%;
  background-image: url('https://images.unsplash.com/photo-1534528741775-53994a69daeb?auto=format&fit=crop&w=200&q=80');
}

.tile-b {
  left: 22%;
  top: 18%;
  background-image: url('https://images.unsplash.com/photo-1584917865442-de89df76afd3?auto=format&fit=crop&w=200&q=80');
}

.tile-c {
  left: 7%;
  top: 43%;
  background-image: url('https://images.unsplash.com/photo-1511499767150-a48a237f0083?auto=format&fit=crop&w=200&q=80');
}

.tile-d {
  left: 22%;
  top: 43%;
  background-image: url('https://images.unsplash.com/photo-1543466835-00a7907e9de1?auto=format&fit=crop&w=200&q=80');
}

.sample-main {
  position: absolute;
  right: 10%;
  top: 12%;
  width: 50%;
  height: 76%;
  background-image: url('https://images.unsplash.com/photo-1494790108377-be9c29b29330?auto=format&fit=crop&w=400&q=80');
  border-width: 1px;
}

.sample-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, hsl(0 0% 100% / 0.05) 1px, transparent 1.2px);
  background-size: 18px 18px;
  background-position: 0 0;
  pointer-events: none;
  mask-image: linear-gradient(to right, transparent 0, transparent 35%, black 50%, black 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, transparent 35%, black 50%, black 100%);
}

.empty-hint {
  position: absolute;
  inset-inline: 0;
  bottom: 0px;
  z-index: 4;
  color: var(--text-faint);
  text-align: center;
  font-weight: 500;
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  pointer-events: none;
}

/* ----- Prompt card ------------------------------------------------------ */

.prompt-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.prompt-card__label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.prompt-card p {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all var(--t-base) var(--ease-out);
}

.prompt-card p.is-expanded {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.55;
  padding: 12px 0;
}

.prompt-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.text-action-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out);
}

.text-action-btn:hover {
  background: hsl(0 0% 100% / 0.05);
  color: var(--text-strong);
}

.icon-action-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out);
}

.icon-action-btn:hover {
  color: var(--text);
  background: hsl(0 0% 100% / 0.05);
}

.copy-button {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: border-color var(--t-fast) var(--ease-out);
}

.copy-button:hover { border-color: var(--brand); }

/* ----- Recent strip ----------------------------------------------------- */

.recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.recent-head h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-md);
}

.recent-head a {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: var(--text-sm);
  transition: color var(--t-fast) var(--ease-out);
}

.recent-head a:hover { color: var(--text); }

.recent-strip {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  gap: 10px;
  align-items: center;
  min-height: 72px;
}

.recent-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(80px, 1fr);
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.recent-track::-webkit-scrollbar { display: none; }

.recent-track > * { scroll-snap-align: start; }

.round-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--panel-soft);
  color: var(--text-muted);
  transition: color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out);
}

.round-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.recent-card {
  height: 60px;
  border-width: 1px;
  transition: transform var(--t-base) var(--ease-out),
              border-color var(--t-base) var(--ease-out);
}

.recent-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
}

.recent-card video,
.work-card video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* ----- My works --------------------------------------------------------- */

.works-panel {
  grid-column: 2 / -1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px;
  overflow: auto;
}

.works-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-kicker {
  margin: 0;
  color: var(--brand);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.works-header h1 {
  margin: 0;
  color: var(--text);
  font-size: var(--text-2xl);
  font-weight: 700;
}

.works-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.works-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.works-section-head h2 {
  margin: 0;
  color: var(--text);
  font-size: var(--text-md);
  font-weight: 650;
}

.works-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  background: var(--panel-soft);
  font-size: var(--text-sm);
}

.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 12px;
}

.work-card {
  position: relative;
  min-height: 136px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  background-position: center;
  background-size: cover;
  transition: transform var(--t-base) var(--ease-out),
              border-color var(--t-base) var(--ease-out);
}

.work-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
}

.work-card-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: #fff;
  font-size: 10px;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-base) var(--ease-out);
}

.work-card:hover .work-card-meta {
  opacity: 1;
}

/* ==========================================================================
   Settings dialog
   ========================================================================== */

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: hsl(225 18% 3% / 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: overlayIn var(--t-base) var(--ease-out);
}

.settings-overlay.is-hidden,
.is-hidden {
  display: none;
}

.settings-dialog {
  width: min(440px, calc(100vw - 32px));
  display: grid;
  gap: 18px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: 0 28px 80px hsl(0 0% 0% / 0.55);
  animation: dialogIn var(--t-slow) var(--ease-out);
}

.settings-head,
.settings-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.settings-actions {
  align-items: center;
}

.settings-head > div { flex: 1; min-width: 0; }

.dialog-kicker {
  margin: 0 0 4px;
  color: var(--brand);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-head h2 {
  margin: 0 0 6px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-xl);
  color: var(--text-strong);
}

.settings-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.icon-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--panel-soft);
  color: var(--text-muted);
  transition: color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out);
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.secondary-button {
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--panel-soft);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-base);
  transition: border-color var(--t-fast) var(--ease-out);
}

.secondary-button:hover { border-color: var(--line-strong); }

.save-button {
  height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--brand-ink);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-base);
  box-shadow: 0 8px 20px hsl(40 79% 60% / 0.25);
  transition: background var(--t-fast) var(--ease-out);
}

.save-button:hover { background: hsl(40 84% 65%); }

/* ==========================================================================
   Utilities
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ==========================================================================
   Video compose — duration slider with filled track
   ========================================================================== */

.video-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.video-drop-zone {
  min-height: 124px;
  padding: 12px;
  cursor: pointer;
  transition: border-color var(--t-base) var(--ease-out),
              background var(--t-base) var(--ease-out);
}

.video-drop-zone:hover {
  border-color: var(--brand);
  background: hsl(40 79% 60% / 0.04);
}

.video-drop-zone p {
  font-size: var(--text-xs);
  margin: 2px 0;
  line-height: 1.5;
}

.video-drop-zone .upload-mark {
  width: 36px;
  height: 36px;
  margin-bottom: 6px;
}

.preview-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.uploaded-thumbnail {
  max-width: 100%;
  max-height: 100px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  box-shadow: 0 4px 12px hsl(0 0% 0% / 0.4);
}

#image-drop-zone .uploaded-thumbnail { max-height: 140px; }

.delete-uploaded {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--panel-strong);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  z-index: 10;
  box-shadow: 0 2px 5px hsl(0 0% 0% / 0.5);
  transition: background var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out);
}

.delete-uploaded:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

/* ----- Duration slider with filled track ------------------------------- */

.duration-row {
  display: grid;
  gap: 10px;
  margin: 4px 0 4px;
}

.duration-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
}

.duration-val {
  color: var(--brand);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-md);
}

.duration-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: linear-gradient(
    to right,
    var(--brand) 0%,
    var(--brand) var(--slider-fill, 33%),
    var(--line) var(--slider-fill, 33%),
    var(--line) 100%
  );
  outline: none;
  cursor: pointer;
}

.duration-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  border: 2px solid var(--bg);
  cursor: pointer;
  box-shadow: 0 2px 8px hsl(40 79% 60% / 0.4);
  transition: transform var(--t-fast) var(--ease-out);
}

.duration-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.duration-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  border: 2px solid var(--bg);
  cursor: pointer;
  box-shadow: 0 2px 8px hsl(40 79% 60% / 0.4);
}

.duration-subtext {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

/* ----- Settings toggle (advanced) --------------------------------------- */

.settings-toggle-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-deep);
  color: var(--text-muted);
  transition: color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out);
}

.settings-toggle-btn:hover {
  color: var(--text);
  border-color: var(--brand);
  background: hsl(40 79% 60% / 0.04);
}

/* ==========================================================================
   Video preview — overlay play button
   ========================================================================== */

.video-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-md);
  cursor: pointer;
  background-size: cover;
  background-position: center;
  transition: transform var(--t-base) var(--ease-out),
              border-color var(--t-base) var(--ease-out);
}

.video-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: hsl(0 0% 0% / 0.25);
  transition: background var(--t-base) var(--ease-out);
}

.video-card:hover::before { background: hsl(0 0% 0% / 0.45); }

.video-card .play-icon {
  position: relative;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: hsl(0 0% 100% / 0.92);
  color: var(--bg);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px hsl(0 0% 0% / 0.4);
  transition: transform var(--t-base) var(--ease-out),
              background var(--t-base) var(--ease-out);
}

.video-card:hover .play-icon {
  transform: scale(1.15);
  background: var(--brand);
  color: var(--brand-ink);
}

.video-player-container {
  width: 100%;
  height: 100%;
  position: relative;
  background: hsl(225 16% 2%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-player-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 3;
}

.video-overlay-play-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: var(--radius-pill);
  background: hsl(0 0% 0% / 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid hsl(0 0% 100% / 0.45);
  color: white;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 6px 24px hsl(0 0% 0% / 0.5);
  transition: transform var(--t-base) var(--ease-out),
              background var(--t-base) var(--ease-out),
              border-color var(--t-base) var(--ease-out),
              opacity var(--t-slow) var(--ease-out);
}

.video-overlay-play-btn .play-arrow {
  margin-left: 4px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

.video-overlay-play-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: hsl(0 0% 100% / 0.18);
  border-color: var(--brand);
}

.video-player-container.is-playing .video-overlay-play-btn {
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
  :root {
    --compose-w: 340px;
    --sidebar-w: 220px;
  }
}

@media (max-width: 980px) {
  body { overflow: auto; }

  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 220px 1fr;
    grid-template-rows: auto auto;
    overflow: visible;
  }

  .preview-panel {
    grid-column: 1 / -1;
    min-height: 620px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .compose-panel {
    padding: 18px;
    border-right: 0;
  }

  .preview-panel {
    padding: 18px;
  }

  .control-row,
  .video-control-row {
    grid-template-columns: 1fr 1fr;
  }

  .video-upload-grid {
    grid-template-columns: 1fr;
  }

  .recent-strip {
    grid-template-columns: 1fr;
  }
  .round-button { display: none; }
}
