/* ===== Shared user-dashboard shell: header + bottom nav + global theme =====
   Used by every page in /home via inc/dash_header.php + inc/dash_footer.php.
   Palette = warm aubergine surfaces with terracotta and violet accents.
   Shell selectors are prefixed (.dh-* / .dn-*) so they never clash with page CSS. */
:root{
  /* LIGHT (default) */
  --dh-bg:#fff3ec;
  --dh-glass:rgba(105,54,94,.06);
  --dh-soft:rgba(105,54,94,.05);
  --dh-line:rgba(129,72,108,.14);
  --dh-hair:rgba(129,72,108,.11);
  --dh-gold:#e9583d; --dh-gold-dark:#c64132; --dh-orange:#ff875f;
  --dh-accent:#7445dc;
  --dh-text:#2d1f2b; --dh-muted:#786775; --dh-icon:#5d4b5c; --dh-sheet-text:#5d4b5c;
  --dh-top-bg:rgba(255,243,236,.97);
  --dh-nav-bg:rgba(255,243,236,.99);
  --dh-sheet-bg:#ffffff;
  --dh-ring:#ffffff;
  --dh-shadow:rgba(15,23,42,.16);
  --dh-banner-h:34px;
  --dh-row-h:40px;
  --dh-h:calc(var(--dh-banner-h) + var(--dh-row-h) + 28px);
  --dh-nav-h:68px;
  color-scheme:light;
}
/* DARK: chosen by the user, and always used inside game pages so the shared nav matches the game art */
html[data-theme="dark"], body.dh-compact, body.dh-lockdark{
  --dh-bg:#241238;
  --dh-glass:rgba(255,255,255,.06);
  --dh-soft:rgba(255,255,255,.04);
  --dh-line:rgba(255,255,255,.08);
  --dh-hair:rgba(255,126,91,.25);
  --dh-accent:#ff9b72;
  --dh-text:#fff6ff; --dh-muted:#d1badd; --dh-icon:#eadbf1; --dh-sheet-text:#eadbf1;
  --dh-top-bg:rgba(36,18,56,.96);
  --dh-nav-bg:rgba(36,18,56,.98);
  --dh-sheet-bg:rgba(52,29,72,.98);
  --dh-ring:#241238;
  --dh-shadow:rgba(0,0,0,.55);
}
html[data-theme="dark"]{ color-scheme:dark; }
/* no promo banner (every page except the dashboard) and game pages -> slimmer header */
/* every page except the dashboard has no shared top header */
body.dh-nb,body.dh-compact{ --dh-banner-h:0px; --dh-row-h:0px; --dh-h:0px; }

/* ---------- GLOBAL THEME: one palette for all pages ---------- */
html body.dh-body:not(.dh-compact){
  /* LIGHT (default) */
  --bg:#fff3ec;
  --surface:#ffffff;
  --surface2:#fff0f6;
  --border:#f0cabc;
  --field:#fff8f4;
  --gold:#e9583d;
  --gold-dim:#c64132;
  --purple:#7445dc;
  --orange:#ff805e;
  --muted:#786775;
  --text:#2d1f2b;
  background-color:#fff3ec !important;
  background-image:none !important;
  color:var(--text);
}
html[data-theme="dark"] body.dh-body:not(.dh-compact),
html body.dh-body.dh-lockdark:not(.dh-compact){
  --bg:#241238;
  --surface:#321847;
  --surface2:#3d2057;
  --border:#64417b;
  --field:#2c1640;
  --gold:#ff805e;
  --gold-dim:#f15c43;
  --purple:#b171ff;
  --orange:#ff9b72;
  --muted:#d1badd;
  --text:#fff6ff;
  background-color:#241238 !important;
  background-image:
    radial-gradient(ellipse at 10% 20%, rgba(255,111,76,.18) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 80%, rgba(177,113,255,.18) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(255,111,76,.09) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 0%, rgba(177,113,255,.10) 0%, transparent 40%) !important;
  background-attachment:fixed !important;
  color:var(--text);
}

/* make room for the fixed header/footer on every page */
html body.dh-body{
  box-sizing:border-box !important;
  padding-top:var(--dh-h) !important;
  padding-bottom:calc(var(--dh-nav-h) + env(safe-area-inset-bottom,0px)) !important;
}
/* page-level sticky bars sit directly under the shared header */
html body.dh-body .topbar,
html body.dh-body header.header{ top:var(--dh-h) !important; }
html body.dh-body:not(.dh-compact) .topbar{
  background:var(--dh-top-bg) !important;
  -webkit-backdrop-filter:blur(16px); backdrop-filter:blur(16px);
  border-bottom:1px solid var(--dh-line) !important;
}

/* ---------- header ---------- */
.dh-top{
  position:fixed; top:0; left:50%; transform:translateX(-50%);
  width:100%; max-width:480px; z-index:900; box-sizing:border-box;
  background:var(--dh-top-bg);
  -webkit-backdrop-filter:blur(20px); backdrop-filter:blur(20px);
  border-bottom:1px solid var(--dh-hair);
  padding:10px 12px;
  font-family:'Segoe UI',system-ui,sans-serif; line-height:normal;
}
.dh-top *{ box-sizing:border-box; }
.dh-banner{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  height:var(--dh-banner-h); margin-bottom:10px; padding:0 6px 0 14px;
  background:linear-gradient(135deg,rgba(226,122,90,.16),rgba(160,132,230,.13));
  border:1px solid rgba(226,122,90,.14); border-radius:40px;
}
.dh-banner-text{ color:var(--dh-accent); font-size:11px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dh-banner-text i{ color:var(--dh-orange); margin-right:4px; }
.dh-dl{
  background:linear-gradient(135deg,var(--dh-gold),var(--dh-orange)); color:#1a1200; border-radius:20px;
  padding:5px 12px; font-size:10px; font-weight:800; text-decoration:none; white-space:nowrap;
}
.dh-row{ display:flex; align-items:center; justify-content:space-between; gap:8px; height:var(--dh-row-h); }
.dh-left{ display:flex; align-items:center; gap:8px; flex-shrink:0; }
.dh-logo{ display:flex; align-items:center; gap:8px; text-decoration:none; }
.dh-logo img{
  width:36px; height:36px; border-radius:11px; object-fit:cover;
  border:2px solid rgba(226,122,90,.30); box-shadow:0 0 14px rgba(226,122,90,.17);
}
.dh-name{ font-size:14px; font-weight:800; letter-spacing:-.2px; color:var(--dh-accent); }
.dh-vip{
  background:rgba(226,122,90,.12); border:1px solid rgba(226,122,90,.25); color:var(--dh-accent);
  font-size:10px; font-weight:800; padding:4px 10px; border-radius:999px; white-space:nowrap;
}
.dh-vip i{ margin-right:3px; font-size:9px; }
.dh-coin{
  display:flex; align-items:center; gap:6px; color:#1a1200;
  background:linear-gradient(135deg,var(--dh-gold),var(--dh-gold-dark));
  font-size:12px; font-weight:800; padding:7px 8px 7px 12px; border-radius:999px;
  box-shadow:0 4px 14px rgba(226,122,90,.28); cursor:pointer; white-space:nowrap; text-decoration:none; flex-shrink:0;
}
.dh-coin:hover{ filter:brightness(1.08); color:#1a1200; }
.dh-plus{ background:rgba(10,10,26,.85); color:var(--dh-accent); width:18px; height:18px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-size:13px; font-weight:900; line-height:1; }
.dh-actions{ display:flex; gap:6px; flex-shrink:0; }
.dh-icon{
  position:relative; width:36px; height:36px; border-radius:12px;
  background:var(--dh-glass); border:1px solid var(--dh-line);
  color:var(--dh-icon); display:flex; align-items:center; justify-content:center; font-size:14px; cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
.dh-icon:hover,.dh-icon.open{ background:rgba(226,122,90,.12); color:var(--dh-accent); border-color:rgba(226,122,90,.25); }
.dh-badge{
  position:absolute; top:-5px; right:-5px; min-width:16px; height:16px; padding:0 4px; border-radius:10px;
  background:#ff4757; color:#fff; font-size:9px; font-weight:800; box-shadow:0 0 0 2px var(--dh-ring);
  display:flex; align-items:center; justify-content:center;
}
@media (max-width:430px){ .dh-name{ display:none; } }

/* notification sheet (replaces the old browser alert) */
.dh-sheet{
  position:fixed; z-index:950; top:calc(var(--dh-h) + 6px); right:max(12px,calc(50% - 228px)); width:min(300px,calc(100% - 24px));
  background:var(--dh-sheet-bg); border:1px solid var(--dh-hair); border-radius:16px;
  box-shadow:0 14px 40px var(--dh-shadow); padding:14px; display:none; color:var(--dh-text); font-size:13px;
}
.dh-sheet.open{ display:block; animation:dhPop .18s ease-out; }
.dh-sheet h4{ font-size:13px; color:var(--dh-accent); margin-bottom:6px; font-weight:800; }
.dh-sheet p{ color:var(--dh-sheet-text); line-height:1.45; font-size:12px; }
@keyframes dhPop{ from{opacity:0; transform:translateY(-6px)} to{opacity:1; transform:none} }

/* ---------- bottom nav ---------- */
.dn-bar{
  position:fixed; bottom:0; left:50%; transform:translateX(-50%);
  width:100%; max-width:480px; z-index:900; box-sizing:border-box;
  display:grid; grid-template-columns:repeat(5,1fr);
  padding:8px 0 calc(10px + env(safe-area-inset-bottom,0px));
  background:var(--dh-nav-bg); -webkit-backdrop-filter:blur(20px); backdrop-filter:blur(20px);
  border-top:1px solid var(--dh-hair); border-radius:20px 20px 0 0;
  box-shadow:0 -6px 24px var(--dh-shadow);
  font-family:'Segoe UI',system-ui,sans-serif;
}
.dn-bar *{ box-sizing:border-box; }
.dn-item,.dn-promo{
  display:flex; flex-direction:column; align-items:center; gap:2px; padding:4px 0;
  color:var(--dh-muted); text-decoration:none; cursor:pointer; transition:color .2s;
}
.dn-item:hover{ color:var(--dh-icon); }
.dn-item.active{ color:var(--dh-accent); }
.dn-item.active .dn-ico{ text-shadow:0 0 12px rgba(226,122,90,.45); }
.dn-ico{ font-size:18px; line-height:1.2; }
.dn-lbl{ font-size:10px; font-weight:600; }
.dn-promo .dn-lbl{ color:var(--dh-accent); font-weight:800; }
.dn-orb{
  position:relative; width:48px; height:48px; margin-top:-24px; border-radius:50%;
  background:linear-gradient(145deg,var(--dh-gold),#916bd8); color:#fff; font-size:18px;
  border:4px solid var(--dh-ring); box-shadow:0 6px 18px rgba(196,102,80,.38);
  display:flex; align-items:center; justify-content:center;
}
.dn-orb .dh-badge{ top:-6px; right:-6px; }

/* live notification / inbox list inside the sheet */
.dh-sheet .nt-list{ max-height:min(60vh,380px); overflow-y:auto; margin:0 -6px; padding:0 6px; -webkit-overflow-scrolling:touch; }
.nt-item{ display:flex; gap:10px; padding:9px 8px; border-radius:12px; margin-bottom:6px; background:var(--dh-soft); border:1px solid transparent; }
.nt-item.nt-new{ background:rgba(226,122,90,.08); border-color:rgba(226,122,90,.22); }
.nt-ic{ flex:none; width:30px; height:30px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:12px; background:var(--dh-glass); color:var(--dh-icon); }
.nt-ok .nt-ic{ background:rgba(46,204,113,.15); color:#2ecc71; }
.nt-bad .nt-ic{ background:rgba(255,71,87,.15); color:#ff4757; }
.nt-wait .nt-ic{ background:rgba(226,122,90,.15); color:var(--dh-gold); }
.nt-info .nt-ic{ background:rgba(226,122,90,.16); color:var(--dh-accent); }
.nt-body{ min-width:0; flex:1; }
.nt-body b{ display:block; font-size:12.5px; color:var(--dh-text); margin-bottom:2px; }
.nt-body span{ display:block; font-size:12px; color:var(--dh-sheet-text); line-height:1.4; word-break:break-word; white-space:pre-line; }
.nt-body em{ display:block; font-style:normal; font-size:10.5px; color:var(--dh-muted); margin-top:3px; }

/* theme switch (profile row) */
.theme-sw{ position:relative; flex:none; width:42px; height:24px; border-radius:999px; background:#cbd5e1; transition:background .2s; }
.theme-sw::after{ content:''; position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.3); transition:transform .2s; }
html[data-theme="dark"] .theme-sw{ background:linear-gradient(135deg,#e27a5a,#9b78df); }
html[data-theme="dark"] .theme-sw::after{ transform:translateX(18px); }
/* header toggle shows the icon of the mode you'd switch to */
.dh-theme .fa-sun{ display:none; }
html[data-theme="dark"] .dh-theme .fa-sun{ display:inline; }
html[data-theme="dark"] .dh-theme .fa-moon{ display:none; }

.dh-bn-act{ display:flex; align-items:center; gap:6px; flex-shrink:0; }
.dh-banner .dh-theme{ width:26px; height:26px; border-radius:50%; font-size:12px; }

/* the <html> element also needs the light background (pages paint their own dark one on it) */
html.dh-nm:not([data-theme="dark"]){ background:#fff3ec !important; }
