:root {
  --bg:      #0a0a0a;
  --text:    #f0f0f0;
  --accent:  #ffffff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  display: grid;
  place-items: center;
  text-align: center;
}

#container {
  padding: 5vw;
  line-height: 1.1;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Week view content */
#week-content {
  text-align: center;
}

/* Calendar view content */
#calendar-content {
  width: 100%;
  max-width: 420px;
  text-align: center;
  position: relative;           /* needed for absolute chevrons */
}

.phrase,
.month-title {
  font-size: clamp(1.8rem, 7vw, 5vmin);
  font-weight: 400;
  opacity: 0.92;
  margin-bottom: 0.6rem;
  letter-spacing: -0.02em;
}

.number {
  font-size: clamp(9rem, 40vw, 52vmin);
  font-weight: 900;
  line-height: 0.82;
  color: var(--accent);
  letter-spacing: -0.05em;
}

/* Toggle / Back button */
.toggle-btn {
  margin-top: 2rem;
  font-size: clamp(1.1rem, 4.5vw, 1.6rem);
  padding: 0.7rem 1.6rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 9999px;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  display: inline-block;
  transition: all 0.18s ease;
}

.toggle-btn:hover {
  background: rgba(255,255,255,0.15);
}

/* Calendar table */
table {
  border-collapse: collapse;
  margin: 0 auto;
  font-size: clamp(0.9rem, 3.2vw, 1.25rem);
  width: 100%;
  max-width: 380px;
}

thead th {
  font-weight: 500;
  opacity: 0.8;
  padding: 0.4em 0.5em;
  font-size: clamp(0.9rem, 3vw, 1.2rem);
}

tbody td,
tbody th {
  padding: 0.6em 0.5em;
  text-align: center;
  min-width: 2.1em;
}

.week-col {
  font-weight: 600;
  opacity: 0.75;
  color: #aaaaaa;
  border-right: 1px solid rgba(255,255,255,0.08);
  padding-right: 0.8em;
}

.week-col.current-week {
  font-weight: 800;
  color: var(--accent);
  opacity: 1;
}

td.other-month {
  opacity: 0.35;
}

td.today {
  background: rgba(0, 140, 255, 0.75) !important;
  color: white;
  font-weight: 800;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(0, 140, 255, 0.4);
}

td.weekend:not(.today) {
  opacity: 0.7;
}

tr.current-week {
  background: rgba(100, 180, 255, 0.12);
}

/* Calendar navigation chevrons << and >> */
.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.8rem;
  font-weight: bold;
  line-height: 1;
  color: var(--text);
  opacity: 0.75;
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  transition: all 0.22s ease;
  background: rgba(60, 60, 60, 0);
  z-index: 10;
  user-select: none;
}

.arrow.left  { left: -6rem; }
.arrow.right { right: -6rem; }

.arrow:hover,
.arrow:focus {
  opacity: 1;
  background: rgba(100, 180, 255, 0.45);
  transform: translateY(-50%) scale(1.15);
}

/* Hide helper class */
.hidden {
  display: none !important;
}

/* ──────────────────────────────────────────────
   RESPONSIVE ADJUSTMENTS (especially for iPhone SE ~375px)
───────────────────────────────────────────────── */

@media (max-width: 420px) {
  #container {
    padding: 4vw 5vw;
  }

  .toggle-btn {
    margin-top: 1.4rem;
    padding: 0.6rem 1.3rem;
    font-size: clamp(1rem, 4.3vw, 1.45rem);
  }

  table {
    font-size: clamp(0.85rem, 3vw, 1.15rem);
  }

  thead th,
  tbody td,
  tbody th {
    padding: 0.45em 0.4em;
    min-width: 1.9em;
  }

  .week-col {
    padding-right: 0.6em;
    min-width: 2.1em;
  }

  .arrow {
    font-size: 2.4rem;
    padding: 0.3rem 0.7rem;
  }

  .arrow.left  { left: -2.2rem; }
  .arrow.right { right: -2.2rem; }
}

@media (max-width: 360px) {
  .arrow {
    font-size: 2.1rem;
    padding: 0.3rem 0.6rem;
  }

  .arrow.left  { left: -1.8rem; }
  .arrow.right { right: -1.8rem; }
}

/* Large screens */
@media (min-width: 1400px) {
  .phrase,
  .month-title {
    letter-spacing: -0.04em;
  }
  .number {
    letter-spacing: -0.08em;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* Light mode */
@media (prefers-color-scheme: light) {
  :root {
    --bg:    #f8f8f8;
    --text:  #1a1a1a;
    --accent: #000000;
  }

  .week-col {
    color: #666666;
    border-right-color: rgba(0,0,0,0.06);
  }

  tr.current-week {
    background: rgba(0, 120, 255, 0.08);
  }

  td.today {
    background: rgba(0, 120, 255, 0.9) !important;
    color: white;
  }

  .toggle-btn {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.1);
  }

  .toggle-btn:hover {
    background: rgba(0,0,0,0.08);
  }

  .arrow {
    background: rgba(220, 220, 220, 0);
    color: #333;
  }

  .arrow:hover,
  .arrow:focus {
    background: rgba(100, 180, 255, 0.35);
  }
}
