:root {
  /* Apple-like light palette */
  --bg: #f5f5f7;           /* apple.com background */
  --panel: rgba(255, 255, 255, 0.72);
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 1px 2px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.06);
  --muted: #6e6e73;        /* secondary label */
  --text: #1d1d1f;         /* primary label */
  --primary: #0a84ff;      /* macOS blue accent */
  --primary-600: #0077ed;  /* hover */
  --secondary: #ffffff;    /* controls background */
  --secondary-hover: #f2f2f7;
  --danger: #ff3b30;
  --highlight: #ffd60a;    /* yellow highlight */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-header {
  padding: 28px 20px 8px;
  text-align: center;
}
.app-header h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 2px;
  font-weight: 700;
  text-transform: uppercase;
  color: #000000; /* darkest */
}
.subtitle { 
  display: block; 
  margin: 8px 0 0; 
  font-size: 16px; 
  color: var(--muted); 
  font-weight: 500; 
  letter-spacing: 0.5px; 
}

.container { max-width: 1200px; margin: 0 auto; padding: 16px 20px 32px; }

/* Collapsible sections */
details.collapsible { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; margin-bottom: 12px; box-shadow: var(--shadow); overflow: hidden; }
details.collapsible > summary { cursor: pointer; list-style: none; padding: 12px 16px; font-weight: 700; letter-spacing: 0.2px; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > .collapsible-content { padding: 12px 16px 16px; border-top: 1px solid var(--border); }

/* Auth */
.auth-container { min-height: calc(100vh - 80px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px; width: 100%; max-width: 420px; box-shadow: var(--shadow); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
.auth-title { margin: 0 0 12px; text-align: center; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.auth-form { display: grid; gap: 12px; }
.inline-access { margin-top: -4px; }
.link-btn { background: none; border: none; padding: 0; color: var(--primary); cursor: pointer; text-decoration: underline; font: inherit; }
.form-group label { display: block; margin-bottom: 6px; color: var(--muted); }
.text-input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--secondary); color: var(--text); font-size: 16px; }
.auth-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.auth-error { color: #ff3b30; font-size: 14px; }
.access-request { margin-top: 16px; display: grid; gap: 10px; }
.hook-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.helper-text { font-size: 14px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow);
}
.input-group label { display: block; margin-bottom: 6px; color: var(--muted); }
textarea {
  width: 100%;
  min-height: 140px;
  padding: 14px 14px 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: var(--text);
  resize: vertical;
  font-size: 16px;
  box-shadow: var(--shadow);
}

.controls { margin-top: 16px; display: grid; gap: 16px; }
.input-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.timer-controls {
  display: grid;
  grid-template-columns: minmax(360px, 460px) 1fr auto auto;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow);
}
.timer-setup label { display: block; margin-bottom: 4px; color: var(--muted); }
.time-fields { display: grid; grid-template-columns: 2fr auto 2fr; align-items: center; gap: 12px; }
.time-field { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.time-label { font-size: 13px; color: var(--muted); }
.time-sep { text-align: center; font-weight: 700; color: var(--muted); }
.timer-setup input { width: 100%; min-width: 160px; padding: 16px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--secondary); color: var(--text); font-size: 22px; }

/* Hide number spinners for cleaner numeric entry */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
.timer-display {
  text-align: center;
  font-size: clamp(44px, 7vw, 56px);
  font-weight: 700;
  letter-spacing: -0.5px;
  white-space: nowrap;
  overflow: hidden; /* prevent overlap into input column */
}
.hidden { display: none !important; }

/* Fullscreen timer overlay */
.timer-fullscreen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
}
.timer-fullscreen-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px 32px;
  text-align: center;
  min-width: 60vw;
  max-width: 90vw;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow);
}
.timer-fullscreen-time {
  font-size: 18vw;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.8vw;
}
.timer-fullscreen-cue { margin-top: 12px; font-size: 18px; color: var(--muted); }
.timer-exit { margin-top: 16px; }

/* Flash animation for last 30 seconds */
@keyframes flashPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.0); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 16px rgba(255, 69, 58, 0.15); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.0); }
}
.flash {
  animation: flashPulse 300ms ease;
}

/* Black/white flashing for finished timer in fullscreen */
@keyframes flashBW {
  0% { background: #000; color: #fff; }
  50% { background: #fff; color: #000; }
  100% { background: #000; color: #fff; }
}
.flash-bw {
  animation: flashBW 800ms ease-in-out infinite;
}
.timer-complete {
  background: #ff3b30 !important;
  color: #ffffff !important;
  border-color: rgba(0,0,0,0.15) !important;
}
.timer-buttons { display: flex; gap: 10px; }
.sharing-cue {
  text-align: right;
  font-size: 15px;
  color: var(--muted);
}

.pairing-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 16px;
  color: var(--text);
  background: var(--secondary);
  transition: background-color 120ms ease, box-shadow 120ms ease, transform 60ms ease;
}
.primary {
  background: var(--primary);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 1px 1px rgba(0,0,0,0.06), 0 4px 14px rgba(10,132,255,0.35);
}
.primary:hover { background: var(--primary-600); }
.secondary:hover { background: var(--secondary-hover); }
.accent {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--primary);
}
.accent:hover { background: rgba(10,132,255,0.08); }
.danger { background: #ffffff; color: var(--danger); border-color: var(--danger); }
.danger:hover { background: rgba(255,59,48,0.08); }
button:active { transform: translateY(1px); }

.results {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.results-column h2 { margin: 0 0 8px; font-size: 20px; color: var(--muted); }
.pairs-list { display: grid; gap: 8px; }
.pair-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow);
}
.pair-label { font-weight: 600; }
.pair-names { font-size: 18px; letter-spacing: -0.2px; }
.call-arrow { color: var(--muted); font-size: 14px; margin: 0 8px; }

.recap { margin-top: 12px; }
.recap-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow);
}
.selected-recap {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(32px, 5vw, 60px);
  font-weight: 800;
  background: transparent;
  border: none;
  border-radius: 12px;
}
.selected-group { margin-top: 6px; text-align: center; color: var(--muted); font-size: 16px; }
.recap-actions { margin-top: 10px; display: flex; justify-content: flex-end; }
.highlight { outline: 2px solid var(--primary); box-shadow: 0 0 0 4px rgba(10,132,255,0.15); }

.app-footer { text-align: center; color: var(--muted); padding: 20px 0 28px; font-size: 14px; }

/* Whiteboard */
.whiteboard .card { padding: 12px; }
.whiteboard-textarea { width: 100%; min-height: 220px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--secondary); color: var(--text); font-size: 16px; resize: vertical; }

@media (max-width: 900px) {
  .inputs { grid-template-columns: 1fr; }
  .results { grid-template-columns: 1fr; }
  .timer-controls { grid-template-columns: 1fr; text-align: center; }
  .sharing-cue { text-align: center; }
}

/* Prevent overlap on medium screens by moving the timer to its own row */
@media (max-width: 1400px) and (min-width: 901px) {
  .timer-controls { grid-template-columns: 1fr auto auto; }
  .timer-display { grid-column: 1 / -1; justify-self: center; margin-top: 6px; font-size: clamp(48px, 8vw, 72px); }
  .sharing-cue { grid-column: 1 / -1; text-align: center; }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0c;
    --panel: rgba(28, 28, 30, 0.72);
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 1px 2px rgba(0,0,0,0.5), 0 10px 28px rgba(0,0,0,0.6);
    --muted: #a1a1a6;
    --text: #f5f5f7;
    --primary: #0a84ff;
    --primary-600: #389bff;
    --secondary: #1c1c1e;
    --secondary-hover: #2c2c2e;
    --danger: #ff453a;
    --highlight: #ffd60a;
  }
  .app-header h1 { color: #7a7a80; /* even darker in dark mode */ }
  .accent { background: transparent; color: var(--primary); border-color: var(--primary); }
  .danger { background: transparent; color: var(--danger); border-color: var(--danger); }
  .app-footer { color: #2b2b2e; font-size: 13px; }
}

/* Respect reduced transparency */
@media (prefers-reduced-transparency: reduce) {
  .timer-controls,
  .pair-card,
  .selected-recap,
  textarea {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--secondary);
  }
}


