@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
  color: #f4f1eb;
  background: #141310;
  --surface: #1c1a16;
  --input: #141310;
  --border: #3b362d;
  --muted: #b7aea0;
  --accent: #ffbc73;
  --ink: #251709;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
body:has(.sidebar.is-collapsed) { grid-template-columns: 66px minmax(0, 1fr); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 10px;
  background: #141310;
  border-right: 1px solid var(--border);
}
.sidebar-panel, .sidebar-account {
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
}
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 12px; }
.sidebar-heading .brand { margin: 0; width: auto; }
.sidebar-toggle {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}
.sidebar-toggle:hover { color: var(--accent); border-color: var(--border); }
#sidebar-content { padding: 8px; border-top: 1px solid var(--border); }
.sidebar-modes { display: grid; gap: 5px; }
.sidebar .nav-link { display: flex; align-items: center; gap: 10px; margin: 0; min-height: 42px; }
.sidebar .nav-link span { width: 18px; color: var(--accent); text-align: center; transition: transform 180ms ease; }
.sidebar .nav-link:not(:disabled):hover span { transform: scale(1.17); }
.sidebar-account { margin-top: 10px; }
.sidebar-account :is(form, .nav-link) { padding: 12px; }
.sidebar-account form { gap: 12px; border: 0; background: transparent; }
.sidebar-account h2 { font-size: 15px; }
.sidebar-account form > a { text-align: center; font-size: 13px; }
.sidebar-account p { margin: 0; color: var(--muted); font-size: 13px; }
.sidebar-account p:empty { display: none; }
.sidebar-account:has(form[hidden] + a[hidden]) { display: none; }
.sidebar.is-collapsed :is(#sidebar-content, .sidebar-account, .brand) { display: none; }
.sidebar.is-collapsed .sidebar-heading { justify-content: center; padding: 8px 0; }
.brand {
  display: flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -.07em;
  margin: 0 8px 32px;
}
.brand b { color: var(--accent); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-right: 10px;
  border-radius: 10px 4px 10px 4px;
  background: var(--accent);
  color: var(--ink);
  font-size: 23px;
  font-style: italic;
}
nav { display: grid; gap: 5px; }
.nav-link, nav button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  text-align: left;
  font-size: 14px;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.nav-link { display: block; margin-bottom: 5px; }
#tools { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.nav-link:hover, nav button:not(:disabled):hover { color: #fff3e5; background: #2c241a; transform: translateX(3px); }
.nav-link[aria-current=page], .nav-link[aria-current=true], nav button[aria-current=true] {
  color: #ffd1a1;
  background: #342619;
  border-color: #65462a;
}

main { width: 100%; max-width: 1470px; min-width: 0; margin-inline: auto; padding: 0 clamp(18px, 3.5vw, 52px) 42px; }
header { min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
header strong { color: #e7dfd3; }
#connection:not(:empty) { border: 1px solid var(--border); border-radius: 999px; padding: 6px 11px; font-size: 12px; }
.hero {
  position: relative;
  isolation: isolate;
  min-height: 175px;
  border: 1px solid #503b28;
  border-radius: 22px;
  padding: clamp(20px, 4vw, 38px);
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,35%);
  gap: 20px;
  align-items: center;
  background: radial-gradient(ellipse at 85% 5%, #563019 0, transparent 60%), #251d15;
  overflow: hidden;
}
.catalog-hero { margin-bottom: 19px; }
.hero h1 { margin: 0; font-size: clamp(34px, 5.3vw, 65px); letter-spacing: -.065em; line-height: 1.04; }
.hero p { margin: 13px 0 0; max-width: 44ch; }
.hero img, .hero video { width: 100%; display: block; max-height: 165px; object-fit: contain; border-radius: 12px; }
.hero-art { position: relative; width: min(100%, 245px); height: 140px; justify-self: center; display: grid; place-items: center; color: #ffcc92; }
.hero-art span { position: absolute; width: 90%; height: 69%; border: 1px solid #d89559; border-radius: 50%; transform: rotate(-18deg); }
.hero-art span:nth-child(2) { transform: rotate(28deg); opacity: .65; }
.hero-art span:nth-child(3) { transform: rotate(75deg); opacity: .42; }
.hero-art b { font-size: 86px; font-style: italic; line-height: 1; text-shadow: 0 0 45px #ff994ea0; }
p, small { color: var(--muted); line-height: 1.55; }

.mode-tools { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.mode-tools a { padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; font-size: 13px; }
.mode-tools a:hover { background: #2c241a; border-color: #9b6238; }

.workspace { display: grid; grid-template-columns: minmax(0, 425px) minmax(0, 1fr); gap: 18px; margin-top: 18px; align-items: start; }
form, .result { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: clamp(16px, 2.2vw, 25px); }
form, label { display: grid; gap: 7px; min-width: 0; }
form { gap: 16px; }
label { font-size: 13px; font-weight: 700; color: #ded6c9; }
select, textarea, input:is([type=search],[type=number],[type=text],[type=password]) {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  color: #f4f1eb;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 14px;
}
textarea { min-height: 103px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #948a7c; }
.form-heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.form-heading p { margin: 0; font-size: 12px; }
.catalog-controls, #options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.catalog-controls label:first-child, .catalog-controls label:last-child { grid-column: 1 / -1; }
.catalog-controls label:nth-child(2) { grid-column: 1 / -1; }
#options:empty, #model-status:empty, #price:empty, #sale-price:empty { display: none; }
.upload { padding: 13px; background: #241d15; border: 1px dashed #836342; border-radius: 10px; }
input[type=file] { width: 100%; min-width: 0; }
.upload small { font-weight: 400; }
#source-preview { max-width: 100%; max-height: 160px; margin-top: 10px; border-radius: 8px; }
#price, #model-status, #sale-price { margin: 0; font-size: 12px; }
#sale-price { color: #ffd1a1; }
.primary, #clear, #refresh, #check-topup {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--accent);
  background: #2b2117;
  padding: 10px 14px;
  font-weight: 750;
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}
.primary { color: var(--ink); background: var(--accent); border-color: transparent; }
.primary:not(:disabled):hover { background: #ffcc98; transform: translateY(-2px); box-shadow: 0 8px 20px #ff9e3a22; }
.result { min-height: 300px; }
h2 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
#answer { white-space: pre-wrap; overflow-wrap: anywhere; }
#outputs { display: grid; gap: 15px; }
#outputs img, #outputs video { display: block; max-width: 100%; max-height: 520px; border-radius: 10px; }
#outputs audio { max-width: 100%; }
.history-table { overflow-x: auto; }
.studio-footer { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; }
.offer-page { display: block; }
.offer-page main { max-width: 850px; }
.offer-page article { line-height: 1.65; }
.offer-page h1 { line-height: 1.2; }
.offer-page h2 { margin-top: 1.5em; }
.history-table table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.history-table th, .history-table td { padding: 12px; border-bottom: 1px solid var(--border); }

@media (max-width: 1030px) {
  body { grid-template-columns: 222px minmax(0, 1fr); }
  .workspace { grid-template-columns: minmax(0, 1.13fr) minmax(0, 1fr); }
}
@media (max-width: 760px) {
  body { display: block; }
  .sidebar { position: static; height: auto; display: block; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar.is-collapsed .brand { display: flex; }
  .sidebar.is-collapsed .sidebar-heading { justify-content: space-between; padding: 12px; }
  .sidebar-modes { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .brand { width: 100%; margin: 0 0 6px; }
  .nav-link { margin: 0; padding: 8px; }
  #tools { width: 100%; display: flex; overflow: auto; margin-top: 6px; padding-top: 6px; }
  #tools button { white-space: nowrap; }
  .workspace { grid-template-columns: 1fr; }
}
@media (max-width: 450px) {
  .hero { grid-template-columns: 1fr; min-height: 135px; }
  .hero-art { display: none; }
  #example:empty { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
