:root {
  color-scheme: light;
  --purple: #560064;
  --purple-hover: #6b0876;
  --page-bg: #f7f3f7;
  --row-bg: #ffffff;
  --session-bg: #cbb7cc;
  --break-bg: #eee8ee;
  --tab-bg: #f5f0f5;
  --grid: #d9ced9;
  --text: #171717;
  --tabs-height: 36px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; min-height: 100%; margin: 0; }
html { background: var(--page-bg); }
body {
  background: var(--page-bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}
body.viewer-mode { overflow: hidden; }
button, a { font: inherit; }

.programme-app {
  width: 100%;
  min-height: 100dvh;
  padding: 0 2px 8px;
}

/* Compact day switcher, directly attached to the programme header. */
.day-tabs {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  height: var(--tabs-height);
  padding: 0;
  background: var(--page-bg);
}
.day-tab {
  min-width: 0;
  height: 100%;
  border: 1px solid #cbb6cc;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  background: var(--tab-bg);
  color: #111;
  padding: 2px 4px 1px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
.day-tab-main,
.day-tab-sub {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.day-tab-main { font-size: 10.5px; }
.day-tab-sub { margin-top: 1px; font-size: 8.8px; }
.day-tab[aria-selected="true"] {
  border-top: 3px solid var(--purple);
  background: var(--session-bg);
  padding-top: 0;
}
.day-tab:active { background: #ded1df; }

.programme-table-wrap {
  width: 100%;
  margin: 0;
  overflow-x: hidden;
}
.programme-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
  border: 1px solid var(--grid);
}

/* Match the live Scientific Programme structure: Time | Type | Session & speaker | Country | Title. */
.col-time { width: 68px; }
.col-type { width: 62px; }
.col-speaker { width: 215px; }
.col-country { width: 72px; }
.col-title { width: auto; }

.programme-table th,
.programme-table td {
  border: 1px solid var(--grid);
  vertical-align: top;
}
.programme-table thead th {
  position: sticky;
  top: var(--tabs-height);
  z-index: 30;
  height: 24px;
  padding: 4px 4px 3px;
  overflow: hidden;
  background: var(--purple);
  color: white;
  text-align: left;
  font-size: 10.5px;
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
}
.programme-table thead th:nth-child(1),
.programme-table thead th:nth-child(2),
.programme-table thead th:nth-child(4) {
  text-align: center;
}

.programme-table tbody td {
  padding: 3px 4px;
  background: var(--row-bg);
  font-size: 10.6px;
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.programme-table tbody td.time-cell,
.programme-table tbody td.country-cell,
.programme-table tbody td.type-cell {
  text-align: center;
  white-space: nowrap;
  overflow-wrap: normal;
}
.programme-table tbody td.speaker-cell { font-weight: 500; }
.programme-table tbody td.country-cell,
.programme-table tbody td.type-cell { font-size: 10px; }
.programme-table tbody td.type-cell { font-weight: 700; }

/* Session bands intentionally mirror the live programme: time, blank type,
   Session N under Session & speaker, blank country, session title under Title. */
.session-row td {
  padding-top: 4px !important;
  padding-bottom: 4px !important;
  background: var(--session-bg) !important;
  color: #111;
  font-weight: 700;
  vertical-align: middle;
}
.session-row .session-label-cell,
.session-row .session-title-cell { font-size: 10.8px; }

.break-row td {
  padding-top: 4px !important;
  padding-bottom: 4px !important;
  background: var(--break-bg) !important;
  font-weight: 700;
  vertical-align: middle;
}
.break-row.is-close td { background: var(--session-bg) !important; }

/* Abstract-bearing programme rows are tappable. */
.programme-item.has-abstract { cursor: pointer; }
.programme-item.has-abstract:hover td,
.programme-item.has-abstract:focus-within td,
.programme-item.has-abstract:active td { background: #f7eef8; }
.programme-item .title-cell a {
  display: block;
  color: inherit;
  text-decoration: none;
}
.programme-item.has-abstract .title-cell a::after {
  content: "  ›";
  color: var(--purple);
  font-weight: 700;
}
.programme-item a:focus-visible,
.day-tab:focus-visible,
.abstract-nav-button:focus-visible,
.abstract-focus-hint:focus-visible,
.abstract-focus-overlay:focus-visible {
  outline: 2px solid #2f66cc;
  outline-offset: -2px;
}

.programme-error {
  margin: 12px;
  padding: 16px;
  border: 1px solid #d6c7d7;
  background: white;
  color: #333;
  text-align: center;
  font-size: 14px;
}

/* Abstract viewer. */
.abstract-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 58px;
  background: var(--page-bg);
  overflow: hidden;
}
.abstract-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: max(14px, env(safe-area-inset-top)) 12px 14px;
}
.abstract-card {
  width: min(760px, 100%);
  min-height: min(72dvh, 560px);
  margin: 0 auto;
  padding: 18px 16px;
  background: #fff;
  border: 1px solid var(--grid);
  box-shadow: 0 2px 12px rgba(50, 20, 55, .08);
}
.abstract-meta {
  color: var(--purple);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 700;
}
.abstract-title {
  margin: 8px 0 7px;
  color: #111;
  font-size: 20px;
  line-height: 1.18;
}
.abstract-speaker {
  margin: 0;
  color: #444;
  font-size: 14px;
  line-height: 1.3;
}
.abstract-content-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 220px;
  margin-top: 24px;
  overflow: hidden;
  background: #f1eef1;
  border: 1px solid var(--grid);
}
.abstract-pending {
  display: grid;
  gap: 5px;
  place-items: center;
  min-height: 220px;
  margin: 0;
  padding: 24px 14px;
  border: 1px dashed #cbb6cc;
  background: #faf7fa;
  color: #555;
  text-align: center;
}
.abstract-pending strong {
  color: var(--purple);
  font-size: 19px;
}
.abstract-pending span { font-size: 13px; }
.abstract-pdf {
  position: relative;
  width: 100%;
  height: 100%;
  background: #e7e2e7;
}
.abstract-preview {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 6px;
}
.abstract-pages {
  width: 100%;
  min-height: 100%;
  padding: 8px;
}
.abstract-page-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  margin: 0 auto 10px;
}
.abstract-page-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: white;
  box-shadow: 0 1px 8px rgba(0,0,0,.18);
}
.abstract-page-count {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(0,0,0,.72);
  color: white;
  font-size: 10px;
  font-weight: 700;
  pointer-events: none;
}
.abstract-rotate {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: 10px;
  z-index: 125;
  border: 0;
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(0,0,0,.76);
  color: white;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}

/* Transparent tap target over the abstract in normal view. In full-screen
   mode it is removed so the real abstract can scroll / be interacted with. */
.abstract-focus-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: zoom-in;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.abstract-focus-hint {
  position: fixed;
  left: 50%;
  bottom: calc(68px + env(safe-area-inset-bottom));
  z-index: 120;
  transform: translateX(-50%);
  max-width: min(90vw, 520px);
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(0, 0, 0, .76);
  color: white;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  cursor: pointer;
  touch-action: manipulation;
}

.abstract-nav {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  width: 100%;
  min-height: 58px;
  padding-bottom: env(safe-area-inset-bottom);
  background: white;
  border-top: 1px solid #d1c4d1;
}
.abstract-nav-button {
  min-width: 0;
  min-height: 54px;
  border: 0;
  border-right: 1px solid #d1c4d1;
  padding: 5px 4px;
  background: white;
  color: #222;
  font-size: 13px;
  line-height: 1.05;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.abstract-nav-button:last-child { border-right: 0; }
.abstract-nav-button:active { background: #eee8ee; }
.abstract-nav-back {
  background: var(--purple);
  color: white;
}
.abstract-nav-back:active { background: var(--purple-hover); }
.abstract-nav-button:disabled {
  color: #aaa2aa;
  background: #f1eef1;
  cursor: default;
}

/* Full-screen / clean abstract view, modelled on the poster kiosk photo mode. */
.abstract-viewer.focus-mode {
  grid-template-rows: minmax(0, 1fr);
  background: #fff;
}
.abstract-viewer.focus-mode .abstract-nav { display: none; }
.abstract-viewer.focus-mode .abstract-stage {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  background: #1f1f1f;
}
.abstract-viewer.focus-mode .abstract-card {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: #1f1f1f;
}
.abstract-viewer.focus-mode .abstract-header { display: none; }
.abstract-viewer.focus-mode .abstract-content-shell {
  width: 100%;
  height: auto;
  min-height: 100%;
  aspect-ratio: auto;
  margin: 0;
  border: 0;
  overflow: visible;
  background: #1f1f1f;
}
.abstract-viewer.focus-mode .abstract-pending {
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: 0;
}
.abstract-viewer.focus-mode .abstract-pdf {
  width: 100%;
  height: auto;
  min-height: 100%;
  background: #1f1f1f;
}
.abstract-viewer.focus-mode .abstract-preview { display: none; }
.abstract-viewer.focus-mode .abstract-pages {
  display: block;
  min-height: 100%;
  padding: 8px;
}
.abstract-viewer.focus-mode .abstract-page-wrap { margin-bottom: 8px; }
.abstract-viewer.focus-mode .abstract-focus-overlay { display: none; }
.abstract-viewer.focus-mode .abstract-focus-hint {
  bottom: max(10px, env(safe-area-inset-bottom));
  max-width: min(88vw, 420px);
  padding: 7px 12px;
  font-size: 11px;
}
.abstract-viewer.focus-mode .abstract-rotate { display: block; }

/* Phone-first: keep the live-programme column structure visible without horizontal scrolling. */
@media (max-width: 620px) {
  :root { --tabs-height: 32px; }
  .programme-app { padding-left: 0; padding-right: 0; }
  .day-tab { border-radius: 4px 4px 0 0; padding-left: 2px; padding-right: 2px; }
  .day-tab-main { font-size: 9.2px; }
  .day-tab-sub { font-size: 7.8px; }

  .col-time { width: 12%; }
  .col-type { width: 9%; }
  .col-speaker { width: 25%; }
  .col-country { width: 11%; }
  .col-title { width: 43%; }

  /* iOS/mobile Safari can mis-position sticky table cells beneath another
     sticky element. Keep the day tabs sticky, but leave the purple column
     header in the normal table flow on phones so it never overlaps the
     session row above or the first presentation row below. */
  .programme-table thead th {
    position: static;
    top: auto;
    z-index: auto;
    height: 21px;
    padding: 3px 1px 2px;
    font-size: 7.5px;
    letter-spacing: -0.08px;
    text-overflow: clip;
  }
  .programme-table tbody td {
    padding: 2px 2px;
    font-size: 8.5px;
    line-height: 1.07;
  }
  .programme-table tbody td.country-cell,
  .programme-table tbody td.type-cell { font-size: 7.9px; }
  .session-row td,
  .break-row td {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
  }
  .session-row .session-label-cell,
  .session-row .session-title-cell { font-size: 8.7px; }

  .abstract-stage { padding: max(8px, env(safe-area-inset-top)) 7px 8px; }
  .abstract-card {
    min-height: calc(100dvh - 82px - env(safe-area-inset-bottom));
    padding: 14px 12px;
  }
  .abstract-meta { font-size: 10px; }
  .abstract-title { font-size: 16px; }
  .abstract-speaker { font-size: 12px; }
  .abstract-content-shell { min-height: 180px; margin-top: 18px; }
  .abstract-pending { min-height: 180px; }
  .abstract-pending strong { font-size: 17px; }
  .abstract-nav-button { font-size: 11px; }
  .abstract-focus-hint { font-size: 10.5px; padding: 7px 11px; }
}

@media (max-width: 300px) {
  :root { --tabs-height: 30px; }
  .day-tab-main { font-size: 8px; }
  .day-tab-sub { font-size: 6.9px; }
  .programme-table thead th { font-size: 6.6px; padding-left: 0; padding-right: 0; }
  .programme-table tbody td { font-size: 7.6px; padding-left: 1px; padding-right: 1px; }
  .programme-table tbody td.country-cell,
  .programme-table tbody td.type-cell { font-size: 7px; }
  .session-row .session-label-cell,
  .session-row .session-title-cell { font-size: 7.8px; }
}

@media (min-width: 900px) {
  :root { --tabs-height: 40px; }
  .programme-app { padding-left: 8px; padding-right: 8px; }
  .day-tab-main { font-size: 11.5px; }
  .day-tab-sub { font-size: 9.5px; }
  .programme-table thead th { font-size: 11px; }
  .programme-table tbody td { font-size: 10.9px; }
  .abstract-nav-button { font-size: 15px; }
}
