/* Fonts loaded via HTML link tag: Mukta (Devanagari), Inter, Poppins */

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

:root {
  --bg: #0a0a14;
  --bg2: #10101e;
  --card: rgba(255,255,255,0.04);
  --card-border: rgba(255,255,255,0.08);
  --red: #DC143C;
  --gold: #F4A300;
  --blue: #003893;
  --text: #EDEDED;
  --muted: #8a8a9a;
  --radius: 16px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Mukta', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(220,20,60,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 100%, rgba(244,163,0,0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.container { max-width: 660px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }

/* HERO */
.hero { text-align: center; padding: 60px 0 30px; }
.hero .flag { display: inline-block; margin-bottom: 12px; animation: float 3s ease-in-out infinite; line-height: 1; }
.hero h1 {
  font-family: 'Mukta', 'Poppins', sans-serif;
  font-size: clamp(2.4rem, 8vw, 3.8rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--red), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.hero .sub {
  font-size: clamp(0.95rem, 3vw, 1.15rem);
  color: var(--muted);
  font-weight: 500;
}
.hero .sub span { color: var(--gold); }

/* INPUT SECTION */
.input-section {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 32px 28px;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}
.input-section label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.input-wrap {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.input-wrap .prefix {
  background: rgba(244,163,0,0.12);
  color: var(--gold);
  font-weight: 700;
  padding: 0 16px;
  display: flex;
  align-items: center;
  border-radius: 12px;
  font-size: 1rem;
  border: 1px solid rgba(244,163,0,0.2);
}
.input-wrap input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  min-width: 0;
}
.input-wrap input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(244,163,0,0.15);
}
.input-wrap input::placeholder { color: #555; }

.calc-btn {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 800;
  font-family: 'Mukta', 'Poppins', sans-serif;
  background: linear-gradient(135deg, var(--red), #e8350f);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}
.calc-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(220,20,60,0.35); }
.calc-btn:active { transform: scale(0.98); }
.calc-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s;
}
.calc-btn:hover::after { transform: translateX(100%); }

/* ERROR */
.error-msg { color: var(--red); font-size: 0.85rem; margin-top: 8px; display: none; font-weight: 500; }
.error-msg.show { display: block; }

/* RESULTS */
#results { display: none; }
#results.show { display: block; }

.result-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.result-card.visible { opacity: 1; transform: translateY(0); }
.result-card h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.05rem;
  margin-bottom: 18px;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* RANK */
.rank-display {
  text-align: center;
  padding: 10px 0 20px;
}
.rank-percent {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold), #ffcc33);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.rank-label {
  font-size: 1rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}
.rank-label b { color: var(--text); }
.rank-remark {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 20px;
  background: rgba(244,163,0,0.1);
  border: 1px solid rgba(244,163,0,0.2);
  border-radius: 30px;
  font-family: 'Mukta', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gold);
}

/* PERCENTILE BAR */
.pbar-wrap { margin-top: 20px; }
.pbar-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin-bottom: 6px; }
.pbar {
  height: 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, #d32f2f, #f57c00, #fbc02d, #66bb6a, #2e7d32);
  position: relative;
  overflow: visible;
}
.pbar-marker {
  position: absolute;
  top: 50%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--gold);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(244,163,0,0.5);
  transition: left 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* STATS GRID */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
}
.stat-box .num {
  font-family: 'Poppins', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.2;
}
.stat-box .lbl {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.3;
}
.stat-box.green .num { color: #66bb6a; }
.stat-box.red .num { color: var(--red); }

.prov-item {
  display: grid;
  grid-template-columns: 140px 1fr 60px;
  grid-template-areas: "name bar pct";
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.prov-item .prov-name {
  grid-area: name;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}
.prov-item .prov-name small { color: var(--muted); font-weight: 400; display: block; font-size: 0.72rem; }
.prov-bar-wrap {
  grid-area: bar;
  height: 22px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.prov-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 0;
  min-width: 4px;
}
.prov-pct {
  grid-area: pct;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold);
  text-align: right;
}

/* BUY SECTION */
.buy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.buy-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 18px 14px;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s;
}
.buy-item:hover { transform: translateY(-3px); border-color: rgba(244,163,0,0.3); }
.buy-item .emoji { font-size: 2rem; margin-bottom: 8px; }
.buy-item .val {
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold);
}
.buy-item .desc { font-size: 0.78rem; color: var(--muted); margin-top: 4px; line-height: 1.3; }

/* SHARE CARD */
.share-card-outer { text-align: center; }
#shareCard {
  background: linear-gradient(145deg, #12122a, #1a0a1a);
  border: 1px solid rgba(244,163,0,0.2);
  border-radius: 20px;
  padding: 36px 28px;
  display: inline-block;
  text-align: center;
  max-width: 380px;
  width: 100%;
  position: relative;
  overflow: hidden;
}
#shareCard::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(220,20,60,0.15), transparent 70%);
  pointer-events: none;
}
#shareCard::after {
  content: '';
  position: absolute;
  bottom: -40px;
  left: -40px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(244,163,0,0.12), transparent 70%);
  pointer-events: none;
}
.sc-flag { font-size: 42px; margin-bottom: 8px; }
.sc-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), #ffcc33);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}
.sc-rank {
  font-family: 'Poppins', sans-serif;
  font-size: 2.8rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  margin-bottom: 4px;
}
.sc-sub, .sc-salary { color: var(--muted); font-size: 0.85rem; margin-bottom: 14px; }
.sc-stats { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; }
.sc-stat { text-align: center; }
.sc-stat .v { font-weight: 700; color: var(--gold); font-size: 0.95rem; }
.sc-stat .l { font-size: 0.7rem; color: var(--muted); }
.sc-brand {
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--red);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 12px;
  margin-top: 4px;
}

.share-btns { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.share-btn {
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  font-family: 'Inter', sans-serif;
  transition: transform 0.2s, box-shadow 0.2s;
}
.share-btn:hover { transform: translateY(-2px); }
.share-btn.dl { background: linear-gradient(135deg, var(--gold), #e8930a); color: #000; }
.share-btn.cp { background: rgba(255,255,255,0.1); color: var(--text); border: 1px solid var(--card-border); }
.share-btn.cp.copied { background: rgba(102,187,106,0.2); border-color: #66bb6a; color: #66bb6a; }

/* FOOTER */
.footer {
  text-align: center;
  padding: 40px 20px 30px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.7;
}
.footer a { color: var(--gold); text-decoration: none; }
.footer .heart { color: var(--red); }
.footer .sources { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--card-border); }

/* ANIMATIONS */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* RESPONSIVE */
@media (max-width: 500px) {
  .hero { padding-top: 40px; }
  .input-section { padding: 24px 18px; }
  .result-card { padding: 22px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .buy-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .prov-item {
    grid-template-areas: 
      "name pct"
      "bar bar";
    grid-template-columns: 1fr auto;
    gap: 6px;
    margin-bottom: 16px;
  }
  .prov-bar-wrap {
    height: 12px;
  }
  .sc-rank { font-size: 2.2rem; }
  .share-btns { flex-direction: column; align-items: stretch; }
}

/* LANGUAGE SELECTOR */
.lang-selector {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  padding: 6px 12px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  z-index: 10;
}
.lang-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}
.lang-btn:hover {
  color: var(--foreground);
}
.lang-btn.active {
  color: var(--gold);
  font-weight: 700;
}
.lang-selector .divider {
  color: rgba(255,255,255,0.15);
  font-size: 0.8rem;
}
@media (max-width: 480px) {
  .lang-selector {
    position: static;
    margin: 0 auto 16px;
    align-self: center;
    width: fit-content;
  }
}

