@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap");

:root {
  --hx-purple: #542e91;
  --hx-purple-dark: #442178;
  --hx-purple-soft: #f1ecf8;
  --hx-yellow: #fdd506;
  --ink: #20202a;
  --muted: #61556f;
  --line: rgba(255, 255, 255, 0.26);
  --line-strong: rgba(255, 255, 255, 0.4);
  --panel: rgba(250, 246, 255, 0.76);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --surface: #3d1970;
  --surface-warm: #fffaf1;
  --code: #141024;
  --code-text: #f5f2ff;
  --danger: #8a1f1f;
  --danger-bg: #fff2f2;
  --notice-bg: #fff7d1;
  --notice-text: #5b4700;
  --shadow: 0 26px 70px rgba(24, 9, 43, 0.24);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0)),
    linear-gradient(145deg, #2b124a 0%, #542e91 46%, #7f4ac7 100%),
    var(--surface);
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Nunito", Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(37, 15, 65, 0.34);
  box-shadow: 0 18px 42px rgba(22, 8, 40, 0.16);
  backdrop-filter: blur(22px);
}

.topbar__inner {
  display: flex;
  max-width: 1440px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
}

.brand__logo {
  display: block;
  width: 174px;
  height: auto;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 34px rgba(22, 8, 40, 0.28);
}

.brand__text {
  min-width: 0;
}

.brand h1,
.brand p,
.pane h2,
.summary-box h3,
.empty-state h3,
.empty-state p {
  margin: 0;
}

.brand h1 {
  color: #ffffff;
  font-size: 29px;
  font-weight: 800;
  line-height: 35px;
}

.brand p {
  max-width: 540px;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
}

.template-state {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(253, 213, 6, 0.42);
  border-radius: 999px;
  background: rgba(253, 213, 6, 0.16);
  color: #fff5b5;
  font-size: 13px;
  font-weight: 800;
  line-height: 18px;
  padding: 7px 13px;
  text-align: right;
  white-space: nowrap;
}

.workspace {
  display: grid;
  max-width: 1440px;
  min-height: calc(100vh - 89px);
  margin: 0 auto;
  gap: 22px;
  padding: 28px 24px;
}

@media (min-width: 1024px) {
  .workspace {
    grid-template-columns: minmax(390px, 0.9fr) minmax(540px, 1.1fr);
  }
}

.pane {
  display: flex;
  min-height: 642px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(247, 239, 255, 0.72)),
    var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.pane__header,
.pane__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.pane__header {
  border-bottom: 1px solid rgba(84, 46, 145, 0.1);
  background: rgba(255, 255, 255, 0.62);
}

.pane__header--wrap {
  flex-wrap: wrap;
}

.mode-switch {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid rgba(84, 46, 145, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  padding: 3px;
}

.mode-switch__button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #5a4b68;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  line-height: 18px;
  padding: 7px 12px;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.mode-switch__button.is-active {
  background: var(--hx-purple);
  box-shadow: 0 8px 18px rgba(84, 46, 145, 0.22);
  color: #ffffff;
}

.pane__footer {
  border-top: 1px solid rgba(84, 46, 145, 0.1);
  background: rgba(255, 255, 255, 0.58);
}

.pane h2 {
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  line-height: 24px;
}

.pane__footer,
.summary-box,
.empty-state p {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
}

.brief-form {
  display: grid;
  flex: 1;
  gap: 14px;
  overflow: auto;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(250, 247, 255, 0.44));
}

.field,
.field-grid,
.cta-row {
  min-width: 0;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: #342348;
  font-size: 13px;
  font-weight: 800;
  line-height: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.section-heading span {
  color: #342348;
  font-size: 13px;
  font-weight: 800;
  line-height: 18px;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.cta-section {
  display: grid;
  gap: 10px;
}

.cta-rows {
  display: grid;
  gap: 12px;
}

.cta-row {
  display: grid;
  gap: 12px;
  position: relative;
}

@media (min-width: 760px) {
  .field-grid,
  .cta-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cta-row {
    padding-right: 44px;
  }
}

.brief-control,
.copy-input,
.output-code {
  width: 100%;
  border: 1px solid rgba(84, 46, 145, 0.12);
  border-radius: 12px;
  outline: 0;
  box-shadow: 0 10px 24px rgba(37, 15, 65, 0.05);
  font-size: 14px;
  line-height: 23px;
}

.brief-control,
.copy-input {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  font-family: "Nunito", Arial, Helvetica, sans-serif;
  font-weight: 600;
}

.brief-control {
  min-height: 44px;
  padding: 10px 12px;
}

.brief-control--file {
  padding: 8px 12px;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  min-width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(84, 46, 145, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 20px rgba(37, 15, 65, 0.08);
  color: var(--hx-purple);
  cursor: pointer;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  transition:
    background-color 160ms ease,
    transform 160ms ease;
}

.icon-button:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

.icon-button--remove {
  color: #8a1f1f;
}

@media (min-width: 760px) {
  .icon-button--remove {
    position: absolute;
    right: 0;
    top: 33px;
  }
}

.copy-input {
  min-height: 96px;
  resize: vertical;
  padding: 12px;
}

.copy-input--small {
  min-height: 76px;
}

.copy-input--medium {
  min-height: 112px;
}

.copy-input--large {
  min-height: 168px;
}

.copy-input--html {
  min-height: 540px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 20px;
  resize: vertical;
}

.settings-panel {
  display: grid;
  gap: 8px;
  border-top: 1px solid rgba(84, 46, 145, 0.1);
  background: rgba(255, 255, 255, 0.48);
  padding: 12px 16px;
}

.toggle-warning {
  border: 1px solid rgba(138, 31, 31, 0.22);
  border-radius: 10px;
  background: #fff2f2;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
  line-height: 18px;
  padding: 9px 11px;
}

.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #342348;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  line-height: 20px;
}

.toggle-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #cfc6dc;
  box-shadow: inset 0 0 0 1px rgba(84, 46, 145, 0.12);
  transition: background-color 160ms ease;
}

.toggle-track::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(37, 15, 65, 0.2);
  content: "";
  transition: transform 160ms ease;
}

.toggle-field input:checked + .toggle-track {
  background: var(--hx-purple);
}

.toggle-field input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.brief-control::placeholder,
.copy-input::placeholder {
  color: #97a1b2;
}

.output-code {
  min-height: 460px;
  flex: 1;
  resize: none;
  border: 0;
  border-radius: 0;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    var(--code);
  color: var(--code-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 21px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 17px;
  font-size: 14px;
  font-weight: 800;
  line-height: 20px;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button--primary {
  background: var(--hx-yellow);
  box-shadow: 0 14px 28px rgba(91, 63, 0, 0.22);
  color: #2b124a;
}

.button--primary:hover {
  background: #ffe063;
}

.button--secondary {
  border-color: rgba(84, 46, 145, 0.12);
  background: rgba(255, 255, 255, 0.7);
  color: #3b2559;
  box-shadow: 0 10px 22px rgba(37, 15, 65, 0.08);
}

.button--secondary:hover {
  border-color: rgba(84, 46, 145, 0.22);
  background: #ffffff;
}

.button:disabled {
  cursor: not-allowed;
  background: #d4c7df;
  border-color: #d4c7df;
  box-shadow: none;
  color: #ffffff;
  transform: none;
}

.button--secondary:disabled {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(84, 46, 145, 0.08);
  color: #9b91a8;
}

.status {
  border-bottom: 1px solid rgba(84, 46, 145, 0.1);
  background: var(--notice-bg);
  color: var(--notice-text);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
}

.status--error {
  background: var(--danger-bg);
  color: var(--danger);
}

.empty-state {
  display: grid;
  flex: 1;
  place-items: center;
  padding: 42px;
  text-align: center;
}

.empty-state h3 {
  margin-bottom: 10px;
  color: #2d184f;
  font-size: 30px;
  font-weight: 800;
  line-height: 38px;
}

.empty-state p {
  max-width: 470px;
}

.result {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.summary-grid {
  display: grid;
  gap: 12px;
  border-bottom: 1px solid rgba(84, 46, 145, 0.1);
  background: rgba(255, 255, 255, 0.5);
  padding: 16px;
}

@media (min-width: 760px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.summary-box {
  border: 1px solid rgba(84, 46, 145, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  padding: 14px;
}

.summary-box h3 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 21px;
}

.summary-box p,
.summary-box ul {
  margin: 0 0 7px 0;
}

.summary-box ul {
  padding-left: 20px;
}

@media (max-width: 640px) {
  .topbar__inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .template-state {
    text-align: left;
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .brand__logo {
    width: 154px;
  }

  .brand h1 {
    font-size: 23px;
    line-height: 30px;
  }

  .workspace {
    min-height: auto;
    padding: 14px;
  }

  .pane {
    min-height: 540px;
  }

  .pane__header,
  .pane__footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-switch__button {
    flex: 1;
  }
}
