:root {
  color-scheme: light dark;
  --gap: 12px;
  --touch-target: 44px;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0 var(--gap) calc(var(--touch-target) + 24px);
  line-height: 1.5;
}

header, main, footer {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--gap) 0;
}

h1 { font-size: 1.5rem; }

section { margin-bottom: 24px; }

label {
  display: block;
  margin-top: 8px;
  font-weight: 600;
}

select, input[type="number"], button {
  min-height: var(--touch-target);
  font-size: 1rem;
  padding: 8px;
  width: 100%;
  max-width: 320px;
  margin-top: 4px;
}

button {
  cursor: pointer;
  width: auto;
  padding-inline: 20px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 8px;
  text-align: right;
  border-bottom: 1px solid #ccc;
}

th:first-child, td:first-child { text-align: left; }

.months-cards { display: none; }

.month-card {
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.month-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  margin: 0;
}

.month-card dt { font-weight: 600; }
.month-card dd { margin: 0; text-align: right; }

.ad-slot:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  background: rgba(128, 128, 128, 0.08);
  margin: var(--gap) auto;
  max-width: 960px;
}

.ad-slot-sticky-mobile {
  display: none;
}

.consent-banner:not([hidden]) {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #222;
  color: #fff;
  padding: var(--gap);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  z-index: 100;
}

.consent-banner a { color: #9cf; }

@media (max-width: 640px) {
  #months-table { display: none; }
  .months-cards { display: block; }

  .ad-slot-sticky-mobile:not([hidden]) {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 60px;
    z-index: 50;
  }

  body { padding-bottom: calc(60px + var(--touch-target) + 24px); }
}

#ad-slot-sticky-close {
  position: absolute;
  top: 4px;
  right: 8px;
  min-height: 32px;
  width: 32px;
  max-width: 32px;
  padding: 0;
}

@media (prefers-color-scheme: dark) {
  body { background: #121212; color: #eee; }
  th, td { border-color: #444; }
  .month-card { border-color: #444; }
  .ad-slot { background: rgba(255, 255, 255, 0.08); }
}
