/* The learning path (path.html). Uses the colours from student.css. */
body.pathpage { display: block; padding: 0 0 96px; }
.pathbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 10px 16px; background: #0d1830; color: #fff; border-bottom: 1px solid #2c3e66; }
.pathbar nav { display: flex; gap: 14px; align-items: center; }
.pathbar .muted { color: #aab4cc; margin-left: 8px; }
.textlink { background: none; border: none; color: #cfd8ee; font: inherit; text-decoration: underline; cursor: pointer;
  width: auto; margin: 0; padding: 4px; }
.center { text-align: center; }

#path { max-width: 1100px; margin: 0 auto; padding: 8px 16px 24px; color: #fff; }

.unit { margin-top: 20px; }
.unit-banner { background: #58a85b; color: #fff; border-radius: 16px; padding: 14px 18px; box-shadow: 0 4px 0 #3d7c40; }
.unit-banner .term { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; opacity: .9; }
.unit-banner h2 { margin: 2px 0 4px; font-size: 1.25rem; }
.unit-banner p { margin: 0; font-size: .95rem; opacity: .95; }

.steps { position: absolute; inset: 0; display: flex; flex-direction: row; align-items: flex-start; padding: 76px 24px 0; }
.step { flex: 0 0 150px; display: flex; flex-direction: column; align-items: center; width: 150px; position: relative; }

.node { --p: 0; position: relative; width: 92px; height: 92px; border-radius: 50%; border: none; padding: 0; margin: 0;
  cursor: pointer; background: conic-gradient(#ffd166 calc(var(--p) * 1%), #2b3b63 0); display: grid; place-items: center;
  transition: transform .12s; }
.node:hover { transform: scale(1.05); }
.node:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.node .face { width: 74px; height: 74px; border-radius: 50%; background: #fca311; color: #14213d; font-size: 1.7rem; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 5px 0 #b87405; }
.node.locked { cursor: not-allowed; background: #2b3b63; }
.node.locked .face { background: #55618a; color: #aeb7d1; box-shadow: 0 5px 0 #3b4670; font-size: 1.3rem; }
.node.done .face { background: #58a85b; color: #fff; box-shadow: 0 5px 0 #3d7c40; }
.node.gold { background: conic-gradient(#ffd166 100%, #2b3b63 0); }
.node.gold .face { background: #f4b400; color: #5a3b00; box-shadow: 0 5px 0 #b08000; }
.node.next::after { content: "START"; position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  background: #fff; color: #14213d; font-size: .7rem; font-weight: 800; padding: 3px 8px; border-radius: 8px; animation: bob 1s infinite; }
@keyframes bob { 50% { transform: translate(-50%, -4px); } }
@media (prefers-reduced-motion: reduce) { .node.next::after { animation: none; } }

.node .pips { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; }
.node .pips i { width: 13px; height: 13px; border-radius: 50%; background: #2b3b63; border: 2px solid #0d1830; display: block; }
.node .pips i.on { background: #58a85b; }
.step .label { margin-top: 16px; text-align: center; font-weight: 700; font-size: .95rem; color: #fff; max-width: 220px; }
.step .sub { font-size: .8rem; color: #aab4cc; font-weight: 400; }

#continue-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px; background: #0d1830; border-top: 1px solid #2c3e66; z-index: 6; }
#continue { display: block; margin: 0 auto; max-width: 520px; width: 100%; }

dialog#sheet { border: none; border-radius: 18px; padding: 22px; width: min(440px, 92vw); background: #fff; color: var(--ink); }
dialog#sheet::backdrop { background: rgba(10, 18, 36, .7); }
dialog#sheet h2 { margin: 0 0 8px; }
.can { margin: 4px 0; }
.can.fr { color: #667085; font-style: italic; }
.meter { height: 14px; border-radius: 8px; background: #e6eaf3; overflow: hidden; margin-top: 14px; }
.meter span { display: block; height: 100%; width: 0; background: #58a85b; transition: width .4s; }
.note { background: #fff4d6; border-radius: 8px; padding: 8px 10px; }
#sheet-actions a.button { margin-top: 12px; }

.pathbar .who { display: flex; align-items: center; gap: 10px; }
#avatar { width: 48px; height: 48px; background: repeating-conic-gradient(#ededed 0% 25%, #e5e5e5 0% 50%) 0 0 / 16px 16px; border-radius: 10px; image-rendering: pixelated; display: block; }

/* the milestone pop-up */
dialog#award { border: none; border-radius: 20px; padding: 26px 28px; width: min(380px, 92vw); text-align: center; background: #fff; color: var(--ink); position: relative; overflow: hidden; }
dialog#award::backdrop { background: rgba(10, 18, 36, .75); }
#award-char { width: 96px; height: 96px; image-rendering: pixelated; animation: hop .5s ease-in-out infinite alternate; }
@keyframes hop { to { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { #award-char { animation: none; } }
#award-head { font-size: 1.7rem; margin: 6px 0; }
.award-ched { font-size: 1.5rem; font-weight: 800; color: #b87405; margin: 8px 0; }
dialog#award.kind-lesson_gold #award-head { color: #b08000; }
dialog#award.kind-unit_complete #award-head { color: #3a8f44; }
.burst { position: absolute; inset: 0; pointer-events: none; background:
  radial-gradient(circle at 20% 15%, #ffd166 0 6px, transparent 7px), radial-gradient(circle at 80% 20%, #8be9ff 0 5px, transparent 6px),
  radial-gradient(circle at 12% 60%, #f77bb6 0 5px, transparent 6px), radial-gradient(circle at 88% 65%, #8ee05a 0 6px, transparent 7px),
  radial-gradient(circle at 50% 8%, #b78bf5 0 5px, transparent 6px); }

/* the path runs left to right and scrolls sideways */
.lane-scroll { scrollbar-color: #3b4d78 #0d1830; overflow-x: auto; overflow-y: hidden; padding-bottom: 10px; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.lane { position: relative; min-width: 100%; }
.laneline { position: absolute; left: 0; top: 0; }
.laneline-path { fill: none; stroke: #3b4d78; stroke-width: 4; stroke-dasharray: 2 10; stroke-linecap: round; }
.step .label { max-width: 138px; }
.unit-banner { max-width: 520px; }
@media (prefers-reduced-motion: reduce) { .lane-scroll { scroll-behavior: auto; } }

.meterlabel { display: flex; justify-content: space-between; margin: 12px 0 0; font-weight: 700; }
.meterlabel span { font-weight: 600; color: #667085; }
.meter + .meterlabel { margin-top: 10px; }
.meter.vocab span { background: #ffb703; }

/* the streak: big and bright in the bar, glowing when today already counted */
.streakbtn { display: inline-flex; align-items: center; gap: 10px; width: auto; margin: 0; padding: 6px 18px 6px 12px; background: #1b2a4d; color: #fff;
  border-radius: 999px; border: 2px solid #2c3e66; font-weight: 900; }
.streakbtn:hover { background: #24365f; }
.streakbtn svg.flame { width: 40px; height: 40px; flex: 0 0 auto; }
.streakbtn .num { font-size: 2rem; line-height: 1; color: #ffb347; }
.streakbtn.cold .num { color: #aab4cc; }
.streakbtn:not(.cold) { border-color: #ff9a2e; box-shadow: 0 0 14px rgba(255, 138, 31, .55), inset 0 0 10px rgba(255, 138, 31, .2); }
.streakbtn .shields { display: inline-flex; gap: 5px; margin-left: 2px; }
.shield { width: 21px; height: 24px; }
.shield path { fill: #3b4a73; stroke: #55658f; stroke-width: .6; }
.shield.on path { fill: #4cc3ff; stroke: #bfeaff; }
.shield.on { filter: drop-shadow(0 0 5px rgba(76, 195, 255, .8)); }
svg.flame.lit { filter: drop-shadow(0 0 6px rgba(255, 138, 31, .9)); animation: flameglow 1.5s ease-in-out infinite alternate; }
@keyframes flameglow { from { filter: drop-shadow(0 0 4px rgba(255, 138, 31, .7)); transform: scale(1); } to { filter: drop-shadow(0 0 12px rgba(255, 170, 40, 1)); transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { svg.flame.lit { animation: none; } }
@media (max-width: 560px) { .streakbtn svg.flame { width: 32px; height: 32px; } .streakbtn .num { font-size: 1.6rem; } .shield { width: 17px; height: 20px; } }

dialog#streakdlg { border: none; border-radius: 22px; padding: 26px; width: min(400px, 92vw); text-align: center; background: #fff; color: var(--ink); overflow: hidden; }
dialog#streakdlg::backdrop { background: rgba(10, 18, 36, .75); }
.bigflame { position: relative; padding-top: 6px; }
.bigflame.lit::before { content: ""; position: absolute; left: 50%; top: -10px; width: 230px; height: 230px; margin-left: -115px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 170, 60, .55), rgba(255, 138, 31, .18) 45%, transparent 70%); z-index: 0; animation: halo 1.8s ease-in-out infinite alternate; }
@keyframes halo { from { opacity: .7; transform: scale(.95); } to { opacity: 1; transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .bigflame.lit::before { animation: none; } }
.bigflame svg { position: relative; z-index: 1; width: 110px; height: 110px; }
.bigflame .n { position: relative; z-index: 1; font-size: 3.2rem; font-weight: 900; display: block; line-height: 1; margin-top: -8px; color: #e36a00; }
.bigflame:not(.lit) .n { color: #7c869c; }
dialog#streakdlg h2 { margin: 8px 0 4px; }
dialog#streakdlg p { margin: 8px 0; }
.shieldrow { display: flex; justify-content: center; gap: 14px; margin: 10px 0 2px; }
.shieldrow .shield { width: 46px; height: 53px; }

.node.review .face { font-size: 2rem; background: #7b61ff; color: #fff; box-shadow: 0 5px 0 #5340c0; }
.node.review.done .face { background: #58a85b; box-shadow: 0 5px 0 #3d7c40; }
.node.review.locked .face { background: #55618a; color: #aeb7d1; box-shadow: 0 5px 0 #3b4670; font-size: 1.3rem; }
.node.review { background: #2b3b63; }
.step .sub.assigned { color: #ffd166; font-weight: 700; }
dialog#sheet.review .meterlabel, dialog#sheet.review .meter { display: none; }

/* the streak celebration (streakpop.js) */
#streakpop { border: none; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; color: #fff; text-align: center; overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #1d1740 0%, #0a1126 70%); }
#streakpop::backdrop { background: #000; }
#streakpop[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; }
#streakpop.lit { background: radial-gradient(circle at 50% 42%, #5a2410 0%, #2a1030 38%, #0a1126 75%); transition: background .6s; }
.sp-rays { position: absolute; left: 50%; top: 42%; width: 190vmax; height: 190vmax; margin: -95vmax 0 0 -95vmax; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 190, 70, .22) 0 7deg, transparent 7deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 0, transparent 45%); mask-image: radial-gradient(circle, #000 0, transparent 45%); }
#streakpop.lit .sp-rays { opacity: 1; transition: opacity .8s; animation: sprays 18s linear infinite; }
@keyframes sprays { to { transform: rotate(360deg); } }
.sp-flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: radial-gradient(circle at 50% 42%, #fff 0, #ffd48a 25%, transparent 65%); }
#streakpop.lit .sp-flash { animation: spflash .8s ease-out; }
@keyframes spflash { 0% { opacity: .95; } 100% { opacity: 0; } }
.sp-stage { position: relative; width: min(320px, 70vw); height: min(320px, 70vw); z-index: 2; }
#streakpop.lit .sp-stage { animation: spshake .55s ease-out; }
@keyframes spshake { 0%, 100% { transform: translate(0, 0); } 15% { transform: translate(-7px, 4px); } 30% { transform: translate(8px, -5px); } 45% { transform: translate(-6px, -3px); } 60% { transform: translate(5px, 4px); } 80% { transform: translate(-3px, 1px); } }
.sp-flame { position: absolute; inset: 0; display: grid; place-items: center; transform: scale(.55); transition: transform .25s; }
.sp-flame svg { width: 100%; height: 100%; filter: grayscale(.2) brightness(.7); }
#streakpop.lit .sp-flame { animation: spignite .75s cubic-bezier(.2, 1.6, .4, 1) forwards; }
@keyframes spignite { 0% { transform: scale(.55); } 45% { transform: scale(1.5); } 100% { transform: scale(1.12); } }
#streakpop.lit .sp-flame svg { animation: spburn .7s ease-in-out infinite alternate; filter: drop-shadow(0 0 22px #ff9a1f) drop-shadow(0 0 60px #ff6a00); }
@keyframes spburn { from { transform: scale(1) rotate(-1.5deg); } to { transform: scale(1.06, 1.1) rotate(1.5deg); } }
.sp-num { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-38%); font-size: min(9rem, 28vw); font-weight: 900; line-height: 1; z-index: 3;
  color: #ffe9b8; text-shadow: 0 4px 0 #b34a00, 0 0 28px rgba(255, 130, 20, .9); }
#streakpop:not(.lit) .sp-num { color: #aeb7cc; text-shadow: 0 3px 0 #3b4670; }
.sp-num.pop { animation: sppop .65s cubic-bezier(.2, 1.7, .4, 1); }
@keyframes sppop { 0% { transform: translateY(-38%) scale(.4); opacity: .3; } 55% { transform: translateY(-38%) scale(1.45); opacity: 1; } 100% { transform: translateY(-38%) scale(1); } }
.sp-plus { position: absolute; right: 2%; top: 8%; font-size: 2.4rem; font-weight: 900; color: #7dffb0; text-shadow: 0 0 14px #1bd96a; opacity: 0; z-index: 4; }
.sp-plus.rise { animation: spplus 1.4s ease-out forwards; }
@keyframes spplus { 0% { opacity: 0; transform: translateY(30px) scale(.6); } 25% { opacity: 1; transform: translateY(0) scale(1.2); } 100% { opacity: 0; transform: translateY(-60px) scale(1); } }
.sp-sparks { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.ember { position: absolute; left: 50%; top: 58%; width: 14px; height: 14px; margin: -7px; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, #fff6c4 0, #ffb52e 45%, rgba(255, 90, 0, 0) 75%); animation: spember 1.2s ease-out forwards; }
@keyframes spember { 0% { opacity: 1; transform: translate(0, 0) scale(var(--s)); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0); } }
.sp-title { z-index: 2; margin-top: 8px; font-size: min(2.6rem, 9vw); font-weight: 900; letter-spacing: .02em; opacity: 0; transform: translateY(14px); color: #ffcf6b; text-shadow: 0 0 18px rgba(255, 130, 20, .8); }
.sp-msg { z-index: 2; margin: 8px 24px 0; font-size: 1.2rem; font-weight: 600; opacity: 0; transform: translateY(14px); color: #e6ebf7; max-width: 30em; }
.sp-title.show, .sp-msg.show { opacity: 1; transform: none; transition: opacity .5s, transform .5s; }
.sp-ok { z-index: 2; margin-top: 26px; width: min(360px, 80vw); font-size: 1.15rem; letter-spacing: .05em; text-transform: uppercase; }
#streakpop.still .sp-stage, #streakpop.still .sp-flash, #streakpop.still .sp-rays, #streakpop.still .sp-flame, #streakpop.still .sp-flame svg { animation: none !important; }
#streakpop.still.lit .sp-flame { transform: scale(1.1); }

/* the buttons at each end of a unit */
.node.nav { background: #2b3b63; }
.node.nav .face { background: #3a5aa8; color: #fff; font-size: 2.2rem; box-shadow: 0 5px 0 #243f7a; }
.node.nav.locked .face { background: #55618a; color: #aeb7d1; box-shadow: 0 5px 0 #3b4670; font-size: 1.3rem; }
.node.nav.tour .face { font-size: 2rem; }

/* ---------- phones ---------- */
.menubtn { display: none; }
.menulinks { display: flex; gap: 14px; align-items: center; }
.unit-banner { cursor: default; }

/* the path running down the screen (a phone held upright; path.js adds .vertical) */
.lane-scroll.vertical { overflow: visible; padding-bottom: 0; }
.lane.vertical { width: 100%; min-width: 0; }
.lane.vertical .laneline { width: 100%; }
.lane.vertical .steps { flex-direction: column; align-items: stretch; padding: 56px 12px 0; }
.lane.vertical .step { flex: 0 0 124px; width: auto; height: 124px; flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; transform: none !important; }
.lane.vertical .step:nth-child(4n + 2), .lane.vertical .step:nth-child(4n) { margin-left: 32px; }
.lane.vertical .step:nth-child(4n + 3) { margin-left: 56px; }
.lane.vertical .step .node { flex: 0 0 92px; }
.lane.vertical .step .label { margin-top: 0; text-align: left; max-width: none; flex: 1 1 auto; min-width: 0; font-size: 1rem; }
.lane.vertical .step .sub { font-size: .85rem; }

/* a phone, held either way: a small menu button, a slim banner, smaller bits everywhere */
@media (max-width: 640px), (max-height: 500px) and (orientation: landscape) {
  .pathbar { padding: 8px 12px; gap: 8px; }
  .pathbar nav { gap: 8px; }
  .menubtn { display: inline-grid; place-items: center; width: 42px; height: 42px; margin: 0; padding: 0; background: #1b2a4d; color: #fff;
    border: 2px solid #2c3e66; border-radius: 12px; font-size: 1.3rem; line-height: 1; cursor: pointer; }
  .menulinks { display: none; position: absolute; right: 12px; top: 100%; margin-top: 4px; flex-direction: column; align-items: stretch; gap: 2px;
    background: #0d1830; border: 1px solid #2c3e66; border-radius: 12px; padding: 6px; min-width: 160px; z-index: 20; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
  .menulinks.open { display: flex; }
  .menulinks .textlink { padding: 12px 14px; text-align: left; text-decoration: none; font-size: 1.05rem; border-radius: 8px; }
  .menulinks .textlink:hover { background: #1b2a4d; }
  #avatar { width: 40px; height: 40px; }
  #who { font-size: 1rem; }
  .pathbar .muted { margin-left: 0; font-size: .8rem; white-space: nowrap; }
  .streakbtn { padding: 3px 12px 3px 8px; gap: 6px; border-width: 2px; }
  .streakbtn svg.flame { width: 28px; height: 28px; }
  .streakbtn .num { font-size: 1.4rem; }
  .streakbtn .shields { gap: 3px; }
  .shield { width: 15px; height: 18px; }

  #path { padding: 4px 12px 12px; }
  .unit { margin-top: 10px; }
  .unit-banner { max-width: none; padding: 8px 12px; border-radius: 12px; cursor: pointer; box-shadow: 0 3px 0 #3d7c40; }
  .unit-banner .term { display: none; }
  .unit-banner h2 { margin: 0; font-size: 1rem; }
  .unit-banner h2::after { content: " \25BE"; opacity: .85; }
  .unit-banner p { display: none; margin-top: 6px; font-size: .9rem; }
  .unit-banner.open p { display: block; }
  .unit-banner.open h2::after { content: " \25B4"; }
  #continue-bar { padding: 8px 12px; }
  #continue { padding: 11px; }
}

/* upright phone: the top bar is two tidy rows (picture, name, streak, menu; then level, XP and Ched) */
@media (max-width: 640px) {
  .pathbar.pathmain { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "av name streak menu" "stats stats stats stats";
    align-items: center; column-gap: 10px; row-gap: 2px; }
  .pathbar.pathmain .who, .pathbar.pathmain .whotext, .pathbar.pathmain nav { display: contents; }
  .pathbar .whotext br { display: none; }
  #avatarlink { grid-area: av; }
  #who { grid-area: name; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #who .hi { display: none; }
  #lvl { grid-area: stats; }
  #streak { grid-area: streak; }
  .menubtn { grid-area: menu; }
}

/* phone on its side: one slim row, and the path itself is made smaller so it fits without scrolling down */
@media (max-height: 500px) and (orientation: landscape) {
  .pathbar { padding-top: 5px; padding-bottom: 5px; }
  .pathbar .whotext br { display: none; }
  .pathbar .whotext { min-width: 0; }
  #who, #lvl { display: inline; }
  #who { margin-right: 8px; }
  #avatar { width: 34px; height: 34px; }
  .unit { margin-top: 6px; }
  .lane-scroll { zoom: .62; padding-bottom: 4px; }
  #continue-bar { padding: 6px 12px; }
  #continue { padding: 9px; }
  body.pathpage { padding-bottom: 56px; }
}

/* the character and ship pages on a phone: the title and the Ched on the first row, the two links side by side below */
@media (max-width: 640px) {
  .pathbar:not(.pathmain) { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
  .pathbar:not(.pathmain) > div { flex: 1 1 auto; min-width: 0; }
  .pathbar:not(.pathmain) nav { display: contents; }
  .pathbar:not(.pathmain) .ched { order: 1; flex: 0 0 auto; white-space: nowrap; }
  .pathbar:not(.pathmain) .textlink { order: 2; flex: 1 1 45%; text-align: center; padding: 8px 4px; background: #1b2a4d; border-radius: 10px; text-decoration: none; font-size: .95rem; }
}

/* the practice games in the topic sheet: a grid of buttons */
.gamegrid-label { margin: 16px 0 0; font-weight: 700; color: #667085; font-size: .9rem; }
.gamegrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
#sheet-actions .gamegrid a.button { margin-top: 0; padding: 14px 6px; font-size: .95rem; background: #fff1c9; border: 2px solid var(--accent); }
dialog#sheet { max-height: 92vh; overflow-y: auto; }
/* a phone held sideways, or any wide screen: a wider sheet and more columns */
@media (min-width: 640px), (orientation: landscape) and (max-height: 520px) {
  dialog#sheet { width: min(720px, 94vw); }
  .gamegrid { grid-template-columns: repeat(4, 1fr); }
}

/* guest mode: a bar at the top, and no streak or leaderboard */
.guestbar { background: #ffd166; color: #14213d; text-align: center; padding: 8px 12px; font-weight: 700; font-size: .95rem; }
body.guest #streak, body.guest .menulinks a[href="menu.html"] { display: none; }
