:root {
  color-scheme: dark;
  --bg: #070914;
  --bg-2: #12162b;
  --panel: rgba(255, 255, 255, 0.09);
  --panel-strong: rgba(255, 255, 255, 0.14);
  --border: rgba(255, 255, 255, 0.18);
  --text: #f7f8ff;
  --muted: #aab1d1;
  --soft: #737b9d;
  --cyan: #5ee7ff;
  --green: #8fffb4;
  --pink: #ff6fd8;
  --amber: #ffd166;
  --danger: #ff7a90;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(94, 231, 255, 0.24), transparent 28rem),
    radial-gradient(circle at 88% 8%, rgba(255, 111, 216, 0.19), transparent 25rem),
    linear-gradient(135deg, var(--bg), var(--bg-2) 48%, #160d28);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), transparent 82%);
}

button,
input {
  font: inherit;
}

button,
input,
canvas {
  max-width: 100%;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 44px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 310px);
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow,
.micro-label {
  margin: 0;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 8px 0 8px;
  font-size: clamp(3rem, 8vw, 7.4rem);
  line-height: 0.88;
  letter-spacing: 0;
}

.subtitle {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
}

.hero-side {
  display: grid;
  justify-items: end;
  gap: 14px;
  min-width: min(100%, 310px);
}

.consultant-quote {
  width: min(100%, 310px);
  margin: 0;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.095), rgba(255, 255, 255, 0.035));
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
  opacity: 0.68;
}

.consultant-quote blockquote {
  margin: 0;
  color: rgba(247, 248, 255, 0.9);
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.3;
}

.consultant-quote figcaption {
  margin-top: 8px;
  color: rgba(170, 177, 209, 0.78);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 128px;
  justify-content: center;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  color: var(--muted);
  font-weight: 800;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 18px rgba(255, 122, 144, 0.8);
}

.status-pill.running .status-dot {
  background: var(--green);
  box-shadow: 0 0 18px rgba(143, 255, 180, 0.95);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.glass-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.055));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.glass-card::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 32%);
  opacity: 0.5;
}

.cost-card,
.controls-card,
.stat-card {
  z-index: 0;
  min-width: 0;
}

.cost-card > *,
.controls-card > *,
.stat-card > * {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.cost-card {
  min-height: 530px;
  padding: clamp(22px, 4vw, 36px);
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.card-topline > div:first-child {
  min-width: 0;
}

.micro-copy {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.pulse-orbit {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
}

.pulse-orbit span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  box-shadow: 0 0 30px rgba(94, 231, 255, 0.65);
}

.pulse-orbit.running span {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.85);
    box-shadow: 0 0 0 0 rgba(143, 255, 180, 0.45), 0 0 30px rgba(94, 231, 255, 0.55);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 24px rgba(143, 255, 180, 0), 0 0 44px rgba(255, 111, 216, 0.42);
  }
  100% {
    transform: scale(0.85);
    box-shadow: 0 0 0 0 rgba(143, 255, 180, 0), 0 0 30px rgba(94, 231, 255, 0.55);
  }
}

.live-cost {
  margin: 56px 0 36px;
  max-width: 100%;
  font-size: clamp(3rem, 8.4vw, 7.2rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(100deg, #ffffff, var(--green), var(--cyan), var(--pink));
  background-size: 240% 100%;
  background-clip: text;
  color: transparent;
  text-shadow: 0 20px 70px rgba(94, 231, 255, 0.2);
  white-space: nowrap;
}

.live-cost[data-amount-size="medium"] {
  font-size: clamp(2.75rem, 7.2vw, 6rem);
}

.live-cost[data-amount-size="large"] {
  font-size: clamp(2.35rem, 6.2vw, 5rem);
}

.live-cost[data-amount-size="huge"] {
  font-size: clamp(2rem, 5.2vw, 4.1rem);
}

.live-cost.running {
  animation: shimmer 2.8s linear infinite;
}

@keyframes shimmer {
  from {
    background-position: 0% 50%;
  }
  to {
    background-position: 240% 50%;
  }
}

.meters {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.34);
}

.meter-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.meter-header span {
  min-width: 0;
}

.meter-header span:last-child {
  max-width: 68%;
  text-align: right;
  overflow-wrap: anywhere;
}

#costChart {
  display: block;
  width: 100%;
  height: 180px;
}

.controls-card {
  padding: 24px;
}

.section-heading h2 {
  margin: 6px 0 20px;
  font-size: 1.35rem;
}

.role-form {
  display: grid;
  gap: 12px;
}

.role-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 94px;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.role-row:focus-within,
.role-row:hover {
  border-color: rgba(94, 231, 255, 0.45);
  background: rgba(255, 255, 255, 0.105);
  transform: translateY(-1px);
}

.role-row span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.role-row small {
  color: var(--soft);
}

.role-row input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  text-align: center;
  font-weight: 900;
  outline: none;
}

.role-row input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(94, 231, 255, 0.16);
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

button {
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  font-weight: 900;
  transition: transform 160ms ease, filter 160ms ease, background 160ms ease, border-color 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

button:active {
  transform: translateY(0);
}

button:focus-visible {
  outline: 3px solid rgba(94, 231, 255, 0.55);
  outline-offset: 3px;
}

.primary-button {
  background: linear-gradient(135deg, #00c2ff, #8fffba);
  color: #07101a;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.ghost-button {
  grid-column: 1 / -1;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--muted);
}

.stats-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.stat-card {
  min-height: 150px;
  padding: 20px;
}

.stat-card strong {
  display: block;
  margin: 14px 0 6px;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}

.stat-card strong[data-amount-size="medium"] {
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
}

.stat-card strong[data-amount-size="large"],
.stat-card strong[data-amount-size="huge"] {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.stat-card span {
  color: var(--muted);
}

.fun-fact-panel {
  margin-top: 18px;
  display: grid;
  justify-items: center;
}

.fun-fact-card {
  position: relative;
  width: min(860px, 100%);
  min-width: 0;
  padding: 22px 26px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(94, 231, 255, 0.12), rgba(255, 111, 216, 0.08)),
    rgba(255, 255, 255, 0.055);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  transform: rotate(-0.55deg);
  overflow: hidden;
}

.fun-fact-card::before {
  position: absolute;
  inset: 10px auto auto -34px;
  width: 120px;
  height: 120px;
  content: "";
  border-radius: 50%;
  background: rgba(143, 255, 180, 0.12);
  filter: blur(4px);
}

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

.fun-fact-card blockquote {
  min-height: 2.1em;
  margin: 10px 0 8px;
  color: rgba(247, 248, 255, 0.94);
  font-size: clamp(1.45rem, 3.2vw, 2.6rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  text-wrap: balance;
}

.fun-fact-card p:last-child {
  max-width: 680px;
  min-height: 2.9em;
  margin: 0;
  color: rgba(170, 177, 209, 0.86);
  font-size: 0.98rem;
  font-weight: 750;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .hero,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: flex-start;
  }

  .hero-side {
    width: 100%;
    justify-items: start;
  }

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

@media (max-width: 560px) {
  .app-shell {
    width: min(calc(100% - 20px), 1180px);
    padding: 18px 0 28px;
  }

  h1 {
    font-size: clamp(2.55rem, 15vw, 4.4rem);
    line-height: 0.92;
  }

  .subtitle {
    font-size: 1rem;
    line-height: 1.45;
  }

  .hero {
    gap: 16px;
    margin-bottom: 16px;
  }

  .hero-side {
    grid-template-columns: 1fr auto;
    align-items: stretch;
    gap: 10px;
  }

  .consultant-quote {
    width: 100%;
    padding: 12px 14px;
  }

  .consultant-quote blockquote {
    font-size: 0.9rem;
  }

  .consultant-quote figcaption {
    font-size: 0.7rem;
  }

  .status-pill {
    min-width: 0;
    padding: 10px 12px;
  }

  .status-pill span:last-child {
    display: none;
  }

  .dashboard-grid,
  .stats-grid {
    gap: 12px;
  }

  .cost-card {
    min-height: auto;
  }

  .cost-card,
  .controls-card {
    padding: 16px;
  }

  .card-topline,
  .meter-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .pulse-orbit {
    display: none;
  }

  .live-cost {
    margin: 30px 0 22px;
    font-size: clamp(2.45rem, 13vw, 4.1rem);
  }

  .live-cost[data-amount-size="medium"] {
    font-size: clamp(2.1rem, 11vw, 3.4rem);
  }

  .live-cost[data-amount-size="large"] {
    font-size: clamp(1.75rem, 9vw, 2.8rem);
  }

  .live-cost[data-amount-size="huge"] {
    font-size: clamp(1.45rem, 7.5vw, 2.25rem);
  }

  .meters {
    padding: 14px;
  }

  .meter-header span:last-child {
    max-width: none;
    text-align: left;
  }

  #costChart {
    height: 142px;
  }

  .stats-grid,
  .button-grid {
    grid-template-columns: 1fr;
  }

  .ghost-button {
    grid-column: auto;
  }

  .role-row {
    grid-template-columns: minmax(0, 1fr) 78px;
    padding: 12px;
  }

  .role-row strong,
  .role-row small,
  .stat-card span {
    line-height: 1.35;
  }

  .stat-card {
    min-height: 126px;
    padding: 16px;
  }

  .fun-fact-panel {
    margin-top: 12px;
  }

  .fun-fact-card {
    padding: 18px;
    transform: none;
  }

  .fun-fact-card blockquote {
    min-height: auto;
    font-size: clamp(1.25rem, 7vw, 2rem);
  }

  .fun-fact-card p:last-child {
    min-height: auto;
  }
}

@media (max-width: 390px) {
  .app-shell {
    width: min(calc(100% - 16px), 1180px);
  }

  .hero-side {
    grid-template-columns: 1fr;
  }

  .status-pill {
    justify-self: start;
  }

  .status-pill span:last-child {
    display: inline;
  }

  .role-row {
    grid-template-columns: minmax(0, 1fr) 70px;
    gap: 10px;
  }

  .role-row input {
    min-height: 44px;
  }

  button {
    min-height: 46px;
  }
}

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