  :root {
    --primary: #2d6a4f;
    --primary-light: #40916c;
    --primary-dark: #1b4332;
    --accent: #d4a373;
    --accent-light: #e9c46a;
    --bg: #fefae0;
    --bg-card: #ffffff;
    --text: #2b2d42;
    --text-light: #6c757d;
    --border: #dee2e6;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 12px;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #000;
    color: var(--text);
    min-height: 100vh;
    position: relative;
  }

  body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('Background.png') center center / contain no-repeat;
    z-index: -1;
    pointer-events: none;
  }

  /* Header */
  header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    cursor: pointer;
  }

  .logo svg { width: 36px; height: 36px; }
  .logo img { height: 55px; }

  nav { display: flex; gap: 0.5rem; }

  nav button {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
  }

  nav button:hover, nav button.active {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
  }

  .nav-donate-btn {
    background: #ffdd00;
    border: 1px solid #e6c800;
    color: #1a1a1a;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
  }
  .nav-donate-btn:hover {
    background: #ffe94d;
    border-color: #ffdd00;
    transform: scale(1.05);
  }

  /* Main layout */
  main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
  }

  .view { display: none; }
  .view.active { display: block; }

  /* Search / Browse View */
  .search-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
  }

  .search-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--primary-dark);
  }

  .search-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
  }

  .field { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; min-width: 180px; }
  .field label { font-size: 0.85rem; font-weight: 600; color: var(--text-light); }

  .field input, .field select {
    padding: 0.6rem 0.8rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
  }

  .field input:focus, .field select:focus {
    outline: none;
    border-color: var(--primary);
  }

  .btn {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
  }

  .btn-primary { background: var(--primary); color: white; }
  .btn-primary:hover { background: var(--primary-light); }
  .btn-accent { background: var(--accent); color: var(--text); }
  .btn-accent:hover { background: var(--accent-light); }
  .btn-outline {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
  }
  .btn-outline:hover { background: var(--primary); color: white; }
  .btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
  .btn-danger { background: #e63946; color: white; }
  .btn-danger:hover { background: #c1121f; }

  /* Listings grid */
  .listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
  }

  .listing-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
  }

  .listing-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  }

  .card-image {
    height: 150px;
    background: linear-gradient(135deg, #ddd, #eee);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
  }

  .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .card-image .placeholder-icon {
    color: #bbb;
    font-size: 2.5rem;
  }

  .card-condition {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .condition-like-new { background: #2d6a4f; color: white; }
  .condition-good { background: #40916c; color: white; }
  .condition-fair { background: #e9c46a; color: var(--text); }
  .condition-worn { background: #e76f51; color: white; }

  .card-body { padding: 0.8rem; flex: 1; display: flex; flex-direction: column; }

  .card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: var(--text);
    line-height: 1.3;
  }

  .card-title a {
    color: inherit;
    text-decoration: none;
  }

  .card-title a:hover { color: var(--primary); }

  .bgg-link {
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-bottom: 0.3rem;
  }

  .bgg-link:hover { text-decoration: underline; }

  .card-meta {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-light);
    flex-wrap: wrap;
  }

  .card-meta span { display: flex; align-items: center; gap: 0.2rem; }

  .card-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: auto;
    padding-top: 0.4rem;
  }

  .card-description {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 0.4rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .card-footer {
    padding: 0.8rem 1.2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-light);
  }

  /* Sell form */
  .sell-form {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    max-width: 750px;
    margin: 0 auto;
  }

  .sell-form h2 {
    font-size: 1.4rem;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
  }

  .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .form-grid .full-width { grid-column: 1 / -1; }

  .form-grid .field { margin-bottom: 0.5rem; }

  .form-grid textarea {
    padding: 0.6rem 0.8rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s;
  }

  .form-grid textarea:focus { outline: none; border-color: var(--primary); }

  /* Bulk listing game rows */
  .game-row {
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    margin-bottom: 0.8rem;
    position: relative;
    transition: border-color 0.2s;
  }
  .game-row:hover { border-color: var(--primary-light); }
  .game-row .game-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
  }
  .game-row .game-row-num {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
    background: rgba(45,106,79,0.08);
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
  }
  .game-row .remove-row-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
  }
  .game-row .remove-row-btn:hover { background: #fee; color: #c0392b; }

  /* Bundle toggle & expansion list */
  .bundle-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0.8rem;
    background: rgba(45,106,79,0.04);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
  }
  .bundle-toggle input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
  }
  .bundle-toggle label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
  }
  .bundle-toggle .bundle-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 400;
  }
  .expansion-section {
    margin-top: 0.8rem;
    padding: 0.8rem;
    background: rgba(45,106,79,0.04);
    border: 1.5px dashed var(--primary-light);
    border-radius: 8px;
  }
  .expansion-section h4 {
    font-size: 0.85rem;
    color: var(--primary);
    margin: 0 0 0.5rem;
  }
  .expansion-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.4rem;
    font-size: 0.88rem;
  }
  .expansion-item .exp-name { flex: 1; }
  .expansion-item .exp-remove {
    background: none;
    border: none;
    color: #c0392b;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
  }
  .expansion-item .exp-remove:hover { background: #fee; }
  .expansion-search-wrap {
    position: relative;
    margin-top: 0.4rem;
  }
  .expansion-search-wrap input {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
  }
  .expansion-search-wrap .bgg-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
  }
  .card-expansions {
    font-size: 0.8rem;
    color: var(--primary);
    margin-top: 0.2rem;
    font-weight: 600;
  }

  /* Suburb dropdown */
  .postcode-wrap { position: relative; }
  .suburb-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
  .suburb-dropdown-item {
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
  }
  .suburb-dropdown-item:hover { background: rgba(45,106,79,0.06); }
  .suburb-dropdown-item:last-child { border-bottom: none; }
  .suburb-dropdown-item .suburb-name { font-weight: 600; color: var(--text); }
  .suburb-dropdown-item .suburb-state { color: var(--text-light); font-size: 0.8rem; margin-left: 0.4rem; }
  .suburb-selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(45,106,79,0.08);
    color: var(--primary);
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 0.3rem;
  }
  .suburb-selected-tag button {
    background: none;
    border: none;
    color: #c0392b;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    line-height: 1;
  }

  /* Powered by BGG badge */
  .bgg-badge {
    position: fixed;
    bottom: 10px;
    left: 10px;
    z-index: 1000;
    opacity: 0.7;
    transition: opacity 0.2s;
  }
  .bgg-badge:hover { opacity: 1; }
  .bgg-badge a {
    color: #ccc;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    background: rgba(0,0,0,0.5);
    padding: 4px 8px;
    border-radius: 4px;
  }
  .bgg-badge img { height: 18px; }

  /* BGG search dropdown */
  .bgg-search-wrap { position: relative; }

  .bgg-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1.5px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
    display: none;
  }

  .bgg-results.show { display: block; }

  .bgg-result-item {
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
  }

  .bgg-result-item:hover { background: #f8f9fa; }

  .bgg-result-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
  }

  .bgg-result-info { flex: 1; }
  .bgg-result-name { font-weight: 600; font-size: 0.9rem; }
  .bgg-result-year { font-size: 0.8rem; color: var(--text-light); }

  .bgg-selected {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0.8rem;
    background: #f0faf4;
    border: 1.5px solid var(--primary-light);
    border-radius: 8px;
    margin-top: 0.5rem;
  }

  .bgg-selected img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
  .bgg-selected-info { flex: 1; }
  .bgg-selected-name { font-weight: 700; font-size: 0.95rem; }
  .bgg-selected-year { font-size: 0.8rem; color: var(--text-light); }
  .bgg-selected .remove-btn {
    background: none;
    border: none;
    color: #e63946;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.2rem;
  }

  /* My listings */
  .my-listings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
  }

  .my-listings-header h2 {
    font-size: 1.4rem;
    color: var(--primary-dark);
  }

  .empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
  }

  .empty-state svg { width: 80px; height: 80px; margin-bottom: 1rem; opacity: 0.4; }
  .empty-state h3 { margin-bottom: 0.5rem; font-size: 1.2rem; }

  /* Detail modal */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }

  .modal-overlay.show { display: flex; }

  .modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  }

  .modal-header {
    padding: 1.5rem 2rem 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }

  .modal-header h2 { font-size: 1.4rem; flex: 1; }
  .modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.2rem;
  }

  .modal-body { padding: 1rem 2rem 2rem; }

  .modal-image {
    width: 100%;
    height: 250px;
    background: #eee;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .modal-image img { width: 100%; height: 100%; object-fit: cover; }

  .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
  }

  .detail-label { font-weight: 600; color: var(--text-light); font-size: 0.9rem; }
  .detail-value { font-weight: 500; }

  .contact-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f0faf4;
    border-radius: 8px;
  }

  .contact-section h3 { font-size: 1rem; margin-bottom: 0.5rem; color: var(--primary-dark); }

  /* Spinner */
  .spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
  }

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

  /* Results count */
  .results-info {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--text-light);
  }

  /* Sort bar */
  .sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* Toast */
  .toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 300;
  }

  .toast.show { transform: translateY(0); opacity: 1; }

  /* Map */
  #map-container {
    height: 600px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
  }

  #map-container .leaflet-popup-content {
    font-family: 'Segoe UI', system-ui, sans-serif;
    min-width: 200px;
  }

  .map-popup-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.3rem;
  }

  .map-popup-price {
    color: var(--primary);
    font-weight: 800;
    font-size: 1.2rem;
    margin: 0.3rem 0;
  }

  .map-popup-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.3rem;
  }

  .map-legend {
    display: flex;
    gap: 1.5rem;
    padding: 0.8rem 1.2rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    align-items: center;
  }

  .map-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .map-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
  }

  /* Wanted cards */
  .wanted-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    box-shadow: var(--shadow);
    margin-bottom: 0.8rem;
    border-left: 4px solid var(--accent);
  }

  .wanted-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.4rem;
  }

  .wanted-card-title { font-weight: 700; font-size: 1.05rem; }

  .wanted-card-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .wanted-badge {
    display: inline-block;
    background: var(--accent);
    color: var(--text);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* Responsive — tablets & phones */
  @media (max-width: 768px) {
    /* Header & logo */
    header { flex-direction: column; gap: 0.5rem; padding: 0.6rem 1rem; }
    .logo { font-size: 1.2rem; }
    .logo img { height: 38px; }

    /* Nav buttons — compact 2-row grid */
    nav {
      display: flex; flex-wrap: wrap; justify-content: center;
      gap: 0.35rem;
      width: 100%;
    }
    nav button, .nav-donate-btn {
      font-size: 0.72rem;
      padding: 0.35rem 0.6rem;
      border-radius: 6px;
    }

    /* Main content area */
    main { padding: 0.75rem; }

    /* Search section */
    .search-section { padding: 1rem; margin-bottom: 1rem; }
    .search-section h2 { font-size: 1.1rem; margin-bottom: 0.6rem; }
    .search-row { flex-direction: column; gap: 0.5rem; }
    .search-row .field { min-width: 0; max-width: none !important; width: 100%; }

    /* Sort bar */
    .sort-bar { flex-direction: column; gap: 0.4rem; align-items: stretch; margin-bottom: 0.6rem; }
    .sort-bar select { width: 100%; }

    /* Listings grid */
    .listings-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.5rem; }
    .card-image { height: 110px; }
    .card-body { padding: 0.6rem; }
    .card-title { font-size: 0.9rem; }
    .card-footer { padding: 0.5rem 0.6rem; font-size: 0.78rem; }
    .card-price { font-size: 1rem; }
    .card-description { font-size: 0.78rem; }
    .bgg-link { font-size: 0.7rem; }

    /* Forms (Sell / Edit) */
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .field { margin-bottom: 0.3rem; }

    /* Modals */
    .modal { max-width: 95vw; }
    .modal-header { padding: 1rem 1.2rem 0; }
    .modal-header h2 { font-size: 1.15rem; }
    .modal-body { padding: 0.8rem 1.2rem 1.2rem; }

    /* Wizard search section */
    #view-wizard .search-section .search-row { flex-direction: column; gap: 0.5rem; }
    #view-wizard .search-section .search-row .field { min-width: 0; max-width: none !important; width: 100%; }

    /* Wanted cards */
    #view-wanted > div { grid-template-columns: 1fr !important; }
  }

  /* Extra-small phones */
  @media (max-width: 400px) {
    header { padding: 0.5rem 0.6rem; }
    .logo { font-size: 1rem; }
    .logo img { height: 30px; }
    nav button, .nav-donate-btn { font-size: 0.65rem; padding: 0.3rem 0.45rem; }
    main { padding: 0.5rem; }
    .search-section { padding: 0.75rem; }
    .listings-grid { grid-template-columns: 1fr; }
    .card-image { height: 140px; }
    .card-body { padding: 0.5rem; }
  }
