:root {
  color-scheme: light;
  --bg: oklch(1 0 0);
  --surface: oklch(0.976 0.006 170);
  --surface-strong: oklch(0.936 0.012 170);
  --ink: oklch(0.18 0.018 170);
  --muted: oklch(0.38 0.018 170);
  --border: oklch(0.84 0.012 170);
  --primary: oklch(0.45 0.086 170);
  --primary-hover: oklch(0.39 0.088 170);
  --primary-soft: oklch(0.94 0.034 170);
  --accent: oklch(0.57 0.145 35);
  --error: oklch(0.48 0.15 25);
  --focus: oklch(0.62 0.14 195);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--surface), var(--bg) 42%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(100% - 32px, 920px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 48px 0;
}

.panel {
  width: 100%;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.heading {
  margin-bottom: 28px;
}

.heading.compact {
  margin-bottom: 22px;
}

.mark {
  margin: 0 0 10px;
  color: var(--primary);
  font-weight: 700;
}

h1,
h2 {
  max-width: 12ch;
  margin: 0;
  color: var(--ink);
  font-size: 2.25rem;
  line-height: 1.08;
  font-weight: 750;
  text-wrap: balance;
}

h2 {
  max-width: 18ch;
  font-size: 1.55rem;
  line-height: 1.14;
}

h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 750;
}

.form,
.result {
  display: grid;
  gap: 10px;
}

.result {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

label {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 650;
}

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

input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  outline: none;
  transition: border-color 160ms ease, background-color 160ms ease;
}

input::placeholder {
  color: var(--muted);
  opacity: 1;
}

input:focus-visible {
  border-color: var(--focus);
  background: var(--bg);
  box-shadow: 0 0 0 3px oklch(0.9 0.04 195);
}

button {
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: var(--primary);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease;
}

a.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border-radius: 8px;
  color: white;
  background: var(--primary);
  font-weight: 700;
  text-decoration: none;
  transition: background-color 160ms ease, transform 160ms ease;
}

button:hover {
  background: var(--primary-hover);
}

a.button:hover {
  background: var(--primary-hover);
}

button:active,
a.button:active {
  transform: translateY(1px);
}

button:focus-visible,
a.button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  background: var(--surface-strong);
  color: var(--muted);
}

button.secondary,
a.button.secondary {
  min-height: 40px;
  color: var(--ink);
  background: var(--surface-strong);
}

button.secondary:hover,
a.button.secondary:hover {
  background: var(--primary-soft);
}

.standalone {
  justify-self: start;
}

.status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
}

.status[data-kind="error"] {
  color: var(--error);
}

.status[data-kind="success"] {
  color: var(--primary);
}

.automation {
  padding-top: 28px;
}

.automation-panel {
  display: grid;
  gap: 20px;
}

.settings-block {
  display: grid;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.field-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.meta {
  min-height: 24px;
  margin: 4px 0 0;
  color: var(--muted);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--ink);
  font-weight: 650;
}

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

.status-block {
  gap: 14px;
}

.status-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.status-list div {
  min-width: 0;
}

.status-list dt {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
}

.status-list dd {
  margin: 3px 0 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 24px, 760px);
    align-content: flex-start;
    padding-top: 28px;
  }

  .panel {
    padding: 22px;
  }

  h1,
  h2 {
    max-width: 14ch;
    font-size: 1.8rem;
  }

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

  .field-head {
    display: grid;
  }

  .button-row {
    justify-content: flex-start;
  }

  .status-list {
    grid-template-columns: 1fr;
  }
}

@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;
  }
}
