:root {
  --bg: #080b12;
  --panel: rgba(17, 23, 37, 0.78);
  --panel-solid: #111725;
  --line: rgba(148, 163, 184, 0.16);
  --text: #e6edf7;
  --muted: #8fa0b8;
  --accent: #5eead4;
  --accent-2: #38bdf8;
  --warn: #fbbf24;
  --radius: 16px;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial,
    sans-serif;
}

body {
  position: relative;
  overflow-x: hidden;
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 15% -10%, rgba(56, 189, 248, 0.18), transparent 60%),
    radial-gradient(50rem 30rem at 95% 10%, rgba(94, 234, 212, 0.12), transparent 55%),
    linear-gradient(180deg, #080b12 0%, #0a0f1a 60%, #080b12 100%);
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, 92vw);
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.brand {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.mark {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #041016;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.25);
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.status {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
  padding-top: 0.5rem;
  min-height: 1.4rem;
}

.search-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.search-form {
  display: grid;
  gap: 1rem;
}

.search-field label,
.filters label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.input-wrap {
  position: relative;
}

input[type='search'],
select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(6, 10, 18, 0.7);
  color: var(--text);
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type='search']:focus,
select:focus {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.12);
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 0.8rem 1.25rem;
  font-weight: 650;
  font-size: 0.95rem;
  color: #041016;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.suggestions {
  position: absolute;
  z-index: 20;
  inset-inline: 0;
  top: calc(100% + 6px);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.suggestion {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.suggestion:hover,
.suggestion.active {
  background: rgba(94, 234, 212, 0.08);
}

.suggestion small {
  color: var(--muted);
}

.results {
  margin-top: 1.5rem;
  display: grid;
  gap: 1rem;
}

.group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}

.group-title {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.group-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.8rem;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  background: rgba(148, 163, 184, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
}

.badge.match {
  border-color: rgba(94, 234, 212, 0.4);
  color: var(--accent);
}

.airings {
  display: grid;
}

.airing {
  display: grid;
  grid-template-columns: 44px minmax(0, 1.4fr) minmax(150px, 0.9fr) auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.8rem 1.15rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.airing:last-child {
  border-bottom: 0;
}

.airing:hover {
  background: rgba(148, 163, 184, 0.04);
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.92);
  padding: 3px;
}

.logo-fallback {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(94, 234, 212, 0.18));
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
}

.channel-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-sub {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.time {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}

.time small {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  margin-top: 0.15rem;
}

.now {
  color: var(--accent);
  font-weight: 600;
}

.empty,
.error,
.loading {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--muted);
  background: rgba(17, 23, 37, 0.45);
}

.error {
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.footer a {
  color: var(--accent-2);
  text-decoration: none;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent-2);
  font: inherit;
  font-size: inherit;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(4, 8, 14, 0.82);
  backdrop-filter: blur(8px);
}

.gate[hidden] {
  display: none;
}

.gate-card {
  width: min(420px, 92vw);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.gate-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
}

.gate-card p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.gate-card input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(6, 10, 18, 0.7);
  color: var(--text);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  font-size: 0.95rem;
  outline: none;
}

.gate-card input:focus {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.12);
}

.gate-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.9rem;
}

.key-error {
  min-height: 1.2em;
  margin: 0.7rem 0 0 !important;
  color: #fca5a5 !important;
  font-size: 0.82rem !important;
}

.show-more {
  background: transparent;
  color: var(--accent-2);
  padding: 0.7rem 1.15rem;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 600;
}

.more-wrap {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 1.5rem;
}

.more-wrap button {
  background: rgba(94, 234, 212, 0.12);
  border: 1px solid rgba(94, 234, 212, 0.35);
  color: var(--accent);
  box-shadow: none;
}

@media (max-width: 780px) {
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .airing {
    grid-template-columns: 40px minmax(0, 1fr);
  }
  .airing .time {
    grid-column: 2;
  }
  .group-head {
    flex-direction: column;
    gap: 0.4rem;
  }
  .hero {
    flex-direction: column;
  }
  .status {
    text-align: left;
    padding-top: 0;
  }
}
