:root {
  color-scheme: light;
  --ink: #152033;
  --muted: #607086;
  --line: #d9e2ec;
  --soft: #f5f8fb;
  --panel: #ffffff;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --mark: #fff1a6;
  --shadow: 0 18px 45px rgba(17, 31, 54, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #eef3f8;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
  display: grid;
  grid-template-columns: 370px 1fr;
  gap: 20px;
}

/* Explicit display values above would defeat the hidden attribute. */
.app-shell[hidden],
.landing[hidden] {
  display: none;
}

/* Landing page */
.landing {
  min-height: 100vh;
  display: grid;
  align-content: start;
}

.landing-inner {
  width: min(1020px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0 56px;
  text-align: center;
}

.landing h1 {
  font-size: clamp(3rem, 8vw, 5.2rem);
}

.landing-where {
  margin: 18px 0 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.landing-blurb {
  margin: 12px auto 0;
  max-width: 640px;
  color: var(--muted);
  line-height: 1.6;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}

.landing-actions button,
.landing-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}

#enter-explorer {
  color: white;
  background: var(--accent);
}

#enter-explorer:hover {
  background: var(--accent-dark);
}

.landing-actions .secondary {
  color: var(--accent-dark);
  background: #dfefff;
}

.landing-actions .secondary:hover {
  background: #cde3ff;
}

.landing-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 40px;
}

.stat-tile {
  padding: 18px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-tile .stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-tile .stat-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.landing-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  text-align: left;
}

.landing-card {
  padding: 22px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.landing-card h2 {
  margin: 0 0 14px;
  font-size: 1.15rem;
}

.track-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 2fr;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 0.92rem;
  font-weight: 700;
}

.track-row .track-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.track-row .track-fill {
  height: 14px;
  min-width: 2px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.track-row .track-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.landing-card-second {
  margin-top: 22px !important;
  padding-top: 18px;
  border-top: 1px solid var(--soft);
}

.landing-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.landing-keywords a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  background: #dfefff;
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
}

.landing-keywords a:hover {
  background: #cde3ff;
}

.landing-keywords a span {
  color: var(--muted);
  font-weight: 700;
}

.landing-keyword-bars {
  margin-top: 16px;
}

.schedule-item {
  display: grid;
  gap: 2px;
  padding: 9px 0;
  border-top: 1px solid var(--soft);
  font-size: 0.94rem;
  line-height: 1.45;
}

.schedule-item:first-of-type {
  border-top: 0;
}

.schedule-item .when {
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 0.85rem;
}

.landing-card-wide {
  margin-top: 16px;
  text-align: left;
}

.landing-card-note {
  margin: -6px 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.landing-day {
  border-top: 1px solid var(--soft);
}

.landing-day:first-of-type {
  border-top: 0;
}

.landing-day summary {
  padding: 11px 2px;
  cursor: pointer;
  font-weight: 800;
}

.landing-day summary:hover {
  color: var(--accent-dark);
}

.landing-day-table {
  width: 100%;
  margin: 2px 0 12px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.landing-day-table td {
  padding: 6px 10px 6px 2px;
  border-top: 1px solid var(--soft);
  vertical-align: top;
  line-height: 1.4;
}

.landing-day-table td.when {
  width: 175px;
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 0.84rem;
  white-space: nowrap;
}

.landing-day-table .loc,
.landing-day-table td.place {
  color: #15803d;
  font-weight: 800;
}

.landing-day-table td.place {
  width: 110px;
  white-space: nowrap;
  text-align: right;
}

.pill-room {
  color: #14532d;
  background: #dcfce7;
  border-color: #bbf7d0;
  font-weight: 800;
}

.pill-session {
  color: #1e40af;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.pill-live {
  color: #7f1d1d;
  background: #fee2e2;
  border-color: #fecaca;
  font-weight: 800;
}

@media (max-width: 760px) {
  .landing-columns {
    grid-template-columns: 1fr;
  }

  .landing-day-table td.when {
    width: auto;
    white-space: normal;
  }
}

.search-panel,
.answer-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* The sidebar scrolls with the page as one flow: it is usually shorter than
   the results, so it scrolls off first and the content continues. */
.search-panel {
  align-self: start;
  padding: 28px;
}

.answer-panel {
  min-height: calc(100vh - 80px);
  padding: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  line-height: 1;
}

.subtitle {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.search-form {
  margin-top: 28px;
}

.search-form label,
.filters label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.search-row {
  display: flex;
  gap: 8px;
}

.search-row input,
.filters select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 13px;
  color: var(--ink);
  outline: none;
}

.search-row input:focus,
.filters select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.filters select:disabled {
  background: var(--soft);
  color: var(--muted);
  cursor: not-allowed;
}

.search-row button,
.quick-filters button,
.action-grid button,
.save-button,
.link-button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.search-row button {
  flex: 0 0 auto;
  padding: 0 16px;
  color: white;
  background: var(--accent);
  font-weight: 800;
}

.search-row button:hover {
  background: var(--accent-dark);
}

.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.quick-filters button,
.hot-keywords-list button,
.save-button,
.link-button {
  padding: 8px 10px;
  color: var(--accent-dark);
  background: #dfefff;
  font-weight: 800;
}

.hot-keywords {
  margin-top: 18px;
}

.hot-keywords-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.hot-keywords-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 164px;
  overflow: auto;
  padding-right: 4px;
}

.hot-keywords-list button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
}

.hot-keywords-list span {
  color: var(--muted);
  font-weight: 700;
}

.empty-keywords {
  color: var(--muted);
  font-size: 0.9rem;
}

.filters {
  display: grid;
  gap: 8px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.filters label:not(:first-child) {
  margin-top: 8px;
}

.action-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.action-grid button,
.nav-button {
  min-height: 44px;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: white;
  background: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.nav-button:hover {
  background: var(--accent-dark);
}

#clear-button,
#now-button,
#cloud-button,
#about-button {
  color: var(--accent-dark);
  background: #dfefff;
}

#clear-button:hover,
#now-button:hover,
#cloud-button:hover,
#about-button:hover {
  background: #cde3ff;
}

#saved-button {
  color: #7a4c00;
  background: #ffe8ae;
}

#saved-button:hover {
  background: #ffd978;
}

.status {
  color: var(--muted);
  font-weight: 700;
}

.answer {
  margin: 0 0 22px;
  padding: 18px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.55;
}

.answer:empty {
  display: none;
}

.results {
  display: grid;
  gap: 12px;
}

.paper-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.paper-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.paper-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
  line-height: 1.35;
}

.save-button.saved {
  color: #7a4c00;
  background: #ffe8ae;
}

.meta,
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* Section badges */
.badge-paper {
  color: #1e3a8a;
  background: #dbeafe;
  border-color: #bfdbfe;
  font-weight: 800;
}

.badge-workshop {
  color: #5b21b6;
  background: #ede9fe;
  border-color: #ddd6fe;
  font-weight: 800;
}

.badge-tutorial {
  color: #9a3412;
  background: #ffedd5;
  border-color: #fed7aa;
  font-weight: 800;
}

.badge-special-day {
  color: #14532d;
  background: #dcfce7;
  border-color: #bbf7d0;
  font-weight: 800;
}

.badge-keynote {
  color: #7f1d1d;
  background: #fee2e2;
  border-color: #fecaca;
  font-weight: 800;
}

/* Paper track badges */
.badge-rtp {
  color: #1e40af;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.badge-ads {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.badge-dtb {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

.badge-ais {
  color: #6d28d9;
  background: #f5f3ff;
  border-color: #ddd6fe;
}

.badge-bsi {
  color: #9f1239;
  background: #fff1f2;
  border-color: #fecdd3;
}

.authors {
  margin-top: 10px;
  line-height: 1.45;
  color: var(--ink);
  font-weight: 700;
}

.institutions {
  margin-top: 8px;
  line-height: 1.45;
  color: var(--muted);
  font-size: 0.92rem;
}

.links {
  margin-top: 12px;
}

/* Keyword cloud */
.cloud-area {
  margin: 0 0 20px;
}

.cloud-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.cloud-crumb-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.cloud-crumb {
  border: 1px solid #b9cdf3;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--accent-dark);
  padding: 6px 12px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}

.cloud-crumb:hover {
  background: #dbe8ff;
}

.cloud-crumb.reset {
  border-color: var(--line);
  background: var(--soft);
  color: var(--muted);
}

/* Rotating keyword sphere. Words are positioned each animation frame by
   JS; vertical touch gestures still scroll the page, horizontal ones spin. */
.cloud {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
  margin: 4px 0 8px;
}

.cloud.dragging {
  cursor: grabbing;
}

.cloud-word {
  position: absolute;
  left: 0;
  top: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  padding: 2px 6px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  will-change: transform, opacity;
}

.cloud-word:hover,
.cloud-word:focus-visible {
  background: #eef4ff;
  outline: none;
  opacity: 1 !important;
}

.cloud-count {
  margin-left: 5px;
  color: var(--muted);
  font-size: 0.68em;
  font-weight: 700;
}

.cloud-hint {
  margin: -2px 0 14px;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.cloud-sort {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 2px 0 16px;
}

.cloud-sort-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.cloud-sort-buttons {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.sort-chip {
  border: 0;
  padding: 8px 12px;
  background: white;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.sort-chip + .sort-chip {
  border-left: 1px solid var(--line);
}

.sort-chip.active {
  background: var(--accent);
  color: white;
}

.related-details {
  margin-top: 12px;
}

.related-details summary {
  width: fit-content;
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 0.92rem;
}

.related-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.related-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  padding: 8px 10px;
  text-align: left;
  font-size: 0.9rem;
  cursor: pointer;
}

.related-item:hover,
.related-item:focus-visible {
  background: #e8f0fa;
  outline: none;
}

.related-item .pill {
  flex: 0 0 auto;
  background: white;
}

.related-item .related-title {
  min-width: 0;
  line-height: 1.35;
}

.link-button {
  text-decoration: none;
}

mark {
  background: var(--mark);
  border-radius: 3px;
  padding: 0 2px;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 18px 0;
  }

  .search-panel {
    position: static;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
  }

  .search-panel,
  .answer-panel {
    padding: 18px;
  }

  .search-row,
  .paper-header {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .search-row button,
  .save-button {
    min-height: 44px;
    width: 100%;
  }
}
