:root{
  --teal: #0C4F48;
  --lime: #E0FF0C;
  --ink: #072c28;
  --ink-soft: #35514d;
  --bg-soft: #f6f9ff;
  --card: rgba(255,255,255,0.93);
  --card-strong: rgba(255,255,255,0.97);
  --line: rgba(12,79,72,0.12);
  --line-strong: rgba(224,255,12,0.35);
  --shadow: 0 14px 38px rgba(0,0,0,0.16);
  --shadow-soft: 0 10px 26px rgba(0,0,0,0.12);
  --correct-bg: #dff6e4;
  --correct-border: #42a65a;
  --incorrect-bg: #fff3bf;
  --incorrect-border: #d6b100;
}

*{
  box-sizing: border-box;
}

html{
  scroll-behavior: smooth;
}

html, body{
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body{
  margin: 0;
  font-family: system-ui, Arial, sans-serif;
  color: #0b1f1d;

  background:
    linear-gradient(180deg, rgba(12,79,72,0.88), rgba(12,79,72,0.55)),
    url("../assets/img/karachi_bg.jpg");

  background-size: 110% auto;
  background-position: top center;
  background-repeat: no-repeat;
  background-color: #0C4F48;
  background-attachment: fixed;
}


.container{
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 26px;
  box-sizing: border-box;
}

h1, h2, h3, h4{
  margin: 0 0 12px 0;
  color: #061a18;
  line-height: 1.2;
}

p{
  line-height: 1.6;
  margin: 0 0 12px 0;
}

.screen{
  display: none;
}

.screen.active{
  display: block;
}

#app > .screen{
  background: rgba(246,249,255,0.74);
  border: 1px solid rgba(224,255,12,0.18);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.topbar{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.topbar h1{
  margin-bottom: 0;
}

.lang-btn{
  margin-top: 0;
  min-width: 92px;
  white-space: nowrap;
}

.card,
.question-card,
.review-card,
.intro-card,
.result-card{
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(6px);
}

.card-title{
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--ink);
}

.card-hint{
  opacity: 0.82;
  font-size: 0.94rem;
  margin-bottom: 10px;
  color: var(--ink-soft);
}

.intro-card{
  margin-top: 12px;
}

.question-card,
.review-card{
  margin-top: 16px;
}

.result-card{
  border: 1px solid var(--line-strong);
  box-shadow: 0 14px 40px rgba(0,0,0,0.18);
}

.grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

input[type="number"]{
  width: 100%;
  font-size: 1.05rem;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(12,79,72,0.18);
  background: rgba(255,255,255,0.96);
  color: #06231f;
}

input[type="number"]:focus,
textarea:focus{
  outline: 3px solid rgba(224,255,12,0.45);
  outline-offset: 1px;
  border-color: rgba(12,79,72,0.3);
}

.total-row{
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.ok{
  color: #126c2a;
  font-weight: 800;
}

.warn{
  color: #b34a00;
  font-weight: 800;
}

button{
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(224,255,12,0.35);
  background: var(--teal);
  color: white;
  cursor: pointer;
  font-weight: 800;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}

button:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.16);
}

button:focus{
  outline: 3px solid rgba(224,255,12,0.65);
  outline-offset: 2px;
}

button[disabled]{
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.linklike{
  background: transparent;
  color: var(--lime);
  text-decoration: underline;
  padding: 0;
  border: 0;
  margin-top: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: none;
}

.options-group{
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.option{
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(12,79,72,0.14);
  background: #fff;
  cursor: pointer;
  transition: border-color .12s ease, transform .12s ease, box-shadow .12s ease;
}

.option:hover{
  border-color: rgba(12,79,72,0.28);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.06);
}

.option input{
  margin-top: 4px;
  flex: 0 0 auto;
}

.option span{
  line-height: 1.5;
}

.review-option{
  cursor: default;
  transform: none;
  box-shadow: none;
}

.review-option.correct{
  background: var(--correct-bg);
  border-color: var(--correct-border);
}

.review-option.incorrect{
  background: var(--incorrect-bg);
  border-color: var(--incorrect-border);
}

.review-meta{
  margin-top: 12px;
  padding: 12px;
  background: rgba(12,79,72,0.05);
  border-radius: 12px;
  border: 1px solid rgba(12,79,72,0.08);
}

.review-meta p:last-child{
  margin-bottom: 0;
}

.score-pill{
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
  font-weight: 800;
  margin-bottom: 16px;
}

.result-metric{
  margin-bottom: 16px;
}

.metric-label{
  font-size: 0.95rem;
  color: var(--teal);
  font-weight: 700;
  margin-bottom: 4px;
}

.metric-value{
  font-size: 1.25rem;
  font-weight: 800;
  color: #061a18;
  line-height: 1.35;
}

.persona-box,
.overall-box{
  margin-top: 18px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(12,79,72,0.06);
  border: 1px solid rgba(12,79,72,0.08);
}

.persona-box h3,
.overall-box h3{
  margin-bottom: 8px;
}

#persona-img{
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(12,79,72,0.15);
  margin-top: 12px;
  display: block;
}

textarea{
  width: 100%;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(12,79,72,0.18);
  background: rgba(255,255,255,0.92);
  color: #06231f;
  resize: vertical;
  min-height: 110px;
}

body[dir="rtl"],
.rtl{
  direction: rtl;
}

body[dir="rtl"] .topbar,
.rtl .topbar{
  flex-direction: row-reverse;
}

body[dir="rtl"] .option,
.rtl .option{
  flex-direction: row-reverse;
}

body[dir="rtl"] .metric-value,
.rtl .metric-value,
body[dir="rtl"] .metric-label,
.rtl .metric-label,
body[dir="rtl"] .card-title,
.rtl .card-title,
body[dir="rtl"] .card-hint,
.rtl .card-hint{
  text-align: right;
}

@media (max-width: 768px){
  .container{
    padding: 16px;
  }

  #app > .screen{
    padding: 16px;
    border-radius: 16px;
  }

  .topbar{
    align-items: stretch;
    flex-direction: column;
  }

  .lang-btn{
    align-self: flex-start;
  }

  .grid{
    grid-template-columns: 1fr;
  }

  .metric-value{
    font-size: 1.12rem;
  }
}

@media (max-width: 480px){
  button{
    width: 100%;
  }

  .lang-btn{
    width: auto;
  }

  .option,
  .review-option{
    padding: 10px;
  }
}

.lang-btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.flag{
  font-size: 1.15rem;
  line-height: 1;
}

.quiz-progress{
  display: inline-block;
  margin: 10px 0 6px 0;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
  font-weight: 800;
}

.quiz-nav{
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 12px;
}

.quiz-nav button{
  min-width: 120px;
}

.slide-in-left{
  animation: slideInLeft 260ms ease both;
}

.slide-in-right{
  animation: slideInRight 260ms ease both;
}

@keyframes slideInLeft{
  from{
    opacity: 0;
    transform: translateX(32px);
  }
  to{
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight{
  from{
    opacity: 0;
    transform: translateX(-32px);
  }
  to{
    opacity: 1;
    transform: translateX(0);
  }
}

.comment-box{
  margin-top: 18px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(12,79,72,0.06);
  border: 1px solid rgba(12,79,72,0.08);
}

.lang-btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;

  border: 2px solid var(--lime);
  background: var(--teal);   /* keeps original colour */
  color: white;

  font-weight: 800;
  padding: 8px 12px;
  border-radius: 12px;
  margin-top: 0;
  min-width: 92px;
  white-space: nowrap;
}

.lang-btn:hover{
  background: #0a423d;
}

.flag{
  width: 22px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  display: inline-block;
  flex: 0 0 auto;
}

/* Strong Urdu / RTL localisation */
html[dir="rtl"],
body[dir="rtl"]{
  direction: rtl;
  text-align: right;
}

body[dir="rtl"] h1,
body[dir="rtl"] h2,
body[dir="rtl"] h3,
body[dir="rtl"] h4,
body[dir="rtl"] p,
body[dir="rtl"] .card-title,
body[dir="rtl"] .card-hint,
body[dir="rtl"] .metric-label,
body[dir="rtl"] .metric-value,
body[dir="rtl"] .review-meta,
body[dir="rtl"] .overall-box,
body[dir="rtl"] .persona-box,
body[dir="rtl"] .comment-box{
  text-align: right;
}

/* Keep title on right and language button on left in Urdu */
body[dir="rtl"] .topbar{
  flex-direction: row-reverse;
}

/* Fix option alignment */
body[dir="rtl"] .option{
  flex-direction: row-reverse;
  text-align: right;
}

body[dir="rtl"] .option input{
  margin-left: 10px;
  margin-right: 0;
}

/* Fix quiz navigation: Next should appear on the left in Urdu */
body[dir="rtl"] .quiz-nav{
  flex-direction: row-reverse;
}

/* Keep flag + English label readable inside language button */
.lang-btn{
  direction: ltr;
}

body[dir="rtl"] .lang-btn{
  direction: ltr;
  text-align: center;
}

/* Urdu text readability */
body[dir="rtl"]{
  line-height: 1.8;
}

body[dir="rtl"] .option span{
  line-height: 1.9;
}

/* Final RTL fixes */
body[dir="rtl"] .topbar{
  flex-direction: row !important;
  text-align: right;
}

body[dir="rtl"] .topbar h1{
  text-align: right;
}

body[dir="rtl"] .lang-btn{
  margin-right: auto;
  margin-left: 0;
  direction: ltr;
}

/* Quiz question title */
body[dir="rtl"] .question-card h3{
  text-align: right;
}

/* Keep radio on the right, text after it */
body[dir="rtl"] .option{
  flex-direction: row !important;
  justify-content: flex-start;
  text-align: right;
}

body[dir="rtl"] .option input{
  margin-left: 10px;
  margin-right: 0;
}

/* Keep A/B/C/D labels readable */
body[dir="rtl"] .option span{
  width: 100%;
  text-align: right;
}

/* Keep progress as 1 / 5 */
.quiz-progress{
  direction: ltr;
}