:root {
  --bg: #06101f;
  --bg2: #0b1830;
  --nav: #09152a;
  --panel: #121e33;
  --panel2: #18253d;
  --line: rgba(186, 207, 255, 0.13);
  --text: #f3f6ff;
  --sub: #99a9c8;
  --muted: #99a9c8;
  --cyan: #29d8ff;
  --violet: #7b72ff;
  --pink: #ff6e96;
  --accent: #29d8ff;
  --blue: #7ff0ff;
  --radius: 14px;
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

* { box-sizing: border-box; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { text-decoration: none; color: inherit; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 54% 13%, #253d79 0, transparent 25%),
    linear-gradient(180deg, #0b1934 0, #06101f 48%, #030a12 100%);
  min-height: 100vh;
}

.app { min-height: 100vh; padding-left: 94px; }

/* sidebar */
aside {
  position: fixed;
  z-index: 10;
  left: 0;
  top: 0;
  bottom: 0;
  width: 94px;
  background: rgba(5, 13, 27, 0.82);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 20px 12px;
}
.logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  font-size: 27px;
  font-weight: 950;
  letter-spacing: -5px;
  color: white;
}
.side-nav { display: grid; gap: 9px; width: 100%; }
.side-link {
  min-height: 51px;
  border: 0;
  background: transparent;
  color: #9daac0;
  border-radius: 11px;
  display: grid;
  place-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}
.side-link b { font-size: 19px; font-weight: 500; }
.side-link.active,
.side-link:hover:not(:disabled) { background: #30405f; color: white; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.side-link:disabled { opacity: 0.45; cursor: not-allowed; }
.side-bottom { margin-top: auto; display: grid; gap: 13px; width: 100%; }
.sale {
  background: linear-gradient(160deg, #726dff, #2775ee);
  font-size: 10px;
  text-align: center;
  border-radius: 7px;
  padding: 8px 2px;
  font-weight: 950;
}
.account {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  margin: auto;
  background: linear-gradient(135deg, #ffb782, #fd608e);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 950;
}

/* topbar */
.topbar {
  height: 68px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(8, 18, 38, 0.5);
  position: sticky;
  top: 0;
  z-index: 9;
}
.brand { font-weight: 900; letter-spacing: -1.2px; }
.brand small { color: #80dfff; font-size: 10px; margin-left: 7px; letter-spacing: 0.08em; }
.top-right { display: flex; gap: 9px; align-items: center; }
.top-pill {
  border: 1px solid var(--line);
  background: #12213a;
  color: #c2d1e9;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 11px;
  font-weight: 800;
}
.top-pill.credit { color: #7ff0ff; }
.top-pill.gate-out { cursor: pointer; }
.profile {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #354563;
  display: grid;
  place-items: center;
  font-size: 12px;
}

/* main hero */
main { max-width: 1760px; margin: auto; padding: 0 28px 60px; }
.hero {
  min-height: 500px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-light {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 25%, rgba(255, 165, 107, 0.39), transparent 20%),
    radial-gradient(ellipse at 54% 19%, rgba(123, 124, 255, 0.34), transparent 32%),
    linear-gradient(180deg, transparent 35%, #06101f 92%);
}
.hero-orb {
  position: absolute;
  width: 310px;
  height: 310px;
  border-radius: 45% 55% 42% 58%;
  background: linear-gradient(135deg, #eecfaf, #946c56 45%, #272f5c);
  filter: blur(0.2px);
  opacity: 0.7;
  top: -33px;
  left: 50%;
  transform: translateX(-50%) rotate(28deg);
  box-shadow: 0 0 115px rgba(255, 174, 118, 0.42);
}
.hero-orb::after {
  content: "";
  position: absolute;
  inset: 43px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.54);
}
.hero-content {
  position: relative;
  z-index: 2;
  width: min(100%, 1200px);
  text-align: center;
  padding-top: 4px;
}
.hero h1 {
  font-size: clamp(32px, 3.1vw, 54px);
  letter-spacing: -3.4px;
  margin: 0 0 12px;
}
.hero h1::before { content: "|"; color: #76eaff; margin-right: 2px; font-weight: 400; }
.hero-sub { margin: 0 0 18px; font-size: 14px; line-height: 1.6; }
.hero-sub strong { color: #c6f9ff; }

.tabs {
  display: inline-flex;
  border-radius: 99px;
  background: rgba(21, 29, 49, 0.65);
  border: 1px solid var(--line);
  padding: 3px;
  margin-bottom: 25px;
}
.tabs button {
  border: 0;
  color: #cad4e4;
  background: transparent;
  border-radius: 99px;
  padding: 9px 25px;
  font-size: 13px;
  font-weight: 850;
}
.tabs button.active { background: rgba(255, 255, 255, 0.19); color: white; }
.tabs button:disabled { opacity: 0.45; cursor: not-allowed; }

.prompt {
  text-align: left;
  background: rgba(23, 34, 55, 0.84);
  border: 1px solid rgba(190, 211, 255, 0.18);
  border-radius: 25px;
  padding: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(20px);
}
.uploads { display: flex; gap: 12px; align-items: start; }
.upload {
  width: 74px;
  height: 80px;
  border-radius: 12px;
  border: 1px solid rgba(206, 224, 255, 0.2);
  background: #3a465c;
  display: grid;
  place-items: center;
  text-align: center;
  color: #e8efff;
  font-size: 11px;
  font-weight: 800;
  flex: none;
}
.upload b { font-size: 20px; display: block; margin-bottom: 5px; }
.divider { width: 1px; height: 50px; background: #59677e; margin: 15px 1px; flex: none; }
.prompt textarea {
  flex: 1;
  width: 100%;
  min-height: 80px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: white;
  padding: 9px 0;
  font-size: 14px;
  line-height: 1.6;
}
.prompt textarea::placeholder { color: #8d9ab0; }
.prompt-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.select {
  border: 0;
  border-radius: 8px;
  background: #202c43;
  color: #dce7fb;
  padding: 9px 11px;
  font-size: 11px;
  font-weight: 800;
}
.select.primary { background: #193a4d; color: #c6f9ff; }
.select-wrap { padding: 0; overflow: hidden; display: inline-flex; }
.select-wrap select {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 9px 11px;
  font-size: 11px;
  font-weight: 800;
  outline: none;
  cursor: pointer;
}
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.check-inline input { width: auto; margin: 0; }
.ghost-mini { background: transparent; border: 1px solid var(--line); color: #cbd5e1; }
.go {
  margin-left: auto;
  width: 39px;
  height: 39px;
  border: 0;
  border-radius: 50%;
  background: #3d4a60;
  color: #d3dfef;
  font-size: 20px;
}
.go:hover { background: #4a5975; color: #fff; }

/* tools */
.tools-wrap { margin-top: 7px; position: relative; }
.tools {
  display: flex;
  gap: 11px;
  overflow-x: auto;
  padding: 0 0 12px;
  scrollbar-color: #3a4a5d transparent;
}
.tool {
  min-width: 183px;
  height: 89px;
  background: rgba(25, 34, 51, 0.9);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f1f4fc;
  text-align: left;
}
.tool:hover { border-color: #6ca9ff; background: #1e2d48; }
.tool.big {
  min-width: 375px;
  background: linear-gradient(120deg, #fff 0 43%, #e8f2ff 100%);
  color: #10255a;
}
.tool-image {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, #5d5af5, #ff8968);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex: none;
}
.tool.big .tool-image { width: 64px; height: 58px; background: #5a7ffe; }
.tool b { font-size: 13px; letter-spacing: -0.7px; }
.tool small { display: block; color: #9eacc0; font-size: 10px; margin-top: 5px; }
.tool.big small { color: #506180; }

/* feed + gallery */
.feed-head {
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin-top: 29px;
  height: 46px;
}
.feed-head a {
  font-size: 12px;
  color: #8f9cb2;
  font-weight: 750;
  height: 46px;
  display: flex;
  align-items: center;
}
.feed-head a.active { color: white; border-bottom: 2px solid white; }
.feed-muted { font-size: 12px; color: #64748b; }
.feed-submit {
  margin-left: auto;
  border: 1px solid var(--line);
  background: #19253a;
  color: white;
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 11px;
  font-weight: 850;
}

.gallery {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1.25fr 1.1fr;
  gap: 10px;
  margin-top: 15px;
}
.story {
  min-height: 255px;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #18233a;
  border: 1px solid rgba(187, 210, 255, 0.09);
}
.story::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--art);
  transition: 0.35s;
}
.story:hover::before { transform: scale(1.06); }
.story::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(1, 5, 13, 0.74), transparent 65%);
}
.story-copy {
  position: absolute;
  z-index: 2;
  left: 18px;
  right: 18px;
  bottom: 18px;
}
.story-copy b { font-size: 20px; letter-spacing: -1.5px; }
.story-copy small { display: block; color: #cbd4e3; font-size: 11px; margin-top: 7px; }
.art1 { --art: radial-gradient(circle at 51% 41%, #fcf1e0 0 4%, transparent 5%), radial-gradient(circle at 49% 45%, #5b504c 0 24%, transparent 25%), linear-gradient(135deg, #09070d, #29192c 55%, #736185); }
.art2 { --art: radial-gradient(ellipse at 65% 40%, #ffe2c7, transparent 21%), linear-gradient(135deg, #6f4a38, #cba57a 45%, #311d22); }
.art3 { --art: radial-gradient(circle at 53% 38%, #c2d7ff 0 8%, transparent 9%), radial-gradient(ellipse at 50% 55%, #283040 0 33%, transparent 34%), linear-gradient(135deg, #06080e, #28324a); }
.art4 { --art: linear-gradient(135deg, transparent 44%, rgba(255, 147, 91, 0.75) 45% 49%, transparent 50%), linear-gradient(120deg, #9e5a35, #eda26e 47%, #635164); }
.badge {
  position: absolute;
  z-index: 3;
  top: 13px;
  left: 13px;
  background: rgba(7, 14, 28, 0.7);
  backdrop-filter: blur(6px);
  border-radius: 99px;
  padding: 6px 9px;
  font-size: 10px;
  font-weight: 900;
}

/* estimate / workbench panels */
.panel {
  margin-top: 24px;
  background: rgba(23, 34, 55, 0.92);
  border: 1px solid rgba(190, 211, 255, 0.18);
  border-radius: 16px;
  padding: 20px;
}
.panel-workbench { margin-top: 32px; }
.panel h2 { margin: 0 0 12px; font-size: 18px; }
.meta { list-style: none; padding: 0; margin: 0 0 16px; }
.meta li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.meta b { color: var(--cyan); }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.adv {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px 12px;
  background: rgba(0, 0, 0, 0.2);
}
.adv summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  padding: 12px 4px;
  color: #7ff0ff;
  list-style: none;
}
.adv summary::-webkit-details-marker { display: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-size: 14px;
}
.btn.primary { background: linear-gradient(135deg, #29d8ff, #7b72ff); color: #06101f; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.log {
  margin-top: 14px;
  background: #0b0f17;
  border-radius: 10px;
  padding: 12px;
  font-size: 11px;
  overflow: auto;
  color: #a5f3fc;
}
.muted { color: var(--muted); font-size: 13px; }
.warn { color: #fb923c; font-size: 12px; }
.job-list { list-style: none; padding: 0; margin: 0; }
.job-list li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.st-completed { color: #4ade80; }
.st-failed { color: #f87171; }
.st-running, .st-queued { color: #29d8ff; }
.result-host { margin-top: 16px; }
.result-host video {
  width: 100%;
  max-height: 420px;
  border-radius: 12px;
  background: #000;
  margin-top: 10px;
}
.progress {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(41, 216, 255, 0.12);
  border: 1px solid rgba(41, 216, 255, 0.35);
  font-size: 13px;
  color: #c6f9ff;
}
.progress.ok {
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.35);
  color: #bbf7d0;
}
.ref-field { margin-bottom: 8px; }
.ref-field > span b { color: var(--cyan); font-weight: 700; }
.ref-hint { margin: 8px 0 0; font-size: 12px; text-align: left; }
.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.ref-grid-hero:empty { display: none; }
.ref-thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 1;
  background: #0b0f17;
}
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
}
footer a { color: var(--blue); }

/* gate + banner */
.gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 15, 0.92);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.gate-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.gate-card h2 { margin: 0 0 8px; font-size: 20px; }
.gate-err { color: #f87171; font-size: 13px; margin: 0 0 10px; }
.or-banner {
  background: rgba(248, 113, 113, 0.12);
  border-bottom: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  padding: 10px 16px;
  font-size: 13px;
  text-align: center;
  position: relative;
  z-index: 11;
}
.or-banner code { color: #fde68a; }
input[type="password"] {
  width: 100%;
  background: #0b0f17;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px;
  font-size: 14px;
}

/* toast */
#toast {
  position: fixed;
  z-index: 99;
  right: 25px;
  bottom: 25px;
  transform: translateY(100px);
  transition: 0.25s;
  background: #edf9ff;
  color: #101d32;
  border-radius: 9px;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 850;
  pointer-events: none;
  opacity: 0;
}
#toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 900px) {
  .app { padding-left: 0; }
  aside { display: none; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  main { padding: 0 15px 35px; }
  .topbar { padding: 0 15px; }
  .hero { min-height: 485px; }
  .tool.big { min-width: 280px; }
}
@media (max-width: 520px) {
  .brand small,
  .top-pill:not(.credit):not(.gate-out) { display: none; }
  .hero h1 { letter-spacing: -2.4px; }
  .prompt { border-radius: 18px; }
  .uploads { gap: 7px; }
  .upload { width: 57px; height: 66px; font-size: 9px; }
  .upload b { font-size: 16px; }
  .prompt textarea { font-size: 12px; }
  .select { font-size: 10px; padding: 8px; }
  .gallery { grid-template-columns: 1fr; }
  .story { min-height: 230px; }
}
