/* Sagotra theme: navy header, cream paper, gold accents. */
@font-face{font-family:'nyk Ngayogyan New';src:url('../fonts/nyk-ngayogyan.ttf') format('truetype');font-weight:400;font-style:normal;font-display:swap;unicode-range:U+A980-A9DF}
@font-face{font-family:'nyk Ngayogyan New';src:url('../fonts/nyk-ngayogyan.ttf') format('truetype');font-weight:700;font-style:normal;font-display:swap;unicode-range:U+A980-A9DF}
:root{--indigo:#1d2a4d;--indigo2:#2b3d6e;--gold:#e8a824;--gold-d:#b9811a;--leaf:#2f7d5b;--bad:#b3362f;--rose:#c4577a;
--paper:#fffaf0;--line:#ecd9a8;--ink:#172036;--muted:#6b6f80;
--bs-primary:#2b3d6e;--bs-body-bg:#fbf1da;--bs-body-color:var(--ink);--bs-body-font-family:'Outfit',system-ui,sans-serif;
--font-jv:'nyk Ngayogyan New','Noto Sans Javanese',sans-serif;--tree-gutter:68px;--lvl:#bc9f57;--tree-pt:1.2rem;--tree-pb:.9rem}
html{background:#f8e8c4}
body{background:linear-gradient(180deg,#fcf4e0 0%,#f6e4bd 100%) fixed;min-height:100vh}
h1,h2,h3,.display-3,.display-5,.navbar-brand,.serif{font-family:'Fraunces',serif;font-weight:800;color:var(--indigo)}
.jv{font-family:var(--font-jv);font-weight:700;line-height:1.5}
.view{position:relative}
.ti{width:1.15em;height:1.15em;vertical-align:-.2em;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.ti.fill{fill:currentColor}
:focus-visible{outline:3px solid var(--gold);outline-offset:2px}

/* scenery */
.scene{position:fixed;inset:0;z-index:0;pointer-events:none;overflow:hidden}
.scene img{position:absolute;height:auto}
.scene .temple{bottom:40px;width:280px;opacity:.32}.scene .t-l{left:-90px}.scene .t-r{right:-90px;transform:scaleX(-1)}
.scene .c1{top:96px;right:1.5%;width:170px;opacity:.75}.scene .c2{top:130px;left:1%;width:110px;opacity:.7}.scene .c3{top:54%;right:3%;width:90px;opacity:.55}
nav,main,.site-foot{position:relative;z-index:1}
main{z-index:2}  /* above the footer, so the fixed answer bar is never painted over by it */
@media (max-width:991px){.scene .temple,.scene .c3{display:none}}

/* header */
.trah-nav{background:var(--indigo) repeating-linear-gradient(45deg,#ffffff07 0 2px,transparent 2px 20px);border-bottom:3px solid var(--gold);padding:.55rem 0}
.navbar-brand{color:#fff!important;font-size:1.6rem}.brand-logo{height:40px;width:40px;margin-right:.55rem;object-fit:contain}.adm-brand .brand-logo{height:32px;width:32px;margin-right:.45rem;vertical-align:middle}
.navbar-brand .jv{color:var(--gold);font-size:1.15rem;margin-left:.5rem}
.btn-nav{color:#f6d98a;border:1.5px solid #e8a82480;border-radius:2rem;background:#ffffff0d;padding:.35rem .9rem}
.btn-nav:hover,.btn-nav:focus-visible{background:#ffffff22;color:#fff}.btn-nav .ti{color:var(--gold)}
.btn-gold{background:linear-gradient(180deg,#f4bd3e,#e8a824);color:#241a00;font-weight:700;border:0;border-radius:2rem;box-shadow:0 3px 0 #b9811a}
.btn-gold:hover,.btn-gold:focus-visible{background:linear-gradient(180deg,#f8c957,#eeb235);color:#241a00}
.btn-play{font-size:1.5rem;padding:.65rem 2.4rem;display:inline-flex;gap:.7rem;align-items:center}.btn-play .ti{fill:currentColor}

/* cards */
.panel{background:#fffaf0f2;border:1px solid var(--line);border-radius:1.15rem;padding:1.1rem 1.3rem;box-shadow:0 6px 18px #b98a2d1a}
.panel h2{font-size:1.25rem}
.progress{background:#eadfc2;border-radius:1rem}.progress-bar{background:linear-gradient(90deg,#f0b232,#e8a824);border-radius:1rem}

/* home */
.hero-card{position:relative;overflow:hidden;min-height:470px;border-radius:1.6rem;border:1px solid var(--line);padding:2.4rem 2.4rem 2rem;
background:linear-gradient(180deg,#fffaf0 0%,#fbecc8 100%);box-shadow:0 10px 28px #b98a2d26}
.hero-card .bar{width:64px;height:6px;border-radius:4px;background:var(--gold);margin-bottom:1.4rem}
.hero-card h1{font-size:clamp(1.9rem,2.8vw,2.7rem);line-height:1.15;margin-bottom:1.2rem}
.hero-card .lead{max-width:23rem;font-size:1.08rem;color:#3a4260}
.hero-text{position:relative;z-index:2}
.mode-box{background:#fffdf6;border:1px solid var(--line);border-radius:1rem;padding:.8rem 1rem;max-width:23rem;display:flex;gap:.7rem;align-items:flex-start}
.mode-box .ti{color:var(--indigo);font-size:1.4rem;flex-shrink:0;margin-top:.15rem}
.mode-box .form-check{margin:0;padding-left:2.6rem}
.hero-art{position:absolute;right:0;bottom:0;width:48%;height:100%;z-index:1}
.hero-art .temple{position:absolute;right:-30px;bottom:0;width:62%;opacity:.28}
.hero-art .mascot{position:absolute;right:26%;bottom:40px;width:200px}
.hero-art .scroll{position:absolute;right:14px;bottom:10px;width:min(300px,62%)}
@media (max-width:767px){.hero-text{max-width:100%}.hero-art{display:none}.hero-card{min-height:0}}
.rank-card h2{font-size:1.7rem}.rank-card .xp{color:var(--muted);font-size:.9rem}
.stats3 .col-4+.col-4{border-left:1px solid var(--line)}
.stats3 b{font:800 1.6rem 'Fraunces',serif;color:var(--indigo)}
.badge-tile{text-align:center;font-size:.72rem;color:var(--muted);line-height:1.2}
.badge-tile .e{display:grid;place-items:center;width:46px;height:46px;margin:0 auto 6px;border-radius:50%;background:#eee3c8;color:#a89c7c;font-size:1.35rem;border:2px solid #e2d3aa}
.badge-tile.on{color:var(--ink)}.badge-tile.on .e{background:#fbe3a0;color:var(--gold-d);border-color:var(--gold)}
.howto{list-style:none;counter-reset:n;padding:0;margin:0}
.howto li{counter-increment:n;position:relative;padding-left:2.2rem;margin-bottom:.7rem;font-size:.92rem;line-height:1.45}
.howto li::before{content:counter(n);position:absolute;left:0;top:.05rem;width:1.5rem;height:1.5rem;border-radius:50%;background:var(--gold);color:#fff;font-weight:700;font-size:.8rem;display:grid;place-items:center}

/* game */
.hud{padding:.9rem 1.4rem 1rem}
.hud-row{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;margin-bottom:.55rem;gap:.5rem}
.hud-row b{font:800 1.35rem 'Fraunces',serif;color:var(--indigo)}
.hud-r{justify-self:end;display:flex;gap:1.1rem;align-items:center}.hud-r .sep{width:1px;height:1.6rem;background:var(--line)}
.heart{color:var(--bad);font-size:1.25rem;margin:0 .1rem}.heart.off{color:#d8cdb0}
.timer{height:12px}.timer .progress-bar{transition:width .25s linear}.timer .progress-bar.low{background:var(--bad)}
.qcard{padding:1.2rem 1.4rem}
.q-head{display:flex;gap:.9rem;align-items:flex-start}
.q-ico{width:46px;height:46px;flex-shrink:0;border-radius:50%;background:#fbe3a0;border:2px solid var(--gold);color:var(--gold-d);display:grid;place-items:center;font-size:1.4rem}
.q-kind{color:var(--gold-d);font-weight:600;font-size:.95rem}
.q-text{font:800 1.35rem/1.35 'Fraunces',serif;color:var(--indigo)}.q-text.jv{font-family:var(--font-jv);font-weight:700;font-size:1.5rem;line-height:1.8}
.q-aksara{font-family:var(--font-jv);font-weight:700;font-size:2.8rem;line-height:1.5;color:var(--indigo);margin:.2rem 0 .4rem 3.5rem}
.btn-hint{border:2px solid #3b6fd8;color:#2b5bc0;border-radius:.8rem;background:#fff;font-weight:600;white-space:nowrap}.btn-hint:hover{background:#eef3ff;color:#2b5bc0}
.hint{background:#fff3cf;border:1px solid #f0d58a;border-radius:.8rem;padding:.6rem .85rem;font-size:.9rem;margin-top:.8rem}
.tree-wrap{position:relative}
.tree-bands{position:absolute;left:0;right:0;top:var(--tree-pt);bottom:var(--tree-pb);z-index:0;pointer-events:none}
.tree-scroll{position:relative;z-index:1;overflow-x:auto;overflow-y:hidden;margin-left:var(--tree-gutter);padding:var(--tree-pt) 10px var(--tree-pb) 6px;scrollbar-width:thin}
.plot{position:relative;width:100%;--node-h:78px;--row-gap:66px;height:calc(5 * var(--node-h) + 4 * var(--row-gap) + 12px)}
#lines{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:1}
#lines path{fill:none;stroke:#b7a27a;stroke-width:2}#lines path.sp{stroke:#d9a32a}
.band{position:absolute;left:0;right:0;border-radius:.9rem;background:#fbf2dc}.band.alt{background:#f3e4c0}
.lvl{position:absolute;left:.9rem;top:.35rem;font:800 2.3rem/1 'Fraunces',serif;color:var(--lvl);letter-spacing:-.02em;user-select:none}
.lvl.txt{font-size:1.45rem;top:.6rem;letter-spacing:0}
.lvl.jv{font-family:var(--font-jv);font-weight:700;font-size:2.1rem;line-height:1.2;top:.15rem;letter-spacing:0}.lvl.jv.txt{font-size:1.5rem;top:.35rem}
.tree-hint{text-align:center;font-size:.8rem;color:var(--muted);margin:.1rem 0 .4rem}
.node{position:absolute;width:13.5%;min-width:86px;max-width:132px;height:var(--node-h);transform:translateX(-50%);display:flex;flex-direction:column;justify-content:center;z-index:2;
border:1px solid #e3d2a6;border-radius:.8rem;background:linear-gradient(180deg,#fffdf6,#fbf1d6);box-shadow:0 3px 6px #b98a2d26;text-align:center;padding:.2rem;font:inherit;color:inherit;overflow:visible;touch-action:manipulation;user-select:none;-webkit-user-select:none}
button.node:hover:not(:disabled){border-color:var(--gold);box-shadow:0 5px 12px #b98a2d40}.node:disabled{opacity:1;cursor:default}
.node .nm{font-weight:700;font-size:.92rem;line-height:1.2;color:var(--indigo);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.node .jv{font-size:.95rem;line-height:1.45;color:var(--indigo2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.node.aku{border:2px dashed var(--gold);background:#fff4d2}
.node.ok{border:2px solid var(--leaf);background:#e3f4ec}.node.no{border:2px solid var(--bad);background:#fbe9e7}
.bdg{position:absolute;top:-11px;width:28px;height:28px;border-radius:50%;display:grid;place-items:center;border:2px solid #fff;box-shadow:0 1px 4px #1d2a4d40}
.sexmark{display:grid;place-items:center;width:22px;height:22px;margin:4px auto 0;border-radius:50%;color:#fff}
.sexmark .ti{width:14px;height:14px;stroke:#fff;stroke-width:2.4;display:block;margin:0}
.sexmark.m{background:var(--indigo2)}.sexmark.f{background:var(--rose)}
.bdg.ord{right:-11px;background:var(--gold);color:#241a00;font-weight:800;font-size:1rem;line-height:1}.bdg.ord.jv{font-size:.68rem;font-weight:700;overflow:hidden}
.opt{width:100%;text-align:left;border:1.5px solid var(--line);background:#fffdf6;border-radius:.9rem;padding:.7rem .95rem;font-weight:700;color:var(--indigo);touch-action:manipulation;user-select:none;-webkit-user-select:none}
.opt:hover:not(:disabled){border-color:var(--gold);background:#fff4d2}.opt:active:not(:disabled){border-color:var(--gold);background:#fff4d2}.opt small{display:block;font-weight:500;color:var(--muted)}
.opt.ok{border-color:var(--leaf);background:#e3f4ec}.opt.no{border-color:var(--bad);background:#fbe9e7}
.feedback{border-radius:1rem;padding:1rem 1.1rem;background:#fff;border:2px solid var(--leaf)}.feedback.bad{border-color:var(--bad)}
.side-head{background:var(--indigo);color:#fff;margin:-1.1rem -1.3rem 1rem;padding:.8rem 1.3rem;border-radius:1.15rem 1.15rem 0 0;position:relative;overflow:hidden;display:flex;align-items:center;gap:.6rem}
.side-head h2{color:#fff;margin:0;font-size:1.3rem}.side-head .ti{color:var(--gold);font-size:1.5rem}
.side-head img{position:absolute;right:-6px;bottom:-6px;width:96px;opacity:.9}
.coach{position:relative;min-height:210px;border-radius:1.15rem;border:1px solid var(--line);overflow:hidden;background:linear-gradient(180deg,#fde9b3,#f6cf72);box-shadow:0 6px 18px #b98a2d26}
.coach .temple{position:absolute;left:-30px;bottom:0;width:70%;opacity:.35}.coach .mascot{position:absolute;right:6px;bottom:-4px;width:170px}
.bubble{position:absolute;left:16px;top:22px;background:#fffdf6;border-radius:1.1rem;padding:.7rem 1rem;font:800 1.15rem/1.25 'Fraunces',serif;color:var(--indigo);box-shadow:0 3px 8px #b98a2d33;max-width:9rem}
.bubble::after{content:"";position:absolute;right:-10px;bottom:14px;border:8px solid transparent;border-left:12px solid #fffdf6}

/* result, hall of fame */
.hero{background:var(--indigo);color:#eef1fa;border-radius:1.4rem;position:relative;overflow:hidden;
background-image:repeating-linear-gradient(45deg,#ffffff08 0 2px,transparent 2px 22px),repeating-linear-gradient(-45deg,#ffffff08 0 2px,transparent 2px 22px)}
.hero .display-3{color:#fff}.res-mascot{width:150px;margin:-.5rem auto .3rem;display:block}
.chip{background:#ffffff1a;border-radius:2rem;padding:.35rem .9rem}
.table{--bs-table-bg:transparent}.me-row{background:#fff0c4!important}
.m0{color:#d19a1f}.m1{color:#8c96aa}.m2{color:#a8693a}

/* footer */
.site-foot{margin-top:2.5rem;padding:3rem 1rem 1.2rem;text-align:center;color:#6a5f45;font-size:.85rem;overflow:hidden;border-top:1px solid var(--line)}
.site-foot img{position:absolute;bottom:-14px;width:min(30vw,400px);opacity:.95}.site-foot .d-l{left:-20px;transform:scaleX(-1)}.site-foot .d-r{right:-20px}
.site-foot p{position:relative;z-index:1;margin:0 auto;max-width:44rem}
@media (max-width:767px){.site-foot img{display:none}}
/* phones and small tablets: compact single column, sticky prompt + action bar */
@media (max-width:991px){
  :root{--tree-gutter:54px}
  .hud{padding:.55rem .9rem .65rem}
  .hud-row{margin-bottom:.4rem}
  .hud-row b{font-size:1.05rem}
  .heart{font-size:1.05rem}
  .timer{height:8px}
  .qcard{padding:.9rem 1rem}
  .q-head{position:sticky;top:64px;z-index:6;background:#fffaf0;padding:.4rem .25rem .55rem;margin:-.4rem -.25rem .25rem;border-radius:.6rem}
  .q-aksara{font-size:2rem;margin-left:2.6rem}
  .plot{--node-h:64px;--row-gap:52px}
  .lvl{font-size:1.9rem}.lvl.txt{font-size:1.2rem}.lvl.jv{font-size:1.7rem}.lvl.jv.txt{font-size:1.25rem}
  .node{max-width:none;border-radius:.65rem}
  .node .nm{font-size:clamp(.72rem,.55vw + .55rem,.9rem)}
  .node .jv{font-size:clamp(.78rem,.5vw + .55rem,.95rem);line-height:1.3}
  .sexmark{width:17px;height:17px;margin-top:2px}
  .sexmark .ti{width:10px;height:10px}
  .bdg{width:21px;height:21px;top:-8px;font-size:.78rem}
  .bdg.ord{right:-8px}
  .opt{padding:.5rem .7rem;font-size:.95rem}
  .opt .jv.fs-5{font-size:1rem!important}
  #v-game:has(#feedback:not(.d-none)){padding-bottom:9.5rem}  /* room for the fixed answer bar only while it is showing */
  .feedback{position:fixed;left:0;right:0;bottom:0;z-index:30;margin:0;border-radius:1.1rem 1.1rem 0 0;box-shadow:0 -8px 24px #1d2a4d33;padding:1rem 1.1rem calc(1rem + env(safe-area-inset-bottom))}
  .feedback #btn-next{width:100%;padding:.8rem;font-size:1.1rem}
}
/* phones: stacked prompt, smallest tree type */
@media (max-width:767px){
  :root{--tree-gutter:38px}
  .tree-wrap{margin:0 -.75rem}
  .container{padding-left:.6rem;padding-right:.6rem}
  .trah-nav .container{flex-wrap:nowrap}
  .navbar-brand{font-size:1.35rem}
  .brand-logo{height:32px;width:32px;margin-right:.45rem}
  .navbar-brand .jv{font-size:1rem;margin-left:.4rem}
  .btn-nav{padding:.3rem .7rem;font-size:.9rem}
  .q-head{top:56px}
  .qcard{padding:.8rem .75rem}
  .tree-scroll{padding-left:2px;padding-right:.45rem}
  .node .nm{font-size:.68rem;letter-spacing:-.01em;overflow:visible;text-overflow:clip}
  .node{padding-left:0;padding-right:0}
  .node{padding:.12rem}
  .q-head{display:grid;grid-template-columns:auto 1fr auto;grid-template-areas:"ico kind btn" "text text text";gap:.35rem .75rem;align-items:center}
  .q-head>.flex-grow-1{display:contents}
  .q-kind{grid-area:kind}
  #q-text{grid-area:text}
  .q-ico{grid-area:ico}
  #btn-hint{grid-area:btn;justify-self:end}
  .q-text{font-size:1.05rem}
  .q-text.jv{font-size:1.15rem}
  .q-aksara{font-size:1.7rem;margin-left:2rem}
  .plot{--node-h:60px;--row-gap:46px}
  .node{min-width:0;width:13.6%}
  .lvl{left:.45rem;font-size:1.4rem}.lvl.txt{font-size:.95rem;top:.5rem}.lvl.jv{font-size:1.3rem}.lvl.jv.txt{font-size:1rem}
}
@media (max-width:359px){
  .navbar-brand{font-size:1.2rem}
  .navbar-brand .jv{font-size:.9rem}
  .btn-nav{padding:.25rem .55rem;font-size:.85rem}
}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
