/* Problem page styles (uses variables from app.css) */

/* --- Top header bar --- */
header.top {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr; /* left: back+profile, middle: progress, right: score */
  align-items: center;
  gap: 1rem;
  max-width: 980px;
  margin: 1rem auto 0;
  padding: 0 1rem;
  color: var(--text);
}

/* Left block: back + profile */
header.top .left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

/* Back link (match shop style) */
.back {
  color: var(--text);
  text-decoration: none !important;
  background: #1b2540;
  border: 1px solid var(--border);
  padding: .45rem .7rem;
  border-radius: 10px;
}

/* Profile + avatar + ring */
.profile {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: .5rem;
}
.profile .name {
  font-weight: 600;
  color: var(--text);
  opacity: .95;
}
/* avatar wrapper (36px) with ring overlay support */
.avatar-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0e1626;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  /*overflow: hidden;*/
}
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.avatar-fallback {
  position: absolute;
  font-size: 18px;
  opacity: 0.9;
}
.ring {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  object-fit: contain;
  pointer-events: none;
}

/* points chip under profile */
.profile .profile-points {
  grid-column: 1 / -1;
  margin-top: .35rem;
  width: fit-content;
}
.points-chip {
  padding: .4rem .65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-elev);
  color: var(--text);
  font-weight: 600;
}
.points-chip .points-val { margin-left: .35rem; }

/* Progress */
.progress-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .75rem;
  padding-left: 1.5rem;
  min-width: 100px;
}
.progress {
  height: 10px;
  background: var(--panel-elev);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress .bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  width: 0%;
  transition: width .35s ease;
}
.pct { font-size: .9rem; color: var(--muted); }

.score { text-align: center; color: var(--muted); }
.score strong { color: var(--text); }

/* --- Card --- */
main.card {
  max-width: 980px;
  margin: 1.25rem auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1.5rem;
  position: relative;
  min-height: 200px;
  min-width: 260px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}

.question {
  margin: .25rem 0 1rem;
  font-weight: 700;
  letter-spacing: .2px;
  color: var(--text);
}
.question .q-label {
  color: var(--text);
  opacity: .95;
  margin-right: .5rem;
}
.question .q-text {
  white-space: pre-wrap;
  color: var(--text);
  opacity: .95;
}

/* --- Multiple choice (Problem 1) --- */
ol.choices {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .75rem;
}
ol.choices li {
  opacity: 0;
  transform: translateY(6px) scale(0.98);
}
ol.choices[data-ready="true"] li {
  animation: pop .28s ease forwards;
  animation-delay: calc(var(--i) * 85ms);
}
@keyframes pop {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.choice {
  width: 100%;
  text-align: left;
  background: var(--panel-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .95rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .75rem;
  cursor: pointer;
  transition: transform .06s ease, border-color .12s ease, background .12s ease;
}
.choice:disabled {
  opacity: .7;
  cursor: not-allowed;
}
.choice:hover:not(:disabled),
.choice:focus-visible:not(:disabled) {
  border-color: #3a4a68;
  background: #1d2740;
  transform: translateY(-1px);
  outline: none;
}
.badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #24314d;
  display: grid;
  place-items: center;
  color: #d4e2ff;
  font-weight: 800;
}
.label { line-height: 1.35; }

/* --- Fill-in (Problem 2) --- */
.graph {
  display: grid;
  place-items: center;
  margin: 0 0 1rem;
}
.graph .svg {
  width: min(720px, 100%);
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0e1626;
}

form.fillin {
  display: grid;
  gap: .9rem;
}
.eq {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  font-size: 1.1rem;
  color: var(--text);
}
.eq input {
  width: 3.25rem;
  text-align: center;
  padding: .45rem .4rem;
  background: var(--panel-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-weight: 700;
}
.eq input:disabled { opacity: .65; }
.eq input:focus {
  outline: none;
  border-color: #3a4a68;
  box-shadow: 0 0 0 2px rgba(106,160,255,.15) inset;
}

.actions { display: flex; gap: .5rem; }
.secondary, .primary {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .7rem 1rem;
  background: #152038;
  color: var(--text);
  cursor: pointer;
  text-decoration: none; /* for potential <a class="primary"> use */
  display: inline-block;
}
.primary { background: #1f2d4b; border-color: #334466; }
.primary:disabled { opacity: .6; cursor: not-allowed; }

/* --- Numeric (Problem 3) --- */
form.numeric { display: grid; gap: .5rem; }
.num-wrap { display: flex; gap: .6rem; align-items: center; }
.num-wrap input {
  width: 6.5rem;
  text-align: center;
  padding: .55rem .5rem;
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--panel-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
}
.num-wrap input:disabled { opacity: .65; }
.num-wrap input:focus {
  outline: none;
  border-color: #3a4a68;
  box-shadow: 0 0 0 2px rgba(106,160,255,.15) inset;
}
.num-hint { margin: 0; color: var(--muted); font-size: .9rem; }

/* --- Feedback blocks --- */
.feedback {
  margin: .5rem 0 1rem;
  padding: .6rem .8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  width: fit-content;
  background: #0e1626;
}
.feedback[data-type="correct"] {
  box-shadow: inset 0 0 0 9999px rgba(22,193,114,.12);
  color: #9af0c7;
}
.feedback[data-type="incorrect"] {
  box-shadow: inset 0 0 0 9999px rgba(255,77,77,.12);
  color: #ffb1b1;
}

/* --- Overlay ✔ / ✗ --- */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 72px;
  font-weight: 800;
  pointer-events: none;
  opacity: 0;
  animation: flash .7s ease;
}
.overlay[data-type="correct"] { color: var(--ok); }
.overlay[data-type="incorrect"] { color: var(--bad); }
@keyframes flash {
  0% { opacity: 0; transform: scale(.9); }
  20% { opacity: .95; transform: scale(1); }
  80% { opacity: .95; }
  100% { opacity: 0; }
}
