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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #0f0f0f;
  color: #f5f5f5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  text-align: center;
  padding: 2rem;
  max-width: 420px;
  width: 100%;
}

/* Header with settings gear */
.app-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 1rem;
}

.app-header h1 {
  margin-bottom: 0;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  color: #a0a0a0;
}

.settings-btn {
  position: absolute;
  right: 0;
  background: none;
  border: none;
  color: #606060;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-btn:hover {
  color: #a0a0a0;
  background: #1a1a1a;
}

/* Live count badge */
.live-count {
  font-size: 0.95rem;
  color: #8c8c8c;
  margin-bottom: 0.5rem;
  min-height: 1.4em;
}

.live-count.has-count {
  color: #4ade80;
}

/* Active users list */
.active-users-list {
  margin-bottom: 2rem;
}

.active-users-list:empty {
  display: none;
}

.active-user {
  font-size: 0.85rem;
  color: #d1d5db;
  padding: 0.15rem 0;
}

.active-user-meta {
  font-size: 0.8rem;
  color: #606060;
  padding: 0.15rem 0;
  font-style: italic;
}

/* Timer display */
.timer-display {
  font-size: 6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  margin-bottom: 2rem;
  line-height: 1;
}

.timer-display.running {
  color: #4ade80;
}

.timer-display.finished {
  color: #facc15;
}

/* Preset buttons */
.presets {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.preset-btn {
  background: #1a1a1a;
  color: #a0a0a0;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 0.5rem 1.25rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.preset-btn:hover {
  background: #252525;
  color: #f5f5f5;
}

.preset-btn.active {
  background: #252525;
  color: #f5f5f5;
  border-color: #4ade80;
}

.preset-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Control buttons */
.controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0.75rem 2.5rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-start {
  background: #4ade80;
  color: #0f0f0f;
}

.btn-start:hover:not(:disabled) {
  background: #22c55e;
}

.btn-stop {
  background: #ef4444;
  color: #fff;
}

.btn-stop:hover:not(:disabled) {
  background: #dc2626;
}

/* Modal overlay */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 2rem;
  width: 90%;
  max-width: 360px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: #606060;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.modal-close:hover {
  color: #f5f5f5;
  background: #252525;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #f5f5f5;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #a0a0a0;
  margin-bottom: 0.4rem;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: #0f0f0f;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  color: #f5f5f5;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input[type="text"]:focus {
  border-color: #4ade80;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem !important;
  color: #f5f5f5 !important;
}

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: #4ade80;
  cursor: pointer;
}

.privacy-notice {
  font-size: 0.8rem;
  color: #606060;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.btn-save {
  width: 100%;
  background: #4ade80;
  color: #0f0f0f;
}

/* Completion message */
.completion-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.completion-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.completion-overlay.fade-out {
  opacity: 0;
}

.completion-card {
  background: #166534;
  border: 1px solid #22c55e;
  border-radius: 14px;
  padding: 2rem 2.5rem;
  text-align: center;
  max-width: 340px;
  width: 90%;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.completion-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #f0fdf4;
  margin-bottom: 0.5rem;
}

.completion-detail {
  font-size: 1rem;
  color: #bbf7d0;
  margin-bottom: 0.25rem;
}

.completion-percentile {
  font-size: 0.95rem;
  color: #86efac;
}

.completion-detail:empty,
.completion-percentile:empty {
  display: none;
}
