:root {
  --bg: #f4f5f2;
  --panel: #ffffff;
  --panel-soft: #f8f8f6;
  --ink: #1f2420;
  --muted: #737a73;
  --line: #dfe2dc;
  --line-strong: #cbd0c8;
  --green: #0e6b50;
  --green-dark: #084c39;
  --green-soft: #e8f2ed;
  --amber: #d7952a;
  --blue: #355f8a;
  --shadow: 0 12px 35px rgba(38, 47, 40, 0.07);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(rgba(31, 36, 32, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 36, 32, 0.025) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: "Noto Sans KR", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
select,
input[type="file"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(14, 107, 80, 0.2);
  outline-offset: 2px;
}

.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 16px 18px;
  border-right: 1px solid var(--line);
  background: rgba(250, 250, 248, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 24px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: "DM Sans", sans-serif;
  font-size: 17px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  background: var(--ink);
}

.brand-mark span {
  width: 3px;
  border-radius: 2px;
  background: #eef5f0;
}

.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 18px; background: #7fd2ad; }
.brand-mark span:nth-child(3) { height: 13px; }
.brand-mark span:nth-child(4) { height: 22px; background: #e8b35d; }

.tool-nav {
  display: grid;
  gap: 6px;
}

.nav-button {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.nav-button:hover {
  background: var(--panel);
}

.nav-button.is-active {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: 0 4px 14px rgba(38, 47, 40, 0.05);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
  font-family: "DM Sans", sans-serif;
  font-size: 10px;
  font-weight: 700;
}

.nav-button.is-active .nav-icon {
  background: var(--green-soft);
  color: var(--green);
}

.nav-button strong,
.nav-button small {
  display: block;
}

.nav-button strong {
  font-size: 13px;
}

.nav-button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.sidebar-footer {
  display: grid;
  gap: 6px;
  margin-top: auto;
}

.quiet-button {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.quiet-button:hover {
  border-color: var(--line-strong);
  background: var(--panel);
  color: var(--ink);
}

.file-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.main {
  min-width: 0;
  padding: 0 30px 36px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 92px;
  max-width: 1260px;
  margin: 0 auto;
}

.eyebrow,
.step {
  margin: 0;
  color: var(--green);
  font-family: "DM Sans", sans-serif;
  font-size: 10px;
  font-weight: 700;
}

.topbar h1 {
  margin: 5px 0 0;
  font-size: 22px;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.save-state {
  color: var(--muted);
  font-size: 11px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  font-size: 18px;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.tool-view {
  display: none;
  max-width: 1260px;
  margin: 0 auto;
}

.tool-view.is-active {
  display: block;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(350px, 0.9fr) minmax(390px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.panel-head h2 {
  margin: 4px 0 0;
  font-size: 16px;
  white-space: nowrap;
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field > span {
  color: #4d554e;
  font-size: 11px;
  font-weight: 600;
}

.field-help {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.quick-presets {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.section-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.section-label span {
  color: #4d554e;
  font-size: 11px;
  font-weight: 700;
}

.section-label small {
  color: var(--muted);
  font-size: 9px;
}

.preset-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.preset-button {
  min-height: 36px;
  padding: 7px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: #596159;
  font-size: 10px;
  font-weight: 700;
}

.preset-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.preset-button.is-selected {
  border-color: rgba(14, 107, 80, 0.45);
  background: var(--green-soft);
  color: var(--green);
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--ink);
}

input,
select {
  height: 42px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  min-height: 92px;
  padding: 11px;
  line-height: 1.65;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  background: var(--panel);
  outline: none;
}

::placeholder {
  color: #a2a8a2;
}

.primary-button,
.secondary-button,
.download-button,
.copy-button,
.text-button {
  border-radius: 6px;
  font-weight: 700;
}

.primary-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--green);
  background: var(--green);
  color: white;
  font-size: 12px;
}

.primary-button:hover:not(:disabled) {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.trial-status {
  padding: 13px 14px;
  border: 1px solid #dbc9a5;
  border-radius: 7px;
  background: #fff9ed;
}

.trial-status div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.trial-status span {
  color: #66583c;
  font-size: 11px;
  font-weight: 700;
}

.trial-status strong {
  color: #8a5b16;
  font-size: 11px;
}

.trial-status p {
  margin: 7px 0 0;
  color: #806f51;
  font-size: 10px;
  line-height: 1.6;
}

.exhausted-result {
  display: grid;
  min-height: 180px;
  place-content: center;
  color: var(--muted);
  text-align: center;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.text-button:hover {
  color: var(--ink);
}

.copy-button {
  min-width: 56px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 11px;
}

.copy-button:hover {
  border-color: var(--green);
  color: var(--green);
}

.copy-button.compact {
  min-height: 30px;
}

.output {
  position: sticky;
  top: 18px;
}

.output-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: -2px 0 13px;
}

.output-summary span,
.privacy-badge {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
}

.result-box {
  overflow: auto;
  min-height: 390px;
  max-height: 58vh;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #202823;
  color: #e9f0eb;
  font-family: "Noto Sans KR", sans-serif;
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: keep-all;
}

.style-result {
  min-height: 250px;
}

.lyrics-result {
  min-height: 500px;
}

.sub-output {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.sub-output-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.sub-output h3 {
  margin: 4px 0 0;
  font-size: 12px;
}

.sub-output p {
  margin: 12px 0 0;
  color: #4d554e;
  font-size: 11px;
  line-height: 1.65;
}

.tag-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.tag-guide span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-soft);
  color: #596159;
  font-family: "DM Sans", sans-serif;
  font-size: 9px;
  font-weight: 700;
}

.tip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--amber);
  background: #fbf7ef;
}

.tip strong {
  color: #8a601d;
  font-size: 11px;
}

.tip p {
  margin: 0;
  color: #6f6654;
  font-size: 10px;
  line-height: 1.6;
}

.concept-strip {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 13px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.concept-strip small,
.concept-strip strong {
  display: block;
}

.concept-strip small {
  color: var(--muted);
  font-family: "DM Sans", sans-serif;
  font-size: 9px;
  font-weight: 700;
}

.concept-strip strong {
  margin-top: 5px;
  font-size: 12px;
}

.concept-visual {
  position: relative;
  overflow: hidden;
  height: 54px;
  border-radius: 5px;
  background:
    linear-gradient(150deg, transparent 48%, rgba(221, 153, 50, 0.45) 49%, transparent 51%),
    linear-gradient(135deg, #182635 0%, #355f76 58%, #c9863c 100%);
}

.moon {
  position: absolute;
  top: 9px;
  right: 15px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f1cf93;
  box-shadow: 0 0 14px rgba(241, 207, 147, 0.62);
}

.window-line {
  position: absolute;
  inset: 0 44% 0 auto;
  width: 1px;
  background: rgba(255, 255, 255, 0.33);
}

.figure {
  position: absolute;
  bottom: -5px;
  left: 25px;
  width: 16px;
  height: 34px;
  border-radius: 10px 10px 2px 2px;
  background: #101b21;
}

.negative-prompt {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.negative-prompt summary {
  padding: 12px 14px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.detail-body {
  display: flex;
  gap: 12px;
  align-items: start;
  padding: 0 14px 14px;
}

.detail-body p {
  flex: 1;
  margin: 0;
  color: #5e655f;
  font-size: 11px;
  line-height: 1.6;
}

.audio-layout {
  display: grid;
  grid-template-columns: minmax(430px, 1.3fr) minmax(320px, 0.7fr);
  gap: 18px;
  align-items: start;
}

.audio-upload-panel {
  min-height: 570px;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 26px;
  border: 1px dashed #aeb7ae;
  border-radius: 7px;
  background:
    radial-gradient(circle at 50% 45%, rgba(14, 107, 80, 0.07), transparent 32%),
    var(--panel-soft);
  text-align: center;
  transition: border-color 150ms ease, background 150ms ease;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--green);
  background-color: var(--green-soft);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-symbol {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--panel);
  color: var(--green);
  font-size: 24px;
}

.dropzone strong,
.dropzone small,
.dropzone em {
  display: block;
}

.dropzone strong {
  font-size: 14px;
}

.dropzone small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.dropzone em {
  margin-top: 18px;
  color: #929892;
  font-size: 9px;
  font-style: normal;
}

.audio-file-card {
  display: grid;
  grid-template-columns: 42px 1fr 36px;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.file-icon {
  display: grid;
  place-items: center;
  height: 42px;
  border-radius: 5px;
  background: var(--green-soft);
  color: var(--green);
  font-family: "DM Sans", sans-serif;
  font-size: 9px;
  font-weight: 700;
}

.file-meta {
  min-width: 0;
}

.file-meta strong,
.file-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta strong {
  font-size: 12px;
}

.file-meta span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.remove-audio {
  font-size: 17px;
}

#waveform {
  display: block;
  width: 100%;
  height: 148px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #202823;
}

.audio-settings {
  display: grid;
  gap: 17px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 7px;
}

.analysis-grid div {
  min-height: 78px;
  padding: 13px;
}

.analysis-grid div:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.analysis-grid div:nth-child(-n + 2) {
  border-bottom: 1px solid var(--line);
}

.analysis-grid span,
.analysis-grid strong {
  display: block;
}

.analysis-grid span {
  color: var(--muted);
  font-size: 9px;
}

.analysis-grid strong {
  margin-top: 8px;
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
}

.audio-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.secondary-button {
  min-height: 40px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 11px;
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--panel);
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.download-button {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
  font-size: 11px;
  text-decoration: none;
}

.download-button.is-disabled {
  cursor: not-allowed;
  opacity: 0.35;
  pointer-events: none;
}

.audio-note {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  transform: translateY(12px);
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: var(--ink);
  color: white;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    display: block;
    height: auto;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    display: none;
  }

  .tool-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-button {
    display: flex;
    justify-content: center;
    min-height: 42px;
    padding: 6px;
    text-align: center;
  }

  .nav-button small,
  .nav-icon {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .main {
    padding: 0 18px 28px;
  }

  .topbar {
    min-height: 76px;
  }

  .work-grid,
  .audio-layout {
    grid-template-columns: 1fr;
  }

  .output {
    position: static;
  }
}

@media (max-width: 600px) {
  .sidebar {
    padding: 8px;
  }

  .nav-button strong {
    font-size: 10px;
  }

  .main {
    padding: 0 10px 20px;
  }

  .topbar {
    min-height: 68px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .eyebrow,
  .save-state {
    display: none;
  }

  .panel {
    padding: 16px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .section-label {
    display: block;
  }

  .section-label small {
    display: block;
    margin-top: 4px;
  }

  .preset-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-box {
    min-height: 320px;
    max-height: none;
  }

  .audio-upload-panel {
    min-height: 0;
  }

  .dropzone {
    min-height: 210px;
  }

  .concept-strip {
    grid-template-columns: 76px 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
