:root {
  color-scheme: light;
  --bg: #f8fbf9;
  --ink: #0c1728;
  --muted: #526075;
  --line: #dce6e2;
  --panel: rgba(255, 255, 255, .82);
  --inside: #148a2b;
  --outside: #075db9;
  --status: #2f9b31;
  --status-light: #bdf4bd;
  --status-soft: #eef9ee;
  --danger: #f12929;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(47, 155, 49, .08), transparent 30rem),
    radial-gradient(circle at 85% 30%, rgba(7, 93, 185, .08), transparent 26rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 42%, #f6faf8 100%);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 18px calc(env(safe-area-inset-bottom, 0px) + 24px);
}

.topbar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 8px;
  margin: 4px 0 18px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--inside);
}

.brand-mark svg {
  width: 42px;
  height: 42px;
}

.topbar h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(1.35rem, 5vw, 1.8rem);
  line-height: 1.1;
  letter-spacing: 0;
}

.metric-card,
.explain-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(12, 23, 40, .07);
  backdrop-filter: blur(16px);
}

.metric-card {
  padding: 16px 18px;
}

.metric-card--inside {
  border-color: rgba(20, 138, 43, .22);
}

.metric-card--outside {
  border-color: rgba(7, 93, 185, .22);
}

.metric-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.place-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  line-height: 1;
}

.metric-card--inside .metric-title { color: var(--inside); }
.metric-card--outside .metric-title { color: var(--outside); }

.metric-title h2 {
  margin: 0;
  font-size: .98rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: minmax(112px, .85fr) 1.45fr;
  gap: 14px;
}

.inputs {
  display: grid;
  gap: 12px;
  border-right: 1px solid var(--line);
  padding-right: 14px;
}

label span,
.calculated p {
  display: block;
  margin: 0 0 4px;
  color: #26344a;
  font-size: .78rem;
  line-height: 1.25;
}

.value-control {
  width: 100%;
  min-height: 35px;
  border: 0;
  border-radius: 12px;
  margin: 0;
  padding: 4px 8px;
  background: rgba(255, 255, 255, .55);
  color: inherit;
  text-align: left;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.value-control:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--status), transparent 68%);
}

.value-control strong {
  font-size: 1.25rem;
  line-height: 1;
}

.value-control em {
  margin-left: 4px;
  font-style: normal;
  font-weight: 700;
}

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

.calculated p {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding-right: 8px;
}

.calculated p:last-child {
  border-right: 0;
  padding-right: 0;
}

.calculated strong {
  display: block;
  margin-top: 8px;
  color: currentColor;
  font-size: clamp(.92rem, 3.1vw, 1.05rem);
  line-height: 1.15;
  white-space: nowrap;
}

.metric-card--inside .calculated strong { color: var(--inside); }
.metric-card--outside .calculated strong { color: var(--outside); }
.metric-card--outside.is-wet .calculated strong { color: var(--danger); }

.orb-section {
  display: grid;
  place-items: center;
  margin: 16px 0;
}

.orb {
  position: relative;
  width: min(88vw, 360px);
  aspect-ratio: 1 / 1;
  color: var(--status);
}

.orb-svg,
.orb-content {
  position: absolute;
  inset: 0;
}

.orb-halo {
  fill: color-mix(in srgb, var(--status), transparent 93%);
  stroke: color-mix(in srgb, var(--status), transparent 82%);
  stroke-width: 2;
}

.orb-ring {
  fill: none;
  stroke: var(--status);
}

.orb-ring.outer {
  stroke-width: 4;
  opacity: .75;
}

.orb-ring.inner {
  stroke-width: 1.6;
  opacity: .22;
}

.liquid {
  fill: url(#liquidGradient);
  opacity: .9;
}

.liquid-back {
  opacity: .45;
}

.orb-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 58px 48px 48px;
  text-align: center;
  pointer-events: none;
}

.wind-badge {
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
}

.wind-badge svg {
  width: 100%;
  height: 100%;
}

.wind-badge circle {
  fill: color-mix(in srgb, var(--status-light), white 52%);
}

.wind-badge path {
  fill: none;
  stroke: var(--status);
  stroke-width: 4;
  stroke-linecap: round;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--status);
  font-size: .82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.verdict {
  margin: 0;
  color: var(--status);
  font-size: clamp(2.9rem, 14vw, 4.35rem);
  font-weight: 850;
  line-height: .92;
  text-transform: uppercase;
  letter-spacing: 0;
}

.subverdict {
  margin: 12px 0 12px;
  color: var(--status);
  font-size: 1rem;
  font-weight: 750;
}

.fine-line {
  width: 56px;
  height: 1px;
  margin-bottom: 12px;
  background: color-mix(in srgb, var(--status), transparent 76%);
}

.reason {
  margin: 0;
  color: #172235;
  font-size: .98rem;
  line-height: 1.35;
}

.reason strong {
  color: var(--status);
  font-size: 1.35rem;
}

.explain-card {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  margin-top: 20px;
  padding: 17px 18px;
  border-color: color-mix(in srgb, var(--status), transparent 75%);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--status), white 90%), rgba(255, 255, 255, .82) 55%),
    var(--panel);
}

.hint-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--status-light), white 46%);
  color: var(--status);
}

.hint-icon svg {
  width: 32px;
  height: 32px;
}

.hint-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.explain-card h2 {
  margin: 0 0 8px;
  color: var(--status);
  font-size: .96rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.explain-card p {
  margin: 0;
  color: #1a2638;
  font-size: .92rem;
  line-height: 1.55;
}

.edit-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 23, 40, .28);
  backdrop-filter: blur(12px);
}

.edit-modal[hidden] {
  display: none;
}

.edit-panel {
  width: min(100%, 330px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 28px 80px rgba(12, 23, 40, .22);
}

.edit-panel label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 700;
}

.edit-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  color: var(--ink);
  font-size: 1.55rem;
  font-weight: 750;
}

.edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.edit-actions button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: #edf2f5;
  color: #1c2b3d;
  font-weight: 750;
}

.edit-actions button[type="submit"] {
  background: var(--status);
  color: white;
}

.drag-slider {
  position: fixed;
  z-index: 30;
  width: 58px;
  height: 230px;
  display: grid;
  grid-template-rows: 28px 1fr 28px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--status), transparent 72%);
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 22px 60px rgba(12, 23, 40, .18);
  backdrop-filter: blur(14px);
  color: var(--status);
  font-weight: 850;
  touch-action: none;
  user-select: none;
}

.drag-slider[hidden] {
  display: none;
}

.drag-track {
  position: relative;
  width: 8px;
  height: 148px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--status), transparent 84%);
}

.drag-track i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--status);
  box-shadow: 0 6px 16px rgba(12, 23, 40, .2);
  transform: translate(-50%, -50%);
}

@media (max-width: 390px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .metric-card {
    padding: 14px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .inputs {
    grid-template-columns: 1fr 1fr;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 12px;
  }

  .orb {
    width: min(94vw, 340px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
