@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

body {
  font-family: 'Press Start 2P', cursive, Arial, sans-serif;
  background: #1a1a2e;
  color: #e94560;
  text-align: center;
  padding: 40px 20px;
  margin: 0;
  image-rendering: pixelated;
  min-height: 100vh;
  box-sizing: border-box;
  overflow-x: hidden;
  line-height: 1.618;
}

a {
  text-decoration: none;
  color: inherit;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  background: #16213e;
  padding: 40px;
  border: 3px solid #e94560;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  margin-bottom: 48px;
}

.tab {
  padding: 16px 32px;
  background: #2c3e50;
  border: 2px solid #3498db;
  color: #ecf0f1;
  font-family: 'Press Start 2P', cursive;
  font-size: 11px;
  font-weight: normal;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
  word-wrap: break-word;
  hyphens: auto;
  overflow-wrap: break-word;
}

.tab:hover,
.tab:focus,
.tab.active {
  background: #3498db;
  color: #1a1a2e;
  border-color: #2980b9;
  outline: none;
}

/* ── Headings ── */
h1 {
  color: #f39c12;
  font-family: 'Press Start 2P', cursive;
  font-weight: normal;
  font-size: 28px;
  margin-bottom: 40px;
}

h2 {
  color: #f39c12;
  font-family: 'Press Start 2P', cursive;
  font-weight: normal;
  font-size: 20px;
  margin: 32px 0 24px 0;
}

/* ── Filter bar ── */
.filter {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
  padding: 24px;
  background: #2c3e50;
  border: 2px solid #3498db;
  border-radius: 8px;
}

.filter select {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  font-size: 11px;
  font-family: 'Press Start 2P', cursive;
  background: #34495e;
  color: #ecf0f1;
  border: 2px solid #3498db;
  border-radius: 4px;
}

.filter label {
  font-size: 11px;
  margin-bottom: 8px;
  color: #3498db;
  display: block;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Day section ── */
.day {
  background: #0f3460;
  border: 2px solid #3498db;
  padding: 32px;
  margin: 32px 0;
  text-align: left;
}

/* ── Movie entry ── */
.movie {
  padding: 16px 20px;
  font-size: 14px;
  color: #ecf0f1;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  font-family: 'Press Start 2P', cursive;
  font-weight: normal;
  gap: 20px;
  margin-bottom: 12px;
  background: #1e3a8a;
  border-radius: 4px;
  border: 1px solid #2980b9;
  transition: border 500ms ease-out;
}

.movie.highlight {
  border-color: #a8ffee;
}

.movie-title {
  font-weight: bold;
  font-size: 18px;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  min-width: 0;
  color: #7dd3fc;
}

.movie-title a {
  color: #7dd3fc;
  text-decoration: none;
  font-weight: bold;
  transition: color 0.2s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 4px;
  background: rgba(125, 211, 252, 0.1);
  border: 1px solid rgba(125, 211, 252, 0.3);
  min-width: 0;
}

.movie-title a:hover {
  color: #38bdf8;
  background: rgba(125, 211, 252, 0.2);
  border-color: #7dd3fc;
}

.movie-title span.title-text {
  color: #7dd3fc;
  padding: 8px 12px;
  border-radius: 4px;
  background: rgba(125, 211, 252, 0.1);
  border: 1px solid rgba(125, 211, 252, 0.3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.movie-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

/* ── Time / venue badges ── */
.movie-time,
.movie-cinema {
  flex: 0 0 auto;
  text-align: center;
  font-size: 12px;
  color: #ecf0f1;
  background: #2c3e50;
  border: 2px solid #3498db;
  padding: 8px 12px;
  border-radius: 4px;
  white-space: nowrap;
  height: 32px;
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.movie-cinema[data-venue="SIFF"] {
  border-color: #e74c3c;
  color: #ff8a80;
}

.movie-cinema[data-venue="Northwest Film Forum"] {
  border-color: #27ae60;
  color: #a8e6cf;
}

.movie-cinema[data-venue="Grand Illusion Cinema"] {
  border-color: #f39c12;
  color: #ffe0b2;
}

/* ── Other Times button ── */
.other-times-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  background: #8e44ad;
  color: #ecf0f1;
  border: 2px solid #9b59b6;
  border-radius: 4px;
  padding: 8px 12px;
  font-family: 'Press Start 2P', cursive;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 32px;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.other-times-btn:hover {
  background: #9b59b6;
  border-color: #8e44ad;
}

/* ── Share button ── */
.share-btn {
  background: #2c3e50;
  color: #e4eded;
  opacity: 0.9;
  border: 2px solid #7f8c8d;
  border-radius: 4px;
  font-family: 'Press Start 2P', cursive;
  cursor: pointer;
  padding: 8px 12px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-width: 32px;
  flex-shrink: 0;
  font-size: 0; /* hide text on desktop, show icon */
  width: 36px;
}

.share-btn::before { content: '⎘'; font-size: 20px; }
.share-btn.copied::before { content: '✓'; }
.share-btn.error::before { content: '✗'; }

.share-btn:hover { background: #bdc3c7; border-color: #95a5a6; opacity: 0.9; }
.share-btn.copied { background: #27ae60; color: #ecf0f1; border-color: #229954; opacity: 1; }
.share-btn.error { background: #e74c3c; color: #ecf0f1; border-color: #c0392b; opacity: 1; }

/* ── Movie group (by-movie view) ── */
.movie-group {
  background: #0f3460;
  border: 2px solid #3498db;
  padding: 32px;
  margin: 32px 0;
  text-align: left;
}

.movie-group h3 {
  color: #3498db;
  font-family: 'Press Start 2P', cursive;
  font-weight: normal;
  font-size: 16px;
  margin: 0 0 20px 0;
}

/* ── Stale warning ── */
.stale-warning {
  background: #7f0000;
  border: 2px solid #e74c3c;
  color: #ff8a80;
  padding: 16px;
  margin-bottom: 24px;
  font-size: 11px;
  text-align: left;
}

/* ── Loading ── */
.loading {
  color: #3498db;
  font-size: 14px;
  padding: 40px;
}

/* ── Footer ── */
footer {
  margin-top: 64px;
  text-align: center;
  font-size: 10px;
  opacity: 0.7;
  color: #95a5a6;
  padding: 32px;
  line-height: 2;
}

/* ── Other Times Dialog ── */
.dialog-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1999;
}

.other-times-dialog {
  display: flex;
  flex-direction: column;
  position: fixed;
  max-height: min(80vh, 600px);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #181830;
  border: 3px solid #00fff7;
  padding: 28px 32px 20px 32px;
  color: #39ff14;
  font-family: 'Press Start 2P', cursive;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 0 32px #00fff7, 0 0 8px #ff0080 inset;
  z-index: 2000;
  min-width: 340px;
  max-width: 90vw;
  border-radius: 8px;
}

.other-times-dialog-title {
  color: #ff0080;
  font-size: 14px;
  margin-bottom: 16px;
  text-shadow: 0 0 4px #00fff7;
  word-break: break-word;
}

.other-times-list {
  overflow-y: auto;
  flex: 1;
  text-align: left;
  margin-bottom: 16px;
}

.other-times-link {
  display: block;
  color: #00fff7;
  background: #222;
  border: 1px solid #ff0080;
  border-radius: 4px;
  margin: 6px 0;
  padding: 10px 12px;
  text-decoration: none;
  font-size: 11px;
  font-family: 'Press Start 2P', cursive;
  transition: background 0.2s, color 0.2s, border 0.2s;
  box-shadow: 0 0 6px #00fff7;
  cursor: pointer;
}

.other-times-link:hover {
  background: #ff0080;
  color: #fff;
  border: 1px solid #00fff7;
}

.closeBtn {
  margin-top: 12px;
  padding: 10px 20px;
  background: #ff0080;
  color: #fff;
  border: none;
  font-family: 'Press Start 2P', cursive;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 0 8px #00fff7;
  flex-shrink: 0;
}

.closeBtn:hover { background: #39ff14; color: #000; }

.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════
   MOBILE  (≤ 767px)
   Key ideas:
   - Tabs become a compact 2-column grid, not a tall vertical stack
   - Filter collapses to 1 column but stays tight
   - Movie row: title full-width on top, then ONE flex row of
     badges + buttons below — they wrap naturally, no full-width blocks
   - Press Start 2P is very wide; shrink sizes aggressively
═══════════════════════════════════════════════════ */
@media (max-width: 767px) {
  body {
    padding: 4px;
    line-height: 1.4;
  }

  .container {
    width: 100%;
    padding: 12px;
    margin: 0;
    border-width: 2px;
  }

  h1 {
    font-size: 14px;
    margin: 12px 0 20px;
    line-height: 1.5;
    word-break: break-word;
  }

  h2 {
    font-size: 11px;
    margin: 16px 0 12px;
    line-height: 1.4;
    word-break: break-word;
  }

  /* Tabs: 2-column grid so they don't eat the whole screen */
  .tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
  }

  .tab {
    padding: 10px 6px;
    font-size: 8px;
    min-height: 44px;
    line-height: 1.4;
    word-break: break-word;
    hyphens: auto;
  }

  /* Filter: single column, compact */
  .filter {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
    margin-bottom: 16px;
  }

  .filter label { font-size: 9px; }

  .filter select {
    font-size: 10px;
    height: 36px;
    padding: 0 6px;
  }

  .day,
  .movie-group {
    padding: 12px;
    margin: 12px 0;
  }

  /* Movie row: stack title above, badges in a wrapping row below */
  .movie {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
    gap: 8px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 2px solid #2980b9;
  }

  .movie-title {
    font-size: 10px;
    max-width: 100%;
    width: 100%;
  }

  .movie-title a,
  .movie-title span.title-text {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
    line-height: 1.5;
    font-size: 10px;
    display: block;
    width: 100%;
  }

  /* Info row: wrapping flex so badges sit side by side */
  .movie-info {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .movie-time,
  .movie-cinema {
    font-size: 9px;
    height: 28px;
    min-width: 0;
    padding: 0 8px;
    flex: 0 0 auto;
  }

  .other-times-btn {
    font-size: 8px;
    height: 28px;
    min-width: 0;
    padding: 0 8px;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* Share button: small square icon only */
  .share-btn {
    font-size: 0;
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 0;
    flex: 0 0 auto;
  }

  .share-btn::before { font-size: 14px; }

  footer {
    font-size: 8px;
    margin-top: 24px;
    padding: 12px 4px;
  }

  .other-times-dialog {
    min-width: 0;
    width: 92vw;
    padding: 16px;
    font-size: 10px;
  }

  .other-times-dialog-title { font-size: 11px; }
  .other-times-link { font-size: 9px; padding: 8px 10px; }
  .closeBtn { font-size: 10px; padding: 8px 14px; }
}

/* ── Tablet ── */
@media (max-width: 1024px) and (min-width: 768px) {
  .container { width: 95%; padding: 24px; }
  .filter { grid-template-columns: 1fr 1fr 1fr; gap: 16px; padding: 20px; }
  .tab { padding: 14px 20px; font-size: 11px; }
  .movie-title { font-size: 16px; }
}
