@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600;700&display=swap");

:root {
  --bg: #04070e;
  --panel: #04070e;
  --panel-2: #04070e;
  --text: #bcd7ff;
  --muted: #7aa0d8;
  --accent: #4da3ff;
  --accent-2: #ff6b6b;
  --border: #1b3b6b;
  --shadow: none;
  --radius: 0px;
  --thumb-size: 120px;
  --cell-width: calc(var(--thumb-size) + 20px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  background: var(--bg);
  color: var(--text);
  cursor: crosshair;
}

.header {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: none;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand .title {
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brand .subtitle {
  color: var(--muted);
  font-size: 14px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

select,
button {
  padding: 10px 12px;
  border-radius: 0px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
}

button {
  cursor: pointer;
  background: #0b1b33;
  color: var(--text);
  font-weight: 600;
  border: none;
  box-shadow: var(--shadow);
}

main {
  padding: 20px 24px 48px;
}

.status {
  margin: 12px 0 20px;
  color: var(--muted);
}

.grid-wrapper {
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-2);
  box-shadow: var(--shadow);
}

.grid-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  table-layout: fixed;
}

.grid-table th,
.grid-table td {
  border: 1px solid var(--border);
  padding: 10px;
  vertical-align: top;
  width: var(--cell-width);
  max-width: var(--cell-width);
  min-width: var(--cell-width);
  overflow: hidden;
}

.grid-table th {
  position: sticky;
  top: 0;
  background: #071526;
  z-index: 5;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.grid-table th.date-group {
  text-align: center;
}

.grid-table th.city-subheader {
  font-size: 11px;
  color: var(--accent);
}

.grid-table.compare th.date-group {
  border-left: 2px solid rgba(77, 163, 255, 0.75);
  border-right: 2px solid rgba(77, 163, 255, 0.75);
}

.grid-table.compare th.city-subheader {
  border-left: 2px solid rgba(77, 163, 255, 0.75);
}

.grid-table.compare th.city-subheader:nth-child(2n + 2) {
  border-left: 2px solid rgba(77, 163, 255, 0.75);
  border-right: 2px solid rgba(77, 163, 255, 0.75);
}

.grid-table.compare td:nth-child(2n + 2) {
  border-left: 2px solid rgba(77, 163, 255, 0.75);
}

.grid-table.compare td:nth-child(2n + 3) {
  border-right: 2px solid rgba(77, 163, 255, 0.75);
}

.grid-table .rank-header {
  left: 0;
  z-index: 6;
  position: sticky;
  background: #071526;
  width: 64px;
  max-width: 64px;
  min-width: 64px;
}

.grid-table .rank-cell {
  position: sticky;
  left: 0;
  background: #071526;
  font-weight: 600;
  color: var(--accent);
  width: 64px;
  max-width: 64px;
  min-width: 64px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: var(--thumb-size);
  margin: 0 auto;
}

.card img {
  width: var(--thumb-size);
  height: var(--thumb-size);
  object-fit: cover;
  border-radius: 0px;
  border: 1px solid var(--border);
  background: #04070e;
  cursor: zoom-in;
}

.card a {
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  line-height: 1.25;
  max-width: var(--thumb-size);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card a:hover {
  color: var(--accent);
}

.empty {
  color: var(--muted);
  font-size: 12px;
}

.compare-toggle {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 18px;
}

.thumb-controls {
  gap: 8px;
}

.thumb-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.thumb-buttons button {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 0px;
  background: #0b1b33;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

#thumb-size-label {
  font-size: 12px;
  color: var(--muted);
  min-width: 52px;
  text-align: center;
}

#compare-city-wrap {
  opacity: 0.6;
  pointer-events: none;
}

#compare-city-wrap.active {
  opacity: 1;
  pointer-events: auto;
}

.grid-section {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.grid-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 8, 0.86);
}

.modal-panel {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  width: min(900px, 92vw);
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow);
}

.modal-panel img {
  width: 100%;
  height: auto;
  border-radius: 0px;
  border: 1px solid var(--border);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-close {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
  padding: 4px 8px;
  line-height: 1;
  font-size: 14px;
  min-width: 28px;
  min-height: 28px;
}

.modal-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  flex: 1;
}

.modal-meta-left strong {
  color: var(--text);
  font-weight: 700;
}

.modal-link {
  margin-top: 4px;
  color: var(--muted);
  max-width: 460px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}

.modal-link:hover {
  color: var(--accent);
}

.modal-meta-right {
  text-align: right;
  white-space: nowrap;
  color: var(--muted);
}

@media (max-width: 800px) {
  .header {
    position: static;
  }

  .grid-table {
    min-width: 700px;
  }
}
