/* ===== Colours: dark navy, easy on the eyes ===== */
:root {
  --bg: #0b1120;
  --card: #131c31;
  --card-2: #1a2540;
  --line: #24314f;
  --text: #e6ecf7;
  --muted: #8a99b8;
  --accent: #4f8cff;
  --good: #34d399;
  --ok: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  --tabs-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

/* ===== Top bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 17, 32, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar h1 { font-size: 1.15rem; margin: 0; white-space: nowrap; }
.timer { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.timer strong { color: var(--text); font-variant-numeric: tabular-nums; }

select {
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.95rem;
}

/* ===== List of cards ===== */
main { padding: 12px 12px calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom)); }

.list { display: grid; gap: 14px; grid-template-columns: 1fr; }

/* PC and tablets: several cards next to each other */
@media (min-width: 720px)  { .list { grid-template-columns: repeat(2, 1fr); } main { max-width: 1400px; margin: 0 auto; } }
@media (min-width: 1100px) { .list { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1500px) { .list { grid-template-columns: repeat(4, 1fr); } }

.group-title {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 6px 4px -4px;
}

.empty { color: var(--muted); text-align: center; margin-top: 60px; line-height: 1.6; }

/* ===== Card ===== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: opacity 0.25s, transform 0.25s;
}
.card.leaving { opacity: 0; transform: scale(0.96); }
.card.gone { opacity: 0.45; filter: grayscale(0.8); }

.photo {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--card-2) center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.badge {
  position: absolute;
  top: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(11, 17, 32, 0.85);
}
.badge.site { left: 10px; }
.badge.score { right: 10px; font-size: 0.95rem; }
.badge.gone-label { left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 1rem; background: rgba(0,0,0,0.8); }

.body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.title { font-size: 1.05rem; font-weight: 650; line-height: 1.3; margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 0.78rem; color: var(--muted); }
.chip.hot { color: var(--ok); border-color: #5a4a1a; }

.warning {
  font-size: 0.82rem; color: var(--ok); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer;
}
.warning.open { -webkit-line-clamp: unset; }

/* Score meter */
.meter { height: 8px; background: var(--card-2); border-radius: 999px; overflow: hidden; }
.meter > div { height: 100%; border-radius: 999px; }

/* Price table */
.prices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.price-box { background: var(--card-2); border-radius: 10px; padding: 8px 10px; }
.price-box small { display: block; color: var(--muted); font-size: 0.74rem; }
.price-box b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.price-box.profit b { color: var(--good); }

details { font-size: 0.84rem; color: var(--muted); }
details summary { cursor: pointer; padding: 2px 0; }
details ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.5; }

.found { font-size: 0.8rem; color: var(--muted); }

/* Buttons */
.actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.actions a, .actions button {
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  padding: 12px 0;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
}
.open { flex: 1; background: var(--accent); color: #fff; }
.icon-btn { width: 52px; background: var(--card-2); color: var(--text); font-size: 1.25rem !important; }
.icon-btn.trash { background: #3a1f28; }
.icon-btn:active, .open:active { transform: scale(0.96); }

/* ===== Bottom tabs ===== */
.tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(11, 17, 32, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  height: var(--tabs-h);
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
  cursor: pointer;
}
.tabs button span { font-size: 1.35rem; }
.tabs button.active { color: var(--text); }
.tabs button.active::after {
  content: "";
  position: absolute;
  top: 0;
  width: 40%;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}
.tabs b {
  position: absolute;
  top: 6px;
  left: calc(50% + 10px);
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
}
.tabs b:empty { display: none; }

/* Small message at the bottom */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--card-2);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 20;
  white-space: nowrap;
}
.toast button { background: none; border: none; color: var(--accent); font-weight: 700; margin-left: 10px; font-size: 0.9rem; cursor: pointer; }
