:root {
      --bg: #f7f7f5;
      --surface: #ffffff;
      --ink: #141414;
      --muted: #6b6b6b;
      --line: #e6e6e3;
      --line-strong: #d0d0cb;
      --accent: #111111;
      --accent-ink: #ffffff;
      --loot: #b42318;
      --loot-bg: #fef3f2;
      --loot-border: #fecdca;
      --great: #b54708;
      --great-bg: #fffaeb;
      --great-border: #fedf89;
      --good: #175cd3;
      --good-bg: #eff8ff;
      --good-border: #b2ddff;
      --fair: #475467;
      --fair-bg: #f2f4f7;
      --fair-border: #d0d5dd;
      --skip: #667085;
      --skip-bg: #f9fafb;
      --skip-border: #e4e7ec;
      --unknown: #98a2b3;
      --unknown-bg: #f9fafb;
      --danger: #d92d20;
      --radius: 14px;
      --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.04);
      --font: "Inter", system-ui, -apple-system, sans-serif;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      font-family: var(--font);
      color: var(--ink);
      background: var(--bg);
      min-height: 100vh;
    }
    a { color: var(--ink); }
    .wrap { max-width: 960px; margin: 0 auto; padding: 1rem 1rem 3rem; }

    .top {
      position: sticky;
      top: 0;
      z-index: 30;
      background: rgba(247, 247, 245, 0.9);
      backdrop-filter: blur(10px);
      border-bottom: 1px solid var(--line);
      margin: -1rem -1rem 1rem;
      padding: 0.85rem 1rem;
    }
    .top-inner {
      max-width: 960px;
      margin: 0 auto;
      display: flex;
      flex-wrap: wrap;
      gap: 0.75rem;
      align-items: center;
      justify-content: space-between;
    }
    .brand h1 {
      margin: 0;
      font-size: 1.15rem;
      font-weight: 700;
      letter-spacing: -0.03em;
    }
    .brand {
      display: flex;
      align-items: center;
      gap: 0.55rem;
    }
    .brand-logo {
      width: 28px;
      height: 28px;
      border-radius: 6px;
      object-fit: contain;
    }
    .brand p {
      margin: 0.15rem 0 0;
      color: var(--muted);
      font-size: 0.82rem;
    }
    .top-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 0.45rem;
      align-items: center;
    }
    .live {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.06em;
      border: 1px solid var(--line);
      background: var(--surface);
      border-radius: 999px;
      padding: 0.35rem 0.65rem;
    }
    .live i {
      width: 0.45rem;
      height: 0.45rem;
      border-radius: 50%;
      background: #12b76a;
    }

    .toolbar {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      align-items: center;
      margin-bottom: 0.75rem;
    }
    .chips { display: flex; flex-wrap: wrap; gap: 0.35rem; flex: 1; }
    .chip {
      border: 1px solid var(--line);
      background: var(--surface);
      color: var(--muted);
      border-radius: 999px;
      padding: 0.38rem 0.75rem;
      font: inherit;
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
    }
    .chip.active {
      color: var(--ink);
      border-color: var(--ink);
      background: #fff;
    }
    .chip .count { margin-left: 0.25rem; font-weight: 500; opacity: 0.7; }

    button, .btn {
      border: 0;
      border-radius: 999px;
      padding: 0.5rem 0.9rem;
      font: inherit;
      font-size: 0.84rem;
      font-weight: 650;
      cursor: pointer;
      background: var(--accent);
      color: var(--accent-ink);
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.35rem;
    }
    button.secondary, .btn.secondary {
      background: var(--surface);
      color: var(--ink);
      border: 1px solid var(--line-strong);
    }
    button.secondary.on {
      border-color: var(--ink);
      background: #111;
      color: #fff;
    }

    .meta-strip {
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem 1rem;
      color: var(--muted);
      font-size: 0.8rem;
      margin-bottom: 0.9rem;
    }
    .meta-strip strong { color: var(--ink); font-weight: 600; }
    .error { color: var(--danger); }

    .panel {
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 0.85rem;
      margin-bottom: 0.9rem;
      box-shadow: var(--shadow);
    }
    details summary {
      cursor: pointer;
      font-weight: 650;
      font-size: 0.9rem;
    }
    label {
      display: block;
      font-size: 0.78rem;
      color: var(--muted);
      margin-bottom: 0.28rem;
    }
    input {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 0.6rem 0.7rem;
      font: inherit;
      background: #fff;
      color: var(--ink);
    }
    .row { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: end; margin-top: 0.65rem; }
    .grow { flex: 1 1 220px; }

    .timeline { display: grid; gap: 0.75rem; }
    .card {
      position: relative;
      overflow: hidden;
      display: grid;
      grid-template-columns: 140px 1fr auto;
      gap: 1rem;
      align-items: start;
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 0.95rem;
      box-shadow: var(--shadow);
    }
    .card-bg-sparkline {
      position: absolute;
      right: 0;
      bottom: 0;
      width: 55%;
      height: 75%;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.3s ease-in-out;
      z-index: 1;
    }
    .card:hover .card-bg-sparkline {
      opacity: 0.08;
    }
    .thumb-wrap {
      position: relative;
      display: block;
    }
    .thumb-wrap .time {
      position: absolute;
      top: 8px;
      left: 8px;
      background: rgba(0, 0, 0, 0.65);
      color: #fff;
      font-size: 0.68rem;
      font-weight: 700;
      padding: 0.15rem 0.45rem;
      border-radius: 6px;
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      pointer-events: none;
      z-index: 2;
    }
    .thumb {
      width: 140px;
      height: 140px;
      object-fit: contain;
      background: #fafafa;
      border-radius: 14px;
      border: 1px solid var(--line);
    }
    .thumb.placeholder, .thumb.logo-thumb {
      background: #18181b;
      padding: 10px;
    }
    .update-flash {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      color: #12b76a;
      font-weight: 600;
      font-size: 0.75rem;
      padding: 0.25rem 0.6rem;
      background: rgba(18, 183, 106, 0.08);
      border: 1px solid rgba(18, 183, 106, 0.2);
      border-radius: 999px;
      opacity: 0;
      transition: opacity 0.4s ease, transform 0.4s ease;
      transform: scale(0.95);
      pointer-events: none;
    }
    .update-flash.show {
      opacity: 1;
      transform: scale(1);
    }
    .update-flash::before {
      content: '';
      display: inline-block;
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background-color: #12b76a;
      box-shadow: 0 0 0 2px rgba(18, 183, 106, 0.25);
    }

    .card.skeleton-card {
      pointer-events: none;
      border-color: var(--line);
      background: var(--surface);
      position: relative;
      overflow: hidden;
    }
    .skeleton-box {
      background: #e2e8f0;
      border-radius: 6px;
      position: relative;
      overflow: hidden;
    }
    .skeleton-box::after {
      position: absolute;
      top: 0; right: 0; bottom: 0; left: 0;
      transform: translateX(-100%);
      background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.5) 30%,
        rgba(255, 255, 255, 0.8) 60%,
        rgba(255, 255, 255, 0)
      );
      animation: shimmer 1.5s infinite;
      content: '';
    }
    @keyframes shimmer {
      100% { transform: translateX(100%); }
    }
    @keyframes slideDownIn {
      from { opacity: 0; transform: translateY(-16px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .card.new-deal-entry {
      animation: slideDownIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .badge {
      display: inline-flex;
      align-items: center;
      border-radius: 999px;
      padding: 0.18rem 0.6rem;
      font-size: 0.68rem;
      font-weight: 750;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      border: 1px solid transparent;
    }
    .badge.Loot {
      color: #e11d48;
      background: linear-gradient(135deg, #ffe4e6 0%, #fecdd3 100%);
      border-color: #fda4af;
      box-shadow: 0 1px 4px rgba(225, 29, 72, 0.12);
    }
    .badge.Great {
      color: #d97706;
      background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
      border-color: #fcd34d;
      box-shadow: 0 1px 4px rgba(217, 119, 6, 0.12);
    }
    .badge.Good {
      color: #0284c7;
      background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
      border-color: #7dd3fc;
      box-shadow: 0 1px 4px rgba(2, 132, 199, 0.1);
    }
    .badge.Fair {
      color: #475569;
      background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
      border-color: #cbd5e1;
    }
    .badge.Skip {
      color: #4b5563;
      background: #f3f4f6;
      border-color: #d1d5db;
    }
    .badge.Unknown { color: var(--unknown); background: var(--unknown-bg); border-color: var(--line); }
    .badge.Page {
      color: #7e22ce;
      background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
      border-color: #c084fc;
    }

    .rating-banner {
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      color: var(--muted);
      font-size: 0.75rem;
      font-weight: 550;
      border: 1px solid var(--line);
      border-radius: 999px;
      padding: 0.12rem 0.48rem;
      background: #fafafa;
    }
    .rating-score {
      font-size: 0.78rem;
      font-weight: 700;
      color: #27272a;
    }
    .rating-star {
      color: #d97706;
      font-size: 0.72rem;
    }
    .rating-count {
      color: var(--muted);
      font-size: 0.7rem;
      font-weight: 500;
    }

    .buy-pill {
      font-size: 0.68rem;
      font-weight: 750;
      letter-spacing: 0.02em;
      border-radius: 999px;
      padding: 0.14rem 0.52rem;
      border: 1px solid transparent;
      line-height: 1;
    }
    .buy-pill.buy-now {
      color: #047857;
      background: #ecfdf5;
      border-color: #a7f3d0;
    }
    .buy-pill.great-value {
      color: #0369a1;
      background: #f0f9ff;
      border-color: #bae6fd;
    }
    .buy-pill.fair-price {
      color: #4b5563;
      background: #f3f4f6;
      border-color: #e5e7eb;
    }

    .sparkline-inline {
      display: inline-block;
      vertical-align: middle;
      margin-left: 0.35rem;
    }

    .card.page-deal {
      grid-template-columns: 130px 1fr auto;
      padding: 0.5rem 1rem;
      gap: 1rem;
      border: 1px dashed #cbd5e1;
      background: #f8fafc;
      border-radius: 12px;
      align-items: center;
    }
    .card.page-deal .thumb {
      width: 75px;
      height: 75px;
      padding: 4px;
      background: #f1f5f9;
      border: 1px dashed #cbd5e1;
      border-radius: 8px;
      justify-self: center;
    }
    .card.page-deal .title {
      font-size: 0.9rem;
      margin: 0.15rem 0;
      -webkit-line-clamp: 1;
    }
    .card.page-deal .btn {
      padding: 0.3rem 0.7rem;
      font-size: 0.75rem;
      min-height: 1.9rem;
    }
    .page-note {
      margin-top: 0.25rem;
      font-size: 0.72rem;
      color: #64748b;
      font-weight: 600;
    }

    .meta-inline {
      display: inline-flex;
      flex-wrap: wrap;
      gap: 0.35rem;
      align-items: center;
    }
    .pill {
      color: var(--muted);
      font-size: 0.75rem;
      font-weight: 550;
      border: 1px solid var(--line);
      border-radius: 999px;
      padding: 0.12rem 0.45rem;
      background: #fafafa;
    }
    .title {
      margin: 0.4rem 0 0.2rem;
      font-size: 0.98rem;
      font-weight: 650;
      line-height: 1.3;
      letter-spacing: -0.02em;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .byline {
      color: var(--muted);
      font-size: 0.8rem;
      margin-bottom: 0.45rem;
      display: flex;
      flex-wrap: wrap;
      gap: 0.25rem 0.45rem;
      align-items: center;
    }
    .byline .time {
      font-weight: 650;
      color: #2f2f2f;
    }
    .byline .ist {
      font-weight: 550;
      color: #525252;
    }
    .price-row {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem 0.85rem;
      align-items: baseline;
    }
    .now {
      font-size: 1.45rem;
      font-weight: 750;
      letter-spacing: -0.03em;
      line-height: 1;
    }
    .now small {
      font-size: 0.8rem;
      color: var(--muted);
      font-weight: 600;
      margin-right: 0.1rem;
    }
    .stat { font-size: 0.78rem; color: var(--muted); }
    .stat b { color: var(--ink); font-weight: 650; }
    .side {
      display: grid;
      gap: 0.4rem;
      justify-items: center;
      min-width: 112px;
    }
    .side .btn { width: 100%; min-height: 2.3rem; }
    .qr {
      width: 78px;
      height: 78px;
      border-radius: 10px;
      border: 1px solid var(--line);
      background: #fff;
      object-fit: contain;
    }
    .empty {
      text-align: center;
      padding: 2.5rem 1rem;
      color: var(--muted);
      border: 1px dashed var(--line-strong);
      border-radius: var(--radius);
      background: var(--surface);
    }
    .handles-mini {
      display: flex;
      flex-wrap: wrap;
      gap: 0.3rem;
      margin-top: 0.55rem;
    }
    .handle-pill {
      font-size: 0.7rem;
      border: 1px solid var(--line);
      border-radius: 999px;
      padding: 0.18rem 0.5rem;
      color: var(--muted);
      background: #fafafa;
    }
    .share-btn {
      display: none;
      align-items: center;
      justify-content: center;
      gap: 0.35rem;
      background: #25D366;
      color: #ffffff;
      border: none;
      border-radius: 8px;
      padding: 0.45rem 0.85rem;
      font-weight: 600;
      font-size: 0.82rem;
      cursor: pointer;
      text-decoration: none;
      transition: all 0.15s ease;
      white-space: nowrap;
      margin-top: 0.4rem;
      box-shadow: 0 2px 4px rgba(37, 211, 102, 0.25);
    }
    .share-btn:hover {
      background: #20bd5a;
      transform: translateY(-1px);
    }
    @media (max-width: 720px) {
      .card { grid-template-columns: 110px 1fr; }
      .card.page-deal { grid-template-columns: 110px 1fr; }
      .side {
        grid-column: 1 / -1;
        grid-template-columns: 1fr auto;
        align-items: center;
        min-width: 0;
      }
      .thumb { width: 110px; height: 110px; }
      .card.page-deal .thumb { width: 65px; height: 65px; }
      .qr { display: none !important; }
      .share-btn { display: inline-flex !important; }
    }

    @keyframes spin { 100% { transform: rotate(360deg); } }
    .spinner {
      animation: spin 1s linear infinite;
      display: inline-block;
      width: 14px;
      height: 14px;
      border: 2px solid rgba(255,255,255,0.3);
      border-radius: 50%;
      border-top-color: currentColor;
    }

    .notify-modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 100;
      background: rgba(0, 0, 0, 0.45);
      backdrop-filter: blur(5px);
      display: flex;
      align-items: flex-end;
      justify-content: center;
      padding: 1rem;
      animation: fadeIn 0.3s ease;
    }
    .notify-modal-backdrop[hidden] {
      display: none !important;
    }
    @media (min-width: 640px) {
      .notify-modal-backdrop {
        align-items: center;
      }
    }
    .notify-modal {
      position: relative;
      background: var(--surface);
      border: 1px solid var(--line-strong);
      border-radius: var(--radius);
      padding: 1.25rem 1.25rem 1rem;
      max-width: 420px;
      width: 100%;
      box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
      animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .notify-modal-close {
      position: absolute;
      top: 0.75rem;
      right: 0.75rem;
      background: transparent;
      border: none;
      color: var(--muted);
      font-size: 1.25rem;
      line-height: 1;
      padding: 0.25rem 0.5rem;
      cursor: pointer;
      border-radius: 50%;
    }
    .notify-modal-close:hover { color: var(--ink); background: var(--fair-bg); }
    .notify-modal-icon {
      width: 44px;
      height: 44px;
      border-radius: 12px;
      background: #f1edff;
      color: #5b35c9;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 0.75rem;
    }
    .notify-modal h3 {
      margin: 0 0 0.35rem;
      font-size: 1.05rem;
      font-weight: 700;
      letter-spacing: -0.02em;
    }
    .notify-modal p {
      margin: 0 0 1rem;
      font-size: 0.85rem;
      color: var(--muted);
      line-height: 1.45;
    }
    .notify-modal-actions {
      display: flex;
      gap: 0.5rem;
      flex-wrap: wrap;
    }
    .notify-modal-actions .btn {
      flex: 1 1 140px;
    }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    @keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }