:root {
  --bg: #05060a;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.07);
  --text: #f5f7fb;
  --muted: #9aa4b8;
  --muted-2: #626c82;
  --accent: #6a8dff;
  --accent-2: #a06bff;
  --accent-3: #43e0ff;
  --gold: #f0cc6a;
  --line: rgba(255, 255, 255, 0.09);
  --radius: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  padding: 0 0 calc(24px + env(safe-area-inset-bottom));
  position: relative;
  overflow-x: hidden;
}

.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}
.glow-a { width: 320px; height: 320px; top: -140px; left: -90px; background: rgba(106, 141, 255, 0.35); }
.glow-b { width: 300px; height: 300px; top: 120px; right: -120px; background: rgba(160, 107, 255, 0.28); }

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: linear-gradient(180deg, rgba(5, 6, 10, 0.95) 60%, rgba(5, 6, 10, 0));
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 34px; height: 34px; display: block; flex: none; }
.logo svg,
.logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text b { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.brand-text small {
  font-size: 11px;
  color: var(--muted-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 46vw;
}

.langs { display: flex; gap: 4px; background: var(--surface); border-radius: 999px; padding: 3px; }
.langs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 600 11px/1 "Inter", sans-serif;
  padding: 7px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s var(--ease);
}
.langs button.on { background: var(--surface-2); color: var(--text); }

.wrap { position: relative; z-index: 1; padding: 4px 16px 0; }

/* ---------------------------------------------------------------- search */

.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 12px;
  height: 46px;
  transition: 0.2s var(--ease);
}
.searchbar:focus-within { border-color: rgba(106, 141, 255, 0.55); background: var(--surface-2); }
.searchbar .ico { width: 18px; height: 18px; color: var(--muted-2); flex: none; }
.searchbar input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  color: var(--text);
  font: 500 15px/1 "Inter", sans-serif;
}
.searchbar input::placeholder { color: var(--muted-2); }
.searchbar input::-webkit-search-cancel-button { display: none; }
.clear {
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

/* ---------------------------------------------------------------- chips */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 14px 0 4px;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 14px;
  font: 600 13px/1 "Inter", sans-serif;
  cursor: pointer;
  transition: 0.2s var(--ease);
  white-space: nowrap;
}
.chip.on {
  color: #080a12;
  background: linear-gradient(120deg, var(--accent-3), var(--accent) 55%, var(--accent-2));
  border-color: transparent;
}
.chip .n { opacity: 0.6; margin-left: 4px; font-weight: 700; }

/* ---------------------------------------------------------------- grid */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 0 8px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 90% at 100% 0%, rgba(106, 141, 255, 0.16), transparent 60%);
  opacity: 0;
  transition: 0.25s var(--ease);
  pointer-events: none;
}
.card:active { transform: scale(0.97); }
.card:active::after, .card:hover::after { opacity: 1; }
.card .flag {
  width: 46px;
  height: 32px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.8);
  margin-bottom: 2px;
}
.card .flag.emoji { width: auto; height: auto; border: 0; box-shadow: none; font-size: 30px; line-height: 1.1; }
.card .cname { font: 700 14px/1.25 "Inter", sans-serif; letter-spacing: -0.01em; }
.card .ctags {
  font: 500 11px/1.35 "Inter", sans-serif;
  color: var(--muted-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .hot {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  background: rgba(255, 138, 76, 0.16);
  color: #ff9d5c;
  border-radius: 999px;
  padding: 3px 7px;
  font-weight: 700;
}
.card .hot.soon {
  background: rgba(240, 204, 106, 0.14);
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
}
.card.is-soon { opacity: 0.72; }
.card.is-soon .ctags { color: var(--gold); opacity: 0.85; }

.status.is-soon { color: var(--gold); }
.status.is-soon i { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.terms.soon-text { font-size: 14px; font-weight: 500; color: var(--muted); }

.skeleton {
  height: 108px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 70%);
  background-size: 220% 100%;
  animation: shine 1.2s infinite linear;
}
@keyframes shine { to { background-position: -220% 0; } }

.empty { text-align: center; color: var(--muted-2); font-size: 14px; padding: 30px 20px; }

/* ---------------------------------------------------------------- sheet */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  visibility: hidden;
}
.sheet.open { visibility: visible; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 8, 0.72);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.28s var(--ease);
}
.sheet.open .sheet-backdrop { opacity: 1; }

.sheet-card {
  position: relative;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #0b0d15;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  transform: translateY(102%);
  transition: transform 0.34s var(--ease);
}
.sheet.open .sheet-card { transform: translateY(0); }

.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.sheet-body { overflow-y: auto; padding: 22px 18px 10px; -webkit-overflow-scrolling: touch; }

.geo-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.geo-head .flag-lg {
  width: 62px;
  height: 44px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.9);
  flex: none;
}
.geo-head .flag-lg.emoji { width: auto; height: auto; border: 0; box-shadow: none; font-size: 40px; line-height: 1; }
.geo-head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.geo-head .sub { color: var(--muted-2); font-size: 12px; margin-top: 3px; }
.status { display: inline-flex; align-items: center; gap: 5px; color: #56d6a0; font-weight: 600; }
.status i { width: 6px; height: 6px; border-radius: 50%; background: #56d6a0; box-shadow: 0 0 8px #56d6a0; }

.opt {
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.opt h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.opt .label { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.reqs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.req {
  font: 600 12px/1 "Inter", sans-serif;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(106, 141, 255, 0.12);
  border: 1px solid rgba(106, 141, 255, 0.22);
  color: #c3d0ff;
}
.terms { font-size: 15px; font-weight: 600; line-height: 1.4; }
.terms b { color: var(--gold); font-weight: 700; }

.note {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--accent-2);
  border-radius: 0 12px 12px 0;
  padding: 10px 12px;
}

.sheet-foot {
  display: flex;
  gap: 8px;
  padding: 12px 18px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(11, 13, 21, 0.9);
  backdrop-filter: blur(8px);
}
.btn {
  flex: 1;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font: 700 14px/1 "Inter", sans-serif;
  cursor: pointer;
  transition: transform 0.15s var(--ease), opacity 0.2s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  color: #080a12;
  background: linear-gradient(120deg, var(--accent-3), var(--accent) 50%, var(--accent-2));
  box-shadow: 0 10px 26px -12px rgba(106, 141, 255, 0.9);
}
.btn.ghost { flex: 0 0 46px; background: var(--surface-2); color: var(--text); font-size: 17px; padding: 14px 0; }

@media (min-width: 620px) {
  .wrap, .topbar { max-width: 620px; margin: 0 auto; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sheet { align-items: center; justify-content: center; }
  .sheet-card { max-width: 560px; border-radius: 26px; border-bottom: 1px solid var(--line); }
}
