/**
 * Memory Move — Progress page (warm, readable, dementia-friendly)
 */

.progress-page {
  --bg: #f4ead8;
  --bg-deep: #e8dcc4;
  --ink: #2c2418;
  --muted: #6b5e4d;
  --accent: #8b5a2b;
  --accent-soft: #a67c52;
  --gold: #b8954a;
  --card: #fffdf8;
  --card-border: #d4c4a8;
  --success: #4a6b52;
  --success-soft: #e8f0e9;
  --neutral: #8a7d6e;
  --neutral-soft: #ebe6de;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(44, 36, 24, 0.08);
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 18px;
  color: var(--ink);
  background: var(--bg);
  background-image: linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  line-height: 1.55;
  padding-bottom: 100px;
}

.progress-page *,
.progress-page *::before,
.progress-page *::after {
  box-sizing: border-box;
}

.progress-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: rgba(255, 253, 248, 0.92);
  border-bottom: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
}

.progress-back {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--accent);
  font-size: 1.25rem;
  text-decoration: none;
  line-height: 1;
}

.progress-back:hover {
  background: var(--bg);
}

.progress-header-title {
  flex: 1;
  text-align: center;
}

.progress-header-title h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
}

.progress-header-title p {
  margin: 4px 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.progress-header-spacer {
  width: 44px;
  flex-shrink: 0;
}

.progress-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 32px;
}

.progress-warm-summary {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--ink);
}

.progress-warm-summary p {
  margin: 0 0 12px;
}

.progress-warm-summary p:last-child {
  margin-bottom: 0;
}

.progress-section-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 14px;
}

.progress-grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.progress-stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 14px 16px;
  box-shadow: var(--shadow);
}

.progress-stat-card .value {
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.2;
}

.progress-stat-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 6px;
}

.progress-trends {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}

.progress-trends ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.progress-trends li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(212, 196, 168, 0.5);
  font-size: 1rem;
  color: var(--ink);
}

.progress-trends li:last-child {
  border-bottom: none;
}

.progress-trends .trend-label {
  color: var(--muted);
  font-size: 0.88rem;
  display: block;
  margin-bottom: 4px;
}

/* Win / loss / draw bar */
.progress-wld-bar {
  display: flex;
  height: 14px;
  border-radius: 8px;
  overflow: hidden;
  margin: 12px 0 8px;
  background: var(--neutral-soft);
}

.progress-wld-bar .seg {
  height: 100%;
  min-width: 2px;
}

.progress-wld-bar .win {
  background: var(--success);
  opacity: 0.85;
}

.progress-wld-bar .loss {
  background: var(--neutral);
  opacity: 0.55;
}

.progress-wld-bar .draw {
  background: var(--accent-soft);
  opacity: 0.5;
}

.progress-wld-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  font-size: 0.88rem;
  color: var(--muted);
}

.progress-wld-legend span::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

.progress-wld-legend .lg-win::before {
  background: var(--success);
  opacity: 0.85;
}
.progress-wld-legend .lg-loss::before {
  background: var(--neutral);
  opacity: 0.55;
}
.progress-wld-legend .lg-draw::before {
  background: var(--accent-soft);
  opacity: 0.5;
}

/* Mini horizontal bars */
.progress-mini-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--neutral-soft);
  margin-top: 6px;
  overflow: hidden;
}

.progress-mini-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--accent-soft));
  border-radius: 4px;
  max-width: 100%;
}

.progress-timeline {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 10px;
  align-items: flex-end;
}

.progress-timeline .tick {
  width: 8px;
  border-radius: 3px 3px 0 0;
  background: var(--gold);
  opacity: 0.65;
  min-height: 4px;
}

.progress-session-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.progress-session-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  border: none;
  background: var(--card);
  font: inherit;
  color: inherit;
}

.progress-session-head:hover {
  background: rgba(255, 253, 248, 0.7);
}

.progress-session-head:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.progress-session-date {
  font-family: var(--serif);
  font-size: 1.1rem;
  margin: 0 0 4px;
}

.progress-session-meta {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

.progress-session-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.progress-pill {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--neutral-soft);
  color: var(--ink);
}

.progress-pill.soft-win {
  background: var(--success-soft);
  color: var(--success);
}

.progress-expand-icon {
  color: var(--muted);
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.progress-session-card.is-open .progress-expand-icon {
  transform: rotate(180deg);
}

.progress-session-body {
  display: none;
  border-top: 1px solid var(--card-border);
  padding: 8px 0 12px;
}

.progress-session-card.is-open .progress-session-body {
  display: block;
}

.progress-game-row {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(212, 196, 168, 0.35);
  font-size: 0.98rem;
}

.progress-game-row:last-child {
  border-bottom: none;
}

.progress-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  margin-bottom: 32px;
}

.progress-btn {
  font: inherit;
  font-size: 0.95rem;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--accent);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.progress-btn:hover {
  background: var(--bg);
}

.progress-btn.danger {
  color: var(--muted);
  border-color: rgba(139, 90, 43, 0.35);
}

.progress-empty {
  text-align: center;
  padding: 48px 24px 32px;
  max-width: 420px;
  margin: 0 auto;
}

.progress-empty .icon {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 16px;
  opacity: 0.45;
}

.progress-empty h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0 0 12px;
}

.progress-empty p {
  color: var(--muted);
  margin: 0 0 24px;
}

.progress-empty a {
  display: inline-block;
  padding: 14px 24px;
  border-radius: 10px;
  background: var(--accent);
  color: #fffdf8;
  text-decoration: none;
  font-weight: 600;
}

.progress-empty a:hover {
  opacity: 0.92;
}

.progress-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  background: rgba(255, 253, 248, 0.95);
  border-top: 2px solid var(--gold);
  backdrop-filter: blur(8px);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.progress-bottom-nav a {
  flex: 1;
  max-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px 16px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.82rem;
}

.progress-bottom-nav a:hover {
  color: var(--ink);
}

.progress-bottom-nav a.active {
  color: var(--accent);
  font-weight: 600;
}

.progress-bottom-nav .nav-icon {
  font-size: 1.35rem;
  line-height: 1;
}

@media (max-width: 480px) {
  .progress-grid-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}
