/* ============================================================
   Helm — Learn Kubernetes
   Design: Duolingo mechanics (real benchmark) + Kubernetes
   nautical brand. Anti-slop: real brand colour, one warm
   accent, rounded tactile components, Nunito display.
   ============================================================ */

:root {
  /* Brand — Kubernetes blue is the anchor */
  --k8s:        #326CE5;
  --k8s-press:  #2152b8;   /* the 3D bottom edge */
  --k8s-soft:   #E8F0FF;
  --navy:       #14233D;   /* deep-sea text */
  --ink:        #1f2d44;
  --slate:      #5B6B85;
  --muted:      #8A99B5;
  --line:       #E4EAF3;
  --line-strong:#CBD6E8;

  /* Surfaces — warm off-white, not stark */
  --bg:         #F5F8FC;
  --bg-2:       #EAF1FA;
  --card:       #FFFFFF;

  /* Feedback — Duolingo's beloved green/coral + brass accent */
  --green:      #58CC02;
  --green-press:#46A302;
  --green-soft: #E9F8DA;
  --green-ink:  #3a8a00;
  --coral:      #FF4B4B;
  --coral-press:#E03A3A;
  --coral-soft: #FFE4E4;
  --coral-ink:  #C42626;
  --amber:      #FF9600;   /* streak / single warm accent */
  --gold:       #FFB020;

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --shadow: 0 2px 0 var(--line-strong);
  --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Buttons: tactile 3D press ---------- */
.btn {
  border: 0;
  border-radius: var(--r-md);
  padding: 14px 20px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--k8s);
  box-shadow: 0 4px 0 var(--k8s-press);
  transition: transform .06s ease, box-shadow .06s ease, background .15s ease;
  text-transform: uppercase;
  user-select: none;
}
.btn .btn-label { display: inline-block; }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--k8s-press); }
.btn:disabled { background: var(--bg-2); color: var(--muted); box-shadow: 0 4px 0 var(--line-strong); cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 14px; font-size: 13px; }
.btn-primary { background: var(--k8s); box-shadow: 0 4px 0 var(--k8s-press); }
.btn-green   { background: var(--green); box-shadow: 0 4px 0 var(--green-press); }
.btn-green:active:not(:disabled) { box-shadow: 0 1px 0 var(--green-press); }
.btn-coral   { background: var(--coral); box-shadow: 0 4px 0 var(--coral-press); }
.btn-coral:active:not(:disabled) { box-shadow: 0 1px 0 var(--coral-press); }
.btn-ghost {
  background: transparent; color: var(--slate);
  box-shadow: none; border: 2px solid var(--line-strong);
  text-transform: none; font-weight: 700;
}
.btn-ghost:active { transform: translateY(1px); }
.iconbtn { background: none; border: 0; padding: 4px; display: inline-flex; }

/* ---------- Screen scaffolding ---------- */
.screen { min-height: 100%; }

/* ============ LOGIN ============ */
.login {
  display: flex; align-items: center; justify-content: center;
  padding: calc(28px + var(--safe-top)) 20px calc(28px + var(--safe-bot));
  background:
    radial-gradient(120% 80% at 50% -10%, var(--k8s-soft) 0%, var(--bg) 55%);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  padding: 32px 26px 26px;
  box-shadow: 0 14px 40px rgba(20,35,61,.10);
}
.brand { text-align: center; margin-bottom: 22px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 84px; height: 84px; border-radius: 26px;
  background: var(--k8s); box-shadow: 0 6px 0 var(--k8s-press);
  margin-bottom: 14px;
}
.brand-name {
  margin: 0; font-size: 34px; font-weight: 900; color: var(--navy);
  letter-spacing: -0.02em;
}
.brand-tag { margin: 4px 0 0; color: var(--slate); font-weight: 700; font-size: 15px; }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding-left: 4px; }
.field input {
  font-family: inherit; font-size: 17px; font-weight: 700; color: var(--ink);
  background: var(--bg); border: 2px solid var(--line-strong);
  border-radius: var(--r-md); padding: 14px 16px; outline: none;
  transition: border-color .15s ease, background .15s ease;
}
.field input:focus { border-color: var(--k8s); background: #fff; }
.field input::placeholder { color: var(--muted); font-weight: 600; }
.login-error {
  margin: 0; color: var(--coral-ink); background: var(--coral-soft);
  border-radius: var(--r-sm); padding: 10px 14px; font-size: 14px; font-weight: 700;
}
.login-foot { text-align: center; color: var(--muted); font-size: 13px; font-weight: 700; margin: 16px 0 0; }

/* ============ APP CHROME ============ */
.app { display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 2px solid var(--line);
  padding-top: var(--safe-top);
}
.topbar-inner {
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
}
.topbar-brand {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--navy); font-weight: 900; font-size: 20px;
  letter-spacing: -0.01em;
}
.stats { display: flex; align-items: center; gap: 14px; }
.stat { display: inline-flex; align-items: center; gap: 5px; font-weight: 900; color: var(--navy); font-size: 16px; background: none; border: 0; }
.stat-streak b { color: var(--amber); }
.stat-xp b { color: var(--gold); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--k8s); color: #fff; font-weight: 900; font-size: 15px;
  text-transform: uppercase; box-shadow: 0 3px 0 var(--k8s-press);
}

.view { max-width: 640px; margin: 0 auto; width: 100%; padding: 0 16px; }

/* ============ HOME / PATH ============ */
.home-hero { padding: 26px 6px 10px; }
.kicker { margin: 0; color: var(--amber); font-weight: 800; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
#welcome-name { margin: 2px 0 0; font-size: 30px; font-weight: 900; color: var(--navy); letter-spacing: -0.02em; text-transform: capitalize; }
.home-sub { margin: 6px 0 0; color: var(--slate); font-weight: 700; font-size: 15px; }

/* difficulty picker — segmented control */
.diff-picker {
  display: flex; gap: 3px; margin: 18px 0 0;
  background: var(--bg-2); border-radius: 14px; padding: 4px;
}
.diff {
  flex: 1 1 0; min-width: 0; border: 0; background: transparent;
  color: var(--slate); font-weight: 800; font-size: 12px; letter-spacing: -0.03em;
  padding: 10px 2px; border-radius: 10px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; transition: color .12s ease, background .12s ease, box-shadow .12s ease;
}
.diff.active { color: #fff; }
.diff.d-beginner.active     { background: var(--green); box-shadow: 0 2px 0 var(--green-press); }
.diff.d-intermediate.active { background: var(--k8s);   box-shadow: 0 2px 0 var(--k8s-press); }
.diff.d-advanced.active     { background: #7A3FD0;      box-shadow: 0 2px 0 #5d2ba8; }
.diff.d-expert.active       { background: #A21157;      box-shadow: 0 2px 0 #7a0d41; }
.diff:active { transform: translateY(1px); }
.diff-hint { margin: 10px 4px 0; font-size: 13px; font-weight: 700; color: var(--muted); min-height: 18px; }

/* daily goal card */
.goal-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 18px 0 0; padding: 16px; background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 3px 0 var(--line); }
.goal-ring { flex: 0 0 auto; position: relative; width: 62px; height: 62px; }
.goal-ring svg { transform: rotate(-90deg); }
.goal-ring .ring-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 900; color: var(--navy); }
.goal-body { flex: 1 1 auto; min-width: 0; }
.goal-title { font-size: 16px; font-weight: 900; color: var(--navy); }
.goal-prog { font-size: 13px; font-weight: 700; color: var(--slate); margin-top: 2px; }
.goal-card.goal-met .goal-title { color: var(--green-ink); }
.goal-card.goal-met .ring-num { color: var(--green-ink); }
.goal-change { flex: 0 0 auto; border: 2px solid var(--line-strong); background: transparent; color: var(--slate); font-weight: 800; font-size: 12px; padding: 8px 12px; border-radius: 10px; }
.goal-change:active { transform: translateY(1px); }
.goal-presets { display: none; gap: 7px; width: 100%; margin-top: 4px; }
.goal-presets.open { display: flex; }
.goal-preset { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; border: 2px solid var(--line-strong); background: var(--bg); color: var(--slate); padding: 8px 4px; border-radius: 10px; }
.goal-preset .gp-xp { font-size: 15px; font-weight: 900; line-height: 1; }
.goal-preset .gp-lbl { font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.goal-preset.active { border-color: var(--k8s); background: var(--k8s-soft); color: var(--k8s); }

/* review-mistakes card */
.review-card { display: flex; align-items: center; gap: 14px; width: 100%; margin: 16px 0 0; padding: 14px 16px; text-align: left; background: #FFF7E8; border: 2px solid #F4C95D; border-radius: var(--r-lg); box-shadow: 0 3px 0 #E6B844; color: inherit; transition: transform .07s ease, box-shadow .07s ease; }
.review-card:active { transform: translateY(2px); box-shadow: 0 1px 0 #E6B844; }
.review-ic { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--amber); color: #fff; box-shadow: 0 2px 0 #d98100; }
.review-ic svg { width: 26px; height: 26px; }
.review-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.review-title { font-size: 16px; font-weight: 900; color: var(--navy); }
.review-sub { font-size: 13px; font-weight: 700; color: #9a7b2e; margin-top: 2px; }
.review-go { flex: 0 0 auto; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; color: #fff; background: var(--amber); padding: 8px 12px; border-radius: 10px; box-shadow: 0 2px 0 #d98100; }

.path { display: flex; flex-direction: column; gap: 14px; padding: 18px 0 8px; }
.unit {
  position: relative; display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 2px solid var(--line);
  border-radius: var(--r-lg); padding: 16px 18px;
  box-shadow: 0 3px 0 var(--line); text-align: left;
  transition: transform .07s ease, box-shadow .07s ease, border-color .15s ease;
  width: 100%; color: inherit;
}
.unit:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.unit.empty, .unit:disabled { opacity: .5; }
.unit:disabled:active { transform: none; box-shadow: 0 3px 0 var(--line); }
.unit-badge {
  flex: 0 0 auto; width: 58px; height: 58px; border-radius: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--k8s-soft); color: var(--k8s);
  box-shadow: inset 0 0 0 2px rgba(50,108,229,.15);
}
.unit-badge svg { width: 30px; height: 30px; }
.unit-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.unit-title { display: block; margin: 0; font-size: 18px; font-weight: 900; color: var(--navy); line-height: 1.2; }
.unit-sub { display: block; margin: 3px 0 0; font-size: 13px; color: var(--slate); font-weight: 700; line-height: 1.3; }
.unit-meter { display: block; margin-top: 10px; height: 9px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.unit-meter > span { display: block; height: 100%; border-radius: 99px; background: var(--green); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.unit-pct { flex: 0 0 auto; font-size: 13px; font-weight: 900; color: var(--muted); min-width: 38px; text-align: right; }
.unit.done .unit-badge { background: var(--green-soft); color: var(--green-ink); box-shadow: inset 0 0 0 2px rgba(88,204,2,.2); }
.unit.done .unit-pct { color: var(--green-ink); }

.home-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 20px 4px calc(34px + var(--safe-bot)); }
.home-foot .ver { width: 100%; margin: 6px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; }

/* ============ LESSON ============ */
.lesson { display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: 0; }
.lesson-bar { display: flex; align-items: center; gap: 12px; padding: 14px 0 6px; }
.progress { flex: 1 1 auto; height: 16px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 99px; background: var(--green); transition: width .4s cubic-bezier(.2,.8,.2,1); box-shadow: inset 0 -4px 0 rgba(0,0,0,.07); }
.lesson-count { font-weight: 900; color: var(--muted); font-size: 14px; min-width: 34px; text-align: right; }

.q-wrap { flex: 1 1 auto; padding: 18px 2px 8px; }
.q-tag { display: inline-block; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 99px; margin-bottom: 14px; }
.q-tag.beginner     { background: var(--green-soft); color: var(--green-ink); }
.q-tag.intermediate { background: var(--k8s-soft); color: var(--k8s); }
.q-tag.advanced     { background: #F1E6FF; color: #7A3FD0; }
.q-tag.expert       { background: #FBE3EC; color: #A21157; }
.q-prompt { font-size: 22px; font-weight: 800; color: var(--navy); line-height: 1.32; margin: 0 0 20px; letter-spacing: -0.01em; }
.q-prompt code { background: var(--bg-2); padding: 1px 6px; border-radius: 7px; font-size: .88em; font-weight: 800; color: var(--ink); }
.q-prompt .blank { color: var(--k8s); letter-spacing: 2px; border-bottom: 3px solid var(--k8s); padding: 0 4px; }

/* MCQ choices */
.choices { display: flex; flex-direction: column; gap: 12px; }
.choice {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--card); border: 2px solid var(--line-strong);
  border-radius: var(--r-md); padding: 15px 16px; font-size: 16px; font-weight: 700;
  color: var(--ink); box-shadow: 0 3px 0 var(--line); width: 100%;
  transition: transform .06s ease, box-shadow .06s ease, border-color .12s, background .12s;
}
.choice:active:not(.locked) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.choice .key {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--line-strong); color: var(--muted);
  font-size: 13px; font-weight: 900;
}
.choice.selected { border-color: var(--k8s); background: var(--k8s-soft); color: var(--k8s); }
.choice.selected .key { border-color: var(--k8s); color: var(--k8s); }
.choice.correct { border-color: var(--green); background: var(--green-soft); color: var(--green-ink); }
.choice.correct .key { border-color: var(--green); color: var(--green-ink); background: #fff; }
.choice.wrong { border-color: var(--coral); background: var(--coral-soft); color: var(--coral-ink); }
.choice.wrong .key { border-color: var(--coral); color: var(--coral-ink); background: #fff; }
.choice.locked { pointer-events: none; }
.choice.dim { opacity: .5; }

/* Fill-in */
.fill-hint { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 8px; }
.fill-input {
  width: 100%; font-family: inherit; font-size: 19px; font-weight: 800; color: var(--ink);
  background: var(--card); border: 2px solid var(--line-strong);
  border-radius: var(--r-md); padding: 16px 18px; outline: none; box-shadow: 0 3px 0 var(--line);
  transition: border-color .15s ease;
}
.fill-input:focus { border-color: var(--k8s); }
.fill-input.correct { border-color: var(--green); background: var(--green-soft); color: var(--green-ink); }
.fill-input.wrong { border-color: var(--coral); background: var(--coral-soft); color: var(--coral-ink); }

.lesson-actions { padding: 12px 2px calc(16px + var(--safe-bot)); position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 26%); }

/* result drawer */
.result {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.9,.2,1);
}
.result.show { transform: translateY(0); }
.result.correct .result-inner { background: var(--green-soft); }
.result.wrong .result-inner   { background: var(--coral-soft); }
.result-inner { max-width: 640px; margin: 0 auto; padding: 20px 18px calc(22px + var(--safe-bot)); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.result-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.result-icon { width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #fff; font-size: 24px; font-weight: 900; }
.result.correct .result-icon { color: var(--green-ink); }
.result.wrong .result-icon { color: var(--coral-ink); }
.result-title { font-size: 22px; font-weight: 900; }
.result.correct .result-title { color: var(--green-ink); }
.result.wrong .result-title { color: var(--coral-ink); }
.result-explain { margin: 0 0 16px; font-size: 15px; font-weight: 700; line-height: 1.5; color: var(--ink); }
.result-explain code { background: rgba(255,255,255,.6); padding: 1px 6px; border-radius: 6px; font-weight: 800; }
.result.correct #continue-btn { background: var(--green); box-shadow: 0 4px 0 var(--green-press); }
.result.correct #continue-btn:active { box-shadow: 0 1px 0 var(--green-press); }
.result.wrong #continue-btn { background: var(--coral); box-shadow: 0 4px 0 var(--coral-press); }
.result.wrong #continue-btn:active { box-shadow: 0 1px 0 var(--coral-press); }

/* ============ SUMMARY ============ */
.summary { display: flex; align-items: center; justify-content: center; min-height: 100dvh; }
.summary-card { text-align: center; max-width: 380px; width: 100%; padding: 30px 24px; }
.summary-burst {
  width: 120px; height: 120px; margin: 0 auto 18px; border-radius: 50%;
  background: radial-gradient(circle, var(--gold) 0%, var(--amber) 70%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 0 #d98100; position: relative;
}
.summary-burst::after { content: "★"; color: #fff; font-size: 58px; line-height: 1; }
#summary-title { font-size: 28px; font-weight: 900; color: var(--navy); margin: 0 0 22px; }
.summary-stats { display: flex; gap: 14px; margin-bottom: 26px; }
.sstat { flex: 1; border: 2px solid var(--line); border-radius: var(--r-md); padding: 16px 10px; background: var(--card); box-shadow: 0 3px 0 var(--line); }
.sstat-xp { border-color: var(--gold); }
.sstat-acc { border-color: var(--k8s); }
.sstat-num { display: block; font-size: 26px; font-weight: 900; color: var(--navy); }
.sstat-xp .sstat-num { color: var(--gold); }
.sstat-acc .sstat-num { color: var(--k8s); }
.sstat-lbl { display: block; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; }

/* ============ TOAST ============ */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bot)); transform: translateX(-50%);
  background: var(--navy); color: #fff; font-weight: 800; font-size: 14px;
  padding: 12px 18px; border-radius: 99px; z-index: 50; box-shadow: 0 8px 24px rgba(20,35,61,.3);
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

@keyframes pop { 0% { transform: scale(.96); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }
.pop { animation: pop .3s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.shake { animation: shake .4s ease; }

@media (min-width: 560px) {
  .q-prompt { font-size: 25px; }
  .home-hero { padding-top: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: .01ms !important; }
}
