:root {
  /* Soft daylight — low eye strain, calm biophilic tint */
  --bg0: #eef5f1;
  --bg1: #f7faf8;
  --ink: #2a3531;
  --ink-dim: #5f6f68;
  --accent: #3f8f78;
  --accent-deep: #2f6d5c;
  --accent-soft: rgba(63, 143, 120, 0.12);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --line: rgba(42, 53, 49, 0.1);
  --ok: #2f8a64;
  --warn: #b07a2a;
  --danger: #c45b4d;
  --shadow: 0 10px 30px rgba(47, 109, 92, 0.08);
  --radius: 20px;
  --font: "Avenir Next", "Segoe UI", "Gill Sans", "Helvetica Neue", sans-serif;
  --display: "Avenir Next", "Segoe UI", "Gill Sans", sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg0);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(90% 70% at 0% 0%, rgba(163, 214, 196, 0.45) 0%, transparent 55%),
    radial-gradient(80% 60% at 100% 10%, rgba(186, 210, 230, 0.4) 0%, transparent 50%),
    radial-gradient(70% 50% at 50% 100%, rgba(232, 220, 196, 0.35) 0%, transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  animation: drift 22s ease-in-out infinite alternate;
}

@keyframes drift {
  from {
    transform: scale(1) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.04) translate3d(0, -1.5%, 0);
  }
}

.top {
  display: flex;
  justify-content: flex-end;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 20px 0;
}

.pill {
  margin: 0;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.pill[data-state="online"] {
  color: var(--ok);
  border-color: rgba(47, 138, 100, 0.28);
  background: rgba(47, 138, 100, 0.08);
}

.pill[data-state="offline"] {
  color: var(--warn);
  border-color: rgba(176, 122, 42, 0.3);
  background: rgba(176, 122, 42, 0.08);
}

.app {
  padding: 28px 20px 120px;
  max-width: 440px;
  margin: 0 auto;
}

.screen {
  animation: rise 280ms ease-out both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lede {
  margin: 0 0 1.55rem;
  color: var(--ink);
  font-size: clamp(1.35rem, 5.5vw, 1.7rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.converter {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.5rem;
}

.field-label {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 600;
}

.input-wrap {
  position: relative;
  display: grid;
}

.input-wrap input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  color: var(--ink);
  font: inherit;
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  padding: 1.05rem 3.1rem 1.05rem 1.1rem;
  outline: none;
  box-shadow: var(--shadow);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.input-wrap input[type="text"]:focus {
  border-color: rgba(63, 143, 120, 0.55);
  box-shadow:
    var(--shadow),
    0 0 0 4px var(--accent-soft);
  transform: translateY(-1px);
}

.clear-inside {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  z-index: 2;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(42, 53, 49, 0.08);
  color: var(--ink-dim);
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

.clear-inside[hidden] {
  display: none;
}

.clear-inside:active {
  background: rgba(42, 53, 49, 0.14);
  color: var(--ink);
}

.result {
  margin-top: 0.15rem;
  padding: 1.15rem 1.2rem 1.25rem;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid rgba(63, 143, 120, 0.18);
  background:
    linear-gradient(160deg, rgba(63, 143, 120, 0.12), rgba(255, 255, 255, 0.85));
  box-shadow: var(--shadow);
}

.result-label {
  margin: 0 0 0.4rem;
  color: var(--ink-dim);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.result-value {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.05rem, 9vw, 2.75rem);
  font-weight: 700;
  color: var(--accent-deep);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  animation: tick 220ms ease-out;
}

@keyframes tick {
  from {
    opacity: 0.35;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dock {
  position: fixed;
  left: 50%;
  bottom: calc(14px + var(--safe-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 0.3rem;
  padding: 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 28px rgba(42, 53, 49, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.dock-link {
  position: relative;
  text-decoration: none;
  color: var(--ink-dim);
  padding: 0.65rem 1.15rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  transition: color 160ms ease, background 160ms ease;
}

.dock-link.is-active {
  color: #fff;
  background: var(--accent);
}

.dock-link--soon {
  opacity: 0.7;
}

.soon {
  margin-left: 0.25rem;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.8;
}

.dev-note {
  margin: 0.25rem 0 0;
  color: var(--ink-dim);
  font-size: 1.05rem;
}

.placeholder {
  margin-top: 0.5rem;
  padding: 1.25rem;
  border: 1px dashed rgba(42, 53, 49, 0.18);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-dim);
  line-height: 1.45;
}

.placeholder h2 {
  margin: 0 0 0.5rem;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .atmosphere,
  .screen,
  .result-value {
    animation: none;
  }
}
