/* Calendar Crunch — game board skin. Deliberately not the 7ax.css palette:
   this is a parody of a work calendar, not the site chrome. */

:root {
  --cc-row-h: 14px;
  --cc-axis-w: 44px;
  --cc-grid-line: #e2e2e2;
  --cc-lunch-tint: #fff6da;
}

.cc-title { margin-top: 8px; font-size: clamp(40px, 8vw, 64px); }
.cc-subtitle { max-width: 60ch; margin: 12px 0 0; color: var(--muted); font-size: 17px; }

/* ---------- HUD ---------- */

.cc-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 28px 0 20px;
}

.cc-hud-item {
  background: var(--card);
  border-radius: 16px;
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 90px;
}

.cc-hud-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.cc-hud-value { font-family: var(--font-display); font-size: 26px; line-height: 1; }

.cc-hud-sanity { min-width: 140px; justify-content: center; }

.cc-sanity-bar {
  width: 100%;
  height: 10px;
  background: #ddd;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 4px;
}

.cc-sanity-fill {
  height: 100%;
  width: 100%;
  background: #4caf7d;
  transition: width 0.2s ease, background 0.2s ease;
}

/* ---------- board wrap ---------- */

.cc-board-wrap {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  padding: 12px;
  max-width: 480px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.cc-board-header {
  display: grid;
  grid-template-columns: var(--cc-axis-w) repeat(5, 1fr);
}

.cc-day {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ink);
  padding-bottom: 6px;
}

.cc-board-body {
  display: flex;
}

.cc-time-axis {
  width: var(--cc-axis-w);
  position: relative;
}

.cc-time-label {
  position: absolute;
  left: 0;
  right: 6px;
  transform: translateY(-6px);
  text-align: right;
  font-size: 10px;
  color: var(--muted);
}

.cc-lunch-tint {
  position: absolute;
  left: 0;
  right: 0;
  background: var(--cc-lunch-tint);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cc-lunch-tint span {
  writing-mode: vertical-rl;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #b08a2e;
  font-weight: 700;
}

.cc-board {
  flex: 1;
  /* Cells are nowrap, so their min-content width is the whole meeting title.
     Without these the grid refuses to shrink and the board overflows on mobile. */
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: var(--cc-row-h);
}

.cc-cell {
  border-right: 1px solid var(--cc-grid-line);
  border-bottom: 1px solid var(--cc-grid-line);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 9px;
  line-height: 1.3;
  padding: 1px 3px;
  color: #fff;
}

.cc-cell.cc-hour-start { border-top: 1px solid #c9c9c9; }
.cc-cell.cc-lunch-row { background: var(--cc-lunch-tint); }
.cc-cell.cc-filled { border-radius: 3px; }

/* A completed row blinks before it clears. brightness() rides on top of the
   inline background, so one rule covers every meeting colour. */
.cc-cell.cc-clearing { animation: cc-row-flash 0.09s steps(1, end) 3; }

@keyframes cc-row-flash {
  0%  { filter: brightness(3.2); }
  50% { filter: none; }
}

/* ---------- toast ---------- */

.cc-toast {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  z-index: 5;
  white-space: nowrap;
}

/* ---------- overlays ---------- */

.cc-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 16px;
}

/* The class sets display, so it outranks the browser's [hidden] rule —
   without this both overlays stay stacked over the board forever. */
.cc-overlay[hidden] { display: none; }

.cc-overlay-card { text-align: center; padding: 20px; }
.cc-overlay-card h2 { font-size: 28px; margin-bottom: 8px; }
.cc-overlay-card p { margin: 4px 0; }
.cc-overlay-card .btn { margin-top: 14px; }

.cc-overlay-card .coffee-note { margin-top: 16px; font-size: 13px; line-height: 1.45; opacity: 0.7; }
.cc-overlay-card .coffee-note a { color: inherit; text-underline-offset: 2px; }

/* ---------- touch controls ---------- */

.cc-touch-controls {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin: 16px 0;
}

.cc-touch-controls button {
  flex: 1;
  padding: 14px 0;
  font-size: 18px;
  border: none;
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
  /* Kills the double-tap-to-zoom delay and stops rapid taps selecting text. */
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.cc-touch-controls button:active { background: var(--glare); }
#btnDrop { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }

/* ---------- about / how-to ---------- */

.cc-howto, .cc-about { margin-top: var(--gap-section); }
.cc-howto h2, .cc-about h2 { font-size: 24px; margin-bottom: 12px; }
.cc-howto p, .cc-about p { margin: 8px 0; }

/* On a phone the board, the HUD and the buttons all have to sit on one
   screen — otherwise you can't watch the stack and reach the controls at
   the same time. Everything above the board gets compressed. */
@media (max-width: 640px) {
  :root { --cc-row-h: 11px; }

  .cc-title { font-size: 32px; margin-top: 0; }
  .cc-subtitle { display: none; }

  .cc-hud {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 14px 0 12px;
  }
  .cc-hud-item { min-width: 0; padding: 6px 8px; border-radius: 12px; }
  .cc-hud-sanity { min-width: 0; }
  .cc-hud-label { font-size: 9px; letter-spacing: 0.02em; }
  .cc-hud-value { font-size: 18px; }

  .cc-board-wrap { padding: 8px; }
  .cc-touch-controls { margin: 12px 0; gap: 6px; }
}

@media (max-width: 380px) {
  :root { --cc-axis-w: 36px; }
  .cc-touch-controls button { padding: 12px 0; font-size: 16px; }
}
