:root {
  --bg: #151412;
  --board: #191815;
  --line: #2b2823;
  --text: #ece7de;
  --soft: #c9c3b8;
  --muted: #989186;
  --accent: #e0a458;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 500 16px/1.5 "Uber Move", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

::selection { background: var(--accent); color: #1a1408; }

.wrap {
  max-width: 620px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 18px 20px calc(32px + env(safe-area-inset-bottom));
}

/* Top bar */
.bar {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 2px 2px 14px;
}

.back {
  color: var(--muted);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: nowrap;
}
.back:hover { color: var(--accent); }

/* Target line */
.target-line {
  margin: 28px 2px 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
}
.target-line b { color: var(--soft); font-weight: 500; }

/* Tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: 10px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 22px 2px 18px;
}
.tile + .tile { border-left: 1px solid var(--line); padding-left: 16px; }

.tile-num {
  font-size: clamp(30px, 8.5vw, 46px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.tile-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.done .tile-num { color: var(--muted); }

/* No specific time set: only the days tile, centered */
.tiles.no-time { grid-template-columns: 1fr; }
.tiles.no-time .tile:nth-child(n + 2) { display: none; }
.tiles.no-time .tile {
  align-items: center;
  text-align: center;
}

/* Totals */
.totals {
  margin: 12px 2px 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
}

.done {
  margin: 16px 2px 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 20px;
}

/* Settings */
.settings { margin-top: 52px; }

/* Date button + calendar popover */
.picker { position: relative; max-width: 340px; margin-bottom: 16px; }

.date-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  background: var(--board);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: 500 15px/1.4 "Uber Move", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  cursor: pointer;
  text-align: left;
}
.date-btn:hover, .date-btn[aria-expanded="true"] { border-color: var(--accent); }
.date-btn:focus-visible { outline: none; border-color: var(--accent); }

.chev { color: var(--muted); font-size: 12px; transition: transform 0.15s ease; }
.date-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

.pop {
  position: absolute;
  z-index: 10;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: var(--board);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 10px;
}

.cal-title { font-weight: 700; font-size: 15px; }

.cal-nav { display: flex; gap: 4px; }
.cal-nav button {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.cal-nav button:hover { background: var(--line); }

.cal-dow, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-dow span {
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 0 6px;
}

.cal-grid button {
  aspect-ratio: 1;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--text);
  font: 500 14px "Uber Move", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding: 0;
}
.cal-grid button:hover { background: var(--line); }
.cal-grid button.today { color: var(--accent); font-weight: 700; }
.cal-grid button.selected {
  background: var(--accent);
  color: #1a1408;
  font-weight: 700;
}
.cal-grid .blank { visibility: hidden; }

.time-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 12px 4px 2px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
}

.time-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex: none;
  border: none;
  border-radius: 13px;
  background: var(--line);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s ease, background 0.15s ease;
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after {
  transform: translateX(18px);
  background: #1a1408;
}

.time-btn {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  font: 500 14px "Uber Move", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.time-btn:hover, .time-btn.open { border-color: var(--accent); }
.time-btn:focus-visible { outline: none; border-color: var(--accent); }

/* Temporary time dropdown, anchored to the time button */
.time-controls { position: relative; }

.time-menu {
  position: absolute;
  z-index: 5;
  bottom: calc(100% + 8px);
  right: 0;
  width: 128px;
  max-height: 216px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--board);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  scrollbar-width: none;
}
.time-menu::-webkit-scrollbar { display: none; }

.time-menu button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 7px;
  color: var(--text);
  font: 500 14px "Uber Move", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.time-menu button:hover { background: var(--line); }
.time-menu button.selected {
  background: var(--accent);
  color: #1a1408;
  font-weight: 700;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--soft);
  cursor: pointer;
  min-height: 44px;
}
.check input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
  flex: none;
}

/* Desktop: use the full screen — wider column, bigger numbers, vertically centered */
@media (min-width: 900px) {
  .wrap {
    max-width: 1080px;
    padding: 24px 48px 40px;
  }

  .target-line {
    margin-top: 6vh;
    font-size: 13.5px;
  }

  .tile { padding: 44px 2px 36px; }
  .tile + .tile { padding-left: 32px; }

  .tile-num { font-size: clamp(64px, 8.5vw, 118px); }

  .tile-label { font-size: 13px; letter-spacing: 0.12em; }

  .totals { font-size: 13.5px; }

  .done { font-size: 26px; }

  .settings {
    margin-top: 48px;
    display: flex;
    align-items: center;
    gap: 32px;
  }

  .picker {
    flex: none;
    width: 340px;
    margin-bottom: 0;
  }
}

@media (max-width: 480px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile { padding: 18px 2px 14px; }
  .tile + .tile { border-left: none; padding-left: 2px; }
  .tile:nth-child(even) { border-left: 1px solid var(--line); padding-left: 16px; }
  .tile:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
