/* Doigts Magiques V3 — couche visuelle. Identité frappe : encre, corail, menthe, touches. */

:root {
  --v3-ink: #122033;
  --v3-ink-soft: #3d5168;
  --v3-coral: #e85d3a;
  --v3-coral-deep: #c44728;
  --v3-mint: #1f9d72;
  --v3-gold: #c9891a;
  --v3-paper: rgba(255, 252, 248, 0.94);
  --v3-line: rgba(18, 32, 51, 0.12);
  --v3-shadow: 0 12px 32px rgba(18, 32, 51, 0.08);
  --bg-1: #e4f1fb;
  --bg-2: #f3f6fb;
  --bg-3: #fff1ea;
  --ink: var(--v3-ink);
  --accent: var(--v3-coral);
  --accent-dark: var(--v3-coral-deep);
  --radius: 14px;
}

.v3-dash,
.v3-page {
  width: min(72rem, calc(100% - 2rem));
  margin: 0.75rem auto 1.25rem;
}

.v3-dash-title,
.v3-page-title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  letter-spacing: -0.03em;
  color: var(--v3-ink);
}

.v3-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.9fr;
  gap: 0.75rem;
  align-items: start;
}

.v3-grid--dash {
  grid-template-columns: 1.15fr 0.85fr;
}

.v3-card {
  background: var(--v3-paper);
  border: 1px solid var(--v3-line);
  border-radius: 14px;
  box-shadow: var(--v3-shadow);
  padding: 0.9rem 1rem 1rem;
  min-width: 0;
}

.v3-card--lead {
  background:
    radial-gradient(120px 80px at 100% 0%, rgba(232, 93, 58, 0.16), transparent 70%),
    linear-gradient(180deg, #fff, #fff8f5);
}

.v3-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--v3-coral-deep);
}

.v3-card-title {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.v3-card-copy,
.v3-muted {
  margin: 0 0 0.75rem;
  color: var(--v3-ink-soft);
  font-size: 0.95rem;
}

.v3-actions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.v3-actions a,
.v3-inline-links a {
  color: var(--v3-ink);
  font-weight: 650;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.v3-actions a {
  display: flex;
  align-items: center;
  min-height: 2.2rem;
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
}

.v3-actions a:hover {
  background: rgba(232, 93, 58, 0.08);
}

.v3-actions a:hover,
.v3-inline-links a:hover {
  border-bottom-color: var(--v3-coral);
}

.v3-identity {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.v3-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-weight: 750;
  flex: none;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.12);
}

.v3-avatar[data-avatar="key-coral"] { background: #e85d3a; }
.v3-avatar[data-avatar="key-mint"] { background: #1f9d72; }
.v3-avatar[data-avatar="key-ink"] { background: #122033; }
.v3-avatar[data-avatar="key-gold"] { background: #c9891a; }
.v3-avatar[data-avatar="spark"] { background: #d4537e; }
.v3-avatar[data-avatar="comet"] { background: #3b6fd8; }
.v3-avatar[data-avatar="pulse"] { background: #0f8f8a; }
.v3-avatar[data-avatar="rhythm"] { background: #6b4cc4; }
.v3-avatar[data-avatar="ten"] { background: #2f6f4e; }
.v3-avatar[data-avatar="bolt"] { background: #f0a202; color: #122033; }
.v3-avatar[data-avatar="maestro"] { background: #7a1f3d; }
.v3-avatar[data-avatar="legend"] { background: #1b1b1b; }

.v3-xp {
  height: 8px;
  background: rgba(18, 32, 51, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 0.35rem;
}

.v3-xp > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--v3-coral), #f0a202);
  border-radius: inherit;
  width: 0;
  transition: width 180ms ease;
}

.v3-bar {
  width: min(88rem, calc(100% - 1.5rem));
  margin: 0.4rem auto 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.7rem;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--v3-line);
  border-radius: 12px;
}

.v3-bar-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: auto;
  align-items: center;
}

.v3-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 1.8rem;
  padding: 0 0.55rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--v3-line);
  font-size: 0.82rem;
  color: var(--v3-ink);
  text-decoration: none;
}

.v3-pill strong { font-variant-numeric: tabular-nums; }

.v3-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.v3-feed li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.v3-podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.v3-podium article,
.v3-place {
  background: #fff;
  border: 1px solid var(--v3-line);
  border-radius: 14px;
  padding: 0.75rem 0.8rem 0.85rem;
  min-width: 0;
}

.v3-place--1,
.v3-podium article:first-child {
  border-color: rgba(201, 137, 26, 0.55);
  background: linear-gradient(180deg, #fff8e8, #fff);
  box-shadow: 0 10px 24px rgba(201, 137, 26, 0.12);
}

.v3-place--2 { background: linear-gradient(180deg, #f4f7fb, #fff); }
.v3-place--3 { background: linear-gradient(180deg, #fff4ee, #fff); }

.v3-medal {
  margin: 0 0 0.35rem;
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--v3-ink);
  color: #fff;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.v3-place--1 .v3-medal { background: #c9891a; color: #122033; }
.v3-place--2 .v3-medal { background: #8aa0b5; }
.v3-place--3 .v3-medal { background: #c47a52; }

.v3-place-score { margin: 0.35rem 0 0; font-variant-numeric: tabular-nums; }

.v3-you {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin: 0 0 0.8rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: #122033;
  color: #fff;
}

.v3-you strong {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.v3-table-wrap { overflow-x: auto; }

.v3-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.7rem 0 0.85rem;
}

.v3-stats div {
  background: #fff;
  border: 1px solid var(--v3-line);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
}

.v3-stats span,
.v3-stats small {
  display: block;
  color: var(--v3-ink-soft);
  font-size: 0.75rem;
}

.v3-stats strong {
  display: block;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.v3-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.v3-table th,
.v3-table td {
  text-align: left;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid var(--v3-line);
}

.v3-table tr.is-me { background: rgba(232, 93, 58, 0.08); }

.v3-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.v3-filters button {
  min-height: 2.25rem;
  border-radius: 999px;
  border: 1px solid var(--v3-line);
  background: #fff;
  padding: 0 0.8rem;
  cursor: pointer;
  font: inherit;
}

.v3-filters button[aria-pressed="true"] {
  background: var(--v3-ink);
  color: #fff;
  border-color: var(--v3-ink);
}

.v3-achieve-grid,
.v3-avatar-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
}

.v3-achieve {
  border: 1px solid var(--v3-line);
  border-radius: 12px;
  padding: 0.7rem;
  background: #fff;
}

.v3-achieve.is-locked { opacity: 0.72; }
.v3-achieve.is-earned { box-shadow: inset 3px 0 0 var(--v3-mint); }

.v3-tier {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.v3-tier--bronze { color: #8a5a2b; }
.v3-tier--silver { color: #5d6b7a; }
.v3-tier--gold { color: #8a6410; }

.v3-journey {
  display: grid;
  gap: 0.45rem;
}

.v3-journey a,
.v3-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--v3-line);
}

.v3-step-mark {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--v3-mint);
  color: #fff;
  font-size: 0.8rem;
}

.v3-step.is-locked .v3-step-mark { background: #c5d0dc; }

.v3-toast-host {
  position: fixed;
  right: 0.8rem;
  bottom: 0.8rem;
  z-index: 40;
  display: grid;
  gap: 0.45rem;
  width: min(22rem, calc(100% - 1.6rem));
}

.v3-toast {
  background: var(--v3-ink);
  color: #fff;
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  box-shadow: var(--v3-shadow);
}

.v3-toast button {
  margin-top: 0.4rem;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  min-height: 2rem;
  padding: 0 0.6rem;
  cursor: pointer;
}

.v3-thread,
.v3-msg {
  border: 0;
  border-bottom: 1px solid var(--v3-line);
  background: transparent;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0;
  font: inherit;
  cursor: pointer;
  color: inherit;
}

.v3-msg-log {
  display: grid;
  gap: 0.4rem;
  max-height: 24rem;
  overflow: auto;
  margin-bottom: 0.6rem;
}

.v3-msg {
  cursor: default;
  border: 1px solid var(--v3-line);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  width: fit-content;
  max-width: 100%;
}

.v3-msg.is-mine {
  margin-left: auto;
  background: #fff4ef;
}

.v3-form {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.v3-form input,
.v3-form select,
.v3-form textarea {
  font: inherit;
  min-height: 2.5rem;
  border-radius: 10px;
  border: 1px solid var(--v3-line);
  padding: 0.35rem 0.6rem;
  flex: 1;
}

.v3-note {
  font-size: 0.85rem;
  color: var(--v3-ink-soft);
}

.v3-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
}

.home-onboard { padding-bottom: 0.25rem; }
.home-hero--speed { margin-top: 0.25rem; }

.v3-card a:focus-visible,
.v3-filters button:focus-visible,
.v3-form button:focus-visible,
.v3-pill:focus-visible,
.v3-thread:focus-visible,
.v3-toast button:focus-visible,
.v3-avatar-pick button:focus-visible {
  outline: 3px solid var(--v3-ink);
  outline-offset: 2px;
}

.stage-keys {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.85rem 0 0;
  padding: 0;
}

.stage-keys span {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 8px;
  background: #fff;
  color: var(--v3-ink);
  border: 1px solid var(--v3-line);
  box-shadow: 0 3px 0 rgba(18, 32, 51, 0.14);
  font-weight: 750;
  font-size: 0.85rem;
}

.stage-keys span:nth-child(3),
.stage-keys span:nth-child(4) {
  color: #fff;
  background: var(--v3-coral);
  border-color: var(--v3-coral-deep);
}

.v3-profile-head { margin-bottom: 1rem; }

.v3-avatar-pick button {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-align: left;
  font: inherit;
  background: #fff;
  border: 1px solid var(--v3-line);
  border-radius: 12px;
  padding: 0.45rem;
  cursor: pointer;
  color: inherit;
}

.v3-avatar-pick button.is-current {
  border-color: var(--v3-coral);
  box-shadow: 0 0 0 2px rgba(232, 93, 58, 0.2);
}

.v3-avatar-pick button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.v3-table a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: inherit;
  font-weight: 650;
  text-decoration: none;
}

.v3-table .v3-avatar {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 6px;
  font-size: 0.75rem;
}

.v3-table tr.is-me td:first-child {
  box-shadow: inset 3px 0 0 var(--v3-coral);
}

.v3-challenge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.v3-challenge-actions button,
.v3-form button.btn {
  min-height: 2.4rem;
}

.v3-pulse {
  list-style: none;
  margin: 0 0 0.65rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.v3-pulse-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.v3-pulse-row span { min-width: 0; }
.v3-pulse-row a {
  color: inherit;
  font-weight: 650;
  text-decoration: none;
}
.v3-pulse-row strong {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.v3-pulse .v3-avatar {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 6px;
  font-size: 0.75rem;
}

body {
  background:
    radial-gradient(880px 380px at 0% -10%, rgba(232, 93, 58, 0.16), transparent 58%),
    radial-gradient(720px 420px at 100% 0%, rgba(31, 157, 114, 0.14), transparent 52%),
    linear-gradient(180deg, #e7f2fb 0%, #f6f3ee 38%, #fff 100%);
}

.top-bar {
  position: sticky;
  top: 0;
  background: rgba(255, 252, 248, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--v3-line);
}

.v3-bar {
  background: rgba(18, 32, 51, 0.94);
  color: #fff;
  border-color: transparent;
}

.v3-bar .v3-muted,
.v3-bar .v3-identity,
.v3-bar .v3-identity strong { color: #fff; }

.v3-bar .v3-pill {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
}

.v3-card {
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.v3-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(18, 32, 51, 0.1);
}

.home-onboard .home-title {
  letter-spacing: -0.04em;
}

.home-tenfingers {
  background: rgba(255, 252, 248, 0.92);
}

.home-tenfingers-list li,
.home-tenfingers-list li:first-child {
  background: #fff;
  border: 1px solid var(--v3-line);
  border-radius: 12px;
  padding: 0.7rem 0.75rem;
}

.home-activities {
  width: min(72rem, 100%);
  margin: 0.4rem auto 0;
}

.home-activity-card {
  background: rgba(255, 252, 248, 0.94);
}

.home-hero--speed .st-panel {
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(18, 32, 51, 0.08);
}

.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

@media (min-width: 700px) {
  .home-activity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 800px) {
  .home-tenfingers { max-width: 72rem; }
  .home-tenfingers-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
  }
  .home-activity-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .v3-journey { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v3-step {
    border: 1px solid var(--v3-line);
    border-radius: 12px;
    padding: 0.55rem 0.65rem;
    background: #fff;
  }
}

@media (max-width: 900px) {
  .v3-grid,
  .v3-grid--dash,
  .v3-podium {
    grid-template-columns: 1fr;
  }
  .v3-bar { align-items: flex-start; flex-direction: column; }
  .v3-bar-meta { margin-left: 0; }
  .stage-keys span { width: 1.85rem; height: 1.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  .v3-xp > span,
  .v3-toast,
  .v3-card,
  .btn-primary,
  .stage-keys span {
    transition: none;
    animation: none;
  }
  .v3-card:hover,
  .btn-primary:hover { transform: none; }
}
