/* ─── PAGE WRAPPER (constrained + centered) ─────────────── */
    .page-wrap {
      display: flex;
      max-width: 1440px;
      margin: 0 auto;
      min-height: 100vh;
    }

    .content-col {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
    }

    /* ─── SIDEBAR ────────────────────────────────────────────── */
    .sidebar {
      position: sticky;
      top: 0;
      width: var(--sb-w);
      height: 100vh;
      background: #1d1d1d;
      z-index: 260;
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      padding: 24px 14px 28px;
      overflow-y: auto;
      overflow-x: hidden;
      transition: width .25s cubic-bezier(.4,0,.2,1),
                  padding .25s cubic-bezier(.4,0,.2,1);
    }

    .sb-logo {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 28px;
      padding: 0 6px;
      overflow: hidden;
    }

    .sb-logo-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 60px; height: 34px;
      background: var(--red);
      border-radius: 10px;
      font-size: 17px;
      font-weight: 900;
      color: #fff;
      letter-spacing: -1px;
      flex-shrink: 0;
      transition: width .25s, height .25s, border-radius .25s, font-size .25s;
    }

    .sb-logo-sub {
      font-size: 8px;
      font-weight: 500;
      color: rgba(255,255,255,.38);
      letter-spacing: 1.5px;
      text-transform: uppercase;
      white-space: nowrap;
    }

    .sb-nav {
      display: flex;
      flex-direction: column;
      gap: 8px;
      flex: 1;
    }

    .sb-item {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 14px 16px;
      border-radius: 12px;
      background: transparent;
      color: rgba(255,255,255,.72);
      font-size: 15px;
      font-weight: 500;
      cursor: pointer;
      transition: background .15s, color .15s;
      user-select: none;
      white-space: nowrap;
      overflow: hidden;
    }

    .sb-item svg { flex-shrink: 0; }
    .sb-item:hover { background: rgba(255,255,255,.08); color: #fff; }
    .sb-item.active { background: rgba(255,255,255,.13); color: #fff; font-weight: 600; }
    .sb-label { overflow: hidden; }

    .sb-item--sub {
      padding: 10px 16px 10px 28px;
      font-size: 13px;
      background: rgba(255,255,255,.03);
      color: rgba(255,255,255,.55);
      border-radius: 8px;
    }

    .sb-item--sub:hover { background: rgba(255,255,255,.08); color: #fff; }

    /* ── hamburger (only at mobile) ─ */
    .hamburger-btn {
      display: none;
      flex-direction: column;
      justify-content: center;
      gap: 5px;
      width: 36px; height: 36px;
      padding: 6px;
      background: none;
      border: none;
      cursor: pointer;
      border-radius: 8px;
      flex-shrink: 0;
      transition: background .15s;
    }

    .hamburger-btn:hover { background: var(--bg); }

    .hamburger-btn span {
      display: block;
      width: 20px; height: 2px;
      background: rgba(255,255,255,.8);
      border-radius: 1px;
    }

    /* ── mobile overlay ─ */
    .sb-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,.55);
      z-index: 250;
    }

    .sb-overlay.open { display: block; }

    /* ── narrow: icon-only (480 – 959 px) ─ */
    @media (max-width: 959px) {
      :root { --sb-w: 64px; }
      .sidebar { padding: 20px 0; align-items: center; }
      .sidebar .logo { display: none; }
      .sb-logo { padding: 0; align-items: center; margin-bottom: 20px; }
      .sb-logo-badge { width: 40px; height: 40px; border-radius: 50%; font-size: 14px; }
      .sb-logo-sub { display: none; }
      .sb-nav { align-items: center; width: 100%; gap: 4px; }
      .sb-item { width: 44px; height: 44px; padding: 0; justify-content: center; background: transparent; border-radius: 50%; gap: 0; }
      .sb-item:hover { background: rgba(255,255,255,.1); }
      .sb-item.active { background: transparent; color: var(--red); }
      .sb-item.active svg { stroke: var(--red); }
      .sb-label { display: none; }
    }

    /* ── mobile: sidebar width token (< 640px handled by bottom bar block) ─ */
    @media (max-width: 639px) {
      :root { --sb-w: 0px; }
    }

    /* ─── BOTTOM BAR + SHEET — hidden everywhere by default ────────── */
    .bottom-bar       { display: none; }
    .bb-sheet         { display: none; }
    .bb-sheet-backdrop { display: none; }

    /* ─── BOTTOM BAR + SHEET — mobile only (< 640px) ────────────────── */
    @media (max-width: 639px) {

      /* Completely remove the sidebar — bottom bar replaces it */
      .sidebar { display: none !important; }

      /* Push body content up so the bar never covers anything */
      body { padding-bottom: 60px; }

      /* ── Bottom bar ── */
      .bottom-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: #1d1d1d;
        border-top: 1px solid rgba(255,255,255,.1);
        z-index: 480;
      }

      .bb-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        background: none;
        border: none;
        color: rgba(255,255,255,.5);
        font-size: 10px;
        font-weight: 500;
        cursor: pointer;
        transition: color .15s;
        padding: 0;
      }
      .bb-tab svg { stroke: rgba(255,255,255,.5); transition: stroke .15s; }
      .bb-tab.active       { color: var(--red, #ff2442); }
      .bb-tab.active svg   { stroke: var(--red, #ff2442); }

      /* ── More sheet ── */
      .bb-sheet-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 490;
      }
      .bb-sheet-backdrop.open { display: block; }

      .bb-sheet {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 24px rgba(0,0,0,.12);
        transform: translateY(100%);
        transition: transform .3s cubic-bezier(.4,0,.2,1);
        z-index: 500;
        padding: 10px 0 0;
        padding-bottom: 76px;
      }
      .bb-sheet.open { transform: translateY(0); }

      .bb-sheet-handle {
        width: 36px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
        margin: 0 auto 10px;
      }

      .bb-sheet-item {
        display: flex;
        align-items: center;
        gap: 16px;
        width: 100%;
        padding: 14px 22px;
        background: none;
        border: none;
        font-size: 15px;
        font-weight: 500;
        color: var(--text, #111);
        cursor: pointer;
        text-align: left;
        transition: background .12s;
      }
      .bb-sheet-item:active           { background: #f4f4f4; }
      .bb-sheet-item.active           { color: var(--red, #ff2442); }
      .bb-sheet-item.active svg       { stroke: var(--red, #ff2442); }
    }

    /* ─── HEADER ─────────────────────────────────────────────── */
    .header-logo {
      display: none;
      flex-direction: column;
      text-decoration: none;
      flex-shrink: 0;
      user-select: none;
      line-height: 1;
    }

    .header-logo-mark {
      font-size: 28px;
      font-weight: 900;
      color: var(--red);
      letter-spacing: -1px;
    }

    .header-logo-sub {
      font-size: 7.5px;
      font-weight: 500;
      color: rgba(255,255,255,.38);
      letter-spacing: 1.4px;
      text-transform: uppercase;
      white-space: nowrap;
      margin-top: 2px;
    }

    #header {
      position: sticky;
      top: 0;
      z-index: 300;
      height: 56px;
      background: #1d1d1d;
      border-bottom: 1px solid rgba(255,255,255,.08);
      display: flex;
      align-items: center;
      padding: 0 24px;
      gap: 18px;
    }

    .logo {
      display: flex;
      flex-direction: column;
      line-height: 1;
      text-decoration: none;
      user-select: none;
      flex-shrink: 0;
    }

    .logo-mark {
      font-size: 36px;
      font-weight: 900;
      color: var(--red);
      letter-spacing: -1px;
    }

    .logo-sub {
      font-size: 10px;
      font-weight: 500;
      color: rgba(255,255,255,.45);
      letter-spacing: 1.8px;
      text-transform: uppercase;
      margin-top: 2px;
    }

    .header-nav {
      display: flex;
      gap: 1px;
      flex-shrink: 1;
      overflow: hidden;
    }

    .hlink {
      padding: 5px 11px;
      border-radius: 20px;
      font-size: 13px;
      color: rgba(255,255,255,.55);
      cursor: pointer;
      text-decoration: none;
      font-weight: 400;
      transition: background .15s, color .15s;
      white-space: nowrap;
    }

    .hlink:hover { background: rgba(255,255,255,.08); color: #fff; }

    .hlink.active {
      color: #fff;
      font-weight: 600;
    }

    .search-wrap {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      width: 260px;
    }

    .search-box {
      display: flex;
      align-items: center;
      background: rgba(255,255,255,.1);
      border-radius: 20px;
      height: 36px;
      padding: 0 14px;
      gap: 8px;
      border: 1.5px solid rgba(255,255,255,.15);
      transition: border-color .2s, box-shadow .2s;
      cursor: text;
    }

    .search-box:focus-within {
      border-color: var(--red);
      box-shadow: 0 0 0 2px rgba(255,36,66,.12);
    }

    .search-box svg { color: rgba(255,255,255,.6); flex-shrink: 0; }

    .search-box input {
      flex: 1;
      border: none;
      background: transparent;
      outline: none;
      font-size: 14px;
      color: #fff;
    }

    .search-box input::placeholder { color: rgba(255,255,255,.4); }

    .header-right {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-left: auto;
      flex-shrink: 0;
    }

    .icon-btn {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: rgba(255,255,255,.55);
      transition: background .15s, color .15s;
      position: relative;
      flex-shrink: 0;
    }

    .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

    .notif-dot {
      position: absolute;
      top: 6px;
      right: 6px;
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--red);
      border: 1.5px solid #1d1d1d;
    }

    .btn {
      height: 30px;
      padding: 0 11px;
      border-radius: 16px;
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      transition: all .15s;
      white-space: nowrap;
    }

    .btn-outline {
      background: transparent;
      border: 1.5px solid var(--red);
      color: var(--red);
    }

    .btn-outline:hover { background: var(--red); color: var(--white); }

    .btn-solid {
      background: var(--red);
      border: 1.5px solid var(--red);
      color: var(--white);
    }

    .btn-solid:hover { opacity: .88; }

    /* ─── CATEGORY BAR ───────────────────────────────────────── */
    .catbar-wrap {
      position: sticky;
      top: 56px;
      z-index: 200;
      background: #1d1d1d;
      border-bottom: 1px solid rgba(255,255,255,.08);
      display: flex;
      align-items: stretch;
    }

    #catbar {
      flex: 1;
      min-width: 0;
      display: flex;
      padding: 0 8px;
      overflow-x: auto;
      -ms-overflow-style: none;
      scrollbar-width: none;
      scroll-behavior: smooth;
    }

    #catbar::-webkit-scrollbar { display: none; }

    .cat-arr {
      display: none;
      flex-shrink: 0;
      width: 36px;
      background: #1d1d1d;
      border: none;
      cursor: pointer;
      color: rgba(255,255,255,.5);
      align-items: center;
      justify-content: center;
      transition: color .15s, opacity .2s;
      padding: 0;
      position: relative;
      z-index: 1;
    }

    .cat-arr:hover { color: #fff; }

    /* subtle inner edge line */
    .cat-arr-left  { box-shadow: inset -1px 0 0 rgba(255,255,255,.08); }
    .cat-arr-right { box-shadow: inset  1px 0 0 rgba(255,255,255,.08); }

    /* fade arrows that have nowhere to go */
    .cat-arr.cat-arr--dim {
      opacity: .28;
      pointer-events: none;
    }

    /* show only when viewport is at least half a standard desktop (≥ 600 px) */
    @media (min-width: 600px) {
      .cat-arr { display: flex; }
    }

    .cat {
      padding: 13px 16px;
      font-size: 14px;
      color: rgba(255,255,255,.5);
      cursor: pointer;
      white-space: nowrap;
      position: relative;
      font-weight: 400;
      transition: color .15s;
      user-select: none;
    }

    .cat::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 16px;
      right: 16px;
      height: 2px;
      background: var(--red);
      border-radius: 1px;
      transform: scaleX(0);
      transition: transform .2s;
    }

    .cat:hover { color: #fff; }

    .cat.active {
      color: #fff;
      font-weight: 600;
    }

    .cat.active::after { transform: scaleX(1); }

    /* ─── MAIN GRID AREA ──────────────────────────────────────── */
    #main {
      padding: 16px 20px 60px;
    }

    /* Pinterest-style masonry using CSS columns */
    .masonry {
      columns: 5 200px;
      column-gap: 12px;
    }

    /* ─── PAGE VIEWS ─────────────────────────────────────────── */
    .page { display: none; }
    .page.page--active { display: block; }
    .catbar-wrap.catbar--hidden { display: none; }

    /* ── Right sidebar ── */
    .cf-rightnav {
      position: sticky;
      top: 72px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .cf-widget {
      background: rgba(0,0,0,.18);
      border: 1px solid rgba(255,255,255,.08);
      border-radius: 4px;
      overflow: hidden;
    }

    .cf-widget-hdr {
      padding: 10px 16px 8px;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 1px;
      text-transform: uppercase;
      color: rgba(255,255,255,.55);
      border-bottom: 1px solid rgba(255,255,255,.06);
    }

    .cf-community-row {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 16px;
      border-bottom: 1px solid rgba(255,255,255,.04);
      cursor: pointer;
      transition: background .12s;
    }

    .cf-community-row:last-of-type { border-bottom: none; }
    .cf-community-row:hover { background: rgba(255,255,255,.05); }

    .cf-comm-avatar {
      width: 32px; height: 32px;
      border-radius: 50%;
      flex-shrink: 0;
      overflow: hidden;
    }

    .cf-comm-avatar img { width: 100%; height: 100%; object-fit: cover; }

    .cf-comm-info { flex: 1; min-width: 0; }

    .cf-comm-name {
      font-size: 14px;
      font-weight: 700;
      color: rgba(255,255,255,.85);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .cf-comm-members { font-size: 12px; color: rgba(255,255,255,.45); }

    .cf-comm-join {
      padding: 4px 14px;
      border-radius: 20px;
      border: 1.5px solid #0079d3;
      background: transparent;
      color: #0079d3;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
      flex-shrink: 0;
      transition: all .15s;
    }

    .cf-comm-join:hover { background: #0079d3; color: #fff; }

    .cf-widget-more {
      display: block;
      padding: 10px 16px 12px;
      font-size: 13px;
      color: #0079d3;
      cursor: pointer;
      text-decoration: none;
    }

    .cf-widget-more:hover { text-decoration: underline; }

    /* ── Responsive ── */
    @media (max-width: 1100px) {
      .cf-wrap { grid-template-columns: 1fr; }
      .cf-rightnav { display: none; }
    }

    @media (max-width: 760px) {
      .cf-wrap { padding: 12px; }
    }

    /* ─── SUB-CATBAR ─────────────────────────────────────────── */
    .sub-catbar-wrap {
      display: none;
      align-items: stretch;
      background: #1d1d1d;
      border-bottom: 1px solid rgba(255,255,255,.08);
      position: sticky;
      top: 100px;
      z-index: 150;
      transition: margin-left .25s cubic-bezier(.4,0,.2,1);
    }

    .sub-catbar-wrap.visible { display: flex; }

    .sub-catbar {
      flex: 1;
      min-width: 0;
      display: flex;
      align-items: center;
      padding: 0;
      overflow-x: auto;
      -ms-overflow-style: none;
      scrollbar-width: none;
      scroll-behavior: smooth;
    }

    .sub-catbar::-webkit-scrollbar { display: none; }

    .sub-cat {
      padding: 11px 16px;
      font-size: 13.5px;
      color: rgba(255,255,255,.5);
      cursor: pointer;
      white-space: nowrap;
      position: relative;
      font-weight: 400;
      transition: color .15s;
      user-select: none;
    }

    .sub-cat::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 16px;
      right: 16px;
      height: 2px;
      background: var(--red);
      border-radius: 1px;
      transform: scaleX(0);
      transition: transform .2s;
    }

    .sub-cat:hover { color: #fff; }

    .sub-cat.active {
      color: #fff;
      font-weight: 600;
    }

    .sub-cat.active::after { transform: scaleX(1); }

    /* ─── DEFINITION PANEL ────────────────────────────────────── */
    .def-panel {
      display: none;
      padding: 12px 48px 16px;
      transition: margin-left .25s cubic-bezier(.4,0,.2,1);
    }

    .def-panel.visible { display: block; }

    .def-text {
      font-size: 14px;
      line-height: 1.75;
      color: rgba(255,255,255,.55);
      max-width: 960px;
      margin: 0 auto;
      background: rgba(255,255,255,.04);
      border: 1px solid rgba(255,255,255,.08);
      border-radius: 12px;
      padding: 12px 16px;
    }

    .def-text strong {
      color: #fff;
    }

    .def-bill-table {
      width: 100%;
      border-collapse: collapse;
      margin-top: 10px;
      font-size: 13px;
    }
    .def-bill-table td {
      border: 1px solid rgba(255,255,255,.15);
      padding: 6px 10px;
      vertical-align: top;
      color: rgba(255,255,255,.65);
      line-height: 1.5;
    }
    .def-bill-table td:first-child {
      font-weight: 600;
      color: rgba(255,255,255,.9);
      white-space: nowrap;
    }

    /* ─── LOAD MORE SPINNER ───────────────────────────────────── */
    #sentinel {
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 28px;
    }

    .spinner {
      width: 26px;
      height: 26px;
      border: 2.5px solid var(--border);
      border-top-color: var(--red);
      border-radius: 50%;
      animation: spin .75s linear infinite;
    }

    @keyframes spin { to { transform: rotate(360deg); } }

    /* ─── RESPONSIVE ─────────────────────────────────────────── */
    @media (max-width: 1200px) {
      .header-nav { display: none; }
    }

    @media (max-width: 920px) {
      .btn-solid { display: none; }
    }

    @media (max-width: 600px) {
      #header { padding: 0 14px; gap: 10px; }
      #main   { padding: 10px 10px 48px; }
      /* Remove the 150px minimum column width so 2 columns always render
         even on 360px screens. `columns: 2` alone forces exactly 2 columns
         regardless of available width.                                     */
      .masonry { columns: 2; column-gap: 8px; }
      .card-body { padding: 6px 8px 8px; }
      .card-title { font-size: 13px; }
    }

    /* ── Mobile phone (<640px): header layout ── */
    @media (max-width: 639px) {
      .hamburger-btn { display: none; }
      .header-logo   { display: flex; }
      .btn-solid     { display: inline-flex; }

      /* Hide the Log In button on mobile — Submit and other outline buttons stay visible */
      #loginBtn { display: none !important; }

      /* Tighten main padding to squeeze a few extra px for cards          */
      #main { padding: 8px 8px 48px; }

      /* Reduce the definition panel's large horizontal padding so its
         text box doesn't overflow on 360px screens                        */
      .def-panel { padding: 10px 12px 14px; }
    }
