:root {
  --bg: #0b0d10;
  --panel: #12161b;
  --panel-2: #171c22;
  --line: #28313a;
  --text: #f3f5f7;
  --muted: #98a3ad;
  --green: #7f6bff;
  --green-2: #b6adff;
  --blue: #7f6bff;
  --red: #ff6961;
  --amber: #ffca6a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(127, 107, 255, 0.16), transparent 32%),
    linear-gradient(180deg, #080812 0%, #0a0a14 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  background: var(--text);
  color: #0b0d10;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: wait;
}

button.secondary {
  background: #22312a;
  color: var(--text);
  border: 1px solid var(--line);
}

button.danger {
  border-color: rgba(255, 105, 97, 0.45);
  color: #ffb0aa;
}

button.ghost {
  height: 30px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  background: #0f1318;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}

input,
select {
  height: 39px;
  padding: 0 12px;
}

textarea {
  min-height: 104px;
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

label,
.panel-title {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.app-shell {
  display: grid;
  grid-template-columns: 286px minmax(460px, 1fr) 520px;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -10%, rgba(127, 107, 255, 0.14), transparent 30%),
    linear-gradient(180deg, #080812 0%, #0a0a14 100%);
}

.sidebar,
.preview {
  background: rgba(14, 14, 26, 0.92);
  overflow: auto;
}

.sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.platform-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}

.platform-link {
  flex: 1;
  text-align: center;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  text-decoration: none;
  transition: 0.15s ease;
}

.platform-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.platform-link.accent {
  color: var(--green-2);
  border-color: rgba(127, 107, 255, 0.35);
  background: rgba(127, 107, 255, 0.12);
}

.platform-link.accent:hover {
  background: rgba(127, 107, 255, 0.18);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 16px;
  background: var(--text);
  color: #0b0d10;
  font-weight: 950;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.panel,
.field-card,
.console-card {
  background: linear-gradient(180deg, rgba(20, 20, 38, 0.96), rgba(14, 14, 26, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
}

.panel {
  padding: 16px;
  margin-bottom: 14px;
}

.panel input + label,
.two-col {
  margin-top: 14px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stage-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stage-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
}

.stage-list li.active {
  color: var(--green-2);
  border-color: rgba(127, 107, 255, 0.55);
  background: rgba(127, 107, 255, 0.12);
}

.stage-list li.done {
  color: var(--text);
}

.workspace {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 18px;
  padding: 28px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.main-input {
  grid-column: 1 / -1;
}

.field-card {
  padding: 18px;
}

.console-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.log {
  overflow: auto;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
}

.log-row {
  color: #c7d8d0;
  border-bottom: 1px solid rgba(38, 53, 46, 0.55);
  padding: 5px 0;
}

.log-row.success {
  color: var(--green-2);
}

.log-row.error {
  color: var(--red);
}

.log-row.warn {
  color: var(--amber);
}

.preview {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  grid-template-rows: auto 1fr;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tab {
  height: 46px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.tab.active {
  color: #0a0a14;
  background: var(--text);
  box-shadow: none;
}

.tab-pane {
  display: none;
  overflow: auto;
  padding: 18px;
}

.tab-pane.active {
  display: block;
}

.post-card,
.artifact-card,
.image-card,
.export-box,
.naver-box,
.workflow-box,
.image-settings {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(20, 20, 38, 0.96), rgba(14, 14, 26, 0.96));
  margin-bottom: 12px;
}

.post-card {
  overflow: hidden;
}

.post-card header,
.artifact-card summary,
.image-card header {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 850;
}

.post-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.post-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.post-body,
.artifact-body,
.image-card .image-body {
  padding: 14px;
  color: #dceae3;
  line-height: 1.75;
  white-space: pre-wrap;
}

.post-actions {
  display: flex;
  gap: 8px;
  padding: 0 14px 14px;
}

.post-actions button {
  height: 34px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 14px;
}

.tag {
  color: var(--green-2);
  background: rgba(127, 107, 255, 0.12);
  border: 1px solid rgba(127, 107, 255, 0.28);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.empty-state,
.coming-soon {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
}

.coming-soon {
  margin-bottom: 12px;
  color: var(--green-2);
  border-color: rgba(3, 199, 90, 0.45);
  background: rgba(3, 199, 90, 0.06);
}

.export-box {
  display: flex;
  gap: 10px;
  padding: 14px;
}

.image-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 15px;
}

.image-settings .wide {
  grid-column: 1 / -1;
}

.image-actions {
  display: flex;
  gap: 10px;
  margin: 0 0 12px;
}

.generated-image {
  width: 100%;
  display: block;
  border-bottom: 1px solid var(--line);
}

.workflow-box {
  padding: 14px;
}

.workflow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.slot-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.slot-btn {
  height: 32px;
  padding: 0 10px;
  background: #22312a;
  color: var(--text);
  border: 1px solid var(--line);
}

.slot-btn.active {
  background: var(--text);
  color: #0b0d10;
}

.workflow-step-editor {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
  background: #0f1318;
}

.workflow-step-editor strong {
  display: block;
  margin-bottom: 8px;
}

.workflow-step-editor textarea {
  min-height: 92px;
}

.naver-box {
  padding: 15px;
  line-height: 1.55;
}

.naver-box p {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.naver-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.naver-actions select {
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  color: var(--text);
  background: #0f1318;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.assist-divider {
  height: 1px;
  background: var(--line);
  margin: 15px 0;
}

.assist-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.assist-grid .wide {
  grid-column: 1 / -1;
}

.assist-actions {
  grid-template-columns: 1fr 1fr 1fr;
}

.assist-note {
  margin-top: 10px !important;
  font-size: 12px !important;
}

#jsonOutput {
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: #a7f3d0;
  background: #0b0f14;
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 260px 1fr;
  }

  .preview {
    grid-column: 1 / -1;
    height: 50vh;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .app-shell,
  .workspace,
  .input-grid {
    display: block;
    height: auto;
    overflow: visible;
  }

  .sidebar,
  .workspace,
  .preview {
    padding: 16px;
  }

  .topbar,
  .actions {
    display: grid;
  }

  .field-card,
  .console-card {
    margin-top: 12px;
  }
}
