/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --black:      #0A0A0A;
  --black-2:    #111111;
  --black-3:    #1A1A1A;
  --black-4:    #242424;
  --gold:       #F0C020;
  --gold-light: #FFD84D;
  --gold-dim:   #A07C10;
  --gold-muted: rgba(240, 192, 32, 0.14);
  --white:      #FFFFFF;
  --white-60:   rgba(255,255,255,0.6);
  --white-30:   rgba(255,255,255,0.3);
  --white-10:   rgba(255,255,255,0.06);
  --red:        #E55;
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  22px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
}

body {
  background-color: var(--black);
  color: var(--white);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-x: hidden;
}

/* ── Background particles ── */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0;
  animation: float linear infinite;
}

@keyframes float {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 0.15; }
  90%  { opacity: 0.08; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ── Page wrapper ── */
.page-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  margin: auto;
}

/* ── Card ── */
.card {
  background: linear-gradient(160deg, #161616 0%, #0E0E0E 60%, #0A0A0A 100%);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: var(--radius-lg);
  padding: 48px 40px 36px;
  box-shadow:
    0 0 0 1px rgba(212,175,55,0.04),
    0 8px 40px rgba(0,0,0,0.7),
    0 0 80px rgba(212,175,55,0.04);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.6;
}

/* ── Header ── */
.card-header {
  text-align: center;
  margin-bottom: 40px;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(240,192,32,0.28);
  border-radius: 50%;
  margin-bottom: 20px;
  background: radial-gradient(circle at 50% 60%, rgba(240,192,32,0.09) 0%, transparent 70%);
  position: relative;
}

.logo-mark::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid rgba(240,192,32,0.07);
}

.title {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: 0.18em;
  color: var(--white);
  margin-bottom: 8px;
}

.title-accent {
  color: var(--gold);
}

.subtitle {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--white-60);
  text-transform: uppercase;
}

.header-divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 24px auto 0;
  opacity: 0.5;
}

/* ── Input ── */
.input-section {
  margin-bottom: 32px;
}

.input-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--white-60);
  margin-bottom: 10px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: var(--black-3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  overflow: hidden;
}

.input-wrapper:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.12), 0 0 20px rgba(212,175,55,0.08);
}

.input-wrapper.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(238,85,85,0.1);
}

.input-prefix {
  padding: 0 14px 0 18px;
  font-size: 20px;
  font-weight: 300;
  color: var(--gold);
  user-select: none;
  line-height: 1;
}

.capital-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--white);
  font-family: 'Inter', sans-serif;
  font-size: 24px;
  font-weight: 600;
  padding: 18px 18px 18px 0;
  letter-spacing: 0.02em;
  width: 100%;
}

.capital-input::placeholder {
  color: rgba(255,255,255,0.2);
  font-weight: 300;
}

/* Chrome autofill */
.capital-input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 100px var(--black-3) inset;
  -webkit-text-fill-color: var(--white);
}

.input-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--red);
  min-height: 16px;
  transition: opacity var(--transition);
}

/* ── Options ── */
.options-section {
  margin-bottom: 32px;
}

.options-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--white-60);
  margin-bottom: 12px;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: var(--black-3);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-md);
  padding: 18px 10px;
  cursor: pointer;
  color: var(--white);
  font-family: 'Inter', sans-serif;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.option-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212,175,55,0.06) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}

.option-btn:hover {
  border-color: rgba(212,175,55,0.35);
  background: rgba(212,175,55,0.05);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(212,175,55,0.12);
}

.option-btn:hover::after {
  opacity: 1;
}

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

.option-btn.active {
  border-color: var(--gold);
  background: rgba(212,175,55,0.1);
  box-shadow: 0 0 0 1px rgba(212,175,55,0.2), 0 6px 28px rgba(212,175,55,0.15);
}

.option-btn.active::after {
  opacity: 1;
}

.option-months {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.02em;
}

.option-btn.active .option-months {
  color: var(--gold-light);
}

.option-rate {
  font-size: 11px;
  font-weight: 500;
  color: var(--white-60);
  letter-spacing: 0.05em;
}

.option-btn.active .option-rate {
  color: var(--gold);
}

/* ── Results ── */
.results-section {
  background: var(--black-3);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.results-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,175,55,0.3), transparent);
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.results-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--white-60);
}

.results-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(212,175,55,0.1);
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: 20px;
  padding: 3px 10px;
  letter-spacing: 0.06em;
  transition: all var(--transition);
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.result-card {
  background: var(--black-4);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all var(--transition);
}

.result-card--total {
  grid-column: 1 / -1;
  background: rgba(212,175,55,0.06);
  border-color: rgba(212,175,55,0.2);
}

.result-card--highlight {
  border-color: rgba(212,175,55,0.14);
}

.result-card-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white-60);
}

.result-card--total .result-card-label {
  color: rgba(212,175,55,0.7);
}

.result-card-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  font-variant-numeric: tabular-nums;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-card-value.updating {
  opacity: 0;
  transform: translateY(6px);
}

.result-card-value--total {
  font-size: 26px;
  color: var(--gold-light);
}

/* ── Progress Bar ── */
.profit-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profit-bar-track {
  width: 100%;
  height: 26px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.05);
}

.profit-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(240,192,32,0.55), var(--gold));
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(240,192,32,0.35);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.profit-bar-pct {
  font-size: 11px;
  font-weight: 700;
  color: #0A0A0A;
  letter-spacing: 0.06em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.4s ease 0.4s;
  text-shadow: none;
  font-family: 'Inter', sans-serif;
}

.profit-bar-pct.visible {
  opacity: 1;
}

.profit-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--white-30);
  letter-spacing: 0.06em;
}

/* ── Footer ── */
.card-footer {
  text-align: center;
}

.card-footer p {
  font-size: 10.5px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.04em;
}

/* ── Shimmer animation on value update ── */
@keyframes shimmer {
  0%   { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.value-appear {
  animation: shimmer 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .card {
    padding: 36px 22px 28px;
  }

  .title {
    font-size: 22px;
    letter-spacing: 0.12em;
  }

  .options-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .option-btn {
    flex-direction: row;
    justify-content: space-between;
    padding: 16px 20px;
  }

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

  .result-card--total {
    grid-column: auto;
  }
}

@media (max-width: 360px) {
  .capital-input {
    font-size: 20px;
  }
}
