:root {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: #0f172a;
  background: #0b1120;
  line-height: 1.5;
  font-weight: 400;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #111827, #0b1120 45%);
  color: #e2e8f0;
}

.page {
  width: 100%;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hero-actions .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.9rem;
  line-height: 1;
}

.eyebrow {
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  margin: 0 0 0.2rem;
}

h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(2.2rem, 4vw, 2.8rem);
}

.lede {
  margin: 0;
  max-width: 720px;
  color: #cbd5e1;
}

.controls.nav {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-actions {
  display: none;
  align-items: center;
  gap: 0.75rem;
  margin-left: 0;
  position: relative;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.menu-toggle {
  display: none;
  align-items: center;
  gap: 0.4rem;
}

.control {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 10px;
}

.control span {
  color: #94a3b8;
  font-size: 0.9rem;
}

.control .icon,
.search .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
}

.control .icon + span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

select,
input {
  flex: 1;
  background: #111827;
  border: 1px solid #1f2937;
  color: #e2e8f0;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  font-size: 1rem;
}

.ghost {
  background: transparent;
  border: 1px solid #334155;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}

.ghost:hover {
  border-color: #38bdf8;
  color: #e0f2fe;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.9rem;
  font-size: 1.2rem;
}

.refresh-icon {
  font-size: 1.2rem;
}

.search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid #1e293b;
  border-radius: 10px;
  background: #0f172a;
}

.checkbox-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid #1e293b;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  cursor: pointer;
}

.checkbox-control input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: #38bdf8;
}

.checkbox-control span {
  color: #94a3b8;
  font-size: 0.9rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chips button {
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

.chips button.selected {
  border-color: #38bdf8;
  background: #0ea5e9;
  color: #0b1120;
}

.hint,
.error {
  margin: 1rem 0;
  color: #94a3b8;
}

.error {
  color: #f87171;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.card {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

.frame {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
}

.image {
  position: relative;
  background: #0b162b;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.75;
  aspect-ratio: 1;
}

.price {
  position: absolute;
  left: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  padding: 0.35rem 0.6rem;
  font-weight: 700;
}

.badge.end-prize {
  position: absolute;
  left: 0;
  top: 0;
  background: rgba(34, 197, 94, 0.9);
  color: #0b1120;
  padding: 0.35rem 0.6rem;
  font-weight: 700; 
}

.badge.max-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  padding: 0.35rem 0.6rem;
  font-weight: 700;
}

.badge.draw-badge {
  position: absolute;
  right: 0;
  top: 0;
  background: rgba(248, 180, 0, 0.95);
  color: #0b1120;
  padding: 0.35rem 0.6rem;
  font-weight: 700;
}

.progress-overlay {
  position: relative;
  width: 100%;
  height: 32px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.55) 35%, rgba(0, 0, 0, 0.75) 100%);
  display: flex;
  align-items: center;
  padding: 6px 10px;
  box-sizing: border-box;
}

.progress-fill {
  position: absolute;
  inset: 0 0 0 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.35), rgba(56, 189, 248, 0.85));
  pointer-events: none;
  transition: width 160ms ease;
}

.progress-marker {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.8);
}

.progress-labels {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  font-size: 0.9rem;
  color: #e2e8f0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  z-index: 1;
}

.progress-labels span {
  text-align: center;
  font-weight: 700;
  width: 100%;
}

.content {
  padding: 0.25rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.card-timestamps {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: auto;
}

.card-timestamps span {
  white-space: nowrap;
}

.domain {
  margin: 0;
  color: #94a3b8;
  font-size: 0.9rem;
}

h3 {
  margin: 0;
  font-size: 1.05rem;
  color: #e2e8f0;
}

.content h3 {
  text-align: center;
  font-size: 1.25rem;
  line-height: 1.3;
  min-height: calc(1.25rem * 1.3 * 2);
  text-overflow: ellipsis;
  overflow: hidden;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.progress {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

progress {
  width: 100%;
  accent-color: #38bdf8;
  background: #0b162b;
  height: 10px;
  border-radius: 20px;
  overflow: hidden;
}

.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin: 0;
}

.meta div {
  padding: 0.6rem 0.7rem;
  border: 1px solid #1e293b;
  border-radius: 10px;
  background: #0b162b;
}

.meta-table {
  width: 100%;
  font-size: 0.95rem;
  border-collapse: separate;
  border-spacing: 0;
}

.meta-table tr {
  display: grid;
  grid-template-columns: auto 1fr;
  width: 100%;
  line-height: 1.2;
  padding: 0.2rem 0;
}

.meta-table td {
  padding: 0.2rem 0.35rem;
}

.meta-table td:first-child {
  color: #94a3b8;
  text-align: left;
  white-space: nowrap;
  font-weight: 700;
}

.meta-table td:last-child {
  color: #e2e8f0;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.has-tooltip {
  position: relative;
  overflow: visible;
}

.has-tooltip .tooltip {
  position: fixed;
  left: var(--tooltip-left, 0);
  top: var(--tooltip-top, 0);
  transform: translate(-50%, 6px);
  margin-top: 0;
  z-index: 40;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  display: none;
  min-width: 200px;
  max-width: min(420px, 90vw);
  width: max-content;
  text-align: left;
  white-space: normal;
  pointer-events: none;
}

.has-tooltip:hover .tooltip {
  display: block;
}

.has-tooltip .tooltip > div {
  text-align: left;
}

.instant-tooltip {
  position: fixed;
  background: rgba(30, 30, 30, 0.98);
  border: 1px solid #4fc3f7;
  border-radius: 6px;
  padding: 8px;
  font-size: 0.95rem;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  z-index: 1000000;
  width: max-content;
  max-width: min(460px, 90vw);
  pointer-events: none;
}

.instant-tooltip table {
  border-collapse: collapse;
}

.instant-tooltip td {
  padding: 2px 6px;
  white-space: nowrap;
}

.tooltip .muted {
  color: #94a3b8;
  font-weight: 400;
  margin-left: 6px;
}

.debug-line {
  margin: 0;
  font-size: 0.85rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(6px);
}

.modal {
  background: linear-gradient(145deg, #0f172a, #101827);
  border: 1px solid #1f2a3b;
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  width: min(520px, 90vw);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

.modal.winners {
  width: auto;
  min-width: min(480px, 95vw);
  max-width: min(960px, 95vw);
  max-height: 85vh;
  overflow: auto;
  scrollbar-width: none;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.modal h3 {
  margin: 0;
}

.modal-control {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 0.5rem 0;
}

.small {
  font-size: 0.8em;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.modal-buttons {
  display: flex;
  gap: 0.5rem;
}

.table-scroll {
  max-height: 70vh;
  overflow: auto;
  scrollbar-width: none;
}

.meta-table.tight td {
  white-space: nowrap;
  padding: 0.25rem 0.4rem;
}

.meta-table.tight td:last-child {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-table.tight tr {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 5fr;
  align-items: center;
  gap: 0.35rem;
}

.meta-table.tight td:last-child {
  text-align: left;
}

/* hide scrollbars where overflow is enabled */
.table-scroll::-webkit-scrollbar,
.modal.winners::-webkit-scrollbar {
  display: none;
}

.modal input[type="number"]::-webkit-inner-spin-button,
.modal input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.modal input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.context-menu {
  position: fixed;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  z-index: 60;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  overflow: hidden;
}

.context-menu .menu-item {
  background: transparent;
  border: none;
  color: #e2e8f0;
  text-align: left;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
}

.context-menu .menu-item:hover {
  background: #1e293b;
}

.primary {
  background: #0ea5e9;
  border: 1px solid #38bdf8;
  color: #0b1120;
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.25);
}

.ghost.sm,
.primary.sm {
  padding: 0.45rem 0.8rem;
  font-size: 0.95rem;
}

.meta dt {
  color: #94a3b8;
  margin: 0;
  font-size: 0.85rem;
}

.meta dd {
  margin: 0.2rem 0 0;
  font-weight: 700;
  color: #e2e8f0;
}

@media (max-width: 900px) {
  .controls.nav {
    display: none;
  }

  .nav-actions {
    display: flex;
    width: 100%;
    justify-content: flex-end;
  }

  .nav-group {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    flex-direction: column;
    align-items: stretch;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 0.75rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
    min-width: 260px;
    width: min(520px, calc(100vw - 1rem));
    max-height: calc(100vh - 6rem);
    overflow: auto;
    overflow-x: hidden;
    z-index: 5;
  }

  .nav-actions[data-open="true"] .nav-group {
    display: flex;
  }

  .nav-group .control {
    width: 100%;
  }

  .nav-group .ghost,
.nav-group .search,
.nav-group .checkbox-control {
    width: 100%;
  }

  .nav-group .search input {
    width: 100%;
  }

  .nav-group select {
    width: 100%;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .nav-left {
    flex: 1;
  }

  .nav-right {
    width: 100%;
    justify-content: flex-start;
  }
}

