:root {
  --bg: #0a0a0c;
  --panel: #111114;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f4f5;
  --muted: #8b8b96;
  --free: #e4e4e7;
  --creator: #e879a8;
  --pro: #60a5fa;
  --studio: #fb923c;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

.plan-page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

/* Hero / balance */
.hero {
  text-align: center;
  margin-bottom: 1rem;
  min-height: 0;
}

.plan-seo-head {
  max-width: 42rem;
  margin: 0 auto 1.25rem;
}

.plan-seo-head h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.plan-seo-head p {
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.95rem;
  line-height: 1.55;
}

.usage-banner {
  display: inline-block;
  margin: 0 auto;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.usage-balance {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.toast {
  margin: 0.75rem auto 0;
  max-width: 420px;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #34d399;
  font-size: 0.85rem;
}

/* Toolbar */
.plans-toolbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.plans-promo {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
}

.plans-promo strong {
  color: #fbbf24;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.plans-promo-note {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  opacity: 0.85;
}

.billing-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}

.billing-toggle button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
}

.billing-toggle button.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.billing-toggle .save {
  color: #4ade80;
  font-size: 0.72rem;
}

/* Tier grid */
.tier-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  align-items: stretch;
}

.tier-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 520px;
  padding: 1.35rem 1.25rem 1.5rem;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid var(--border);
}

.tier-card.is-featured {
  min-height: 548px;
  margin-top: -8px;
  border-color: rgba(96, 165, 250, 0.45);
  box-shadow:
    0 0 0 1px rgba(96, 165, 250, 0.2),
    0 0 40px rgba(59, 130, 246, 0.12);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.06) 0%, rgba(255, 255, 255, 0.02) 40%);
}

.tier-card.is-current {
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.35);
}

.tier-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: #3b82f6;
  border: 1px solid rgba(147, 197, 253, 0.4);
  white-space: nowrap;
}

.tier-head {
  margin-bottom: 1rem;
}

.tier-name {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.1;
}

.tier-free .tier-name { color: var(--free); }
.tier-creator .tier-name { color: var(--creator); }
.tier-pro .tier-name { color: var(--pro); }
.tier-studio .tier-name { color: var(--studio); }

.tier-desc {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 220px;
}

.tier-cta {
  margin-bottom: 1.25rem;
}

.tier-btn {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.tier-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.tier-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tier-btn--free {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--text);
}

.tier-btn--creator {
  background: linear-gradient(180deg, #db2777, #be185d);
  color: #fff;
  border: 1px solid rgba(244, 114, 182, 0.35);
}

.tier-btn--pro {
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.15) 25%, transparent 25%),
    linear-gradient(225deg, rgba(59, 130, 246, 0.1) 25%, transparent 25%),
    linear-gradient(180deg, #1e293b, #0f172a);
  background-size: 12px 12px, 12px 12px, 100% 100%;
  color: #fff;
  border: 1px solid rgba(96, 165, 250, 0.35);
}

.tier-btn--studio {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  border: 1px solid rgba(251, 146, 60, 0.4);
}

.tier-price {
  margin-bottom: 0.2rem;
  line-height: 1;
}

.tier-amount {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tier-period {
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.15rem;
}

.tier-billing {
  margin: 0 0 1.15rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.tier-features {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.tier-features li {
  position: relative;
  padding: 0.38rem 0 0.38rem 1.35rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.82);
}

.tier-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0.38rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.tier-free .tier-features li::before { color: var(--free); }
.tier-creator .tier-features li::before { color: var(--creator); }
.tier-pro .tier-features li::before { color: var(--pro); }
.tier-studio .tier-features li::before { color: var(--studio); }

.tier-features li.is-credits {
  font-weight: 700;
  color: var(--text);
}

.tier-creator .tier-features li.is-credits { color: #f9a8d4; }
.tier-pro .tier-features li.is-credits { color: #93c5fd; }
.tier-studio .tier-features li.is-credits { color: #fdba74; }

/* Packs */
.packs {
  margin-top: 2.5rem;
  text-align: center;
}

.packs-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
}

.packs-sub {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.pack-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.pack-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 100px;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.pack-chip:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.pack-chip.is-best {
  border-color: rgba(251, 146, 60, 0.45);
  background: rgba(251, 146, 60, 0.06);
}

.pack-euro {
  font-size: 1.1rem;
  font-weight: 700;
}

.pack-coins {
  font-size: 0.72rem;
  color: var(--muted);
}

.pack-bonus {
  color: #4ade80;
}

/* Loading */
.tier-grid.is-loading,
.pack-row.is-loading {
  min-height: 520px;
  border-radius: 14px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.02) 25%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.02) 75%
  );
  background-size: 200% 100%;
  animation: plan-shimmer 1.2s ease-in-out infinite;
}

body.plan-ready .is-loading {
  animation: none;
  background: none;
  min-height: 0;
}

@keyframes plan-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.foot {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
}

.hidden { display: none !important; }

@media (max-width: 1024px) {
  .tier-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .tier-card.is-featured {
    margin-top: 0;
    min-height: 520px;
  }
}

@media (max-width: 560px) {
  .tier-grid {
    grid-template-columns: 1fr;
  }
  .plan-page {
    padding: 1rem 0.85rem 2.5rem;
  }
}
