:root {
  color-scheme: light;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #0f766e;
  --paper: #ffffff;
  --background: #f5f7fa;
  --track: #f1f5f9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--background);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

::selection {
  color: #ffffff;
  background: var(--accent);
}

.page {
  display: grid;
  place-items: start center;
  min-height: 100vh;
  padding: 40px 24px;
}

.shell {
  width: min(100%, 560px);
}

.brand {
  margin: 0 0 32px;
  color: #0f172a;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.04em;
}

.brand-dot { color: var(--accent); }

.card {
  padding: 24px;
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.07), 0 2px 6px rgba(15, 23, 42, 0.03);
}

.eyebrow {
  margin: 0 0 20px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

input {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

input::placeholder { color: #94a3b8; }

input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  align-items: flex-end;
}

.row > .field { flex: 1 1 160px; }

/* Tabs */

.tabs {
  display: flex;
  gap: 4px;
  margin: 24px 0 0;
  padding: 4px;
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 999px;
  background: var(--track);
}

.tab {
  flex: 1;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.tab:hover { color: var(--ink); }

.tab[aria-selected="true"] {
  border-color: var(--line);
  color: #ffffff;
  background: var(--accent);
}

.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tabpanel {
  margin-top: 16px;
  padding: 24px;
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.07), 0 2px 6px rgba(15, 23, 42, 0.03);
}

/* Buttons */

.button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #334155;
  background: var(--paper);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.button:hover { border-color: #cbd5e1; color: #0f172a; }
.button:disabled { cursor: not-allowed; opacity: 0.5; }

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

.button-primary {
  border-color: transparent;
  color: #ffffff;
  background: var(--accent);
}

.button-primary:hover { color: #ffffff; background: #115e59; }
.button-primary:disabled { background: var(--accent); }

.button-block { width: 100%; }

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

/* Segmented control */

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--track);
}

.segmented .button {
  border-color: transparent;
  background: none;
}

.segmented .button:hover { border-color: transparent; background: #e2e8f0; }

.segmented .button[aria-pressed="true"] {
  border-color: var(--line);
  color: #ffffff;
  background: var(--accent);
}

/* Result */

.result {
  margin: 16px 0 0;
  padding: 20px 24px;
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-left: 3px solid var(--accent);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.07), 0 2px 6px rgba(15, 23, 42, 0.03);
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

/* Footer */

.settings {
  margin-top: 24px;
  text-align: center;
}

.hint {
  max-width: 46ch;
  margin: 10px auto 0;
  color: #94a3b8;
  font-size: 12px;
}

@media (max-width: 520px) {
  .page { min-height: auto; padding: 32px 16px 24px; }
  .brand { margin-bottom: 24px; }
  .card, .tabpanel, .result { padding: 20px; border-radius: 18px; }
  .result { font-size: 16px; }
  .button { min-height: 40px; padding: 0 14px; font-size: 13px; }
  .tab { font-size: 12px; padding: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}