:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --surface: #ffffff;
  --surface-muted: #f0ebe2;
  --text: #18201c;
  --muted: #5d675f;
  --border: #d8d1c4;
  --primary: #146c43;
  --primary-strong: #0d4630;
  --primary-soft: #d9efe3;
  --accent: #b85c38;
  --danger: #b42318;
  --focus: #2f7d95;
  --shadow: 0 18px 45px rgba(24, 32, 28, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus), transparent 35%);
  outline-offset: 2px;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  max-width: 760px;
  font-size: 3.8rem;
}

h2 {
  font-size: 1.1rem;
}

.privacy-note {
  max-width: 320px;
  margin: 0;
  color: var(--muted);
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.config-panel,
.output-panel {
  padding: 20px;
}

.output-panel {
  position: sticky;
  top: 20px;
}

.section-heading {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.status-text {
  color: var(--danger);
  font-size: 0.92rem;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-pill.ready {
  border-color: color-mix(in srgb, var(--primary), transparent 45%);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

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

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--text);
  font-weight: 700;
}

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

.full-width {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf9;
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  min-height: 112px;
  resize: vertical;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, ui-monospace,
    monospace;
  font-size: 0.88rem;
}

input::placeholder,
textarea::placeholder {
  color: #8a908b;
}

.input-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
}

.ghost-button,
.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    opacity 180ms ease;
}

.primary-button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #ffffff;
}

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

.secondary-button,
.ghost-button {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
}

.secondary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--primary), var(--border) 45%);
  background: var(--primary-soft);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.5;
}

.advanced {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffaf1;
  padding: 0;
}

.advanced summary {
  min-height: 48px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 800;
}

.advanced[open] {
  padding-bottom: 14px;
}

.advanced[open] .field-grid,
.usage-controls {
  padding: 0 14px;
}

.usage-controls {
  display: grid;
  gap: 14px;
}

.check-row {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

#usage-script {
  min-height: 220px;
}

#result-link {
  min-height: 260px;
  color: var(--primary-strong);
  overflow-wrap: anywhere;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.actions-row > button {
  flex: 1 1 160px;
}

.output-actions {
  margin-top: 14px;
}

.compatibility-alert {
  margin-top: 14px;
  border: 1px solid color-mix(in srgb, var(--accent), #ffffff 35%);
  border-radius: 8px;
  background: #fff1e8;
  color: #703318;
  padding: 12px;
  font-size: 0.92rem;
}

@media (max-width: 900px) {
  .page-header,
  .tool-layout {
    display: grid;
  }

  .tool-layout {
    grid-template-columns: 1fr;
  }

  .output-panel {
    position: static;
  }

  h1 {
    font-size: 3rem;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

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

  .config-panel,
  .output-panel {
    padding: 14px;
  }

  .input-with-action {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
