/* Tokens */
:root {
  --bg: #0b0b0d;
  --fg: #f2f2f4;
  --fg-strong: #f4f4f6;
  --field-bg: #131315;
  --output-bg: #0e0e10;
  --mono: 'Geist Mono', ui-monospace, monospace;
  --sans: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-tap-highlight-color: transparent;
}
::selection { background: rgba(255,255,255,.18); }

.app {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 40px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
}
.wordmark {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: rgba(255,255,255,.5);
  padding: 0;
  transition: color 200ms;
}
.wordmark:hover { color: rgba(255,255,255,.85); }
.topbar-tag { color: rgba(255,255,255,.28); }

/* Stage */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 24px 48px;
}
.panel {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
}

/* Preview */
.segmented {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 4px;
}
.seg {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .02em;
  white-space: nowrap;
  border: none;
  border-radius: 999px;
  padding: 8px 15px;
  background: transparent;
  color: rgba(255,255,255,.55);
  transition: background 200ms, color 200ms;
}
.seg[aria-pressed="true"] {
  background: #ededf0;
  color: var(--bg);
}

.segmented--sm { padding: 3px; gap: 3px; }
.segmented--sm .seg { font-size: 11px; padding: 5px 11px; }

.preview-stage {
  height: 190px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.preview-stage.is-capped::after {
  content: "preview scaled to fit";
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .04em;
  color: rgba(255,255,255,.3);
  pointer-events: none;
}
.preview-text {
  font-weight: 600;
  color: var(--fg-strong);
  line-height: .95;
  letter-spacing: -0.02em;
  font-size: 56px;
  outline: none;
  cursor: text;
  caret-color: rgba(255,255,255,.6);
  border-radius: 10px;
  padding: 0 6px;
  max-width: 100%;
  white-space: nowrap;
  text-align: center;
  transition: box-shadow 160ms;
}
.preview-text:focus { box-shadow: none; }
.preview-text.is-placeholder-size { color: rgba(255,255,255,.3); }
.preview-element.is-placeholder-size { opacity: .3; }
.preview-text:empty::before {
  content: attr(data-placeholder);
  color: rgba(255,255,255,.25);
  font-size: 40px;
}
.preview-element {
  background: #e9e9ec;
  border-radius: 22%;
  width: 56px;
  height: 56px;
}

/* Slider */
.slider-block {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.range {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  height: 18px;
  width: 100%;
}
.range::-webkit-slider-runnable-track {
  height: 2px; border-radius: 999px; background: rgba(255,255,255,.16);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; margin-top: -8px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #ededf0; border: 4px solid var(--bg);
  box-shadow: 0 0 0 1px rgba(255,255,255,.35);
}
.range::-moz-range-track {
  height: 2px; border-radius: 999px; background: rgba(255,255,255,.16);
}
.range::-moz-range-thumb {
  width: 12px; height: 12px; border: 4px solid var(--bg);
  border-radius: 50%; background: #ededf0;
  box-shadow: 0 0 0 1px rgba(255,255,255,.35);
}
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px rgba(255,255,255,.7); }
.range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px rgba(255,255,255,.7); }

.slider-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(255,255,255,.5);
}
.slider-meta { display: flex; align-items: center; gap: 8px; }
.slider-sep { opacity: .4; }
.slider-labels .val { color: var(--fg); }

.divider {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 40px 0 36px;
}

/* Fields */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.field-grid--gap { margin-top: 18px; }
.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.field-label {
  font-size: 15px;
  font-weight: 500;
  color: #e8e8ea;
}
.field-input {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--field-bg);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 160ms;
}
.field-input:focus-within { border-color: rgba(255,255,255,.28); }
.num {
  -moz-appearance: textfield;
  appearance: textfield;
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: .01em;
}
.num::placeholder { color: rgba(255,255,255,.25); }
.num::-webkit-outer-spin-button,
.num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.unit {
  font-family: var(--mono);
  font-size: 13px;
  color: rgba(255,255,255,.35);
}

/* Unit toggle */
.unit-toggle {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

/* Output */
.warn {
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 12px;
  color: #ffb4a2;
  background: rgba(255,120,90,.08);
  border: 1px solid rgba(255,120,90,.25);
  border-radius: 10px;
  padding: 10px 14px;
}
.warn[hidden] { display: none; }

.output-row {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.output-btns {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.clear-btn {
  cursor: pointer;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  padding: 15px 22px;
  white-space: nowrap;
  background: transparent;
  color: #e8e8ea;
  transition: border-color 140ms;
}
.clear-btn:hover { border-color: rgba(255,255,255,.4); }
.hint {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,.3);
  text-align: center;
  letter-spacing: .02em;
}
.hint kbd {
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(255,255,255,.6);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 4px;
  padding: 1px 5px;
}
.warn a {
  color: inherit;
  text-decoration: underline;
}
.warn--soft {
  color: #ffd9a0;
  background: rgba(255,190,90,.08);
  border-color: rgba(255,190,90,.25);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}
.warn-text { flex: 1; }
.warn--soft a { text-decoration: underline; }
.warn-dismiss {
  flex-shrink: 0;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  opacity: .55;
  font-size: 13px;
  line-height: 1.5;
  padding: 2px 4px;
}
.warn-dismiss:hover { opacity: 1; }
.output {
  width: 100%;
  background: var(--output-bg);
  border: 1px dashed rgba(255,255,255,.22);
  border-radius: 12px;
  padding: 15px 18px;
  font-family: var(--mono);
  font-size: 15px;
  color: #dcdce0;
  overflow-x: auto;
  white-space: nowrap;
}
.copy-btn {
  cursor: pointer;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  border: none;
  border-radius: 12px;
  padding: 15px 22px;
  white-space: nowrap;
  background: var(--fg-strong);
  color: var(--bg);
  box-shadow: none;
  transition: opacity 180ms, background 140ms, color 140ms, box-shadow 140ms;
}
.copy-btn.copied {
  background: transparent;
  color: #e8e8ea;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.3);
}

/* Footer */
.footer {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 28px 24px 34px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  color: rgba(255,255,255,.3);
  text-align: center;
}
.footer-accent { color: rgba(255,255,255,.5); }
.footer .dot { opacity: .5; }
.footer-link {
  color: rgba(255,255,255,.5);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 140ms;
}
.footer-link:hover { color: rgba(255,255,255,.8); }
.footer-heart { color: inherit; }
.footer-ver { opacity: .6; }

@media (max-width: 480px) {
  .topbar { padding: 22px 20px; }
  .stage { padding: 8px 18px 40px; }
  .field-grid { gap: 14px; }
  .field-label { font-size: 14px; }
  .output-btns { justify-content: stretch; }
  .output-btns .clear-btn,
  .output-btns .copy-btn { flex: 1; padding: 14px 16px; }
  .footer { font-size: 10px; padding: 24px 18px 30px; }
}

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