:root {
  --bg: #0a0a0a;
  --panel: #141414;
  --panel-2: #1c1c1c;
  --line: #2a2a2a;
  --text: #ececec;
  --muted: #8a8a8a;
  --green: #95d600;
  --green-dim: #4d6e00;
  --danger: #ff5c5c;
  --radius: 10px;
  --display: 'Oswald', Impact, 'Arial Narrow', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 Inter, system-ui, sans-serif; }
a { color: var(--green); text-decoration: none; }
img { display: block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); min-height: 1.2em; margin: 4px 0; font-size: 13px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px; background: rgba(10,10,10,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { font: 700 24px/1 var(--display); letter-spacing: 1px; color: var(--text); }
.logo span { color: var(--green); }
nav { display: flex; gap: 4px; flex: 1; }
nav a { color: var(--muted); padding: 6px 12px; border-radius: 6px; font-weight: 500; }
nav a:hover { color: var(--text); }
nav a.active { color: var(--bg); background: var(--green); }
.account { display: flex; align-items: center; gap: 10px; font-size: 14px; }

main { max-width: 1400px; margin: 0 auto; padding: 24px; }
h1 { font: 700 34px/1.1 var(--display); text-transform: uppercase; margin: 0 0 4px; letter-spacing: .5px; }
h2 { font: 600 22px/1.2 var(--display); text-transform: uppercase; margin: 0 0 12px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

/* ---------- buttons / inputs ---------- */
.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font: 600 14px Inter, sans-serif; cursor: pointer;
}
.btn:hover { border-color: #444; }
.btn.primary { background: var(--green); border-color: var(--green); color: #0a0a0a; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--green-dim); border-color: var(--green); }

/* ---------- collection ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filters input[type=search] { min-width: 220px; flex: 1; max-width: 360px; }
.progress { min-width: 260px; }
.progress-bar { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress-bar > div { height: 100%; background: var(--green); transition: width .3s; }
.line-group { margin-bottom: 28px; }
.line-group h2 { display: flex; gap: 10px; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.line-group h2 small { font: 500 13px Inter, sans-serif; color: var(--muted); text-transform: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; cursor: pointer; transition: border-color .15s, transform .15s; user-select: none;
}
.card:hover { border-color: #3a3a3a; transform: translateY(-2px); }
.card .can { height: 170px; display: grid; place-items: center; background: #fff; border-radius: 6px; overflow: hidden; }
.card .can img { max-height: 160px; max-width: 100%; object-fit: contain; }
.card:not(.tried) .can img { filter: grayscale(.85) brightness(.75); }
.card:not(.tried) .can { background: #d9d9d9; }
.card .name { font-weight: 600; font-size: 14px; margin-top: 8px; line-height: 1.25; }
.card .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card.tried { border-color: var(--green-dim); }
.check {
  position: absolute; top: 16px; right: 16px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,.55); border: 2px solid #777; display: grid; place-items: center; color: transparent; font-weight: 700;
}
.card.tried .check { background: var(--green); border-color: var(--green); color: #0a0a0a; }
.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--panel-2); color: var(--muted); }
.badge.Current { color: var(--green); }
.badge.Discontinued { color: #d77; }
.badge.Regional { color: #7bd; }
.img-fallback { color: #555; font: 700 18px var(--display); text-align: center; padding: 8px; }

/* ---------- tier list ---------- */
.tierlist { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tier-row { display: flex; min-height: 104px; border-bottom: 1px solid var(--line); }
.tier-row:last-child { border-bottom: 0; }
.tier-label {
  width: 90px; flex-shrink: 0; display: grid; place-items: center; cursor: pointer;
  font: 700 36px var(--display); color: #111;
}
.tier-items { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; background: var(--panel); align-content: flex-start; }
.tier-items.drag-over, .pool.drag-over { background: #1d2610; }
.tier-row.target .tier-items { outline: 2px dashed var(--green); outline-offset: -4px; }
.chip {
  width: 76px; background: #fff; border-radius: 6px; padding: 4px; cursor: grab; position: relative;
  border: 2px solid transparent;
}
.chip img { width: 100%; height: 84px; object-fit: contain; pointer-events: none; }
.chip .tip { display: none; }
.chip:hover .tip {
  display: block; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px;
  background: #000; color: #fff; font-size: 12px; padding: 3px 7px; border-radius: 4px; white-space: nowrap; z-index: 5;
}
.chip.selected { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-dim); }
.chip.dragging { opacity: .4; }
.chip .img-fallback { height: 84px; display: grid; place-items: center; font-size: 11px; }
.pool-wrap { margin-top: 22px; }
.pool { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; min-height: 110px; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 14px; }

/* ---------- AI ---------- */
.ai-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.ai-profile { font-size: 16px; line-height: 1.6; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; font-size: 13px; }
.tag.good { border-color: var(--green-dim); color: var(--green); }
.tag.bad { border-color: #5a2a2a; color: #e88; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.recs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.rec { display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--green-dim); border-radius: var(--radius); padding: 14px; }
.rec .can { width: 90px; height: 130px; flex-shrink: 0; background: #fff; border-radius: 6px; display: grid; place-items: center; }
.rec .can img { max-width: 100%; max-height: 124px; object-fit: contain; }
.rec h3 { margin: 0 0 4px; font: 600 18px var(--display); text-transform: uppercase; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid #0a0a0a55; border-top-color: #0a0a0a; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- people ---------- */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.person { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--text); }
.person:hover { border-color: var(--green-dim); }
.person strong { font: 600 20px var(--display); display: block; }

/* ---------- empty / auth / toast ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h2 { color: var(--text); }
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px;
  padding: 0; width: min(380px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,.7); }
#auth-form, #profile-form, #reset-form { padding: 26px; display: flex; flex-direction: column; gap: 12px; position: relative; }
dialog form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.oauth { display: flex; flex-direction: column; gap: 8px; }
.oauth:empty, .oauth:empty + .divider { display: none; }
.btn.oauth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border-color: #fff; }
.btn.oauth-btn:hover { filter: brightness(.95); }
.btn.oauth-btn svg { width: 18px; height: 18px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.notice { color: var(--green); font-size: 13px; margin: 0; }
.close { position: absolute; top: 10px; right: 14px; background: none; border: 0; color: var(--muted); font-size: 24px; cursor: pointer; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: #222; border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; font-size: 14px;
}
.toast.err { border-color: var(--danger); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  nav { order: 3; width: 100%; overflow-x: auto; }
  main { padding: 16px 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .card .can { height: 140px; }
  .tier-label { width: 52px; font-size: 26px; }
  .chip { width: 60px; }
  .chip img { height: 68px; }
  .two-col { grid-template-columns: 1fr; }
}
