:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #5d6865;
  --panel: #ffffff;
  --page: #eef4f1;
  --line: #c9d7d1;
  --accent: #0b6b57;
  --accent-strong: #084b3e;
  --warn: #9a5b00;
  --danger: #9b2635;
  --ok: #0f6a38;
  --radius: 8px;
  --font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow: 0 14px 34px rgba(24, 39, 33, 0.13);
  font-family: var(--font-family);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

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

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

button:disabled {
  cursor: progress;
  opacity: 0.72;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: none;
}

select {
  min-height: 42px;
  padding: 0 10px;
}

textarea {
  resize: vertical;
  min-height: 92px;
  padding: 10px 11px;
  line-height: 1.42;
}

select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  outline: none;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 27px;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  font-size: 15px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.widget-shell {
  width: min(100%, 680px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.visitor-card,
.developer-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.visitor-card {
  padding: 16px;
  display: grid;
  gap: 15px;
}

.visitor-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.brand-name {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.subheading {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.runtime-dot {
  min-width: 72px;
  padding: 7px 9px;
  border-radius: 999px;
  background: #e8f3ef;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
}

.runtime-dot.warn {
  background: #fff4dc;
  color: var(--warn);
}

.record-panel {
  display: grid;
  gap: 11px;
}

.visitor-language {
  grid-template-columns: minmax(0, 1fr);
}

.visitor-language select {
  min-height: 40px;
  background: color-mix(in srgb, var(--page) 65%, #fff);
}

.record-button {
  min-height: 74px;
  border: 0;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 19px;
  font-weight: 850;
}

.record-button.recording {
  background: var(--danger);
}

.record-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.18);
}

.meter {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #d9e5df;
}

.meter-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 120ms linear;
}

.status-line,
.send-status {
  min-height: 19px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.send-status[data-tone="warn"] {
  color: var(--warn);
}

.send-status[data-tone="ok"] {
  color: var(--ok);
}

.preview-panel {
  display: grid;
  gap: 12px;
}

.countdown {
  width: 100%;
  min-height: 48px;
  border-color: #f2d28d;
  background: #fff8e9;
  color: var(--warn);
  font-size: 14px;
  font-weight: 850;
}

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

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 850;
}

.secondary,
.text-button {
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

.text-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.retry {
  justify-self: start;
}

.developer-panel {
  overflow: hidden;
}

.developer-panel summary {
  min-height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.developer-panel summary span:last-child {
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.developer-panel:not([open]) .controls-grid,
.developer-panel:not([open]) .provenance,
.developer-panel:not([open]) .section-heading,
.developer-panel:not([open]) .ledger {
  display: none;
}

.developer-panel[open] summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.controls-grid,
.provenance,
.section-heading,
.ledger {
  margin-left: 14px;
  margin-right: 14px;
}

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

.toggle {
  grid-column: span 3;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
}

.dev-sample {
  grid-column: span 3;
  justify-self: start;
}

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

.provenance {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.provenance strong {
  color: var(--ink);
}

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

.ledger {
  display: grid;
  gap: 8px;
  padding-left: 20px;
  color: var(--muted);
  font-size: 12px;
}

.ledger li {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
}

.hidden {
  display: none !important;
}

@media (max-width: 560px) {
  .widget-shell {
    padding: 10px;
    gap: 10px;
  }

  .visitor-card {
    padding: 14px;
  }

  .visitor-header {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 23px;
  }

  .record-button {
    min-height: 68px;
  }

  .controls-grid,
  .actions {
    grid-template-columns: 1fr;
  }

  .toggle {
    grid-column: auto;
  }
}
