:root {
  --bg: #f5f5f7;
  --bg-soft: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --surface-muted: rgba(248, 250, 255, 0.88);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.12);
  --text: #0f172a;
  --muted: #5a6478;
  --accent: #0a84ff;
  --accent-strong: #0071e3;
  --accent-soft: rgba(10, 132, 255, 0.14);
  --green: #30d158;
  --pink: #ff375f;
  --orange: #ff9f0a;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 14px 38px rgba(15, 23, 42, 0.06);
  --content-width: 1240px;
  --page-padding: 1.25rem;
  --grid-gap: 1.4rem;
  --panel-gap: 1rem;
  --section-gap: 1.15rem;
  --card-gap: 0.9rem;
  --panel-radius: 2rem;
  --card-radius: 1.5rem;
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 10%, rgba(10, 132, 255, 0.14), transparent 26%),
    radial-gradient(circle at 88% 12%, rgba(255, 55, 95, 0.13), transparent 24%),
    radial-gradient(circle at 78% 84%, rgba(48, 209, 88, 0.14), transparent 24%),
    radial-gradient(circle at 18% 88%, rgba(255, 159, 10, 0.12), transparent 24%),
    linear-gradient(180deg, #fbfbfd 0%, #f3f5fa 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.52) 0%,
    rgba(255, 255, 255, 0.12) 100%
  );
  pointer-events: none;
}

.ambient {
  position: fixed;
  width: 32rem;
  height: 32rem;
  border-radius: 50%;
  filter: blur(56px);
  opacity: 0.95;
  pointer-events: none;
  z-index: 0;
}

.ambient-left {
  top: -9rem;
  left: -8rem;
  background: radial-gradient(circle, rgba(90, 200, 250, 0.3), transparent 68%);
  animation: floatBlob 14s ease-in-out infinite;
}

.ambient-right {
  right: -10rem;
  top: 18rem;
  background: radial-gradient(circle, rgba(255, 55, 95, 0.2), transparent 68%);
  animation: floatBlob 16s ease-in-out infinite reverse;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(var(--content-width), calc(100% - (var(--page-padding) * 2)));
  margin: 0 auto;
  padding: 3.5rem 0 4rem;
  display: grid;
  gap: 2rem;
}

.hero {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.9rem var(--grid-gap);
  margin: 0;
  text-align: center;
  justify-items: center;
}

.hero > * {
  grid-column: 2 / span 10;
}

.eyebrow,
.panel-kicker,
.metric-label,
.ticker-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin: 0;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  backdrop-filter: blur(18px);
}

.hero h1 {
  margin: 0;
  max-width: 11ch;
  font-size: clamp(2.6rem, 6vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: -0.065em;
  font-weight: 700;
}

.lead {
  margin: 0;
  max-width: 40rem;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.62;
  letter-spacing: -0.015em;
}

.layout {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--grid-gap);
  align-items: start;
}

.form-panel {
  grid-column: span 5;
}

.result-panel {
  grid-column: span 7;
}

.panel {
  position: relative;
  padding: 1.7rem;
  border-radius: var(--panel-radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px);
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.72),
    rgba(255, 255, 255, 0.18)
  );
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  pointer-events: none;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.form-panel,
.result-panel {
  display: grid;
  gap: var(--panel-gap);
  align-self: start;
}

.panel-header,
.result-intro {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  justify-items: center;
  text-align: center;
}

.panel h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 700;
}

.calculator-form,
.form-section {
  display: grid;
  gap: var(--section-gap);
}

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

.field-label {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

legend.field-label {
  width: 100%;
  padding: 0;
  margin-bottom: 0.65rem;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 4rem;
  padding: 0 1rem 0 1.2rem;
  border-radius: 1.35rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 4px 16px rgba(15, 23, 42, 0.04);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease,
    background 180ms ease;
}

.input-shell:focus-within {
  border-color: rgba(10, 132, 255, 0.45);
  background: #ffffff;
  box-shadow:
    0 0 0 6px rgba(10, 132, 255, 0.12),
    0 12px 28px rgba(10, 132, 255, 0.08);
  transform: translateY(-1px);
}

input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  outline: none;
}

input::placeholder {
  color: rgba(90, 100, 120, 0.72);
}

.input-suffix {
  color: var(--muted);
  font-weight: 700;
}

.schedule-fieldset,
.mode-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.mode-grid,
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--card-gap);
}

.mode-option,
.schedule-option {
  display: block;
}

.mode-option input,
.schedule-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-card,
.schedule-card {
  display: grid;
  gap: 0.34rem;
  min-height: 6rem;
  padding: 1rem 1.05rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 249, 253, 0.92));
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.mode-card strong,
.schedule-card strong {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.mode-card small,
.schedule-card small {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.mode-option input:checked + .mode-card,
.schedule-option input:checked + .schedule-card {
  transform: translateY(-2px);
  border-color: rgba(10, 132, 255, 0.28);
  background:
    radial-gradient(circle at top right, rgba(255, 55, 95, 0.12), transparent 38%),
    radial-gradient(circle at bottom left, rgba(10, 132, 255, 0.14), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 255, 0.96));
  box-shadow:
    0 16px 32px rgba(10, 132, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--card-gap);
}

.hidden {
  display: none;
}

.mode-hint,
.schedule-hint,
.result-status,
.ticker-caption,
.formula-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  letter-spacing: -0.015em;
}

.mode-hint,
.schedule-hint,
.formula-note {
  padding: 1rem 1.1rem;
  border-radius: 1.35rem;
  border: 1px solid rgba(15, 23, 42, 0.06);
  background: rgba(255, 255, 255, 0.62);
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  padding-top: 0.15rem;
}

.primary-button,
.ghost-button {
  min-height: 3.7rem;
  padding: 0 1.35rem;
  border-radius: 999px;
  border: 0;
  font: inherit;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.primary-button {
  color: #ffffff;
  background: linear-gradient(135deg, #0071e3 0%, #0a84ff 56%, #5ac8fa 100%);
  box-shadow: 0 18px 34px rgba(10, 132, 255, 0.24);
}

.ghost-button {
  color: var(--text);
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.primary-button:hover,
.ghost-button:hover,
.primary-button:focus-visible,
.ghost-button:focus-visible {
  transform: translateY(-2px);
}

.per-second-card {
  padding: 1.5rem;
  border-radius: 1.85rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(circle at top left, rgba(10, 132, 255, 0.26), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 55, 95, 0.18), transparent 32%),
    radial-gradient(circle at bottom left, rgba(48, 209, 88, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 255, 0.92));
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.08);
}

.metric-label {
  margin-bottom: 0.8rem;
}

.per-second-value,
.earned-number,
.elapsed-time,
.stat-card strong {
  font-variant-numeric: tabular-nums lining-nums;
}

.per-second-value {
  display: block;
  font-size: clamp(2.4rem, 4vw, 4.2rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--card-gap);
  margin: 0;
}

.stat-card {
  display: grid;
  align-content: space-between;
  gap: 0.8rem;
  min-height: 7.4rem;
  padding: 1.05rem;
  border-radius: var(--card-radius);
  border: 1px solid rgba(15, 23, 42, 0.07);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 255, 0.88));
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
}

.stat-card span {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.stat-card strong {
  display: block;
  font-size: 1.18rem;
  letter-spacing: -0.035em;
  font-weight: 700;
}

.ticker-card {
  position: relative;
  padding: 1.35rem;
  border-radius: 1.85rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(circle at top right, rgba(255, 55, 95, 0.34), transparent 30%),
    radial-gradient(circle at bottom left, rgba(10, 132, 255, 0.34), transparent 30%),
    linear-gradient(145deg, #09101f 0%, #111827 52%, #0f1b35 100%);
  color: #f8fbff;
  box-shadow: 0 26px 56px rgba(7, 13, 30, 0.26);
}

.ticker-card::before {
  content: "";
  position: absolute;
  inset: auto -10% -40% auto;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(90, 200, 250, 0.32), transparent 68%);
  filter: blur(18px);
}

.ticker-card > * {
  position: relative;
  z-index: 1;
}

.ticker-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.ticker-topline > div {
  display: grid;
  gap: 0.35rem;
}

.ticker-label {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
}

.ticker-caption {
  margin-top: 0.6rem;
  color: rgba(238, 244, 255, 0.74);
}

.elapsed-time {
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.98rem;
  font-weight: 600;
  white-space: nowrap;
}

.earned-number {
  margin-top: 1.1rem;
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  line-height: 0.94;
  letter-spacing: -0.07em;
  font-weight: 700;
  text-shadow: 0 0 30px rgba(90, 200, 250, 0.14);
  animation: pulseGlow 3.2s ease-in-out infinite;
}

.ticker-bar {
  margin-top: 1.25rem;
  width: 100%;
  height: 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.ticker-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5ac8fa 0%, #0a84ff 48%, #30d158 100%);
  transition: width 180ms linear;
}

.formula-note {
  margin: 0;
}

.reveal {
  animation: revealUp 760ms cubic-bezier(0.2, 1, 0.22, 1) both;
}

.reveal:nth-child(2) {
  animation-delay: 120ms;
}

@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatBlob {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  50% {
    transform: translate3d(0, -16px, 0) scale(1.04);
  }
}

@keyframes pulseGlow {
  0%,
  100% {
    transform: translateY(0);
    opacity: 1;
  }

  50% {
    transform: translateY(-2px);
    opacity: 0.96;
  }
}

@media (max-width: 1040px) {
  :root {
    --grid-gap: 1rem;
    --panel-gap: 0.95rem;
  }

  .hero > * {
    grid-column: 1 / -1;
  }

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

  .form-panel,
  .result-panel {
    grid-column: auto;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  :root {
    --page-padding: 0.8rem;
    --grid-gap: 0.85rem;
    --panel-gap: 0.85rem;
    --section-gap: 1rem;
    --card-gap: 0.75rem;
    --panel-radius: 1.55rem;
    --card-radius: 1.25rem;
  }

  .page-shell {
    padding-top: 1.25rem;
    padding-bottom: 2rem;
    gap: 1.15rem;
  }

  .panel {
    padding: 1.15rem;
  }

  .eyebrow,
  .panel-kicker,
  .metric-label,
  .ticker-label {
    padding: 0.45rem 0.8rem;
    font-size: 0.72rem;
  }

  .hero h1 {
    max-width: 9.5ch;
    font-size: clamp(2.15rem, 10vw, 3.2rem);
  }

  .lead {
    max-width: 30rem;
    font-size: 0.98rem;
    line-height: 1.56;
  }

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

  .ticker-topline {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .elapsed-time {
    align-self: flex-start;
  }

  .per-second-card,
  .ticker-card {
    padding: 1.15rem;
    border-radius: 1.45rem;
  }

  .per-second-value {
    font-size: clamp(2.15rem, 11vw, 3.35rem);
  }

  .earned-number {
    font-size: clamp(2.3rem, 12vw, 3.8rem);
  }

  .stat-card {
    min-height: 6.6rem;
    padding: 0.95rem;
  }
}

@media (max-width: 560px) {
  .mode-grid,
  .schedule-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    max-width: 9.5ch;
  }

  .input-shell {
    min-height: 3.7rem;
    padding-inline: 1rem;
  }

  input {
    font-size: 1rem;
  }

  .panel h2 {
    font-size: 1.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
