html,body{margin:0;height:100%;overflow:hidden;background:#1d1a24;font-family:Nunito,system-ui,sans-serif}
#app{position:fixed;inset:0}
#note{
  position:fixed; left:10px; bottom:10px; z-index:10; max-width:330px;
  background:#f7ecd2; color:#4a3826; border:1px solid #5a4632; border-radius:8px;
  padding:7px 10px; font-size:11px; line-height:1.4; box-shadow:0 2px 8px rgba(0,0,0,.35);
}

/* ---- part 3: tag / caption / clock / aisle toggle ---- */
#tag{
  position:fixed; left:0; top:0; z-index:12; transform:translate(0,-50%);
  max-width:300px; text-align:center; pointer-events:none;
  background:rgba(28,20,12,.86); border:2px solid #fff0d0; border-radius:10px;
  padding:8px 12px; font-size:13px; line-height:1.45; color:#fff6e4; font-weight:700;
  box-shadow:0 3px 14px rgba(0,0,0,.5); backdrop-filter:blur(3px);
}
#leader{
  position:fixed; left:0; top:0; z-index:11; height:2px; background:rgba(255,240,208,.88);
  border-radius:2px; box-shadow:0 0 5px rgba(0,0,0,.55); pointer-events:none; transform-origin:0 50%;
}
#tag.ok{ border-color:#8fd99a; color:#e9f7e4; }
#tag.bad{ border-color:#ff8577; color:#ffe3de; background:rgba(58,20,14,.88); }
#tag .sub{ font-size:12.5px; color:#e9e2cf; }
#tag.bad .sub{ color:#ffd4cd; }
#tag .small{ font-size:10.5px; font-weight:400; opacity:.85; letter-spacing:.02em; }
#tag .small .tower{ color:#ffcf9a; font-weight:800; opacity:1; }   /* "tower closed, still controlled" */
#caption{
  position:fixed; left:50%; top:58px; z-index:11; transform:translateX(-50%);
  max-width:560px; text-align:center; pointer-events:none;
  background:rgba(20,14,22,.82); color:#f7ecd2; border:1px solid rgba(247,236,210,.35);
  border-radius:14px; padding:10px 18px; font-size:15px; line-height:1.45; font-weight:700;
  box-shadow:0 4px 18px rgba(0,0,0,.5); backdrop-filter:blur(4px);
  opacity:0; transition:opacity .35s ease;
}
#caption.show{ opacity:1; }
#clock{
  position:fixed; right:14px; top:14px; z-index:11; pointer-events:none;
  background:rgba(20,16,24,.8); color:#f7ecd2; border:1px solid rgba(247,236,210,.28);
  border-radius:999px; padding:6px 14px; font-size:13px; font-weight:800; letter-spacing:.03em;
}
#clock.night{ color:#d7c8ff; border-color:rgba(170,130,255,.4); }
#clock.dusk{ color:#ffd9a8; border-color:rgba(255,190,120,.45); background:rgba(40,24,14,.82); }   /* 8:00 PM */
#aisleBtn{
  position:fixed; right:14px; bottom:14px; z-index:12;
  background:#f7ecd2; color:#26211c; border:2px solid #5a4632; border-radius:999px;
  padding:8px 14px; font-size:12px; font-weight:800; letter-spacing:.04em; cursor:pointer;
  box-shadow:0 3px 10px rgba(0,0,0,.4); transition:background .15s ease;
}
#aisleBtn:hover{ background:#ffe9a8; }
#aisleBtn:active{ transform:scale(.97); }

/* ---- part 4: top bar, care cards, sources, legend, phone ---- */
#topbar{
  position:fixed; left:0; right:0; top:0; z-index:30;
  display:flex; align-items:center; gap:8px; flex-wrap:nowrap; overflow:hidden;   /* one row: 9 controls, no wrap */
  background:rgba(247,236,210,.92); border-bottom:1px solid #5a4632;
  padding:6px 10px; box-shadow:0 2px 12px rgba(0,0,0,.28); backdrop-filter:blur(4px);
}
.topbar-title{ font-family:Fraunces,Georgia,serif; font-weight:600; font-size:16px; color:#3a2c1c; letter-spacing:.01em; white-space:nowrap; flex:0 0 auto; }
.topbar-btns{ display:flex; align-items:center; gap:5px; flex-wrap:nowrap; overflow:hidden; min-width:0; margin-left:auto; }
.tb-btn{
  font-family:Nunito,system-ui,sans-serif; font-weight:700; font-size:12px; color:#33302a;
  background:#fffdf4; border:1px solid #5a4632; border-radius:999px; padding:5px 10px; cursor:pointer; flex:0 0 auto;
  display:inline-flex; align-items:center; gap:5px; line-height:1; transition:background .15s ease, transform .1s ease;
}
.tb-btn:hover{ background:#ffe9a8; }
.tb-btn:active{ transform:scale(.96); }
.tb-btn.active{ background:#5a4632; color:#f7ecd2; border-color:#5a4632; }
.tb-btn .ic{ font-size:13px; }
.tb-btn .lbl{ white-space:nowrap; }
.tb-sources{ display:flex; align-items:center; position:relative; }
.tb-sources button{
  font-family:Nunito,system-ui,sans-serif; font-size:11px; font-weight:700; color:#5a4632;
  background:transparent; border:1px dashed #b39a72; border-radius:999px; padding:4px 10px; cursor:pointer;
}
.tb-sources button:hover{ background:#efe0bd; }
.sources-panel{
  position:absolute; top:100%; right:8px; margin-top:4px; z-index:31;
  width:300px; max-width:78vw; background:#f7ecd2; color:#4a3826; border:1px solid #5a4632;
  border-radius:10px; padding:10px 12px; box-shadow:0 6px 22px rgba(0,0,0,.35); font-size:12px; line-height:1.45;
}
.sources-panel strong{ display:block; color:#3a2c1c; letter-spacing:.04em; text-transform:uppercase; font-size:10px; margin-bottom:2px; }
.sources-panel p{ margin:0 0 8px; }
.sources-panel p:last-child{ margin-bottom:0; }
#menu{
  position:absolute; top:100%; right:0; margin-top:4px; z-index:32;
  background:#f7ecd2; border:1px solid #5a4632; border-radius:12px; padding:6px;
  box-shadow:0 10px 26px rgba(0,0,0,.4); display:flex; flex-direction:column; gap:5px; min-width:230px;
}
#menu[hidden]{ display:none; }
#menu button{
  display:flex; align-items:center; gap:8px; text-align:left;
  font-family:Nunito,system-ui,sans-serif; font-size:14px; font-weight:700; color:#33302a;
  background:#fffdf4; border:1px solid #d8c69b; border-radius:9px; padding:9px 11px; cursor:pointer;
}
#menu button:hover{ background:#ffe9a8; }

#hint{
  position:fixed; top:52px; left:50%; transform:translateX(-50%); z-index:29;
  background:rgba(247,236,210,.94); color:#4a3826; border:1px solid #5a4632; border-radius:999px;
  padding:5px 16px; font-size:12.5px; font-weight:700; letter-spacing:.03em;
  box-shadow:0 3px 14px rgba(0,0,0,.35); pointer-events:none; transition:opacity .35s ease; white-space:nowrap;
}
#hint.gone{ opacity:0; }

/* care card (pet-store style) */
#care{
  position:fixed; right:18px; top:50%; transform:translateY(-50%) scale(.96); z-index:28;
  width:330px; max-width:78vw; background:#f7ecd2; color:#4a3826;
  border:2px solid #5a4632; border-radius:14px; box-shadow:0 14px 36px rgba(0,0,0,.45);
  opacity:0; pointer-events:none; transition:opacity .18s ease, transform .18s ease;
  overflow:hidden;
}
#care.show{ opacity:1; transform:translateY(-50%) scale(1); pointer-events:auto; }
.care-stripe{ height:10px; width:100%; }
.care-body{ padding:12px 16px 16px; }
.care-x{
  position:absolute; top:8px; right:8px; z-index:2; width:28px; height:28px; line-height:1;
  background:transparent; color:#5a4632; border:none; font-size:22px; cursor:pointer; font-weight:700;
}
.care-x:hover{ color:#b3261e; }
.care-title{ font-family:Fraunces,Georgia,serif; font-weight:600; font-size:21px; margin:0 24px 2px 0; color:#3a2c1c; }
.care-chip{
  display:inline-block; font-family:Nunito,sans-serif; font-weight:800; font-size:11px; letter-spacing:.06em;
  color:#6a4a1e; background:#efe0bd; border:1px solid #c8b184; border-radius:999px; padding:2px 9px; margin:2px 0 6px;
}
.care-list{ margin:6px 0 0; padding:0; display:flex; flex-direction:column; gap:6px; }
.care-list dt{ font-size:10.5px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; color:#8a5f33; }
.care-list dd{ margin:0 0 2px; font-size:13px; line-height:1.4; color:#3a2c1c; font-weight:700; }
.care-text{ font-size:13px; line-height:1.5; border-top:1px solid #d8c69b; padding-top:10px; margin:10px 0 0; color:#4a3826; font-weight:400; }

/* legend */
#legend{
  position:fixed; left:10px; bottom:10px; z-index:25;
  background:rgba(238,226,196,.94); color:#4a3826; border:1px solid #5a4632; border-radius:11px;
  box-shadow:0 3px 12px rgba(0,0,0,.35); max-width:290px; font-size:12px;
}
.legend-toggle{
  width:100%; background:transparent; border:none; cursor:pointer; text-align:left;
  font-family:Nunito,system-ui,sans-serif; font-size:12px; font-weight:800; letter-spacing:.06em; text-transform:uppercase;
  color:#5a4632; padding:7px 11px;
}
.legend-panel{ padding:0 11px 10px; }
.legend-colors{ list-style:none; margin:0 0 8px; padding:0; display:flex; flex-wrap:wrap; gap:6px 12px; }
.legend-colors li{ display:flex; align-items:center; gap:6px; font-size:11.5px; font-weight:700; color:#3a2c1c; }
.chip{ display:inline-block; width:12px; height:12px; border-radius:4px; border:1px solid #5a4632; }
.legend-note{ margin:0; font-size:11.5px; line-height:1.45; color:#5a4632; }
#legend.collapsed .legend-panel{ display:none; }

/* desktop: shift the scale note and clock below the top bar */
#note{ left:50%; transform:translateX(-50%); bottom:12px; max-width:430px; font-size:10.5px; }
#clock{ top:58px; }

/* widths where nine controls get tight: shed the title, then tighten the buttons. 1366 px fits as it is. */
@media (max-width:1290px){ .topbar-title{ font-size:15px; } }
@media (max-width:1200px){ .topbar-title{ display:none; } }
@media (max-width:1080px){ .tb-btn{ padding:5px 8px; font-size:11.5px; } .tb-sources button{ padding:4px 8px; font-size:10.5px; } }

/* ---- phone layout ---- */
@media (max-width: 700px){
  #topbar{ padding:5px 8px; gap:6px; }
  .topbar-title{ display:none; }
  .topbar-btns{ margin-left:auto; gap:5px; }
  .tb-btn{ padding:6px 8px; font-size:11px; border-radius:10px; }
  .tb-btn .lbl{ display:none; }
  .tb-btn .ic{ font-size:16px; }
  .tb-sources{ display:none; }
  #hint{ top:56px; font-size:11px; padding:4px 12px; }
  #caption{ top:104px; left:10px; right:10px; transform:none; max-width:none; font-size:12px; line-height:1.4; padding:8px 12px; }
  #tag{ max-width:72vw; font-size:12px; padding:6px 10px; }
  #note{ display:none; }
  #legend{ max-width:168px; left:8px; bottom:calc(8px + env(safe-area-inset-bottom)); z-index:26; }
  #legend.collapsed .legend-panel{ display:none; }
  #clock{ top:auto; bottom:12px; right:12px; font-size:11px; padding:4px 10px; }
  #aisleBtn{ display:none; }
  #care{
    left:0; right:0; top:auto; bottom:0; transform:translateY(8%); width:auto; max-width:none;
    border-radius:16px 16px 0 0; border:2px solid #5a4632; border-bottom:none;
    max-height:52vh; overflow-y:auto;
  }
  #care.show{ transform:translateY(0); }
  .care-title{ font-size:19px; }
  .care-body{ padding:10px 18px 14px; }
  .care-list dd{ font-size:12.5px; }
  .care-text{ font-size:12.5px; }
  .legend-note{ font-size:11px; }
}

.care-chip[hidden]{ display:none; }
