:root {
  color-scheme: dark;
  --cyan: #71e7f4;
  --muted: #a4b1c8;
  font-family: Rajdhani, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  color: #eef4ff;
  background:
    radial-gradient(ellipse at top left, #222345, transparent 65%), #090d1b;
}
a {
  color: var(--cyan);
  text-decoration: none;
}
button,
select {
  font-family: inherit;
}
button {
  cursor: pointer;
}
.clash-masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 52px;
  padding: 8px 24px;
  border-bottom: 1px solid #ffffff16;
}
.clash-masthead img {
  width: 95px;
  height: 36px;
  object-fit: contain;
  display: block;
}
.clash-masthead > span {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--muted);
}
.clash-masthead > a:last-child {
  font-size: 0.85rem;
}
main {
  width: 100%;
  max-width: 1800px;
  margin: auto;
  padding: 14px 24px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.compact-title {
  font:
    700 clamp(1rem, 2vw, 1.6rem) Orbitron,
    sans-serif;
  margin: 0 0 12px;
}
.compact-title span {
  color: var(--cyan);
}
.clash-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.clash-tabs {
  display: flex;
  gap: 8px;
}
.clash-tabs button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid #34415c;
  border-radius: 5px;
  background: #11192a;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}
.clash-tabs span {
  font-size: 0.75rem;
  font-weight: 500;
}
.clash-tabs button[aria-pressed="true"] {
  color: var(--cyan);
  background: #16303d;
  border-color: #71e7f488;
}
.clash-toolbar label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  min-width: 0;
}
select {
  width: 290px;
  max-width: 100%;
  min-height: 42px;
  border: 1px solid #3b4c69;
  border-radius: 5px;
  padding: 8px;
  background: #11192b;
  color: #edf4ff;
  font-size: 0.95rem;
  text-overflow: ellipsis;
}
#clash-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.compact-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.72rem;
  color: var(--muted);
}
.compact-meta > span:first-child {
  color: var(--cyan);
  font-weight: 700;
}
.period-scroll {
  flex: 1;
  min-height: 0;
  border: 1px solid #35435f;
  border-radius: 6px;
  overflow: hidden;
  background: #0d1526;
}
.period-table {
  width: 100%;
  height: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.period-table th,
.period-table td {
  border: 1px solid #ffffff10;
  padding: 0;
}
.period-table thead {
  height: 28px;
}
.period-table thead th {
  font-size: 0.75rem;
  font-weight: 600;
  color: #b7c6df;
  background: #172139;
}
.period-table th:first-child {
  width: 100px;
  font-size: 0.7rem;
  color: var(--cyan);
  background: #111c30;
  padding: 4px;
}
.period-table thead small {
  font-size: 0.58rem;
  margin-left: 1px;
  color: #8498ba;
}
.period-table tbody tr {
  height: 16.66%;
}
.period-table td {
  position: relative;
}
.department-bands {
  position: absolute;
  inset: 4px 0;
  display: grid;
  grid-template-columns: repeat(var(--period-count, 20), minmax(0, 1fr));
  gap: 4px 0;
  background-image: linear-gradient(to right, #ffffff0b 1px, transparent 1px);
  background-size: calc(100% / var(--period-count, 20)) 100%;
}
.period-event {
  min-width: 0;
  min-height: 0;
  margin: 0 2px;
  padding: 3px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-align: left;
  border: 1px solid #71e7f455;
  border-radius: 4px;
  background: linear-gradient(110deg, #285365, #173044);
  color: #edf9ff;
}
.band-number {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--cyan);
}
.band-name {
  font-size: clamp(0.55rem, 0.8vw, 0.8rem);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.start-only {
  border-style: dashed;
  justify-content: center;
  padding: 2px;
  background: #183143;
}
.start-only .band-name {
  display: none;
}
.is-proposed {
  border-color: #d9b56d;
  background: linear-gradient(110deg, #55442d, #352a32);
}
.is-proposed .band-number {
  color: #f7cf89;
}
.is-dimmed {
  opacity: 0.22;
}
.is-selected {
  outline: 2px solid #fff;
  outline-offset: -2px;
}
.band-empty {
  grid-column: 1 / -1;
  align-self: center;
  text-align: center;
  color: #55647d;
  font-size: 0.7rem;
}
.compact-pending {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 26px;
  font-size: 0.65rem;
  color: var(--muted);
}
.compact-pending > span {
  white-space: nowrap;
}
.compact-pending button {
  padding: 4px 8px;
  background: #151f32;
  border: 1px dashed #5f6e87;
  color: #c8d6ee;
  border-radius: 4px;
  font-size: 0.7rem;
}
.selection-info {
  flex: 0 0 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #334159;
  border-radius: 6px;
  background: #10192b;
}
.selection-info > div:first-child {
  min-width: 0;
}
.selection-info h2 {
  font-size: 0.95rem;
  line-height: 1.2;
  margin: 0 0 5px;
}
.selection-info p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}
.selection-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
}
.selection-actions button {
  border: 1px solid #59718f;
  border-radius: 4px;
  padding: 7px 10px;
  background: #192b43;
  color: #c9ecf4;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
dialog {
  max-width: 620px;
  width: calc(100% - 32px);
  max-height: 80dvh;
  overflow: auto;
  border: 1px solid #526784;
  border-radius: 8px;
  color: #eef4ff;
  background: #111b2e;
  padding: 20px;
}
dialog::backdrop {
  background: #030612c9;
}
dialog header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}
dialog h2 {
  font-size: 1.1rem;
  margin: 0;
}
dialog button {
  min-width: 40px;
  min-height: 40px;
  background: #1b2b43;
  border: 1px solid #516681;
  color: white;
  border-radius: 4px;
}
dialog > p,
dialog small {
  color: var(--muted);
}
dialog article {
  border-top: 1px solid #ffffff20;
  padding: 12px 0;
}
dialog article > span {
  color: var(--cyan);
  font-size: 0.65rem;
}
dialog article p {
  margin: 6px 0;
  font-weight: 700;
}
button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid #b69aff;
  outline-offset: 1px;
}
@media (max-width: 800px) {
  .clash-tabs span {
    display: none;
  }
  .clash-toolbar label {
    font-size: 0;
  }
  .compact-legend {
    font-size: 0.6rem;
  }
  .compact-pending button span {
    display: none;
  }
}
@media (max-width: 600px) {
  .clash-masthead {
    flex-basis: 42px;
    padding: 5px 10px;
  }
  .clash-masthead img {
    width: 78px;
    height: 30px;
  }
  .clash-masthead > span {
    display: none;
  }
  .clash-masthead > a:last-child {
    font-size: 0.75rem;
  }
  main {
    padding: 10px 8px;
  }
  .compact-title {
    font-size: 0.95rem;
    margin-bottom: 9px;
  }
  .clash-toolbar {
    gap: 6px;
    margin-bottom: 8px;
  }
  .clash-tabs {
    gap: 4px;
  }
  .clash-tabs button {
    padding: 8px;
    min-height: 44px;
    font-size: 0.7rem;
  }
  .clash-toolbar label {
    flex: 1;
  }
  select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 4px;
    font-size: 16px;
  }
  #clash-content {
    gap: 6px;
  }
  .compact-meta {
    flex-direction: column;
    gap: 3px;
    font-size: 0.6rem;
  }
  .compact-legend {
    font-size: 0.55rem;
  }
  .period-table th:first-child {
    width: 57px;
    font-size: 0.5rem;
  }
  .period-table thead th {
    font-size: 0.55rem;
  }
  .period-table thead small {
    font-size: 0.45rem;
  }
  .half-hour {
    display: none;
  }
  .period-table thead {
    height: 24px;
  }
  .department-bands {
    inset: 3px 0;
    gap: 3px 0;
  }
  .period-event {
    gap: 2px;
    margin: 0 1px;
    padding: 2px;
    border-radius: 2px;
  }
  .band-number {
    font-size: 0.55rem;
  }
  .band-name {
    display: block;
  }
  .selection-info {
    flex-basis: 92px;
    padding: 8px;
    gap: 6px;
  }
  .selection-info h2 {
    font-size: 0.78rem;
  }
  .selection-info p {
    font-size: 0.65rem;
  }
  .selection-actions {
    font-size: 0.65rem;
  }
  .selection-actions button {
    padding: 8px;
    min-height: 36px;
    font-size: 0.65rem;
  }
  .compact-pending {
    min-height: 24px;
    gap: 5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}

/* Labels stay inside each continuous event band on every screen. */
.period-event {
  justify-content: center;
  padding: 3px;
}
.band-name {
  display: block;
  white-space: normal;
  text-overflow: clip;
  text-align: center;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.estimated-duration {
  border-style: dashed;
}
.compact-pending button {
  min-width: 0;
  font-size: 0.65rem;
}
@media (max-width: 600px) {
  .band-name {
    display: block;
    font-size: clamp(6.5px, 1.8vw, 9px);
    font-weight: 700;
  }
  .compact-pending {
    gap: 4px;
  }
  .compact-pending > span {
    font-size: 0.5rem;
  }
  .compact-pending button {
    padding: 3px;
    font-size: 0.55rem;
  }
}
.axis-time {
  display: block;
  font-size: clamp(8px, .85vw, 12px);
  white-space: nowrap;
}
.period-table thead {
  height: 34px;
}
@media (max-width: 800px) {
  .period-table thead {
    height: 64px;
  }
  .axis-time {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin: auto;
    font-size: 8px;
    letter-spacing: .02em;
  }
}
.period-event {
  flex-direction: column;
  gap: 2px;
}
.band-venue {
  display: block;
  width: 100%;
  min-height: 0;
  font-size: clamp(7px, .7vw, 10px);
  font-weight: 500;
  line-height: 1.15;
  color: #c2d4df;
  white-space: normal;
  overflow-wrap: anywhere;
}
.pending-venue {
  display: block;
  font-size: .85em;
  color: var(--muted);
}
@media (max-width: 600px) {
  .band-venue {
    font-size: clamp(5.5px, 1.5vw, 7px);
    line-height: 1.05;
  }
  .period-event {
    gap: 1px;
  }
  .compact-pending button .pending-venue {
    display: block;
  }
}

/* Phone layouts use the active 9 AM–5 PM window and larger text. */
@media (max-width: 600px) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  main {
    padding: 8px 6px;
  }
  .clash-masthead {
    flex-basis: 38px;
    padding: 4px 10px;
  }
  .clash-masthead img {
    height: 28px;
  }
  .compact-title {
    font-size: .85rem;
    margin-bottom: 8px;
  }
  .clash-toolbar {
    gap: 8px;
  }
  .clash-tabs button {
    min-width: 48px;
    padding: 8px 6px;
  }
  .clash-toolbar label {
    min-width: 0;
  }
  select {
    border-color: #526684;
    padding-right: 20px;
  }
  .period-table th:first-child {
    width: 51px;
    font-size: 8px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }
  .period-table thead {
    height: 56px;
  }
  .axis-time {
    font-size: 8.5px;
    font-weight: 700;
  }
  .period-event {
    margin: 0 1px;
    padding: 1px 2px;
    gap: 2px;
  }
  .band-name {
    font-size: clamp(7px, 2vw, 9px);
    line-height: 1.1;
    color: #fff;
  }
  .band-venue {
    font-size: clamp(6px, 1.7vw, 8px);
    color: #deebf5;
    line-height: 1.1;
  }
  .selection-info {
    flex-basis: 86px;
  }
  .selection-info h2 {
    font-size: .8rem;
  }
  .selection-info p {
    font-size: .7rem;
  }
  .selection-actions button {
    min-height: 42px;
  }
  .compact-pending button {
    font-size: .6rem;
    padding: 4px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .clash-masthead,
  .compact-title {
    display: none;
  }
  main {
    padding: 6px 10px;
  }
  .clash-toolbar {
    margin-bottom: 5px;
  }
  .clash-tabs button,
  select {
    min-height: 34px;
    padding-top: 4px;
    padding-bottom: 4px;
  }
  .compact-meta {
    font-size: 9px;
  }
  .period-table thead {
    height: 24px;
  }
  .axis-time {
    writing-mode: horizontal-tb;
    transform: none;
    font-size: 8px;
  }
  .selection-info {
    flex-basis: 52px;
    padding: 5px 8px;
  }
  .selection-info h2 {
    font-size: .75rem;
  }
  .selection-info p {
    font-size: .65rem;
  }
  .band-name {
    font-size: 8px;
  }
  .band-venue {
    font-size: 7px;
  }
}
.band-venue {
  text-align: center;
}
@media (max-width: 800px) and (max-height: 650px) {
  .period-event {
    padding: 0 2px;
    gap: 0;
  }
  .band-name {
    font-size: 6.5px;
    line-height: 1;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 100%;
  }
  .band-venue {
    font-size: 5.5px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .selection-info {
    flex-basis: 64px;
    padding: 5px 8px;
  }
  .selection-info h2 {
    font-size: .72rem;
  }
  .selection-info p {
    font-size: .62rem;
  }
}

/* Give laptop bands readable names and room labels within the screen. */
@media (min-width: 801px) {
  .band-name {
    font-size: clamp(14px, 1.15vw, 18px);
    line-height: 1.1;
  }
  .band-venue {
    font-size: clamp(11px, .95vw, 14px);
    line-height: 1.1;
    color: #deebf5;
  }
  .period-table th:first-child {
    width: 112px;
    font-size: 13px;
  }
  .axis-time {
    font-size: 12px;
  }
}
