:root{
  --gold:#d6aa3c; --gold2:#f0cf7a; --ink:#f4efe4; --muted:#b9ad97;
  --bg:rgba(24,16,12,.72); --line:rgba(214,170,60,.28);
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;overflow:hidden;background:#1a120d;color:var(--ink);font-family:'IBM Plex Sans Thai',system-ui,sans-serif}
#c{position:fixed;inset:0;width:100%;height:100%;display:block;touch-action:none}

#loader{position:fixed;inset:0;z-index:50;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.4rem;
  background:radial-gradient(ellipse at 50% 40%,#3a2516 0%,#140d09 70%);transition:opacity .8s}
#loader.done{opacity:0;pointer-events:none}
.brand-mark{font-family:'Cormorant Garamond',serif;letter-spacing:.45em;font-size:.85rem;color:var(--gold)}
.brand-title{font-size:2.6rem;font-weight:500;letter-spacing:.04em;color:var(--gold2)}
.brand-sub{font-size:.85rem;color:var(--muted);letter-spacing:.08em}
.bar{width:min(320px,70vw);height:3px;background:rgba(255,255,255,.1);border-radius:3px;margin-top:1.4rem;overflow:hidden}
.bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--gold),var(--gold2));transition:width .25s}
#loadtxt{font-size:.78rem;color:var(--muted);margin-top:.4rem}

#top{position:fixed;top:0;left:0;right:0;z-index:10;display:flex;justify-content:space-between;align-items:flex-start;
  padding:calc(.9rem + env(safe-area-inset-top)) 1.1rem .9rem;pointer-events:none;
  background:linear-gradient(180deg,rgba(20,13,9,.65),transparent)}
.brand{display:flex;flex-direction:column;line-height:1.15}
.brand .k{font-family:'Cormorant Garamond',serif;letter-spacing:.4em;font-size:.72rem;color:var(--gold)}
.brand .t{font-size:1.5rem;font-weight:500;color:var(--gold2)}
.brand .s{font-size:.78rem;color:var(--muted)}
.top-actions{pointer-events:auto}
.pill{border:1px solid var(--line);background:var(--bg);color:var(--ink);border-radius:999px;padding:.45rem .9rem;font:inherit;font-size:.85rem;cursor:pointer;backdrop-filter:blur(8px)}
.pill:hover{border-color:var(--gold)}

.panel{position:fixed;z-index:10;width:236px;background:var(--bg);border:1px solid var(--line);border-radius:14px;padding:.9rem;
  backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);transition:opacity .3s,transform .3s}
#views{left:1rem;top:6.2rem}
#layers{right:1rem;top:6.2rem}
body.hide-ui .panel{opacity:0;pointer-events:none;transform:translateY(-6px)}
.panel h3{font-size:.9rem;font-weight:500;color:var(--gold2);margin-bottom:.55rem;display:flex;justify-content:space-between;align-items:baseline}
.panel h3 small{font-family:'Cormorant Garamond',serif;font-size:.8rem;color:var(--muted);letter-spacing:.12em}
.mt{margin-top:1rem}
#viewList button{display:block;width:100%;text-align:left;background:transparent;border:1px solid transparent;color:var(--ink);
  font:inherit;font-size:.86rem;padding:.42rem .6rem;border-radius:8px;cursor:pointer}
#viewList button:hover{background:rgba(214,170,60,.1)}
#viewList button.on{border-color:var(--line);background:rgba(214,170,60,.16);color:var(--gold2)}
#layerList label{display:flex;align-items:center;gap:.55rem;font-size:.85rem;padding:.28rem 0;cursor:pointer}
#layerList input{accent-color:var(--gold);width:15px;height:15px}
#layerList .sw{width:10px;height:10px;border-radius:2px;flex:none}
.time{display:flex;align-items:center;gap:.5rem;font-size:.72rem;color:var(--muted)}
.time input{flex:1;accent-color:var(--gold)}
.hint{font-size:.72rem;color:var(--muted);margin-top:.35rem;line-height:1.5}
#note{position:fixed;left:50%;bottom:calc(.6rem + env(safe-area-inset-bottom));transform:translateX(-50%);z-index:9;
  font-size:.7rem;color:var(--muted);background:var(--bg);border:1px solid var(--line);border-radius:999px;padding:.3rem .9rem;white-space:nowrap;max-width:94vw;overflow:hidden;text-overflow:ellipsis}

@media (max-width:760px){
  .brand .t{font-size:1.2rem}.brand .s{display:none}
  .panel{width:auto;left:.6rem!important;right:.6rem!important}
  #views{top:auto;bottom:calc(2.6rem + env(safe-area-inset-bottom))}
  #viewList{display:flex;flex-wrap:wrap;gap:.25rem}
  #viewList button{width:auto;font-size:.78rem;padding:.3rem .55rem;border-color:var(--line)}
  #layers{top:4.6rem;max-height:45vh;overflow:auto}
  body:not(.show-layers) #layers{display:none}
  #note{display:none}
}
