:root {
  --bg: #fff;
  --ink: #14213d;
  --mute: #5a6781;
  --line: #cfd8e3;
  --blue: #2447f5;
  --yellow: #ffc400;
  --ok: #0f7a4a;
  --panel: #fff;
  --card: #fff;
  --rail-bg: #f6f8fb;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html.dark {
  --bg: #0f1419;
  --ink: #e8eef7;
  --mute: #9aa8bd;
  --line: #2a3544;
  --blue: #5b7cff;
  --yellow: #ffc400;
  --ok: #3dcc8c;
  --panel: #161d27;
  --card: #161d27;
  --rail-bg: #0b0f14;
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 "IBM Plex Sans", system-ui, sans-serif;
  transition: background .2s, color .2s;
}
h1, h2, h3, .logo {
  font-family: "Bricolage Grotesque", "Arial Black", sans-serif;
  letter-spacing: -.02em;
  margin: 0;
}

/* Layout: side rails for ads + center content */
.shell {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 160px;
  min-height: 100vh;
  gap: 0;
}
.wrap {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  min-width: 0;
}
.rail {
  background: var(--rail-bg);
  border-color: var(--line);
  padding: 18px 10px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.rail-left { border-right: 1px solid var(--line); }
.rail-right { border-left: 1px solid var(--line); }
.ad-side {
  width: 100%;
  max-width: 140px;
  min-height: 240px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  padding: 14px 8px;
  text-align: center;
  color: var(--mute);
  font-size: 12px;
  line-height: 1.4;
  background: var(--panel);
}
/* Hide side ads on narrow screens; optional bottom slot can be used later */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  gap: 12px;
  flex-wrap: wrap;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
}
nav {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 15px;
  flex-wrap: wrap;
}
nav a { color: var(--mute); text-decoration: none; }
nav a:hover { color: var(--ink); }
nav a.btn { color: #14213d; }

.btn {
  font: 500 15px "IBM Plex Sans", sans-serif;
  border: 2px solid var(--ink);
  background: var(--yellow);
  color: #14213d;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
}
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

h1 {
  font-size: clamp(32px, 5.5vw, 56px);
  line-height: 1.04;
  font-weight: 800;
}
h2.sec { font-size: 26px; margin: 8px 0 16px; }

.hero { padding: 46px 0 36px; max-width: 820px; }
.hero h1 { max-width: 760px; }
.hero p {
  color: var(--mute);
  max-width: 58ch;
  font-size: 18px;
  margin: 14px 0 20px;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-points {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 22px;
  color: var(--mute);
  font-size: 13px;
}

.panel {
  background: var(--panel);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 6px 6px 0 var(--ink);
  margin-bottom: 24px;
}
.panel h2 { font-size: 20px; }
.panel .btn { width: 100%; margin-top: 16px; }

label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-top: 14px;
}
label[hidden] { display: none; }
input, select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
input[type=checkbox] { width: auto; margin: 0 8px 0 0; }
.chk { font-weight: 400; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
small, .by { color: var(--mute); font-size: 14px; }

.narrow { max-width: 460px; margin: 10px auto 40px; }
.bar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 99px;
  padding: 6px 14px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.chip[aria-pressed=true] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}
.card {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--card);
  position: relative;
}
.cover {
  height: 130px;
  background: var(--blue) center/cover;
  position: relative;
}
.cover span {
  position: absolute;
  right: 12px;
  top: 12px;
  background: var(--yellow);
  color: #14213d;
  font-weight: 500;
  font-size: 14px;
  padding: 3px 10px;
  border-radius: 4px;
}
.body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.card h3 { font-size: 19px; }
.tags { font-size: 13px; color: var(--mute); }
.card .btn { margin-top: auto; }
.card .save-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  border: none;
  background: rgba(255,255,255,.92);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.card .save-btn.on { color: #e11d48; }
.ver { color: var(--ok); font-weight: 500; }
.nw { color: #a15c00; font-weight: 500; }
html.dark .nw { color: #f0a050; }

.two {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 28px;
  padding-bottom: 40px;
  align-items: start;
}
.box {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  background: var(--card);
}
.box h3 { font-size: 18px; margin-bottom: 8px; }
.box ul {
  margin: 0;
  padding-left: 18px;
  color: var(--mute);
  font-size: 14px;
}
.price {
  font: 800 32px "Bricolage Grotesque", sans-serif;
}
.photo {
  height: 260px;
  border-radius: 10px;
  background: #f6f8fb center/cover;
  border: 1.5px solid var(--line);
  margin: 8px 0 16px;
}
html.dark .photo { background: #1a222d; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: var(--card);
}
.stat b {
  display: block;
  font: 800 28px "Bricolage Grotesque", sans-serif;
}
.line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
  font-size: 14px;
}
.line .btn {
  padding: 4px 10px;
  font-size: 13px;
  margin-left: 6px;
}

.pol h3 { font-size: 20px; margin: 24px 0 6px; }
.pol p { margin: 0; color: var(--mute); max-width: 68ch; }

footer {
  border-top: 1.5px solid var(--line);
  padding: 22px 0 40px;
  color: var(--mute);
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
footer a { color: var(--ink); }
.linkish {
  background: none;
  border: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.sep { opacity: .5; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  max-width: 90%;
  z-index: 9;
}
#toast.on { opacity: 1; }

/* Auth */
.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  padding: 11px 14px;
  font: 500 15px "IBM Plex Sans", sans-serif;
  cursor: pointer;
  margin-top: 18px;
}
.google-btn:hover {
  background: var(--rail-bg);
  border-color: #9aa8bd;
}
.google-btn:disabled { opacity: .6; cursor: wait; }
.google-mark {
  font: bold 21px Arial, sans-serif;
  color: #4285f4;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--mute);
  font-size: 12px;
  margin: 18px 0 4px;
}
.auth-divider:before,
.auth-divider:after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}
.auth-msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  display: none;
}
.auth-msg.show { display: block; }
.auth-msg.ok {
  background: #e8f8ef;
  color: #0f7a4a;
  border: 1px solid #b7e4c7;
}
.auth-msg.err {
  background: #fdecea;
  color: #b42318;
  border: 1px solid #f5c2c0;
}
html.dark .auth-msg.ok { background: #12301f; color: #3dcc8c; border-color: #1e4d32; }
html.dark .auth-msg.err { background: #2a1515; color: #f5a8a0; border-color: #5c2a28; }

.eyebrow {
  display: block;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  margin-bottom: 9px;
}
.section-intro { margin: 12px 0 18px; }
.section-intro p {
  margin: -8px 0 18px;
  color: var(--mute);
  max-width: 65ch;
}
.community-intro { margin-top: 28px; }
.section-intro .bar { margin-bottom: 8px; }
.section-intro .sec { margin-bottom: 8px; }

.cat-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 20px;
}
.cat-pill {
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--mute);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 13px;
  text-decoration: none;
}
.cat-pill:hover { color: var(--ink); border-color: var(--ink); }

.recent-box {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 28px;
  background: var(--card);
}
.recent-box h3 { font-size: 16px; margin-bottom: 8px; }
.recent-list { display: flex; flex-wrap: wrap; gap: 8px; }
.recent-list a {
  font-size: 13px;
  color: var(--blue);
  text-decoration: none;
}
.recent-list a:hover { text-decoration: underline; }

.share-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.share-row .btn { padding: 6px 12px; font-size: 13px; }

@media (max-width: 780px) {
  .two { grid-template-columns: 1fr; }
  .row { flex-direction: column; gap: 0; }
}
@media (max-width: 560px) {
  .hero { padding-top: 30px; }
  .hero-points { gap: 8px 14px; }
  .hero-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .btn:hover { transform: none; }
}
