/* TidyTrack - Apple-inspired Design System */

:root {
  /* Color Palette */
  --bg-primary: #f5f5f7;
  --bg-secondary: #ffffff;
  --bg-tertiary: #fafafa;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --success: #34c759;
  --warning: #ff9f0a;
  --danger: #ff3b30;
  --border: rgba(0, 0, 0, 0.06);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.06), 0 4px 10px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.08), 0 8px 16px rgba(0, 0, 0, 0.04);

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #6e6e73;
    --border: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.5);
  }
}

/* Reset & Base */
* {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.47059;
  font-weight: 400;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; color: var(--text-primary); }
h3 { font-size: 1.125rem; }

p {
  margin: 0;
  color: var(--text-secondary);
}

/* ==================== LOGIN SCREEN ==================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
}

.login-screen main {
  width: 100%;
  max-width: 380px;
  padding: 1.5rem;
}

.login-box {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-xl);
  text-align: center;
}

.login-box h1 {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
  background: linear-gradient(135deg, var(--accent) 0%, #5856d6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-box > p {
  color: var(--text-tertiary);
  font-size: 0.9375rem;
  margin-bottom: 2rem;
}

.login-box form {
  text-align: left;
}

.login-box label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.login-box input[type="password"] {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-box input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.login-box button {
  width: 100%;
  margin-top: 1.25rem;
}

/* Notice / Error */
.notice {
  background: rgba(255, 59, 48, 0.1);
  border: none;
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-top: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}

/* ==================== MAIN APP ==================== */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ==================== TOOLBAR ==================== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toolbar-row label {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.toolbar-row select {
  padding: 0.5rem 2rem 0.5rem 0.875rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236e6e73' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.toolbar-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.toolbar-buttons {
  display: flex;
  gap: 0.5rem;
}

/* ==================== BUTTONS ==================== */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 1.125rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:active {
  transform: translateY(0);
  box-shadow: none;
}

button.secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

button.secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border);
}

button.danger {
  background: var(--danger);
  width: 100%;
  margin-top: 1.5rem;
}

button.danger:hover {
  background: #ff453a;
}

/* ==================== SECTIONS ==================== */
section h2 {
  font-size: 1.375rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ==================== TASK LIST ==================== */
#taskList {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
  border: 1px solid var(--border);
}

.task-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.task-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.task-indicator.urgent {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(255, 59, 48, 0.4);
  animation: pulse-urgent 2s infinite;
}

.task-indicator.soon {
  background: var(--warning);
}

.task-indicator.ok {
  background: var(--success);
}

.task-indicator.ondemand {
  background: var(--text-tertiary);
}

@keyframes pulse-urgent {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

.task-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.task-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.task-description {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-bottom: 0.375rem;
  line-height: 1.4;
}

.task-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.task-status {
  font-size: 0.75rem;
  margin-top: 0.25rem;
  font-weight: 500;
}

.task-status.urgent { color: var(--danger); }
.task-status.soon { color: var(--warning); }
.task-status.ok { color: var(--success); }
.task-status.ondemand { color: var(--text-tertiary); }

.task-card button {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  background: var(--success);
}

.task-card button:hover {
  background: #30d158;
}

/* Empty & Loading States */
.empty-state,
.loading {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-tertiary);
  font-size: 1rem;
}

/* ==================== MODAL / DIALOG ==================== */
dialog {
  max-width: 90vw;
  width: 440px;
  border: none;
  border-radius: var(--radius-xl);
  padding: 0;
  box-shadow: var(--shadow-xl);
  background: var(--bg-secondary);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

dialog article {
  margin: 0;
  padding: 1.75rem;
}

dialog h2 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

dialog label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}

dialog label:first-of-type {
  margin-top: 0;
}

dialog input[type="text"],
dialog textarea,
dialog select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

dialog input:focus,
dialog textarea:focus,
dialog select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

dialog textarea {
  resize: vertical;
  min-height: 80px;
}

/* Button group */
.button-group {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.button-group button {
  flex: 1;
}

/* ==================== STAR RATING ==================== */
.star-rating {
  display: flex;
  gap: 0.25rem;
  font-size: 1.75rem;
  cursor: pointer;
  margin: 0.5rem 0;
}

.star-rating .star {
  color: var(--border);
  transition: color 0.15s, transform 0.15s;
}

.star-rating .star:hover {
  transform: scale(1.15);
}

.star-rating .star.active {
  color: #ffcc00;
}

.star-rating .star.hover {
  color: #ffd60a;
}

/* Weight help text */
.weight-help {
  margin-top: 0.5rem;
}

.weight-help p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.weight-help details {
  margin-top: 0.5rem;
}

.weight-help summary {
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--accent);
}

.weight-examples {
  margin: 0.5rem 0 0 0;
  padding-left: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ==================== HISTORY ==================== */
#historySection {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

#historySection h3 {
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}

.history-list {
  max-height: 180px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.history-item:last-child {
  border-bottom: none;
}

.history-delete {
  background: transparent;
  border: none;
  color: var(--danger);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  opacity: 0.6;
}

.history-delete:hover {
  opacity: 1;
  background: transparent;
  transform: none;
  box-shadow: none;
}

.history-empty {
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* ==================== CALENDAR ==================== */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.calendar-header h2 {
  font-size: 1.125rem;
  margin: 0;
}

.calendar-nav {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}

.calendar-nav:hover {
  background: var(--bg-tertiary);
  transform: none;
  box-shadow: none;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.calendar-day {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.5rem;
  min-height: 110px;
}

.calendar-day.today {
  border-color: var(--accent);
  border-width: 2px;
}

.calendar-day.past {
  opacity: 0.5;
}

.calendar-day-header {
  text-align: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.calendar-day-name {
  font-size: 0.6875rem;
  text-transform: uppercase;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.calendar-day-number {
  font-size: 1.125rem;
  font-weight: 600;
}

.calendar-task {
  font-size: 0.6875rem;
  padding: 0.25rem 0.375rem;
  margin-bottom: 0.25rem;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.calendar-task.urgent {
  background: rgba(255, 59, 48, 0.12);
  color: var(--danger);
}

.calendar-task.soon {
  background: rgba(255, 159, 10, 0.12);
  color: #cc7700;
}

.calendar-task.ok {
  background: rgba(52, 199, 89, 0.12);
  color: #248a3d;
}

.calendar-more {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  text-align: center;
}

/* ==================== STATS ==================== */
.stats-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  background: var(--bg-tertiary);
  padding: 0.25rem;
  border-radius: var(--radius-md);
}

.stats-tab {
  flex: 1;
  padding: 0.625rem 1rem;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  font-weight: 500;
}

.stats-tab:hover {
  background: transparent;
  transform: none;
  box-shadow: none;
  color: var(--text-primary);
}

.stats-tab.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Season header */
.season-header {
  background: linear-gradient(135deg, var(--accent) 0%, #5856d6 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.season-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.season-subtitle {
  font-size: 0.875rem;
  opacity: 0.9;
}

.season-wins {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.2);
}

.season-win-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.season-win-count {
  font-size: 1.25rem;
  font-weight: 600;
}

.season-win-label {
  font-size: 0.8125rem;
  opacity: 0.9;
}

/* Rivalry message */
.rivalry-message {
  background: linear-gradient(135deg, #5856d6 0%, #af52de 100%);
  color: white;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  text-align: center;
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.rivalry-sub {
  font-size: 0.8125rem;
  opacity: 0.85;
  margin-top: 0.375rem;
  font-weight: 400;
}

/* Leaderboard */
.leaderboard-section {
  margin-bottom: 1.5rem;
}

.leaderboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.player-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.player-card.leader {
  border-color: #ffcc00;
  box-shadow: 0 0 0 1px #ffcc00, var(--shadow-md);
}

.player-rank {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8125rem;
}

.player-card.leader .player-rank {
  background: linear-gradient(135deg, #ffcc00 0%, #ff9500 100%);
  color: #1d1d1f;
}

.player-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0.5rem 0 0.25rem;
}

.player-points {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, #5856d6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.player-points span {
  font-size: 0.8125rem;
  font-weight: 400;
  -webkit-text-fill-color: var(--text-tertiary);
}

.player-level {
  margin: 0.75rem 0;
}

.level-title {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}

.level-progress {
  background: var(--bg-tertiary);
  border-radius: 6px;
  height: 6px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.level-progress-fill {
  background: linear-gradient(90deg, var(--accent), #5856d6);
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease-out;
}

.level-next {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.375rem;
}

.player-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 1rem 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 1.125rem;
  font-weight: 600;
}

.stat-label {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.stat-item.streak .stat-value {
  color: var(--danger);
}

.player-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.375rem;
  margin-top: 0.75rem;
}

.badge-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-tertiary);
  border-radius: 20px;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
}

.badge-icon {
  font-size: 0.875rem;
}

.badge-name {
  color: var(--text-secondary);
}

/* Challenges */
.challenges-section {
  margin-bottom: 1.5rem;
}

.challenges-section h3 {
  font-size: 1.0625rem;
  margin-bottom: 1rem;
}

.challenges-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}

.challenge-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.challenge-card.completed {
  border-color: var(--success);
  background: rgba(52, 199, 89, 0.04);
}

.challenge-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.challenge-icon {
  font-size: 1.25rem;
}

.challenge-name {
  font-weight: 600;
  font-size: 0.9375rem;
}

.challenge-progress-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.challenge-user-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.challenge-user-name {
  font-size: 0.75rem;
  width: 55px;
  color: var(--text-secondary);
}

.challenge-bar {
  flex: 1;
  background: var(--bg-tertiary);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

.challenge-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.challenge-bar-fill.ronan { background: var(--accent); }
.challenge-bar-fill.camille { background: #af52de; }
.challenge-bar-fill.done { background: var(--success); }

.challenge-count {
  font-size: 0.75rem;
  width: 40px;
  text-align: right;
  color: var(--text-secondary);
}

.challenge-count.done {
  color: var(--success);
  font-weight: 600;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.stat-card.full-width {
  grid-column: 1 / -1;
}

.stat-card h3 {
  font-size: 0.9375rem;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-weight: 500;
}

.chart-container {
  position: relative;
  width: 100%;
  min-height: 200px;
  max-height: 280px;
}

/* Delay lists */
.delay-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.delay-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.delay-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.delay-item-value {
  font-weight: 600;
  margin-left: 0.75rem;
}

.delay-item-value.positive { color: var(--danger); }
.delay-item-value.negative { color: var(--success); }

.delay-empty {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* Season History */
.season-history-section {
  margin-top: 1.5rem;
}

.season-history-section h3 {
  font-size: 1.0625rem;
  margin-bottom: 1rem;
}

.season-history-list {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.season-history-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.season-history-item:last-child {
  border-bottom: none;
}

.season-history-name {
  font-weight: 500;
}

.season-history-winner {
  color: var(--accent);
  min-width: 90px;
  text-align: center;
}

.season-history-score {
  color: var(--text-tertiary);
  min-width: 60px;
  text-align: right;
}

/* Rules */
.rules-section {
  margin-top: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.rules-section summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9375rem;
}

.rules-content {
  padding: 0 1rem 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.rules-content h4 {
  color: var(--text-primary);
  margin: 1.25rem 0 0.5rem;
  font-size: 0.9375rem;
}

.rules-content h4:first-child {
  margin-top: 0;
}

.rules-content ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.rules-table {
  width: auto;
  margin: 0.5rem 0;
  font-size: 0.8125rem;
  display: inline-block;
  margin-right: 1.5rem;
  vertical-align: top;
  border-collapse: collapse;
}

.rules-table th,
.rules-table td {
  padding: 0.375rem 0.75rem;
  text-align: left;
  border: 1px solid var(--border);
}

.rules-table th {
  background: var(--bg-tertiary);
  font-weight: 500;
}

/* ==================== BADGE POPUP ==================== */
.badge-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.badge-popup-content {
  background: linear-gradient(135deg, #5856d6 0%, #af52de 100%);
  color: white;
  padding: 2.5rem 3rem;
  border-radius: var(--radius-xl);
  text-align: center;
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: var(--shadow-xl);
}

.badge-popup-icon {
  font-size: 4rem;
  margin-bottom: 0.75rem;
  animation: bounce 0.6s ease infinite;
}

.badge-popup-title {
  font-size: 1.375rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.badge-popup-name {
  font-size: 1rem;
  opacity: 0.9;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ==================== UNDO TOAST ==================== */
.undo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 999;
  animation: slideUp 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.undo-toast-text {
  font-size: 0.9375rem;
}

.undo-toast-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: inherit;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

.undo-toast-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: none;
  box-shadow: none;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ==================== ACTIVITY LOG ==================== */
.log-section {
  max-width: 600px;
  margin: 0 auto;
}

.activity-log {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.log-date-group {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.log-date-header {
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: capitalize;
  border-bottom: 1px solid var(--border);
}

.log-items {
  display: flex;
  flex-direction: column;
}

.log-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.log-item:last-child {
  border-bottom: none;
}

.log-time {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  min-width: 45px;
}

.log-task {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.log-user {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.log-user.ronan {
  background: rgba(0, 113, 227, 0.12);
  color: var(--accent);
}

.log-user.camille {
  background: rgba(175, 82, 222, 0.12);
  color: #af52de;
}

/* ==================== SHARE ==================== */
.share-btn {
  display: block;
  margin: 1.5rem auto 0;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #5856d6 0%, #af52de 100%);
}

.share-btn:hover {
  background: linear-gradient(135deg, #6866e0 0%, #b962e8 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(88, 86, 214, 0.3);
}

.share-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(88, 86, 214, 0.2);
}

.share-card {
  width: 340px;
  padding: 28px;
  background: linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 100%);
  border-radius: var(--radius-xl);
  color: white;
  font-family: var(--font-sans);
  position: fixed;
  top: 0;
  left: 0;
  visibility: hidden;
  pointer-events: none;
  box-shadow: var(--shadow-xl);
}

.share-card.visible {
  position: relative;
  top: auto;
  left: auto;
  visibility: visible;
  pointer-events: auto;
  margin: 1rem auto;
}

.share-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.share-card-logo {
  font-size: 18px;
  font-weight: 600;
}

.share-card-date {
  font-size: 14px;
  opacity: 0.6;
}

.share-card-user {
  text-align: center;
  margin-bottom: 20px;
}

.share-card-user .user-name {
  font-size: 32px;
  font-weight: 700;
}

.share-card-user .user-level {
  font-size: 18px;
  opacity: 0.8;
}

.share-card-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.share-stat {
  text-align: center;
  background: rgba(255,255,255,0.08);
  padding: 16px 12px;
  border-radius: var(--radius-md);
}

.share-stat-value {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, #ffcc00 0%, #ff9500 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.share-stat-label {
  font-size: 10px;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
}

.share-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 16px 0;
}

.share-badge {
  font-size: 28px;
  background: rgba(255,255,255,0.1);
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 600px) {
  main {
    padding: 1rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .toolbar-row {
    justify-content: space-between;
  }

  .toolbar-buttons {
    flex-direction: column;
  }

  .toolbar-buttons button {
    width: 100%;
  }

  .task-card {
    flex-wrap: wrap;
    padding: 1rem;
  }

  .task-card button {
    width: 100%;
    margin-top: 0.75rem;
  }

  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .calendar-day {
    min-height: auto;
    padding: 0.75rem;
  }

  .calendar-day.past {
    display: none;
  }

  .stats-grid,
  .leaderboard,
  .challenges-list {
    grid-template-columns: 1fr;
  }

  .player-stats {
    gap: 1rem;
  }
}
