/* Mobile-first PWA UI */
:root{
  --bg0:#070b13;
  --bg1:#0b1220;
  --card:#0f1a2f;
  --card2:#0b1426;
  --stroke:rgba(255,255,255,.10);
  --text:#eaf0ff;
  --muted:rgba(234,240,255,.72);
  --muted2:rgba(234,240,255,.55);
  --accent:#35d0a8;
  --warn:#ffcc4d;
  --danger:#ff6b6b;
  --shadow:0 10px 26px rgba(0,0,0,.35);
  --r12:12px;
  --r16:16px;
  --r20:20px;
  --pad:16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  background: radial-gradient(1200px 800px at 20% -10%, rgba(53,208,168,.18), transparent 60%),
              radial-gradient(900px 600px at 110% 0%, rgba(90,120,255,.18), transparent 55%),
              linear-gradient(180deg, var(--bg0), var(--bg1));
  color:var(--text);
}

.sr-only{
  position:absolute!important;
  width:1px;height:1px;
  padding:0;margin:-1px;overflow:hidden;
  clip:rect(0,0,0,0);white-space:nowrap;border:0;
}

.app{
  min-height:100%;
  display:flex;
  flex-direction:column;
}

.topbar{
  position:sticky;
  top:0;
  z-index:30;
  padding: calc(10px + var(--safe-top)) var(--pad) 10px var(--pad);
  background: linear-gradient(180deg, rgba(11,18,32,.96), rgba(11,18,32,.82));
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--stroke);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}
.brand-mark{
  width:44px;height:44px;
  display:grid;place-items:center;
  border-radius:14px;
  background: linear-gradient(135deg, rgba(53,208,168,.22), rgba(53,208,168,.08));
  border:1px solid rgba(53,208,168,.35);
  box-shadow: 0 10px 25px rgba(0,0,0,.25);
  flex:0 0 auto;
}
.brand-text{ min-width:0; }
.brand-text h1{
  margin:0;
  font-size:16px;
  letter-spacing:.2px;
  line-height:1.2;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.subtitle{
  margin:2px 0 0 0;
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.icon-btn{
  appearance:none;
  border:none;
  background:transparent;
  color:var(--text);
  width:40px;height:40px;
  display:grid;place-items:center;
  border-radius:12px;
  cursor:pointer;
}
.icon-btn:hover{ background:rgba(255,255,255,.06); }
.icon-btn:active{ transform: translateY(1px); }
.icon-btn:focus-visible{ outline:2px solid rgba(53,208,168,.65); outline-offset:2px; }

.banner{
  margin: 12px var(--pad) 0 var(--pad);
  background: linear-gradient(135deg, rgba(53,208,168,.22), rgba(15,26,47,.9));
  border:1px solid rgba(53,208,168,.30);
  border-radius: var(--r16);
  box-shadow: var(--shadow);
  padding: 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.banner-text{ min-width:0; }
.banner-text strong{ display:block; font-size:13px; }
.banner-sub{ font-size:12px; color:var(--muted); margin-top:2px; }
.banner-actions{ display:flex; gap:8px; flex:0 0 auto; }

.content{
  width:100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 14px var(--pad) calc(80px + var(--safe-bottom)) var(--pad);
}

.search-card{
  position: sticky;
  top: calc(74px + var(--safe-top)); /* sits below the topbar */
  z-index: 25;

  background: linear-gradient(180deg, rgba(15,26,47,.98), rgba(11,20,38,.98));
  border: 1px solid rgba(53,208,168,.28);
  border-radius: 22px;
  box-shadow: 0 18px 38px rgba(0,0,0,.45);

  padding: 16px;
  margin-top: 10px;
}

.search-row{
  display:flex;
  align-items:center;
  gap:10px;
}
.search-input{
  width:100%;
  height:54px;
  padding: 0 16px;
  border-radius: 16px;

  border:1px solid rgba(53,208,168,.55);
  background: rgba(7,11,19,.72);
  color:var(--text);

  font-size:15px;
  outline:none;
}
.search-input:focus{
  border-color: rgba(53,208,168,.85);
  box-shadow: 0 0 0 4px rgba(53,208,168,.18);
}


.chips{
  display:flex;
  gap:8px;
  overflow:auto;
  padding: 12px 2px 6px 2px;
  scroll-snap-type: x mandatory;
}
.chips::-webkit-scrollbar{ height:8px; }
.chips::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.08); border-radius:10px; }

.chip{
  scroll-snap-align: start;
  flex:0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  color: var(--text);
  padding: 8px 12px;
  font-size: 12px;
  cursor:pointer;
}
.chip.is-active{
  background: rgba(53,208,168,.18);
  border-color: rgba(53,208,168,.55);
}
.chip:focus-visible{ outline:2px solid rgba(53,208,168,.65); outline-offset:2px; }

.meta-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top: 8px;
}
.meta{ font-size:12px; color:var(--muted); }
.link-btn{
  background:none;
  border:none;
  color: rgba(53,208,168,.92);
  font-size:12px;
  padding:6px 8px;
  border-radius: 10px;
  cursor:pointer;
}
.link-btn:hover{ background: rgba(53,208,168,.10); }
.link-btn:focus-visible{ outline:2px solid rgba(53,208,168,.65); outline-offset:2px; }

.results{
  margin-top: 18px;
  display:flex;
  flex-direction:column;
  gap: 12px;
}
.results::before{
  content:"";
  display:block;
  height:1px;
  background: rgba(255,255,255,.10);
  margin: 2px 6px 10px 6px;
}


.card{
  background: linear-gradient(180deg, rgba(15,26,47,.92), rgba(11,20,38,.92));
  border: 1px solid var(--stroke);
  border-radius: var(--r20);
  box-shadow: var(--shadow);
  padding: 14px;
}
.card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.card-title{
  margin:0;
  font-size:14px;
  line-height:1.35;
}
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:11px;
  padding: 6px 10px;
  border-radius: 999px;
  border:1px solid rgba(53,208,168,.35);
  background: rgba(53,208,168,.12);
  color: var(--text);
  white-space:nowrap;
  flex:0 0 auto;
}
.kicker{
  display:flex;
  gap:8px;
  align-items:center;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}
.dot{
  width:6px;height:6px;border-radius:50%;
  background: rgba(255,255,255,.25);
}
.card-body{
  margin-top: 10px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}
.penalty{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r16);
  background: rgba(255, 107, 107, .12);
  border: 1px solid rgba(255, 107, 107, .30);
  font-size: 12px;
}
.penalty strong{ color: rgba(255, 190, 190, .95); }

.actions{
  margin-top: 12px;
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
}
.small{
  font-size:12px;
  color: var(--muted);
}
.star-btn{
  border:none;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.star-btn.is-saved{
  background: rgba(255, 204, 77, .16);
  border-color: rgba(255, 204, 77, .40);
}
.star-btn:focus-visible{ outline:2px solid rgba(53,208,168,.65); outline-offset:2px; }

mark.hl{
  background: rgba(255, 204, 77, .95);
  color: #1a1a1a;
  padding: 0 .18em;
  border-radius: 6px;
}

.empty{
  margin-top: 14px;
}
.empty-card{
  text-align:center;
  padding: 22px 16px;
  background: rgba(255,255,255,.04);
  border:1px dashed rgba(255,255,255,.16);
  border-radius: var(--r20);
}
.empty-icon{ font-size: 28px; }
.empty-card h2{ margin: 10px 0 4px 0; font-size: 16px; }
.empty-card p{ margin: 0 0 14px 0; color: var(--muted); font-size: 13px; }

.btn{
  border:none;
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 650;
  cursor:pointer;
  font-size: 12px;
}
.btn-primary{
  background: rgba(53,208,168,.95);
  color:#08121f;
}
.btn-primary:hover{ filter: brightness(1.03); }
.btn-ghost{
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--text);
}
.btn:focus-visible{ outline:2px solid rgba(53,208,168,.65); outline-offset:2px; }

.bottombar{
  position:fixed;
  left:0; right:0;
  bottom:0;
  padding: 10px 14px calc(10px + var(--safe-bottom)) 14px;
  background: linear-gradient(180deg, rgba(11,18,32,.02), rgba(11,18,32,.92));
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--stroke);
  display:flex;
  justify-content:space-around;
  gap:10px;
  z-index:50;
}

.nav-btn{
  flex:1 1 0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  height: 52px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor:pointer;
}
.nav-btn.is-active{
  background: rgba(53,208,168,.12);
  border-color: rgba(53,208,168,.28);
  color: var(--text);
}
.nav-ic{ font-size: 16px; }
.nav-tx{ font-size: 11px; }

.sheet::backdrop{ background: rgba(0,0,0,.45); }
.sheet{
  border:none;
  padding: 0;
  width: min(560px, 92vw);
  border-radius: 22px;
  overflow:hidden;
  box-shadow: var(--shadow);
  background: transparent;
}
.sheet-card{
  margin:0;
  background: linear-gradient(180deg, rgba(15,26,47,.98), rgba(11,20,38,.98));
  border: 1px solid rgba(255,255,255,.12);
  padding: 14px;
}
.sheet-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.sheet-head h3{ margin:0; font-size: 14px; }
.muted{ color: var(--muted); font-size: 13px; line-height: 1.6; margin: 10px 0; }
.list{ color: var(--muted); font-size: 13px; line-height: 1.7; padding-left: 18px; margin: 0; }
.sheet-actions{ margin-top: 14px; display:flex; justify-content:flex-end; }

.tips-body{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top: 10px;
}
.tip{
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.tip strong{ color: rgba(255, 204, 77, .95); }

.toast{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(78px + var(--safe-bottom));
  background: rgba(0,0,0,.78);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 12px;
  box-shadow: var(--shadow);
  max-width: min(520px, 92vw);
  z-index: 80;
}

@media (min-width: 720px){
  .brand-text h1{ font-size: 18px; }
  .subtitle{ font-size: 13px; }
  .search-input{ font-size: 15px; }
  .card-title{ font-size: 15px; }
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; scroll-behavior:auto !important; }
}
/* Donation pop tweaks */
#donatePop .primary-btn{ display:block; text-align:center; text-decoration:none; }
#donatePop .pill-btn{ display:block; text-align:center; text-decoration:none; }
/* ===== Donation popup: make it solid and readable ===== */
#donatePop{
  background: #0b1020 !important;          /* solid */
  border: 1px solid rgba(255,255,255,.14) !important;
  color: #e9eefb !important;
  box-shadow: 0 18px 60px rgba(0,0,0,.65) !important;
}

/* stronger dim behind dialog */
#donatePop::backdrop{
  background: rgba(0,0,0,.72) !important;
}

/* make the content area readable */
#donatePop .sheet-body{
  color: rgba(233,238,251,.94) !important;
}

/* links/buttons inside popup */
#donatePop a.primary-btn,
#donatePop a.pill-btn,
#donatePop button.pill-btn{
  display: block;
  text-align: center;
  text-decoration: none;
  width: 100%;
}

/* ensure link text is visible */
#donatePop a.primary-btn{
  color: #07101b !important;
}

#donatePop a.pill-btn,
#donatePop button.pill-btn{
  color: #e9eefb !important;
}
.sheet.donate{
  background: #0b1020 !important;
}
.sheet.donate::backdrop{
  background: rgba(0,0,0,.72) !important;
}
/* Fallback modal (mobile-safe) */
.modal[hidden]{ display:none; }
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 12px;
}
.modal-card{
  width: min(560px, 100%);
  background: #0b1020;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,.65);
  color: #e9eefb;
}
.modal-head{
  display:flex;
  justify-content: space-between;
  align-items:center;
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.modal-body{ padding: 12px; line-height: 1.6; }
.modal-actions{ display:grid; gap:10px; margin-top:12px; }
.modal-actions a, .modal-actions button{ width:100%; text-align:center; text-decoration:none; }
