:root{
  --bg:#f3f7f8; --surface:#fff; --ink:#10252d; --muted:#5a6f78; --line:#d6e2e6;
  --brand:#0b3a4a; --brand2:#0e7490; --accent:#f59e0b;
  --protected:#b91c1c; --regulated:#b45309; --unregulated:#15803d; --invasive:#6d28d9;
  --protected-bg:#fee2e2; --regulated-bg:#fef3c7; --unregulated-bg:#dcfce7; --invasive-bg:#ede9fe;
  --low-bg:#ecfccb; --low-ink:#3f6212; --good:#15803d; --bad:#b91c1c; --radius:14px; --shadow:0 1px 3px rgba(16,37,45,.12),0 6px 18px rgba(16,37,45,.06);
}
@media (prefers-color-scheme:dark){
  :root{ --bg:#0a1a20; --surface:#112a33; --ink:#e6f1f4; --muted:#93aab3; --line:#23414c;
    --brand:#06222c; --brand2:#38bdf8; --protected:#fca5a5; --regulated:#fcd34d; --unregulated:#86efac; --invasive:#c4b5fd;
    --protected-bg:#4a1717; --regulated-bg:#463208; --unregulated-bg:#123a22; --invasive-bg:#2c1f55;
    --low-bg:#2a3a12; --low-ink:#bef264; --good:#86efac; --bad:#fca5a5; --shadow:0 1px 3px rgba(0,0,0,.5);}
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
a{color:var(--brand2)}
h1,h2,h3{line-height:1.2;margin:0 0 .5rem}
h1{font-size:1.6rem} h2{font-size:1.25rem} h3{font-size:1.05rem}
.top{position:sticky;top:0;z-index:10;display:flex;flex-wrap:wrap;gap:.5rem 1rem;align-items:center;justify-content:space-between;padding:.6rem 16px;background:var(--brand);color:#fff}
.brand{display:flex;align-items:center;gap:.5rem;color:#fff;text-decoration:none;font-weight:700}
.logo{font-size:1.4rem}
#nav{display:flex;gap:.25rem;flex-wrap:wrap}
#nav a{color:#cfe8f0;text-decoration:none;padding:.4rem .75rem;border-radius:999px;font-size:.95rem}
#nav a.on{background:rgba(255,255,255,.18);color:#fff}
main{max-width:1100px;margin:0 auto;padding:16px;min-height:70vh;outline:none}
.foot{max-width:1100px;margin:1rem auto 2rem;padding:0 16px;color:var(--muted);font-size:.85rem}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
.pad{padding:16px}
.row{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
.grow{flex:1 1 auto}
.muted{color:var(--muted)} .small{font-size:.85rem}
.btn{appearance:none;border:1px solid var(--line);background:var(--surface);color:var(--ink);padding:.65rem 1rem;border-radius:10px;font:inherit;cursor:pointer;min-height:44px}
.btn:hover{border-color:var(--brand2)}
.btn.primary{background:var(--brand2);border-color:var(--brand2);color:#fff;font-weight:600}
.btn:disabled{opacity:.5;cursor:not-allowed}
.btn.sel{outline:3px solid var(--brand2);outline-offset:1px}
input[type=text],input[type=search],select{font:inherit;padding:.65rem .8rem;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);min-height:44px;width:100%}
label.f{display:block;font-weight:600;margin:.5rem 0 .25rem}
.badge{display:inline-block;padding:.15rem .6rem;border-radius:999px;font-size:.78rem;font-weight:700;white-space:nowrap}
.b-protected{background:var(--protected-bg);color:var(--protected)}
.b-regulated{background:var(--regulated-bg);color:var(--regulated)}
.b-unregulated{background:var(--unregulated-bg);color:var(--unregulated)}
.b-invasive{background:var(--invasive-bg);color:var(--invasive)}
.b-top{background:#991b1b;color:#fff}
.b-high{background:var(--protected-bg);color:var(--protected)}
.b-moderate{background:var(--regulated-bg);color:var(--regulated)}
.b-low{background:var(--low-bg);color:var(--low-ink)}
.b-none{background:var(--unregulated-bg);color:var(--unregulated)}
/* photos */
.ph{margin:0;position:relative;background:#0b2630;border-radius:12px;overflow:hidden;aspect-ratio:4/3}
.ph img{width:100%;height:100%;object-fit:cover;display:block}
.ph .cap{position:absolute;left:0;right:0;bottom:0;padding:.3rem .5rem;font-size:.68rem;color:#fff;background:linear-gradient(transparent,rgba(0,0,0,.75));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ph .ph-msg{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;text-align:center;padding:1rem;color:#9ec4d1;font-size:.9rem}
.ph.big{aspect-ratio:16/10}
.ph .shuf{position:absolute;top:8px;right:8px;background:rgba(0,0,0,.55);color:#fff;border:0;border-radius:999px;padding:.4rem .8rem;cursor:pointer;min-height:36px}
/* directory */
.filters{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:12px 0}
.filters .search{grid-column:span 3}
@media(max-width:700px){.filters{grid-template-columns:1fr 1fr}.filters .search{grid-column:1/-1}}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px}
.fcard{display:block;text-decoration:none;color:inherit;overflow:hidden}
.fcard .ph{border-radius:0;aspect-ratio:4/3}
.fcard .info{padding:10px 12px}
.fcard .haw{font-weight:700;font-size:1.05rem}
.fcard .en{color:var(--muted);font-size:.9rem}
.fcard .tags{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
/* detail */
.detail{display:grid;grid-template-columns:1.1fr 1fr;gap:18px}
@media(max-width:800px){.detail{grid-template-columns:1fr}}
.rulebox{padding:12px 14px;border-left:6px solid var(--line);border-radius:10px;background:var(--surface);margin:10px 0}
.rulebox.protected{border-color:var(--protected);background:var(--protected-bg)}
.rulebox.regulated{border-color:var(--regulated);background:var(--regulated-bg)}
.rulebox.unregulated{border-color:var(--unregulated);background:var(--unregulated-bg)}
.rulebox.invasive{border-color:var(--invasive);background:var(--invasive-bg)}
.facts{display:grid;grid-template-columns:110px 1fr;gap:6px 12px;margin:10px 0}
.facts dt{font-weight:700;color:var(--muted)} .facts dd{margin:0}
.gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px}
.gallery .ph{aspect-ratio:1}
.looks{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
/* quiz */
.modes{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:12px}
.mode{padding:14px;text-align:left;cursor:pointer;border:2px solid var(--line);border-radius:var(--radius);background:var(--surface);color:inherit;font:inherit}
.mode.sel{border-color:var(--brand2);box-shadow:0 0 0 3px color-mix(in srgb,var(--brand2) 25%,transparent)}
.mode b{display:block;font-size:1.05rem;margin-bottom:2px}
.qhead{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px;flex-wrap:wrap}
.bar{height:8px;background:var(--line);border-radius:99px;overflow:hidden;flex:1;min-width:120px}
.bar>i{display:block;height:100%;background:var(--brand2)}
.qlayout{display:grid;grid-template-columns:1.2fr 1fr;gap:16px}
@media(max-width:800px){.qlayout{grid-template-columns:1fr}}
.opts{display:grid;gap:8px;margin:8px 0}
.opt{text-align:left;padding:.75rem 1rem;border:2px solid var(--line);border-radius:12px;background:var(--surface);color:inherit;font:inherit;cursor:pointer;min-height:48px}
.opt:hover{border-color:var(--brand2)}
.opt.sel{border-color:var(--brand2);background:color-mix(in srgb,var(--brand2) 14%,var(--surface))}
.opt.right{border-color:var(--good);background:var(--unregulated-bg)}
.opt.wrong{border-color:var(--bad);background:var(--protected-bg)}
.opt:disabled{cursor:default}
.namebig{font-size:1.5rem;font-weight:800}
.fb{padding:12px 14px;border-radius:12px;margin:10px 0;font-weight:600}
.fb.ok{background:var(--unregulated-bg);color:var(--good)}
.fb.no{background:var(--protected-bg);color:var(--bad)}
.summary{padding:14px;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);margin-top:12px}
.summary h3{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.score{font-size:3rem;font-weight:800;line-height:1}
/* progress */
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px;margin:12px 0}
.tile{padding:12px 14px}
.tile b{display:block;font-size:1.6rem}
.chart{width:100%;height:auto;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius)}
.chart text{fill:var(--muted);font-size:11px;font-family:inherit}
.legend{display:flex;gap:14px;flex-wrap:wrap;margin:6px 0;font-size:.9rem}
.legend i{display:inline-block;width:12px;height:12px;border-radius:3px;margin-right:6px;vertical-align:-1px}
table{border-collapse:collapse;width:100%;font-size:.92rem}
th,td{padding:.45rem .5rem;border-bottom:1px solid var(--line);text-align:left}
.tablewrap{overflow-x:auto}
.tag{display:inline-block;padding:.1rem .5rem;border:1px solid var(--line);border-radius:6px;font-size:.78rem;color:var(--muted)}
.compare{display:grid;grid-template-columns:1fr 1fr;gap:12px}
@media(max-width:700px){.compare{grid-template-columns:1fr}}
.spin{display:inline-block;width:18px;height:18px;border:3px solid var(--line);border-top-color:var(--brand2);border-radius:50%;animation:sp 1s linear infinite;vertical-align:-3px}
@keyframes sp{to{transform:rotate(360deg)}}
:focus-visible{outline:3px solid var(--accent);outline-offset:2px}

.seasonbar{margin:12px 0}
.strip{display:grid;grid-template-columns:repeat(12,1fr);gap:3px;margin-top:6px;max-width:520px}
.strip span{text-align:center;font-size:.72rem;font-weight:700;padding:.25rem 0;border-radius:5px}
.strip .cl{background:var(--protected-bg);color:var(--protected)} .strip .op{background:var(--unregulated-bg);color:var(--unregulated)}
.meter{display:inline-flex;gap:2px;margin-right:8px;vertical-align:middle}
.meter i{width:14px;height:8px;border-radius:2px;background:var(--line)}
.meter i.on.r1{background:#16a34a}.meter i.on.r2{background:#84cc16}.meter i.on.r3{background:#f59e0b}.meter i.on.r4{background:#ef4444}.meter i.on.r5{background:#991b1b}

/* v4 additions */
.bname{display:flex;flex-direction:column;line-height:1.1;font-size:1.15rem}
.bname small{font-weight:400;font-size:.68rem;color:#bfe0ea;letter-spacing:.02em}
.filters{grid-template-columns:repeat(auto-fit,minmax(170px,1fr))}
.filters .search{grid-column:1/-1}
.ph .shuf.hint{padding:.3rem .65rem;font-size:1.15rem;line-height:1;min-width:44px;min-height:44px}
.spk{appearance:none;border:1px solid var(--line);background:var(--surface);border-radius:999px;margin-left:8px;padding:.15rem .5rem;cursor:pointer;font-size:.85rem;vertical-align:middle;min-height:32px;min-width:36px}
.spk:hover{border-color:var(--brand2)}
.thumb{appearance:none;border:2px solid transparent;border-radius:12px;padding:0;background:none;cursor:pointer;display:block;width:100%}
.thumb.on{border-color:var(--brand2)}
.thumb .ph{aspect-ratio:1}
.qq{width:100%;padding:10px 12px;margin:4px 0 8px;border:2px solid var(--regulated);background:var(--regulated-bg);border-radius:12px}
.qq[hidden]{display:none}
.phases{margin:10px 0;padding:10px 12px;border:2px dashed var(--regulated);border-radius:12px;background:var(--regulated-bg)}
.ph-row{margin-top:8px;padding-left:10px;border-left:5px solid var(--regulated)}
.ph-row.prot{border-color:var(--protected)}
.b-na{background:#1f2937;color:#fff}

/* v4 card B rows + detail status boxes + tabs */
.fcard .rows{margin-top:8px;border-top:1px solid var(--line)}
.fcard .r{display:grid;grid-template-columns:70px 1fr;align-items:center;gap:6px;padding:6px 0;border-bottom:1px solid var(--line);min-height:34px}
.fcard .r:last-child{border-bottom:0}
.lbl{font-size:.64rem;font-weight:800;letter-spacing:.08em;color:var(--muted);text-transform:uppercase}
.note{font-size:.78rem;color:var(--muted)}
.dstat{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px 0}
.dstat .box{border-radius:12px;padding:10px 12px;border:2px solid var(--line);background:var(--surface)}
.dstat .big{font-weight:800;font-size:1.1rem}
.dstat .l.protected{border-color:var(--protected);background:var(--protected-bg)}.dstat .l.regulated{border-color:var(--regulated);background:var(--regulated-bg)}
.dstat .l.unregulated{border-color:var(--unregulated);background:var(--unregulated-bg)}.dstat .l.invasive{border-color:var(--invasive);background:var(--invasive-bg)}
.dstat .c.cg-top,.dstat .c.cg-high{border-color:var(--protected);background:var(--protected-bg)}.dstat .c.cg-moderate{border-color:var(--regulated);background:var(--regulated-bg)}
.dstat .c.cg-low{border-color:var(--low-ink);background:var(--low-bg)}.dstat .c.cg-none{border-color:var(--unregulated);background:var(--unregulated-bg)}.dstat .c.cg-na{border-color:#1f2937}
@media(max-width:560px){.dstat{grid-template-columns:1fr}}
.tabs{display:flex;gap:4px;border-bottom:2px solid var(--line);margin-top:12px;flex-wrap:wrap}
.tabs button{appearance:none;border:0;background:none;padding:.55rem .9rem;border-radius:8px 8px 0 0;font:inherit;font-size:.9rem;color:var(--muted);cursor:pointer;min-height:44px}
.tabs button.on{background:var(--brand2);color:#fff}
.tabpane{padding-top:10px}.tabpane[hidden]{display:none}

/* legal-status popup */
.fcard{overflow:visible}
.fcard .ph{border-radius:14px 14px 0 0}
.tipwrap{position:relative;display:inline-block;cursor:help}
.tippop{display:none;position:absolute;z-index:30;top:calc(100% + 6px);left:0;width:min(280px,78vw);padding:10px 12px;border-radius:10px;background:var(--ink);color:var(--bg);font-size:.82rem;line-height:1.4;font-weight:400;white-space:normal;box-shadow:0 6px 20px rgba(0,0,0,.3)}
.tipwrap:hover .tippop,.tipwrap:focus .tippop,.tipwrap.open .tippop{display:block}

.ph img{animation:fadein .25s ease-out}
@keyframes fadein{from{opacity:0}to{opacity:1}}

/* v6 hide button, quiz menu, tiers, folds */
.ph .shuf.flag{right:auto;left:8px;font-size:.8rem;padding:.35rem .7rem;background:rgba(120,20,20,.65)}
.mode.chosen{width:100%;cursor:default}
.mode.chosen b{display:block}
.tiers{display:grid;gap:10px;margin:10px 0}
.tier{border:1px solid var(--line);border-radius:12px;padding:10px 12px;background:var(--surface)}
.tier .th{display:flex;align-items:center;gap:8px;margin-bottom:6px}
.tier .tfish{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:6px}
details.fold{margin:0 0 4px}
details.fold>summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:8px;min-height:44px}
details.fold>summary::-webkit-details-marker{display:none}
details.fold>summary::before{content:"▸";font-size:1.1rem;transition:transform .15s}
details.fold[open]>summary::before{transform:rotate(90deg)}

/* ---------- phones ---------- */
@media(max-width:700px){
  main{padding:12px}
  .grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .fcard .ph{aspect-ratio:1/1}
  .fcard .info{padding:7px 8px 8px}
  .fcard .haw{font-size:.92rem;line-height:1.2}
  .fcard .en{font-size:.76rem;line-height:1.25}
  .fcard .small{font-size:.7rem}
  .fcard .rows{margin-top:6px}
  .fcard .r{grid-template-columns:42px 1fr;gap:4px;padding:4px 0;min-height:28px;font-size:.78rem}
  .fcard .lbl{font-size:.52rem;letter-spacing:.04em}
  .fcard .note{display:none}
  .fcard .badge{font-size:.66rem;padding:.1rem .45rem}
  .fcard .meter i{width:9px;height:7px}
  .looks{grid-template-columns:repeat(2,minmax(0,1fr))}
  .rtable thead{display:none}
  .rtable tr{display:block;padding:8px 0;border-bottom:1px solid var(--line)}
  .rtable td{display:block;border:0;padding:2px 12px}
  .rtable td:first-child{font-weight:700}
  #stat .opt .muted.small{display:none}
  .opt{min-height:44px;padding:.6rem .8rem}
}
@media(max-width:800px){
  .gallery{display:flex;overflow-x:auto;gap:8px;padding-bottom:8px;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch}
  .gallery .thumb,.gallery>.ph{flex:0 0 118px;width:118px;scroll-snap-align:start}
  #qside.locked .qctl{display:none}
}

details.fold#flt{margin-bottom:6px}
@media(max-width:700px){.introp{display:none}.seasonbar{padding:10px 12px}.seasonbar .badge{font-size:.68rem}.seasonbar .row{gap:6px}}
@media(max-width:700px){
  .fcard .ph{aspect-ratio:4/3}
  .fcard .r{grid-template-columns:54px 1fr}
  .fcard .lbl{letter-spacing:0;font-size:.5rem}
  .seasonbar .badge{font-size:.62rem;padding:.1rem .45rem}
  .seasonbar .row:first-child a{font-size:.75rem}
}
