:root {
  color-scheme: dark;
  --bg: #07090d;
  --panel: #151821;
  --panel-2: #1c202b;
  --ink: #eef4ff;
  --muted: #aab4c2;
  --line: #303746;
  --accent: #39d0c8;
  --accent-strong: #7ee8dd;
  --sky: #61c8ff;
  --gold: #f5c45e;
  --field: #10131a;
  --shadow: 0 24px 70px rgba(0, 0, 0, .38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at 12% 0%, rgba(57, 208, 200, .18), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(97, 200, 255, .13), transparent 30%),
    linear-gradient(145deg, #07090d 0%, #0a0d15 48%, #0f1017 100%);
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans KR", system-ui, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black, transparent 74%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-nav {
  position: sticky;
  top: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 12px 0 10px;
  background: transparent;
  backdrop-filter: none;
  border-bottom: 0;
}

.app-nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.app-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(217, 251, 255, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: #d9fbff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

.app-nav-btn:hover {
  border-color: rgba(94, 234, 212, .38);
  background: rgba(94, 234, 212, .14);
}

.app-nav-btn.is-active,
.app-nav-btn[aria-current="page"] {
  pointer-events: none;
  cursor: default;
  border-color: rgba(94, 234, 212, .52);
  background: rgba(94, 234, 212, .18);
  color: #ffffff;
}

.app-shell {
  position: relative;
  width: min(1500px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 22px 30px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 470px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 52px);
}

.settings-panel,
.output-panel {
  background: rgba(21, 24, 33, .94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.settings-panel {
  padding: 18px;
  overflow: auto;
}

.output-panel {
  padding: 24px;
  overflow: auto;
}

.brand-row {
  display: flex;
  gap: 13px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.app-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 2px solid rgba(126, 232, 221, .82);
  border-radius: 7px;
  color: #ffffff;
  background: rgba(7, 17, 27, .9);
  font-size: 25px;
  line-height: 1;
  font-weight: 1000;
  letter-spacing: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 10px 28px rgba(57, 208, 200, .12);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 21px;
  line-height: 1.25;
}

.brand-row p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.app-meta {
  color: #c9d7e8;
}

.app-meta a {
  text-decoration: none;
}

.app-meta a:first-of-type {
  color: var(--accent-strong);
  font-weight: 900;
}

.app-meta a:last-of-type {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 5px;
  padding: 1px 8px;
  border: 1px solid rgba(245, 196, 94, .72);
  border-radius: 999px;
  color: #f9d874;
  background: rgba(245, 196, 94, .08);
  font-size: 11px;
  font-weight: 900;
}

.app-meta a:hover {
  filter: brightness(1.12);
}

.control-grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.settings-actions,
.blend-panel,
.picker-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(57, 208, 200, .16);
  border-radius: 8px;
  background: rgba(16, 19, 26, .72);
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-actions button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

#settingsStatus {
  min-height: 18px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

label {
  display: grid;
  gap: 7px;
  color: #c8d4e5;
  font-size: 13px;
  font-weight: 800;
}

.textarea-field {
  position: relative;
}

.textarea-field > span {
  padding-right: 40px;
}

.clear-input {
  position: absolute;
  top: 1px;
  right: 0;
  width: 24px;
  min-height: 24px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #aeb9c9;
  line-height: 1;
}

.clear-input svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--field);
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

textarea {
  min-height: 106px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(57, 208, 200, .16);
}

input:disabled,
button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

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

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #1d222c;
  color: var(--ink);
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 850;
}

button:hover:not(.clear-input) {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.clear-input:hover {
  color: #aeb9c9;
  background: transparent;
}

.clear-input.is-hovered {
  color: #f7fbff;
  background: transparent;
}

.clear-input:focus-visible {
  color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(57, 208, 200, .2);
}

.auto-button {
  border-color: rgba(126, 232, 221, .42);
  background: linear-gradient(135deg, rgba(57, 208, 200, .2), rgba(97, 200, 255, .12));
}

.picker-button {
  width: 100%;
  text-align: left;
}

.output-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.output-toolbar h2 {
  font-size: 24px;
}

.output-toolbar p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.results {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.result-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(28, 32, 43, .96), rgba(13, 15, 21, .96));
  padding: 18px;
}

.track-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(9, 13, 20, .72);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.result-card h3 {
  font-size: 18px;
}

.result-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.result-title-group {
  display: grid;
  gap: 4px;
  padding-right: 72px;
}

.result-title-group span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.card-copy {
  position: absolute;
  top: 16px;
  right: 16px;
  min-height: 32px;
  width: auto;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
}

pre {
  margin: 14px 0 0;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
  font: 14px/1.7 "Consolas", "D2Coding", monospace;
  color: #dde8f7;
}

.picker-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(3, 6, 14, .72);
  backdrop-filter: blur(10px);
}

.picker-modal[hidden] {
  display: none;
}

.picker-modal-panel {
  width: min(980px, 100%);
  max-height: min(780px, calc(100vh - 44px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(126, 232, 221, .22);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(18, 20, 25, .98), rgba(9, 11, 16, .98));
  box-shadow: var(--shadow);
}

.picker-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.picker-modal-head p {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.picker-modal-head h2 {
  margin-top: 4px;
  font-size: 24px;
}

.picker-group-list {
  display: grid;
  gap: 14px;
  overflow: auto;
  padding-right: 6px;
}

.picker-group {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: rgba(255, 255, 255, .025);
}

.picker-group h3 {
  font-size: 13px;
  color: #d7e3ee;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.choice-button {
  min-height: 38px;
  padding: 7px 10px;
  text-align: left;
  font-size: 13px;
}

.choice-button.is-selected {
  border-color: var(--accent);
  background: rgba(57, 208, 200, .16);
  color: #ffffff;
}

.text-clarity-picker {
  border-color: rgba(126, 232, 221, .38);
  background: linear-gradient(135deg, rgba(57, 208, 200, .12), rgba(97, 200, 255, .06));
}

.text-clarity-picker p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.text-clarity-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.text-clarity-button {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(9, 13, 20, .58);
  text-align: center;
  font-size: 12px;
}

.text-clarity-button.is-selected {
  border-color: var(--accent);
  background: rgba(57, 208, 200, .2);
  color: #ffffff;
}

.person-detail-picker {
  border-color: rgba(97, 200, 255, .18);
}

.person-detail-picker p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.person-detail-picker.is-disabled {
  opacity: .58;
}

@media (max-width: 960px) {
  .app-shell {
    padding: 12px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .settings-panel,
  .output-panel {
    overflow: visible;
  }
}

@media (max-width: 560px) {
  .two-col {
    grid-template-columns: 1fr;
  }

  .brand-row,
  .output-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

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