:root {
  --ink: #172554;
  --muted: #52637a;
  --paper: #f7fbff;
  --card: #ffffff;
  --line: #d8e5f2;
  --blue: #2563eb;
  --cyan: #06b6d4;
  --teal: #0f766e;
  --violet: #7c3aed;
  --active: #14245a;
  --active-dark: #061236;
  --active-soft: #405487;
  --decayed: #8b5cf6;
  --decayed-soft: #d8d0ff;
  --shadow: 0 18px 45px rgba(23, 37, 84, 0.11);
  --soft-shadow: 0 10px 28px rgba(37, 99, 235, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(6, 182, 212, 0.16), transparent 32rem),
    linear-gradient(135deg, #f8fcff 0%, #eef8ff 55%, #f7f5ff 100%);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

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

.hero,
.dashboard,
.chart-card,
.examples-card {
  margin-bottom: 22px;
}

.hero {
  display: block;
}

.hero__content,
.settings-card,
.isotope-card,
.simulation-card,
.chart-card,
.examples-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(216, 229, 242, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero__content {
  position: relative;
  min-height: clamp(220px, 24vw, 300px);
  overflow: hidden;
  padding: 0;
}

.hero__content::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(248, 252, 255, 0.7) 0%, rgba(248, 252, 255, 0.38) 38%, rgba(248, 252, 255, 0.02) 72%),
    linear-gradient(0deg, rgba(23, 37, 84, 0.16), rgba(23, 37, 84, 0));
  content: "";
  pointer-events: none;
}

.hero__title-row {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: inherit;
  align-items: center;
  padding: clamp(20px, 3vw, 34px);
}

.hero__copy {
  position: relative;
  z-index: 3;
  width: min(100%, 590px);
  border: 1px solid rgba(191, 219, 254, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 40px rgba(23, 37, 84, 0.2);
  padding: clamp(16px, 2.4vw, 24px);
  backdrop-filter: blur(8px);
}

.hero__copy .eyebrow {
  color: #075985;
}

.hero__copy h1 {
  color: #061236;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
}

.curie-graphic {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: inherit;
  background: #eef8ff;
  box-shadow: none;
}

.curie-graphic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center right;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3.2vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 16px;
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.02rem;
}

.dashboard {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.settings-card,
.isotope-card,
.simulation-card,
.chart-card,
.examples-card {
  padding: 22px;
}

.control-column {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

.setting-group {
  margin-bottom: 20px;
}

.setting-group label,
.range-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #1e3a8a;
  font-weight: 800;
}

.setting-group p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
}

output {
  flex: 0 0 auto;
  min-width: 58px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 900;
  padding: 5px 9px;
  text-align: center;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
}

.range-scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 5px;
  color: #64748b;
  font-size: 0.76rem;
  text-align: center;
}

.range-scale span:first-child {
  text-align: left;
}

.range-scale span:last-child {
  text-align: right;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 0.78fr;
  gap: 10px;
  margin: 24px 0 18px;
}

button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

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

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(6, 182, 212, 0.35);
  outline-offset: 3px;
}

.primary-button {
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.22);
  color: #fff;
}

.secondary-button {
  border: 1px solid #bfdbfe;
  background: #eef6ff;
  color: #1d4ed8;
}

.language-switcher {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  border: 1px solid rgba(216, 229, 242, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 3px;
  box-shadow: 0 10px 22px rgba(23, 37, 84, 0.12);
  backdrop-filter: blur(8px);
}

.language-button {
  display: inline-flex;
  width: 36px;
  height: 32px;
  min-height: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.language-button:hover {
  transform: none;
}

.language-button[aria-pressed="true"] {
  border-color: var(--teal);
  background: #d9f4ef;
}

.language-button:focus-visible {
  outline: 2px solid rgba(6, 182, 212, 0.4);
  outline-offset: 2px;
}

.flag {
  width: 22px;
  height: 15px;
  border: 1px solid rgba(32, 38, 46, 0.22);
  border-radius: 2px;
  box-shadow: 0 1px 1px rgba(24, 32, 42, 0.12);
}

.flag-pl {
  background: linear-gradient(#fff 0 50%, #dc143c 50% 100%);
}

.flag-en {
  background: url("assets/flag-gb.svg") center / cover no-repeat;
}

.live-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.live-stats div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px 8px;
  text-align: center;
}

.live-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.live-stats strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.isotope-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 251, 255, 0.92));
}

.isotope-card h2 {
  margin-bottom: 14px;
}

.isotope-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.isotope-list div {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px 12px;
}

.isotope-list dt {
  color: #1e3a8a;
  font-weight: 900;
}

.isotope-list dd {
  margin: 0;
  color: #0f766e;
  font-size: 0.92rem;
  font-weight: 850;
  text-align: right;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.section-heading--compact {
  margin-bottom: 12px;
}

.section-heading--compact .eyebrow {
  margin-bottom: 0;
}

.particle-grid {
  display: grid;
  grid-template-columns: repeat(30, minmax(5px, 1fr));
  gap: clamp(1px, 0.18vw, 3px);
  width: min(100%, 790px);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(239, 246, 255, 0.92));
  box-shadow: inset 0 0 0 6px rgba(219, 234, 254, 0.22);
  padding: clamp(6px, 0.9vw, 10px);
}

.particle {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, var(--active-soft) 0 15%, var(--active) 44%, var(--active-dark) 100%);
  box-shadow: 0 2px 6px rgba(6, 18, 54, 0.28);
  transform: scale(1);
  transition:
    background 260ms ease,
    transform 260ms ease,
    opacity 260ms ease,
    box-shadow 260ms ease;
}

.particle.is-decayed {
  background:
    radial-gradient(circle at 30% 28%, #ede9fe 0 18%, var(--decayed-soft) 45%, var(--decayed) 100%);
  box-shadow: 0 1px 4px rgba(91, 33, 182, 0.13);
  opacity: 0.72;
  transform: scale(0.9);
}

.chart-card {
  padding-bottom: 16px;
}

.chart-note {
  max-width: 350px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  text-align: right;
}

.chart-wrap {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: var(--soft-shadow);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.example-card {
  position: relative;
  overflow: hidden;
  min-height: 214px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--soft-shadow);
}

.example-card::after {
  position: absolute;
  right: -26px;
  bottom: -30px;
  width: 104px;
  height: 104px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  content: "";
}

.example-card--carbon {
  border-color: #99f6e4;
  background: linear-gradient(160deg, #ecfeff 0%, #ccfbf1 100%);
}

.example-card--medicine {
  border-color: #fecdd3;
  background: linear-gradient(160deg, #fff1f2 0%, #ffe4e6 100%);
}

.example-card--physics {
  border-color: #ddd6fe;
  background: linear-gradient(160deg, #f5f3ff 0%, #ede9fe 100%);
}

.example-card--geology {
  border-color: #bae6fd;
  background: linear-gradient(160deg, #eff6ff 0%, #dbeafe 100%);
}

.example-icon {
  display: inline-grid;
  width: 50px;
  height: 50px;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 8px;
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.14);
}

.example-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.example-card--carbon .example-icon {
  background: linear-gradient(135deg, #0f766e, #06b6d4);
}

.example-card--medicine .example-icon {
  background: linear-gradient(135deg, #be123c, #f43f5e);
}

.example-card--physics .example-icon {
  background: linear-gradient(135deg, #5b21b6, #7c3aed);
}

.example-card--geology .example-icon {
  background: linear-gradient(135deg, #1d4ed8, #0891b2);
}

.example-card h3,
.example-card p,
.example-icon {
  position: relative;
  z-index: 1;
}

.examples-grid p {
  margin-bottom: 0;
  color: var(--muted);
}

.copyright-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: right;
}

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

  .control-column {
    position: static;
  }

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

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 22px, 1180px);
    padding-top: 14px;
  }

  .settings-card,
  .isotope-card,
  .simulation-card,
  .chart-card,
  .examples-card {
    padding: 17px;
  }

  .hero__content {
    min-height: clamp(210px, 54vw, 280px);
  }

  .section-heading {
    display: block;
  }

  .hero__title-row {
    min-height: inherit;
    padding: 58px 17px 17px;
  }

  .hero__content::after {
    background:
      linear-gradient(90deg, rgba(248, 252, 255, 0.7) 0%, rgba(248, 252, 255, 0.52) 64%, rgba(248, 252, 255, 0.25) 100%),
      linear-gradient(0deg, rgba(23, 37, 84, 0.16), rgba(23, 37, 84, 0));
  }

  .curie-graphic img {
    object-position: 62% center;
  }

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

  .isotope-list div {
    grid-template-columns: 1fr;
  }

  .isotope-list dd {
    text-align: left;
  }

  .chart-note {
    margin-top: 8px;
    text-align: left;
  }

  .particle-grid {
    gap: 1px;
    padding: 6px;
  }
}

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