:root {
  --berkeley-blue: #003262;
  --california-gold: #FDB515;
  --bg: #f5f6f8;
  --card-bg: #ffffff;
  --border: #e1e4e9;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --now-color: #c0392b;
  --now-bg: #fdecea;
  --soon-color: #a56b00;
  --soon-bg: #fff6e0;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.site-header {
  background: var(--berkeley-blue);
  color: white;
  padding: 20px 24px 0;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 18px;
}

.title-block h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.term-label {
  margin: 0;
  color: var(--california-gold);
  font-size: 0.95rem;
  font-weight: 600;
}

.clock-block {
  text-align: right;
}

.clock-time {
  font-size: 1.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.clock-date {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.8);
  margin-top: 2px;
}

.clock-tz {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
}

.session-banner {
  max-width: 1100px;
  margin: 0 auto;
  background: rgba(253, 181, 21, 0.15);
  border-top: 1px solid rgba(253, 181, 21, 0.4);
  color: var(--california-gold);
  padding: 8px 0;
  font-size: 0.85rem;
  font-weight: 600;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.now-soon-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 36px;
}

@media (max-width: 720px) {
  .now-soon-section { grid-template-columns: 1fr; }
}

.now-soon-section h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  margin: 0 0 12px;
}

.hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-now {
  background: var(--now-color);
  box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.6);
  animation: pulse 1.6s infinite;
}

.dot-soon { background: var(--soon-color); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(192, 57, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.class-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.class-card.now { border-left: 4px solid var(--now-color); }
.class-card.soon { border-left: 4px solid var(--soon-color); }

.class-card .card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.class-card .code {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--berkeley-blue);
  letter-spacing: 0.02em;
}

.class-card .countdown {
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.class-card.now .countdown { color: var(--now-color); }
.class-card.soon .countdown { color: var(--soon-color); }

.class-card .title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 4px 0 2px;
}

.class-card .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.class-card .note {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--soon-color);
  background: var(--soon-bg);
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
}

.empty-msg {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
  margin: 4px 0;
}

.browse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.browse-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.day-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.day-filters button {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.day-filters button:hover {
  border-color: var(--berkeley-blue);
}

.day-filters button.active {
  background: var(--berkeley-blue);
  border-color: var(--berkeley-blue);
  color: white;
}

.table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead th {
  text-align: left;
  padding: 10px 12px;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr.row-now { background: var(--now-bg); }
tbody tr.row-soon { background: var(--soon-bg); }

.status-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.now { background: var(--now-color); color: white; }
.status-badge.soon { background: var(--soon-color); color: white; }
.status-badge.later { background: #e5e7eb; color: var(--text-muted); }
.status-badge.ended { background: #f1f1f1; color: #b0b3b8; }
.status-badge.other { background: transparent; color: var(--text-muted); }

.class-code-cell { font-weight: 700; color: var(--berkeley-blue); white-space: nowrap; }
.class-note-inline {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--soon-color);
}

.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 20px;
}

.site-footer code {
  background: #eceef1;
  padding: 1px 5px;
  border-radius: 4px;
}

/* Below ~700px, the table reflows into stacked cards — a 7-column grid
   with horizontal scrolling is unreadable on a phone. */
@media (max-width: 700px) {
  main { padding: 16px; }

  .header-inner {
    align-items: flex-start;
  }

  .clock-block { text-align: left; }

  .table-wrap {
    overflow-x: visible;
    border: none;
    background: transparent;
  }

  table, thead, tbody, tr, td {
    display: block;
    width: 100%;
  }

  thead { display: none; }

  tbody tr {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 10px;
  }

  tbody tr.row-now { border-color: var(--now-color); }
  tbody tr.row-soon { border-color: var(--soon-color); }

  tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
    text-align: right;
  }

  tbody tr td:first-child { border-top: none; }
  tbody tr td:last-child { border-bottom: none; }

  tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    text-align: left;
    flex-shrink: 0;
  }

  td[data-label="Title"],
  td[data-label="Instructor"] {
    text-align: right;
  }

  .class-note-inline { text-align: right; }
}
