:root {
  --text: #181818;
  --muted: #6b7280;
  --border: #e0e0e0;
  --snow-0-1: #9ecae1;
  --snow-1-3: #6baed6;
  --snow-3-6: #4292c6;
  --snow-6-12: #2171b5;
  --snow-12-plus: #084594;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: #ffffff;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 28px 20px;
  font-size: clamp(12px, 1.4vw, 14px);
}

.page-header {
  margin-bottom: 12px;
}

.page-header h1 {
  margin: 0 0 8px 0;
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 600;
}

.meta {
  color: var(--muted);
}

.search-wrapper {
  margin-bottom: 16px;
}

#search-input {
  width: 100%;
  max-width: 300px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
}

#search-input:focus {
  outline: none;
  border-color: #2f6fe0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 16px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.snow-0-1 { background: var(--snow-0-1); }
.snow-1-3 { background: var(--snow-1-3); }
.snow-3-6 { background: var(--snow-3-6); }
.snow-6-12 { background: var(--snow-6-12); }
.snow-12-plus { background: var(--snow-12-plus); }

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #ffffff;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

thead tr {
  border-bottom: 1px solid #000000;
}

@media (max-width: 768px) {
  th:not(:first-child) {
    width: calc((100% - 90px) / 6);
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: inherit;
}

thead {
  background: #ffffff;
}

th {
  padding: 8px 12px;
  text-align: center;
  font-weight: 600;
  font-size: inherit;
  border-bottom: 1px solid #000000 !important;
  border-left: none;
  border-right: none;
  border-top: none;
  background: #ffffff;
  cursor: pointer;
  position: relative;
  user-select: none;
}

th:first-child {
  text-align: center;
  width: auto;
}

th:not(:first-child) {
  width: calc((100% - 120px) / 6);
}

th.total-column,
td.total-column {
  border-left: 1px solid #9ca3af !important;
}

th.sorted-asc::after,
th.sorted-desc::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

@media (max-width: 768px) {
  th.sorted-asc::after,
  th.sorted-desc::after {
    position: static;
    display: inline-block;
    margin-left: 4px;
    transform: none;
  }
  
  th.sorted-desc::after {
    transform: rotate(180deg);
    display: inline-block;
  }
}

th.sorted-asc::after {
  border-bottom: 7px solid #2f6fe0;
}

th.sorted-desc::after {
  border-top: 7px solid #2f6fe0;
}

td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-left: none;
  border-right: none;
  font-size: inherit;
}

td:first-child {
  text-align: left;
  white-space: normal;
  max-width: 120px;
  line-height: 1.3;
}

tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.027);
}

.day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.day-value {
  font-weight: 400;
}

.day-bar {
  width: 100%;
  max-width: 60px;
  height: 32px;
  display: flex;
  align-items: flex-end;
}

.day-bar-fill {
  width: 100%;
}

.source-footer {
  margin-top: 16px;
  color: var(--muted);
}

@media (max-width: 768px) {
  .container {
    padding: 20px 16px;
    font-size: 12px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  th, td {
    padding: 6px 8px;
  }

  .day-bar {
    height: 24px;
  }
}

@media (max-width: 520px) {
  .container {
    padding: 16px 12px;
    font-size: 11px;
  }

  .page-header h1 {
    font-size: 20px;
  }

  th, td {
    padding: 6px 4px;
  }

  td:first-child {
    max-width: 90px;
    padding: 6px 6px;
  }

  .day-bar {
    max-width: 32px;
    height: 22px;
  }
}
