/* ===== Base (global) ===== */
:root {
  --bg: #121212;
  --card: #1e1e1e;
  --text: #eaeaea;
  --muted: #aaa;
  --border: #2a2a2a;
  --brand: #4da6ff;
  --brand-2: #3399ff;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.no-scroll {
  overflow: hidden;
  padding-right: var(--sbw, 0px);
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* utility */
.hidden { display: none !important; }

/* Header */
header {
  background: var(--card);
  padding: 0 1rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .50rem;
  flex-wrap: wrap;
}

header h1 {
  margin: 0;
  font-size: 1.75rem;
}

/* Nav container */
.site-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  width: 100%;
}

.site-nav .nav-links { display:none !important; }

nav a {
  color: var(--muted);
  text-decoration: none;
}
nav a:hover { color: #fff; }

/* Main */
main {
  max-width: 860px;
  margin: 2rem auto;
  padding: 0 1rem;
}

h1, h2 { color: #fff; }
a { color: var(--brand); }

/* Footer */
footer {
  font-size: .875rem;
  color: #888;
  margin-top: 4rem;
  border-top: 1px solid #333;
  background: var(--card);
  padding: 1rem;
  text-align: center;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  background: #2a2a2a;
  transition: background .15s ease, border-color .15s ease, transform .04s ease;
}
.btn:hover { background: #313131; border-color: #3a3a3a; }
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}
.btn-primary:hover { background: var(--brand-2); }

/* ===== Hamburger (stacked) ===== */
.hamburger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #222;
  cursor: pointer;
  margin-left: auto;

  position: relative;
  top: -46px;

  transition: background .15s ease, border-color .15s ease;
}
.hamburger:hover { background: #252525; border-color: #3a3a3a; }

.hamburger span {
  width: 20px;
  height: 2px;
  background: #eaeaea;
  display: block;
  transition: transform .18s ease, opacity .18s ease;
}

/* morph to X when active */
.hamburger.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ===== Drawer (overlay + panel) ===== */

.nav-drawer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(1.5px);
  z-index: 1000;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .22s ease-out, visibility 0s linear .22s;
}

.nav-drawer.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .22s ease-out;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: max(0px, env(safe-area-inset-right));
  height: 100%;
  width: min(380px, 100svw);
  background: #1e1e1e;
  border-left: 1px solid #2a2a2a;
  box-shadow: -16px 0 40px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;

  transform: translateX(100%);
  transition: transform .22s ease-out;
  z-index: 1001;
}

@supports not (width: 100svw) {
  .drawer-panel { width: min(380px, 100vw); }
}

.nav-drawer.open .drawer-panel { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid #2a2a2a;
  padding-bottom: 8px;
}
.drawer-close {
  background: #2a2a2a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #eaeaea;
  width: 36px;
  height: 36px;
  cursor: pointer;
}

.drawer-panel .btn { margin: 8px 0 16px; }

.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 10px;
}
.drawer-links a {
  color: #eaeaea;
  text-decoration: none;
  font-size: 1.15rem;
  text-align: center;
}

.drawer-user {
  display: none;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid #2a2a2a;
  padding: 6px 0 14px 0;
  margin-bottom: 8px;
}
.drawer-user.show { display: flex; }

.drawer-user .row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-user .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}
.drawer-user .user-meta { display: flex; flex-direction: column; gap: 2px; }
.drawer-user .user-username { font-weight: 600; }
.drawer-user .user-id { color: #bbb; font-size: .9rem; }

.drawer-user .logout-btn {
  width: 100%;
  background: #2a2a2a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px;
  color: #eaeaea;
  cursor: pointer;
}
.drawer-user .logout-btn:hover { background: #313131; }

/* while drawer open, prevent page scroll (no layout shift thanks to scrollbar-gutter) */
.no-scroll { overflow: hidden; }
