/* =============================================================================
   STARLIGHT — Contador de monedas
   Hereda el sistema visual de starlight-principal.
   1. Tokens        2. Base          3. Utilities     4. Buttons
   5. Overlays      6. Header        7. Hero          8. Workspace
   9. Stage        10. Summary      11. Cards        12. Footer
  13. Motion       14. Responsive   15. Reduced motion
   ============================================================================= */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --violet: #5b2091;
  --violet-600: #6b2ba8;
  --violet-400: #8a4fd0;
  --violet-200: #c9a7ff;
  --magenta: #b0298f;
  --lilac: #c9a7ff;

  --ink-900: #07040d;
  --ink-800: #0b0614;
  --ink-700: #120a20;
  --ink-600: #180e2b;

  --text: #f4effb;
  --muted: #a99ac2;
  --line: rgba(201, 167, 255, 0.14);

  --ok: #4ade80;
  --alert: #f87171;
  --marker: #ff4d5f;

  --font-display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, "Liberation Mono", monospace;

  --container: 1240px;
  --radius: 20px;
  --radius-lg: 28px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. Base ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--ink-900);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
  padding: 0;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

::selection {
  background: rgba(176, 41, 143, 0.4);
  color: #fff;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #050309;
}

::-webkit-scrollbar-thumb {
  background: rgba(138, 79, 208, 0.45);
  border-radius: 999px;
  border: 2px solid #050309;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(201, 167, 255, 0.55);
}

:focus-visible {
  outline: 2px solid var(--lilac);
  outline-offset: 3px;
}

/* 3. Utilities ------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

/* Author display rules would otherwise beat the UA's [hidden] rule. */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--lilac);
}

.eyebrow__line {
  display: block;
  width: 30px;
  height: 1px;
  flex: none;
  background: linear-gradient(90deg, var(--violet-400), transparent);
}

.grad {
  background: linear-gradient(100deg, #d8bfff 0%, #b0298f 55%, #8a4fd0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section {
  position: relative;
  padding: clamp(2.5rem, 5vw, 4rem) 0;
}

.section--tips {
  padding-top: clamp(3rem, 6vw, 5rem);
}

.section__head {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: end;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section__title {
  margin-top: 1.2rem;
  max-width: 18ch;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.section__lead {
  max-width: 46ch;
  padding-bottom: 0.4rem;
  color: var(--muted);
  line-height: 1.75;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1200;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  background: var(--violet);
  color: #fff;
  font-size: 0.85rem;
  transform: translateY(-160%);
  transition: transform 0.3s var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* 4. Buttons --------------------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.92rem 1.55rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-soft),
    background-color 0.4s var(--ease-soft), border-color 0.4s var(--ease-soft),
    color 0.4s var(--ease-soft), opacity 0.3s var(--ease-soft);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn__icon {
  width: 17px;
  height: 17px;
  flex: none;
  transition: transform 0.4s var(--ease-out);
}

.btn:hover .btn__icon {
  transform: translateX(3px);
}

.btn--sm {
  padding: 0.62rem 1.1rem;
  font-size: 0.82rem;
}

.btn--block {
  width: 100%;
  padding: 1.05rem 1.55rem;
  font-size: 0.98rem;
  font-weight: 600;
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #7433b4 0%, var(--violet) 52%, #8f2f95 100%);
  box-shadow: 0 14px 34px -16px rgba(91, 32, 145, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn--primary:hover {
  box-shadow: 0 22px 48px -18px rgba(138, 79, 208, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 25%, rgba(255, 255, 255, 0.22) 50%, transparent 75%);
  transform: translateX(-130%);
  transition: transform 0.9s var(--ease-out);
}

.btn--primary:hover::after {
  transform: translateX(130%);
}

.btn--ghost {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.btn--ghost:hover {
  border-color: rgba(201, 167, 255, 0.32);
  background: rgba(201, 167, 255, 0.07);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:disabled::after {
  display: none;
}

/* 5. Overlays -------------------------------------------------------------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.038;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}

/* 6. Header ---------------------------------------------------------------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: 1.1rem 0;
  border-bottom: 1px solid transparent;
  transition: padding 0.4s var(--ease-soft), background-color 0.4s var(--ease-soft),
    border-color 0.4s var(--ease-soft), backdrop-filter 0.4s var(--ease-soft);
}

.header.is-scrolled {
  padding: 0.7rem 0;
  background: rgba(7, 4, 13, 0.74);
  border-bottom-color: var(--line);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex: none;
}

.brand__mark {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(138, 79, 208, 0.55));
  transition: transform 0.6s var(--ease-out);
}

.brand:hover .brand__mark {
  transform: rotate(90deg);
}

.brand__name {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--text);
}

.header__tag {
  margin-left: auto;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lilac);
  background: rgba(201, 167, 255, 0.04);
}

/* 7. Hero ------------------------------------------------------------------ */
.hero {
  position: relative;
  overflow: hidden;
  padding-top: clamp(6.2rem, 9.5vw, 7.8rem);
  padding-bottom: clamp(0.75rem, 1.6vw, 1.25rem);
}

.hero__aura {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}

.hero__aura--violet {
  top: -30%;
  right: -12%;
  width: 54vw;
  height: 54vw;
  max-width: 820px;
  max-height: 820px;
  opacity: 0.7;
  background: radial-gradient(circle, rgba(91, 32, 145, 0.55), transparent 65%);
}

.hero__aura--magenta {
  bottom: -45%;
  left: -12%;
  width: 40vw;
  height: 40vw;
  max-width: 620px;
  max-height: 620px;
  opacity: 0.42;
  background: radial-gradient(circle, rgba(176, 41, 143, 0.4), transparent 68%);
}

.hero__inner {
  position: relative;
  z-index: 2;
}

.hero__title {
  margin-top: 1.25rem;
  max-width: 20ch;
  font-size: clamp(2.4rem, 4.6vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.038em;
}

.hero__lead {
  margin-top: 1.15rem;
  max-width: 62ch;
  font-size: clamp(0.98rem, 1.1vw, 1.06rem);
  line-height: 1.7;
  color: var(--muted);
}

/* 8. Workspace ------------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.panel {
  position: relative;
  padding: clamp(1.35rem, 2.4vw, 1.9rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.048), rgba(255, 255, 255, 0.012));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.panel--controls {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.panel__note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: -0.5rem;
  font-size: 0.74rem;
  line-height: 1.6;
  color: rgba(169, 154, 194, 0.8);
}

.panel__dot {
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 0.42rem;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.7);
}

.field__legend,
.field__label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  margin-bottom: 0.9rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lilac);
}

.field__num {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border: 1px solid rgba(201, 167, 255, 0.22);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0;
  color: var(--violet-200);
  background: rgba(91, 32, 145, 0.3);
}

.field__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.field__row .field__legend {
  width: auto;
  margin-bottom: 0;
}

.field__value {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--text);
}

.field__help {
  margin-top: 0.65rem;
  font-size: 0.74rem;
  line-height: 1.6;
  color: rgba(169, 154, 194, 0.78);
}

/* Coin selector ------------------------------------------------------------ */
.coins {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.coin {
  position: relative;
  display: block;
  cursor: pointer;
}

.coin input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.coin__face {
  display: grid;
  place-items: center;
  gap: 0.18rem;
  padding: 0.68rem 0.25rem 0.58rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.022);
  text-align: center;
  transition: border-color 0.3s var(--ease-soft), background-color 0.3s var(--ease-soft),
    box-shadow 0.4s var(--ease-soft), transform 0.3s var(--ease-out);
}

.coin:hover .coin__face {
  border-color: rgba(201, 167, 255, 0.3);
  background: rgba(201, 167, 255, 0.06);
  transform: translateY(-1px);
}

.coin input:focus-visible + .coin__face {
  outline: 2px solid var(--lilac);
  outline-offset: 3px;
}

.coin input:checked + .coin__face {
  border-color: rgba(201, 167, 255, 0.55);
  background: linear-gradient(150deg, rgba(116, 51, 180, 0.62), rgba(143, 47, 149, 0.32));
  box-shadow: 0 10px 26px -14px rgba(138, 79, 208, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.coin__value {
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.coin__mm {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  color: rgba(201, 167, 255, 0.68);
}

.coin input:checked + .coin__face .coin__mm {
  color: rgba(244, 239, 251, 0.72);
}

/* Drop zone ---------------------------------------------------------------- */
.drop {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 1.5rem 1rem;
  border: 1px dashed rgba(201, 167, 255, 0.26);
  border-radius: var(--radius);
  background: rgba(7, 4, 13, 0.42);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.35s var(--ease-soft), background-color 0.35s var(--ease-soft),
    box-shadow 0.4s var(--ease-soft);
}

.drop:hover,
.drop:focus-visible {
  border-color: rgba(201, 167, 255, 0.5);
  background: rgba(201, 167, 255, 0.05);
}

.drop.is-drag {
  border-color: var(--violet-400);
  background: rgba(138, 79, 208, 0.14);
  box-shadow: inset 0 0 32px -12px rgba(138, 79, 208, 0.85);
}

.drop.is-set {
  border-style: solid;
  border-color: rgba(74, 222, 128, 0.34);
  background: rgba(74, 222, 128, 0.05);
}

.drop__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 0.35rem;
  border: 1px solid rgba(201, 167, 255, 0.18);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(91, 32, 145, 0.42), rgba(176, 41, 143, 0.12));
  color: var(--lilac);
}

.drop__icon svg {
  width: 20px;
  height: 20px;
}

.drop__title {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.drop__hint {
  font-size: 0.7rem;
  line-height: 1.5;
  color: rgba(169, 154, 194, 0.72);
}

/* Slider ------------------------------------------------------------------- */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--violet-400), rgba(201, 167, 255, 0.18));
  cursor: pointer;
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink-900);
  border-radius: 50%;
  background: linear-gradient(160deg, #d8bfff, var(--violet-400));
  box-shadow: 0 0 0 1px rgba(201, 167, 255, 0.4), 0 4px 12px -2px rgba(138, 79, 208, 0.9);
  transition: transform 0.25s var(--ease-out);
}

.range:hover::-webkit-slider-thumb {
  transform: scale(1.12);
}

.range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid var(--ink-900);
  border-radius: 50%;
  background: linear-gradient(160deg, #d8bfff, var(--violet-400));
  box-shadow: 0 0 0 1px rgba(201, 167, 255, 0.4), 0 4px 12px -2px rgba(138, 79, 208, 0.9);
}

.range::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(201, 167, 255, 0.18);
}

/* 9. Stage ----------------------------------------------------------------- */
.panel--result {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-height: 100%;
}

.result__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.result__label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lilac);
}

.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(280px, 42vh, 460px);
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 40%, rgba(91, 32, 145, 0.14), transparent 70%),
    rgba(5, 3, 9, 0.62);
  overflow: hidden;
}

.stage__canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(56vh, 520px);
  border-radius: 10px;
}

.stage__empty,
.stage__loading {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  text-align: center;
}

.stage__icon {
  color: rgba(201, 167, 255, 0.34);
  margin-bottom: 0.4rem;
}

.stage__icon svg {
  width: 54px;
  height: 54px;
}

.stage__text {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.stage__sub {
  font-size: 0.76rem;
  color: rgba(169, 154, 194, 0.75);
  max-width: 34ch;
}

.stage__spinner {
  width: 34px;
  height: 34px;
  margin-bottom: 0.5rem;
  border: 2px solid rgba(201, 167, 255, 0.18);
  border-top-color: var(--violet-400);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 10. Summary -------------------------------------------------------------- */
.summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1.5rem;
  padding-top: 0.35rem;
}

.summary__block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.summary__block--total {
  align-items: flex-end;
  text-align: right;
}

.summary__key {
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(169, 154, 194, 0.85);
}

.summary__countrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.summary__value {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4.6vw, 3.2rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.summary__total {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.2vw, 2.9rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(100deg, #ffffff 0%, #d8bfff 42%, #b0298f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stepper {
  display: flex;
  gap: 0.3rem;
}

.stepper__btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--lilac);
  transition: border-color 0.25s var(--ease-soft), background-color 0.25s var(--ease-soft),
    color 0.25s var(--ease-soft), transform 0.25s var(--ease-out);
}

.stepper__btn svg {
  width: 18px;
  height: 18px;
}

.stepper__btn:hover {
  border-color: rgba(201, 167, 255, 0.4);
  background: rgba(201, 167, 255, 0.1);
  color: var(--text);
  transform: translateY(-1px);
}

.stepper__btn:active {
  transform: translateY(0);
}

.summary__breakdown {
  grid-column: 1 / -1;
  margin-top: 0.55rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.summary__manual {
  grid-column: 1 / -1;
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--violet-200);
}

.result__hint {
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 12px;
  background: rgba(248, 113, 113, 0.07);
  font-size: 0.78rem;
  line-height: 1.6;
  color: #ffc9c9;
}

.result__hint.is-ok {
  border-color: rgba(74, 222, 128, 0.26);
  background: rgba(74, 222, 128, 0.06);
  color: #b9f5cd;
}

/* 11. Cards ---------------------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  position: relative;
  overflow: hidden;
  padding: clamp(1.6rem, 3vw, 2.4rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  transition: transform 0.5s var(--ease-out), border-color 0.5s var(--ease-soft);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(138, 79, 208, 0.18), transparent 65%);
  opacity: 0;
  transition: opacity 0.5s var(--ease-soft);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(201, 167, 255, 0.28);
}

.card:hover::before {
  opacity: 1;
}

.card__index {
  position: absolute;
  top: 1.5rem;
  right: 1.6rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: rgba(201, 167, 255, 0.32);
}

.card__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 1.4rem;
  border: 1px solid rgba(201, 167, 255, 0.18);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(91, 32, 145, 0.4), rgba(176, 41, 143, 0.12));
  color: var(--lilac);
}

.card__icon svg {
  width: 24px;
  height: 24px;
}

.card__title {
  margin-bottom: 0.7rem;
  font-size: 1.24rem;
  letter-spacing: -0.02em;
}

.card__text {
  font-size: 0.93rem;
  line-height: 1.72;
  color: var(--muted);
}

/* 12. Footer --------------------------------------------------------------- */
.footer {
  position: relative;
  overflow: hidden;
  padding: clamp(3rem, 6vw, 5rem) 0 2rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, var(--ink-900), #050309);
}

.footer__inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 3rem;
  padding-bottom: 3rem;
}

.footer__tagline {
  margin-top: 1.2rem;
  font-size: 0.92rem;
  line-height: 1.8;
  color: var(--muted);
}

.footer__nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  justify-self: end;
  min-width: min(100%, 380px);
}

.footer__heading {
  margin-bottom: 1rem;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--lilac);
}

.footer__col a {
  display: block;
  padding: 0.32rem 0;
  font-size: 0.9rem;
  color: var(--muted);
  transition: color 0.3s var(--ease-soft), transform 0.3s var(--ease-out);
}

.footer__col a:hover {
  color: var(--text);
  transform: translateX(3px);
}

.footer__bottom {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  color: rgba(169, 154, 194, 0.72);
}

.footer__wordmark {
  position: absolute;
  bottom: -2.5vw;
  left: 50%;
  width: min(1080px, 94vw);
  height: auto;
  opacity: 0.045;
  transform: translateX(-50%);
  filter: brightness(0) invert(1);
  pointer-events: none;
}

/* 13. Motion --------------------------------------------------------------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease-out) var(--reveal-delay, 0ms),
    transform 0.9s var(--ease-out) var(--reveal-delay, 0ms);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

.js [data-hero] {
  opacity: 0;
  transform: translateY(24px);
}

body.is-ready [data-hero] {
  opacity: 1;
  transform: none;
  transition: opacity 1s var(--ease-out) var(--hero-delay, 0ms),
    transform 1s var(--ease-out) var(--hero-delay, 0ms);
}

/* 14. Responsive ----------------------------------------------------------- */
@media (max-width: 1024px) {
  .app {
    grid-template-columns: minmax(0, 330px) minmax(0, 1fr);
  }

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

@media (max-width: 960px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel--result {
    min-height: 0;
  }

  .section__head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .section__lead {
    padding-bottom: 0;
  }

  .stage {
    min-height: 240px;
  }

  .stage__canvas {
    max-height: 48vh;
  }
}

@media (max-width: 720px) {
  .cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer__inner {
    grid-template-columns: 1fr;
    gap: 2.2rem;
  }

  .footer__nav {
    justify-self: start;
  }

  .footer__bottom {
    flex-direction: column;
    gap: 0.3rem;
  }
}

@media (max-width: 560px) {
  .coins {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .coin__face {
    padding: 0.6rem 0.15rem 0.5rem;
  }

  .coin__value {
    font-size: 0.84rem;
  }

  .coin__mm {
    font-size: 0.5rem;
  }

  .summary {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .summary__block--total {
    align-items: flex-start;
    text-align: left;
    padding-top: 0.6rem;
    border-top: 1px solid var(--line);
  }

  .summary__breakdown,
  .summary__manual {
    margin-top: 0;
  }

  .header__tag {
    display: none;
  }
}

@media (max-width: 420px) {
  .coins {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 15. Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .js [data-reveal],
  .js [data-hero] {
    opacity: 1 !important;
    transform: none !important;
  }

  .stage__spinner {
    animation: none;
    border-top-color: rgba(201, 167, 255, 0.18);
  }
}
