/* DFJ Lyrics - Pro Futuristic UI (Red Theme)
   Compatible with current PHP templates (container/card/box/topbar/etc.)
*/

/* ===== Theme Variables (red-only) ===== */
:root{
  --primary-color:#e60000;
  --primary-dark:#b30000;
  --primary-light:#ff4d4d;
  --primary-gradient: linear-gradient(135deg, #ff1a1a, #b30000);

  --background-color:#0a0a0f;
  --surface-color:#16161f;
  --surface-hover:#1c1c28;

  --text-color:#ffffff;
  --text-secondary:rgba(255,255,255,.72);
  --text-muted:rgba(255,255,255,.45);

  --border-color:rgba(255,255,255,.10);
  --border-glow:rgba(230,0,0,.35);

  --shadow:0 4px 20px rgba(0,0,0,.35);
  --shadow-lg:0 12px 45px rgba(0,0,0,.55);
  --shadow-glow:0 0 28px rgba(230,0,0,.30);

  --glass-bg:rgba(255,255,255,.05);
  --glass-border:rgba(255,255,255,.11);
  --blur: blur(12px);

  --radius:18px;
  --radius-sm:14px;
}

/* ===== Base ===== */
*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%}
body{
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--background-color);
  color: var(--text-color);
  line-height:1.6;
  overflow-x:hidden;
  transition: background .3s ease, color .3s ease;
}

/* Animated background (kept, but red-only) */
body::before{
  content:"";
  position:fixed; inset:0;
  background:
    radial-gradient(circle at 20% 80%, rgba(230,0,0,.14) 0%, transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(230,0,0,.10) 0%, transparent 55%),
    radial-gradient(circle at 50% 45%, rgba(230,0,0,.08) 0%, transparent 60%);
  z-index:-1;
  animation: backgroundShift 18s ease-in-out infinite;
}
@keyframes backgroundShift{
  0%,100%{transform:translateX(0) translateY(0)}
  25%{transform:translateX(-18px) translateY(-10px)}
  50%{transform:translateX(18px) translateY(10px)}
  75%{transform:translateX(-10px) translateY(18px)}
}

/* Links */
a{color:inherit;text-decoration:none}
a:hover{text-decoration:underline}

/* ===== Layout Helpers ===== */
.container{max-width:1100px;margin:0 auto;padding:22px}
@media(max-width:600px){.container{padding:14px}}

.muted{color:var(--text-secondary)}
.small{font-size:.88rem;color:var(--text-muted)}
.msg{margin-top:10px;color:var(--text-secondary)}

/* ===== Glass / Cards ===== */
.glass{
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  border:1px solid var(--glass-border);
  border-radius: var(--radius);
}

.card{
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  border:1px solid var(--glass-border);
  border-radius: var(--radius);
  padding:18px;
  box-shadow: var(--shadow-lg);
}

.card.soft{
  background: rgba(255,255,255,.04);
  border:1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.box{
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding:16px;
}

/* Headings */
h1{
  font-size:2.1rem;
  font-weight:900;
  letter-spacing:-0.02em;
  margin-bottom:6px;
  background: var(--primary-gradient);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
}
h2{font-size:1.2rem;font-weight:800;margin:0 0 10px}
h3{font-size:1.05rem;font-weight:800;margin:0 0 10px}
h4{font-size:1rem;font-weight:800;margin:0 0 10px}

/* ===== Topbar (styled like navbar) ===== */
.topbar{
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  border-bottom:1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.topbar .brand{
  max-width:1100px;
  margin:0 auto;
  padding:0 22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  font-weight:900;
  letter-spacing:-0.02em;
}
.brand::before{display:none}
.topbar .right{
  max-width:1100px;
  margin:0 auto;
  padding:0 22px;
}
.topbar .right, .right{
  display:flex; align-items:center; gap:12px;
}
.link{opacity:.9}
.link:hover{opacity:1}

/* ===== Grids ===== */
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:14px}
.grid3{display:grid;grid-template-columns:1.2fr 1fr 1fr;gap:14px}
@media(max-width:920px){.grid2,.grid3{grid-template-columns:1fr}}

/* ===== Forms ===== */
label{display:block;margin:10px 0 6px;color:var(--text-secondary);font-size:.92rem}
input,select,textarea{
  width:100%;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--border-color);
  background: rgba(10,10,15,.55);
  color: var(--text-color);
  transition: all .25s ease;
}
input:focus,select:focus,textarea:focus{
  outline:none;
  border-color: rgba(230,0,0,.55);
  box-shadow: 0 0 0 3px rgba(230,0,0,.18);
  transform: translateY(-1px);
}
textarea.lyrics{
  min-height:500px;
  padding:1.2rem;
  border-radius:16px;
  line-height:1.8;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  resize:vertical;
}

/* Checkbox */
.checkbox{display:flex;align-items:center;gap:.75rem;margin:12px 0}
.checkbox input[type="checkbox"]{width:18px;height:18px;accent-color: var(--primary-color)}

/* ===== Buttons (futuristic) ===== */
.btn{
  padding:.8rem 1.25rem;
  border:none;
  border-radius:12px;
  font-size:.9rem;
  font-weight:800;
  cursor:pointer;
  transition: all .25s ease;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.5rem;
  position:relative;
  overflow:hidden;
  letter-spacing:.02em;
}
.btn::before{
  content:"";
  position:absolute; top:0; left:-120%;
  width:120%; height:100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent);
  transition:left .55s ease;
}
.btn:hover::before{left:120%}

.btn{ background: var(--primary-gradient); color:#fff; box-shadow: var(--shadow-glow); }
.btn:hover{ transform: translateY(-2px); box-shadow: 0 10px 26px rgba(230,0,0,.32); }

.btn.ghost{
  background: rgba(255,255,255,.04);
  color: var(--text-color);
  border:1px solid var(--border-color);
  box-shadow:none;
}
.btn.ghost:hover{ background: var(--surface-hover); transform: translateY(-1px); }

/* ===== Lists / Cards ===== */
.list{display:flex;flex-direction:column;gap:14px;margin-top:12px}
.item{
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  border:1px solid var(--glass-border);
  border-radius:20px;
  padding:16px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  transition: all .25s ease;
}
.item:hover{
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-glow);
}
.item .title{font-size:1.15rem;font-weight:800}

/* ===== Editor panels ===== */
.row{display:flex;justify-content:space-between;align-items:center;gap:14px;margin:10px 0}
@media(max-width:520px){.row{flex-direction:column;align-items:stretch}}

.recbox,.statsbox,.rhymebox{
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  border:1px solid var(--glass-border);
  border-radius:20px;
  padding:16px;
}
.statrow{
  display:flex;justify-content:space-between;
  padding:.75rem;
  background: rgba(255,255,255,.03);
  border:1px solid var(--border-color);
  border-radius:12px;
  margin-top:.6rem;
}
.player, audio{width:100%;border-radius:12px;background:var(--surface-color);margin-top:10px}

/* ===== Chat ===== */
.chatbox{
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  border:1px solid var(--glass-border);
  border-radius:20px;
  overflow:hidden;
  box-shadow: var(--shadow-lg);
}
.chatlog{height:62vh;overflow:auto;padding:16px;display:flex;flex-direction:column;gap:12px}
.chatmsg{
  padding:12px 14px;
  border-radius:16px;
  background: rgba(255,255,255,.04);
  border:1px solid var(--border-color);
  max-width: 90%;
  animation: messageSlideIn .25s ease;
}
@keyframes messageSlideIn{
  from{opacity:0;transform:translateY(12px)}
  to{opacity:1;transform:translateY(0)}
}
.chatmsg .meta{display:flex;justify-content:space-between;gap:10px;margin-bottom:6px;font-size:.85rem;color:var(--text-secondary)}
.chatmsg .body{white-space:pre-wrap}

.chatinput{
  display:flex;gap:10px;
  padding:14px;
  border-top:1px solid var(--border-color);
  background: rgba(10,10,15,.55);
}
.chatinput input{
  flex:1;
  border-radius:999px;
  padding:14px 16px;
}

/* ===== Bottom nav (pill style) ===== */
.nav{display:flex;justify-content:center;gap:10px;flex-wrap:wrap;margin-top:16px}
.navbtn{
  display:inline-flex; align-items:center; justify-content:center;
  padding:.75rem 1rem;
  border-radius:999px;
  border:1px solid var(--border-color);
  background: rgba(255,255,255,.03);
}
.navbtn.active{
  background: rgba(230,0,0,.14);
  border-color: rgba(230,0,0,.30);
  color: var(--text-color);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar{width:8px}
::-webkit-scrollbar-track{background: rgba(255,255,255,.04); border-radius:4px}
::-webkit-scrollbar-thumb{background: rgba(230,0,0,.70); border-radius:4px}
::-webkit-scrollbar-thumb:hover{background: rgba(230,0,0,.95)}


/* ===== App Loader ===== */
#appLoader{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background: radial-gradient(circle at 50% 30%, rgba(230,0,0,.18), transparent 60%),
              linear-gradient(180deg, #070a10, #0a0a0f);
  z-index:9999;
}
.loader-card{
  width:min(520px, 92vw);
  padding:22px;
  border-radius:24px;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 55px rgba(0,0,0,.55);
  text-align:center;
}
.loader-logo{
  width:84px;height:84px;
  border-radius:20px;
  margin:0 auto 14px auto;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  display:grid;place-items:center;
}
.loader-logo img{width:100%;height:100%;object-fit:cover}
.loader-title{
  font-size:1.15rem;
  font-weight:900;
  letter-spacing:-0.02em;
}
.loader-sub{
  margin-top:6px;
  color: var(--text-secondary);
}
.loader-bar{
  margin:16px auto 0;
  width:100%;
  height:10px;
  border-radius:999px;
  background: rgba(255,255,255,.10);
  overflow:hidden;
  border:1px solid rgba(255,255,255,.10);
}
.loader-bar > span{
  display:block;
  height:100%;
  width:35%;
  background: linear-gradient(90deg, rgba(255,255,255,.10), rgba(230,0,0,.95), rgba(255,255,255,.10));
  filter: drop-shadow(0 0 18px rgba(230,0,0,.35));
  border-radius:999px;
  animation: loaderMove 1.0s ease-in-out infinite;
}
@keyframes loaderMove{
  0%{transform:translateX(-40%)}
  50%{transform:translateX(160%)}
  100%{transform:translateX(-40%)}
}

/* ===== Welcome / Hero ===== */
.navbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 0;
}
.nav-left{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:900;
}
.nav-left img{
  width:26px;height:26px;border-radius:8px;
  border:1px solid rgba(255,255,255,.14);
}
.nav-actions{
  display:flex; gap:10px; align-items:center;
}
.pill{
  border-radius:999px;
  padding:10px 14px;
}
.hero{
  padding:36px 0 18px;
  text-align:center;
}
.hero h1{
  font-size: clamp(2.1rem, 4vw, 3.3rem);
  margin-bottom:10px;
}
.hero p{
  color: var(--text-secondary);
  max-width: 760px;
  margin: 0 auto;
  font-size: 1.05rem;
}
.hero-actions{
  margin-top:18px;
  display:flex;
  justify-content:center;
  gap:12px;
  flex-wrap:wrap;
}
.feature-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:14px;
  margin-top:24px;
}
@media(max-width:1000px){ .feature-grid{grid-template-columns: repeat(2, 1fr);} }
@media(max-width:560px){ .feature-grid{grid-template-columns: 1fr;} }

.feature-card{
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 22px;
  padding:18px;
  box-shadow: 0 10px 28px rgba(0,0,0,.32);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.feature-card:hover{
  transform: translateY(-6px);
  border-color: rgba(230,0,0,.30);
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.feature-emoji{
  font-size: 1.35rem;
  display:inline-flex;
  width:42px;height:42px;
  border-radius:14px;
  align-items:center;justify-content:center;
  background: rgba(230,0,0,.12);
  border:1px solid rgba(230,0,0,.20);
  margin-bottom:10px;
}
.feature-card h3{ margin: 2px 0 6px; font-size: 1.08rem; }
.feature-card p{ color: var(--text-secondary); font-size:.95rem; }
.auth-wrap{ margin-top: 26px; }

/* ===== Shared UI helpers (always on) ===== */
.active-pill{
  border-color: rgba(230,0,0,.35) !important;
  box-shadow: 0 0 0 3px rgba(230,0,0,.10);
}
.brand-left{display:flex;align-items:center;gap:10px}
.brand-logo{width:28px;height:28px;border-radius:10px;border:1px solid rgba(255,255,255,.14)}
.brand-name{font-weight:900}
.searchbar{margin-top:14px}
.searchbar input{border-radius:999px;padding:14px 16px}
.home-hero{display:grid;grid-template-columns:1.2fr .8fr;gap:16px;align-items:stretch}
@media(max-width:900px){.home-hero{grid-template-columns:1fr}}
.home-actions{margin-top:14px;display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-start}
.stat-card{height:100%;border-radius:22px;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.10);padding:16px}
.stat-title{font-weight:900;margin-bottom:10px}
.stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.stat-item{border-radius:16px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.10);padding:12px;text-align:center}
.stat-num{font-size:1.4rem;font-weight:900}
.stat-label{font-size:.85rem;color:var(--text-secondary)}


/* ===== Mobile responsiveness + Sticky bottom nav ===== */

/* Make room for fixed bottom navigation */
body{
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

/* Sticky bottom navigation */
.nav{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  margin: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  background: rgba(10, 10, 15, 0.75);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255,255,255,.10);
}
.navbtn{
  flex: 1;
  max-width: 180px;
  text-align: center;
  border-radius: 999px;
}

/* Reduce card padding on small screens */
@media (max-width: 520px){
  .container{ padding: 12px; }
  .card{ padding: 14px; border-radius: 18px; }
  .box{ padding: 14px; border-radius: 18px; }
  h1{ font-size: 1.85rem; }
  .grid2{ gap: 12px; }
  .grid3{ gap: 12px; }
  .row{ gap: 10px; }
  .btn{ width: 100%; }
  .row .btn{ width: auto; }
}

/* Make topbar action buttons wrap nicely on mobile */
@media (max-width: 680px){
  .topbar .brand{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .topbar .right{
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .topbar .right .btn{
    flex: 1;
    min-width: 120px;
  }
}

/* Home hero stack for phones */
@media (max-width: 900px){
  .home-hero{ grid-template-columns: 1fr; }
}

/* Chat on mobile: keep input visible and log height sensible */
@media (max-width: 600px){
  .chatlog{ height: calc(100vh - 260px); }
  .chatinput{ position: sticky; bottom: 90px; }
}

/* Editor: ensure panels stack and audio controls fit */
@media (max-width: 900px){
  .grid3{ grid-template-columns: 1fr; }
}

/* Prevent nav from covering focused input on some browsers */
:focus{
  scroll-margin-bottom: 110px;
}


.mobile-menu-btn{display:none}

/* ===== Improved mobile sizing (smaller topbar/buttons) ===== */
@media (max-width: 680px){
  .desktop-actions{display:none !important;}
  .mobile-menu-btn{display:inline-flex !important; width:auto;}
  .topbar .brand{flex-direction:row !important; align-items:center !important;}
  .topbar{padding:10px 0;}
  .brand-logo{width:26px;height:26px;border-radius:10px;}
  .brand-name{font-size:1.02rem;}
  .btn{font-size:.92rem;}
  .pill{padding:10px 12px;}
}

@media (max-width: 520px){
  .btn{padding:10px 12px; border-radius:14px;}
  .pill{padding:9px 12px;}
  .container{padding:12px;}
  .row .btn{width:100%;}
  .row{flex-direction:column; align-items:stretch;}
}

/* Mobile menu overlay */
.mobile-menu{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(8px);
  z-index: 200;
  padding: 14px;
}
.mobile-menu-inner{
  max-width: 720px;
  margin: 0 auto;
  border-radius: 22px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 18px 55px rgba(0,0,0,.55);
  padding: 14px;
}
.mobile-menu-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  margin-bottom: 12px;
}
.mobile-menu-close{width:auto}
.mobile-menu-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

/* ===== Compact sticky bottom nav (single row) ===== */
body{
  padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px));
}
.nav{
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  gap: 8px;
}
.navbtn{
  max-width: none;
  padding: 10px 8px;
  font-size: .92rem;
  border-radius: 16px;
  white-space: nowrap;
}
@media (max-width: 420px){
  .navbtn{font-size:.86rem; padding: 10px 6px;}
}


/* ===== Auto-hide bottom nav on scroll ===== */
.nav{
  transition: transform .28s ease, opacity .28s ease;
}
.nav.nav-hidden{
  transform: translateY(120%);
  opacity: 0;
}

/* ===== Light theme override (high contrast) ===== */
body.light{
  --background-color:#f7f7fb;
  --surface-color:#ffffff;
  --surface-hover:#f1f1f7;

  --text-color:#0b0f14;
  --text-secondary:rgba(11,15,20,.78);
  --text-muted:rgba(11,15,20,.58);

  --border-color:rgba(11,15,20,.14);
  --glass-bg:rgba(11,15,20,.03);
  --glass-border:rgba(11,15,20,.10);

  --shadow:0 6px 18px rgba(0,0,0,.12);
  --shadow-lg:0 18px 50px rgba(0,0,0,.18);
}
body.light::before{
  background:
    radial-gradient(circle at 20% 80%, rgba(230,0,0,.10) 0%, transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(230,0,0,.08) 0%, transparent 55%),
    linear-gradient(180deg, #ffffff, #f7f7fb);
}

/* Ensure components remain readable in light mode */
body.light .card,
body.light .feature-card,
body.light .item,
body.light .chatbox,
body.light .chatmsg,
body.light .recbox,
body.light .statsbox,
body.light .rhymebox,
body.light .stat-card{
  background: rgba(255,255,255,.85);
  border-color: rgba(11,15,20,.10);
}

body.light input,
body.light select,
body.light textarea{
  background: rgba(255,255,255,.92);
  border-color: rgba(11,15,20,.14);
  color: var(--text-color);
}

body.light .btn.ghost,
body.light .navbtn{
  background: rgba(11,15,20,.04);
  color: var(--text-color);
  border-color: rgba(11,15,20,.14);
}
body.light .btn.ghost:hover,
body.light .navbtn:hover{
  background: rgba(11,15,20,.06);
}

body.light .topbar{
  background: rgba(255,255,255,.78);
  border-bottom-color: rgba(11,15,20,.10);
}

body.light .nav{
  background: rgba(255,255,255,.82);
  border-top-color: rgba(11,15,20,.10);
}


/* Prevent underlines on button-like links */
.btn, .navbtn{ text-decoration:none !important; }
.btn:hover, .navbtn:hover{ text-decoration:none !important; }


@media (max-width: 600px){
  textarea.lyrics{
    min-height: 60vh;
    font-size: 0.98rem;
  }
}





/* ===== WhatsApp-like chat input (mobile + desktop) ===== */
.chatinput{
  gap: 10px;
  padding: 10px 12px;
}
.chatinput .chatText{
  flex: 1;
  min-height: 52px;
  max-height: 42vh;
  padding: 14px 16px;
  border-radius: 22px;
  line-height: 1.35;
  overflow-y: auto;
  background: rgba(10,10,15,.55);
  border: 1px solid rgba(255,255,255,.12);
}
.sendBtn{
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-gradient);
  box-shadow: var(--shadow-glow);
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
}
.sendBtn:hover{ filter: brightness(1.06); }
.sendBtn:active{ transform: translateY(1px); }
.sendBtn svg{
  width: 22px;
  height: 22px;
  fill: #ffffff;
  transform: translateX(1px);
}
.sendBtn:disabled{
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
}
@media (max-width: 600px){
  .chatinput{ padding: 10px 10px; }
  .chatinput .chatText{
    min-height: 54px;
    padding: 14px 16px;
    border-radius: 22px;
    font-size: 0.98rem;
    max-height: 45vh;
  }
  .sendBtn{ width: 54px; height: 54px; }
}


/* Fix: ensure send button stays visible on very small screens */
.chatinput{ align-items: flex-end; }
.chatinput .chatText{ min-width: 0; }
.sendBtn{ flex: 0 0 auto; }


/* Fix: prevent long chat messages from overflowing */
.chatmsg{
  max-width: 100%;
}
.chatmsg .body{
  overflow-wrap: anywhere;
  word-break: break-word;
}


/* ===== WhatsApp-like fixed input bar ===== */
.chatbox{ position: relative; }
.chatlog{
  /* leave space for fixed input + bottom nav */
  padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
}
.chatinput-fixed{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(1100px, calc(100% - 24px));
  bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  z-index: 150;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(10,10,15,0.82);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
@media (max-width: 600px){
  .chatinput-fixed{
    width: calc(100% - 20px);
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  }
  .chatlog{
    padding-bottom: calc(126px + env(safe-area-inset-bottom, 0px));
  }
}
body.light .chatinput-fixed{
  background: rgba(255,255,255,0.86);
  border-color: rgba(11,15,20,.10);
}


/* ===== Force chat input to stick to bottom on mobile ===== */
@media (max-width: 768px){
  .chatinput-fixed{
    position: fixed !important;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    margin: 0;
    bottom: env(safe-area-inset-bottom, 0px);
    border-radius: 0;
  }
  .chatlog{
    padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  }
}


/* Keep bottom nav always visible on chat */
body.page-chat .nav.nav-hidden{ transform:none; opacity:1; }


/* ===== Index navbar balance + auth form button spacing ===== */
.index-logo-wrap{
  display:flex;
  align-items:center;
  justify-content:center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.10);
}
.index-logo{
  width: 30px;
  height: 30px;
  border-radius: 10px;
  object-fit: cover;
}

.topbar .right{
  gap: 12px;
}
.topbar .right .btn{
  min-width: 120px;
  justify-content:center;
}

/* Form button spacing */
#loginForm .btn, #regForm .btn{
  margin-top: 14px;
}
#loginForm .msg, #regForm .msg{
  margin-top: 10px;
}

/* On small screens keep buttons balanced and not too wide */
@media (max-width: 520px){
  .topbar .right .btn{
    min-width: 0;
    flex: 1;
  }
  .topbar .right{
    gap: 10px;
  }
  #loginForm .btn, #regForm .btn{
    width: 100%;
  }
}
