@font-face {
  font-family: 'Lalezar';
  src: url('fonts/Lalezar-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: 'Open Sans';
  src: url('fonts/OpenSans-VariableFont_wdth,wght.ttf') format('truetype-variations');
  font-weight: 300 800;
  font-style: normal;
}
@font-face {
  font-family: 'Open Sans';
  src: url('fonts/OpenSans-Italic-VariableFont_wdth,wght.ttf') format('truetype-variations');
  font-weight: 300 800;
  font-style: italic;
}

:root {
  color-scheme: light;
  --ink: #1a1a1a;
  --yellow: #f6dfa0;
  --sage: #a7bb88;
  --sage-hover: #e7efdc;
  --sage-chip: #93ac72;
  --panel-bg: #eef0e2;
  --cream: #f1efe4;
  --white: #ffffff;
  --red: #d8483a;
  --radius: 8px;
  --border: 2px solid var(--ink);
  --shadow: 2px 2px 0 0 #0d0d0d;
  --font-display: 'Lalezar', sans-serif;
  --font-body: 'Open Sans', sans-serif;
}

* { box-sizing: border-box; }
button, a { color: inherit; font: inherit; }

body {
  margin: 0;
  background: #d9d7cc;
  font-family: var(--font-body);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 12px 20px;
}

/* ---------- dev controls ---------- */
.devbar {
  width: 100%;
  max-width: 720px;
  background: #2b2b2b;
  color: #fff;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}
.devbar-label { font-weight: 700; opacity: .8; margin-right: auto; }
.devswitch { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.devswitch input { accent-color: var(--sage); width: 16px; height: 16px; }

/* ---------- phone frame ---------- */
.phone {
  width: 360px;
  height: 800px;
  max-width: 100%;
  background: var(--cream);
  border-radius: 28px;
  border: 6px solid #1a1a1a;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
}

.phone-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--sage-chip) transparent;
}
.phone-scroll::-webkit-scrollbar { width: 8px; }
.phone-scroll::-webkit-scrollbar-track { background: transparent; }
.phone-scroll::-webkit-scrollbar-thumb { background: var(--sage-chip); border-radius: 6px; }

.phone-footer {
  flex: 0 0 auto;
  position: relative;
  background: var(--cream);
  border-top: 0.5px solid var(--ink);
  box-shadow: 2px 2px 10px 0 rgba(13, 13, 13, 0.4);
  padding: 14px 16px 16px;
}

.statusbar {
  display: flex;
  justify-content: space-between;
  padding: 8px 20px 0;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px 10px;
}
.topbar h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  margin: 0;
}
.icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  width: 30px;
}

.content {
  padding: 4px 10px 20px;
}

/* ---------- filter header ---------- */
.filter-block { margin-bottom: 14px; }

.filter-header {
  width: 100%;
  background: var(--yellow);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  cursor: pointer;
  transition: background .15s ease;
}
.filter-header.has-active {
  background: var(--sage);
}
.filter-header.attached {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: none;
}

.filter-header-label { display: flex; align-items: center; }

.counter-badge[hidden] { display: none; }
.counter-badge {
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-body);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  transform: translateY(-6px);
}

.chevron {
  width: 20px;
  height: 20px;
  transition: transform .15s ease;
}
.chevron.is-down { transform: rotate(180deg); }

.filter-panel {
  background: var(--panel-bg);
  border: var(--border);
  border-top: none;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  padding: 14px 14px 16px;
}

/* ---------- closed-state active chips strip ---------- */
.closed-chips-strip[hidden] { display: none; }
.closed-chips-strip {
  background: var(--panel-bg);
  border: var(--border);
  border-top: none;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  padding: 10px 14px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- chips (shared) ---------- */
.chip {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 7px 8px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
  white-space: nowrap;
}

.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.tab-chip.active {
  background: var(--yellow);
}

.time-chips {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  margin-top: 14px;
  padding-bottom: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
}
.time-chips:active { cursor: grabbing; }
.time-chips::-webkit-scrollbar { display: none; }
.time-chips .chip { flex: none; }
.time-chip.active {
  background: var(--sage);
}

/* ---------- selector area ---------- */
.selector-area { margin-bottom: 12px; }

.selector-placeholder-btn {
  width: 100%;
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-weight: 800;
  font-family: var(--font-body);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: #555;
}

.selector-value-box {
  width: 100%;
  background: var(--sage);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-weight: 800;
  font-family: var(--font-body);
  font-size: 15px;
  text-align: center;
  cursor: pointer;
}

/* search input and result list: two touching boxes, each fully rounded */
.selector-combo {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.selector-search {
  width: 100%;
  display: block;
  position: relative;
  z-index: 1;
  background: var(--white);
  border: 0.5px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-body);
  text-align: center;
}
.selector-search:focus { outline: none; }
.selector-search::placeholder { color: #8a8a8a; font-weight: 700; text-align: center; }

.selector-list {
  background: var(--white);
  border: 0.5px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 2px 2px 10px 0 rgba(13, 13, 13, 0.4);
  overflow: hidden;
}

.selector-list-scroll {
  max-height: 190px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--sage-chip) transparent;
}
.selector-list-scroll::-webkit-scrollbar { width: 8px; }
.selector-list-scroll::-webkit-scrollbar-track { background: transparent; }
.selector-list-scroll::-webkit-scrollbar-thumb { background: var(--sage-chip); border-radius: 6px; }

.selector-list-item {
  padding: 14px 16px;
  font-weight: 800;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}
.selector-list-item:last-child { border-bottom: none; }
.selector-list-item:hover,
.selector-list-item.highlight {
  background: var(--sage-hover);
}
.selector-list-empty {
  padding: 16px;
  text-align: center;
  color: #888;
  font-weight: 700;
  font-size: 13px;
}

/* ---------- status zone ---------- */
.status-zone {
  min-height: 98px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
}

.status-message {
  background: var(--white);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.4;
  position: relative;
}
.status-message.plain { color: #666; }
.status-message.has-close { padding-right: 32px; }
.status-message .status-link { color: #2a63c7; }
.status-message .msg-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  color: #333;
}

.active-filters-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.active-filters-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 13px;
}
.reset-link {
  color: var(--red);
  font-weight: 800;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font-family: var(--font-body);
}
.reset-link img { width: 14px; height: 14px; }
.active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.active-chip {
  background: var(--sage-chip);
  border-radius: 0;
  padding: 6px 8px;
  font-weight: 800;
  font-family: var(--font-body);
  font-size: 13px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.active-chip button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.active-chip button img {
  width: 10px;
  height: 10px;
}

/* ---------- leaderboard ---------- */
.leaderboard {
  background: #fdf6e3;
  border-radius: var(--radius);
  padding: 16px 6px 10px;
  margin-bottom: 16px;
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}
.podium-item { text-align: center; }
.podium-item .avatar {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 6px;
}
.podium-item .avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.podium-item.first {
  transform: translateY(-12px);
}
.podium-item.first .avatar {
  width: 78px;
  height: 78px;
}
.podium-item .name {
  font-weight: 800;
  font-size: 13px;
  font-family: var(--font-body);
}
.podium-item.first .name { color: #4d7a2f; font-size: 14px; }
.podium-item .score {
  font-weight: 800;
  font-size: 13px;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.podium-item.empty .avatar { filter: grayscale(1); opacity: .5; }
.podium-item.empty .name { color: #999; }
.podium-item.empty .score { color: #999; }

.drop-icon { width: 12px; height: 12px; object-fit: contain; }

.rank-list { border-top: 1px solid #e6dcc0; }
.rank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 6px;
  font-weight: 800;
  font-family: var(--font-body);
  font-size: 14px;
  border-bottom: 1px solid #efe7cf;
}
.rank-row .score { display: flex; align-items: center; gap: 4px; }
.rank-row.empty { color: #999; }
.rank-row.me {
  background: #f8ecb8;
  border-radius: var(--radius);
  border-bottom: none;
  margin-top: 4px;
  padding: 12px 10px;
}
.rank-ellipsis {
  text-align: center;
  padding: 6px;
  letter-spacing: 2px;
  color: #a08c4a;
}

/* ---------- bottom ---------- */
.bottom-links { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.bottom-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 2px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-family: var(--font-body);
  font-size: 14px;
  border-bottom: 1px solid #e2decb;
}
.arrow { width: 16px; height: 16px; transform: rotate(90deg); }

.cta-btn {
  width: 295px;
  height: 40px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4b21a;
  border: var(--border);
  border-radius: 2px;
  box-shadow: var(--shadow);
  padding: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 20px;
  cursor: pointer;
  margin: 0 auto 6px;
}
.cta-sub {
  text-align: center;
  font-size: 12px;
  font-family: var(--font-body);
  color: #7a7a7a;
  font-weight: 700;
  margin: 0;
}
