:root {
  --black: #08090a;
  --panel: #111315;
  --panel-soft: #15181b;
  --line: #2c3136;
  --text: #eceff1;
  --muted: #90989e;
  --accent: #b9c2c9;
  --accent-strong: #dce1e4;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  background: var(--black);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.45;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.34; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  color: var(--black);
  background: var(--accent-strong);
}

.skip-link:focus { top: 1rem; }

.site-header {
  height: 50px;
  padding: 0 max(20px, calc((100% - 1420px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--black);
  background: var(--accent);
  border-radius: 50%;
  font-size: 1.05rem;
  font-weight: 700;
}

.header-note, .panel-index {
  margin: 0;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.app-shell {
  width: min(1420px, calc(100% - 40px));
  margin: 0 auto;
}

.intro {
  min-height: 72px;
  padding: 12px 2px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
}

.intro h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1;
}

.intro > p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.workspace {
  min-height: calc(100svh - 154px);
  display: grid;
  grid-template-columns: minmax(390px, 0.88fr) minmax(480px, 1.12fr);
  gap: 12px;
  padding-bottom: 20px;
}

.composer-panel, .result-panel {
  min-width: 0;
  padding: clamp(18px, 2vw, 28px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.composer-panel { display: flex; flex-direction: column; }

.panel-heading {
  min-height: 38px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
}

.panel-heading h2 {
  margin: 3px 0 0;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1;
}

.text-button {
  padding: 3px 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 1px solid #555;
  font-size: 0.76rem;
}

.text-button:hover, .text-button:focus-visible { color: var(--accent-strong); border-color: var(--accent); }

.field-label {
  margin-bottom: 7px;
  display: flex;
  justify-content: space-between;
  color: #d8d8d3;
  font-size: 0.75rem;
  font-weight: 700;
}

.field-label small { color: var(--muted); font-weight: 500; }

textarea {
  width: 100%;
  min-height: 72px;
  padding: 12px 13px;
  resize: vertical;
  color: var(--text);
  background: #090909;
  border: 1px solid #333;
  border-radius: 10px;
  outline: 0;
  line-height: 1.45;
}

textarea::placeholder, input::placeholder { color: #5d5d59; }
textarea:focus, .amount-field:focus-within { border-color: var(--accent); }

.inline-fields {
  margin: 8px 0 7px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.amount-label { color: #c8c8c2; font-size: 0.7rem; font-weight: 700; }
.amount-label small { color: var(--muted); font-weight: 500; }

.amount-field {
  width: 110px;
  height: 34px;
  margin-top: 5px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  background: #090909;
  border: 1px solid #333;
  border-radius: 8px;
}

.amount-field input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.amount-field b { color: var(--accent); }

.field-help { margin: 0 0 2px; color: var(--muted); font-size: 0.65rem; text-align: right; }
.field-help code { color: var(--accent); }
code { font-family: "SFMono-Regular", Consolas, monospace; }

.control-panel { min-width: 0; margin: 0; padding: 0; border: 0; }
.control-panel legend { margin-bottom: 3px; color: var(--muted); font-size: 0.63rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }

.control {
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(150px, 0.75fr) minmax(120px, 1fr) 76px;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #262626;
}

.control:last-child { border-bottom: 1px solid #262626; }

.control-copy { min-width: 0; display: flex; align-items: center; gap: 9px; font-size: 0.72rem; }
.control-copy code { min-width: 31px; color: var(--accent); font-weight: 800; }
.control-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.control output { color: var(--muted); font-size: 0.65rem; text-align: right; font-variant-numeric: tabular-nums; }

input[type="range"] {
  width: 100%;
  height: 16px;
  margin: 0;
  appearance: none;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: #4a4a47; border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb { width: 12px; height: 12px; margin-top: -5px; appearance: none; background: var(--accent); border: 2px solid var(--black); border-radius: 50%; box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]::-moz-range-track { height: 2px; background: #4a4a47; }
input[type="range"]::-moz-range-progress { height: 2px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; background: var(--accent); border: 2px solid var(--black); border-radius: 50%; }

.generate-button {
  width: 100%;
  min-height: 43px;
  margin-top: 9px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--black);
  background: var(--accent);
  border: 0;
  border-radius: 9px;
  font-weight: 850;
}

.generate-button:hover, .generate-button:focus-visible { background: var(--accent-strong); }

.result-panel {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 90% 0%, rgba(185, 194, 201, 0.06), transparent 18rem),
    var(--panel-soft);
}

.result-heading { margin-bottom: 16px; }
.result-actions { display: flex; gap: 7px; }

.icon-button {
  padding: 6px 10px;
  color: #c7c7c0;
  background: #0b0b0b;
  border: 1px solid #383838;
  border-radius: 999px;
  font-size: 0.68rem;
}

.icon-button:hover:not(:disabled), .icon-button:focus-visible:not(:disabled) { color: var(--black); background: var(--accent); border-color: var(--accent); }

.output-wrap {
  min-height: 270px;
  flex: 1;
  padding: clamp(18px, 3vw, 36px);
  overflow: auto;
  background: #080808;
  border: 1px solid #303030;
  border-radius: 12px;
}

.result-panel.has-output .output-wrap { border-color: #4c565e; box-shadow: inset 3px 0 0 var(--accent); }

#output-text {
  max-width: 760px;
  margin: 0;
  color: #b8bec2;
  font-size: clamp(1rem, 1.5vw, 1.24rem);
  line-height: 1.62;
  white-space: pre-wrap;
}

.result-panel.has-output #output-text { color: var(--text); }

.status { min-height: 17px; margin: 10px 2px 0; color: var(--muted); font-size: 0.66rem; }
.status[data-kind="success"] { color: #b8c6cf; }
.status[data-kind="fallback"] { color: #aeb6bc; }
.status[data-kind="loading"] { color: #d6d6d0; }
.status[data-kind="error"], .status[data-kind="warning"] { color: #cf8c85; }

.about { margin: 2px 0 30px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.about summary { padding: 15px 2px; color: var(--muted); cursor: pointer; font-size: 0.73rem; }
.about-grid { padding: 5px 0 24px; }
.about-grid p { margin: 0; color: var(--muted); font-size: 0.78rem; }
.about-grid .locked-description { max-width: 900px; color: #c8cdd0; font-size: 0.92rem; }

footer {
  min-height: 50px;
  padding: 15px max(20px, calc((100% - 1420px) / 2));
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: #61615e;
  border-top: 1px solid #191919;
  font-size: 0.63rem;
}

@media (max-width: 899px) {
  .header-note { display: none; }
  .app-shell { width: min(100% - 24px, 720px); }
  .intro { padding: 22px 2px; align-items: flex-start; flex-direction: column; gap: 12px; }
  .workspace { min-height: auto; grid-template-columns: 1fr; }
  .composer-panel, .result-panel { padding: 18px; }
  .result-panel { min-height: 520px; scroll-margin-top: 10px; }
}

@media (max-width: 520px) {
  .intro h1 { font-size: 2rem; }
  .inline-fields { align-items: flex-start; flex-direction: column; }
  .field-help { text-align: left; }
  .control { grid-template-columns: minmax(130px, 1fr) 92px 60px; gap: 8px; }
  .control-copy span { font-size: 0.68rem; }
  .result-heading { align-items: flex-start; flex-direction: column; }
  .result-actions { width: 100%; }
  .result-actions button { flex: 1; }
  footer { flex-direction: column; }
}

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