/* LogPose Fitness : thème « nuit sur Grand Line ». Thème sombre uniquement, voulu (couleurs de la version Java). */

:root {
  color-scheme: dark;

  --bg: #060b1a;
  --bg-glow: #17285a;
  --surface: #111a33;
  --surface-2: #16213f;
  --surface-3: #1d2b52;
  --border: #263156;
  --text: #eef1fb;
  --text-dim: #9aa4c7;
  --gold: #f4c430;
  --gold-deep: #b8860b;
  --gold-soft: #ffe28a;
  --ember: #e4463a;
  --ember-soft: #ff6b57;
  --green: #4cc46e;
  --dark-text: #1a1200;

  --font-title: 'Pirata One', Georgia, 'Times New Roman', serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.42), 0 2px 6px rgba(0, 0, 0, 0.3);
  --gutter: 16px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 520px at 50% -8%, var(--bg-glow) 0%, rgba(23, 40, 90, 0) 70%),
    radial-gradient(600px 400px at 100% 100%, rgba(228, 70, 58, 0.1) 0%, rgba(228, 70, 58, 0) 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(var(--gutter) + env(safe-area-inset-top)) calc(var(--gutter) + env(safe-area-inset-right))
    calc(40px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.boot {
  text-align: center;
  color: var(--text-dim);
  margin-top: 30vh;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 400;
  letter-spacing: 0.01em;
}

p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

/* ---------- Bandeau de rang ---------- */

.rank {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--surface-3), var(--surface) 70%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.medal {
  flex: none;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--gold-soft), var(--gold-deep));
  border: 2px solid #7a5c00;
  box-shadow:
    0 0 0 3px rgba(244, 196, 48, 0.18),
    0 6px 16px rgba(244, 196, 48, 0.25),
    inset 0 2px 3px rgba(255, 255, 255, 0.45);
  color: var(--dark-text);
  font-family: var(--font-title);
  font-size: 30px;
  line-height: 1;
}

.medal[data-tier='9'] {
  background: linear-gradient(145deg, #fff2b0, var(--gold) 45%, var(--ember));
  box-shadow:
    0 0 0 3px rgba(228, 70, 58, 0.28),
    0 0 26px rgba(244, 196, 48, 0.55),
    inset 0 2px 3px rgba(255, 255, 255, 0.5);
}

.rank-body {
  flex: 1;
  min-width: 0;
}

.rank-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.rank-name {
  font-family: var(--font-title);
  font-size: 24px;
  color: var(--gold);
  line-height: 1.1;
}

.rank-next {
  font-size: 12px;
  color: var(--text-dim);
  text-align: right;
}

.bar {
  position: relative;
  height: 9px;
  margin: 8px 0 7px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.bar-fill {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold) 60%, var(--gold-soft));
  transform-origin: left center;
  transform: scaleX(var(--ratio, 0));
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.rank-bounty {
  font-size: 13px;
  color: var(--text-dim);
}

/* ---------- Cartes ---------- */

.card {
  position: relative;
  padding: 20px 18px 18px;
  background: linear-gradient(180deg, var(--surface), #0e1730);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--ember), var(--ember-soft) 55%, var(--gold));
}

.card.quiet::before {
  background: linear-gradient(90deg, var(--border), var(--surface-3));
}

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(228, 70, 58, 0.14);
  color: var(--ember-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.flavor {
  margin-top: 8px;
  font-size: 13.5px;
  font-style: italic;
  color: var(--text-dim);
}

.circuit {
  margin: 14px 0 14px;
  font-family: var(--font-title);
  font-size: 27px;
  line-height: 1.15;
  color: var(--gold);
}

.goals {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.goal {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
}

.goal-icon {
  flex: none;
  width: 32px;
  text-align: center;
  font-size: 24px;
  line-height: 1;
}

.goal-label {
  flex: 1;
  font-weight: 700;
}

.goal-value {
  color: var(--text-dim);
  font-size: 14.5px;
}

.deadline {
  margin-top: 16px;
  font-weight: 700;
  font-size: 14.5px;
}

.deadline[data-tone='ok'] {
  color: var(--green);
}

.deadline[data-tone='urgent'],
.deadline[data-tone='late'] {
  color: var(--ember-soft);
}

.note {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-dim);
}

/* ---------- Boutons ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 12px 18px;
  border: 0;
  border-radius: 99px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease, box-shadow 0.2s ease;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.97);
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--ember-soft), var(--ember));
  color: #fff;
  box-shadow: 0 8px 22px rgba(228, 70, 58, 0.4);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-soft), var(--gold) 50%, var(--gold-deep));
  color: var(--dark-text);
  box-shadow: 0 8px 22px rgba(244, 196, 48, 0.3);
}

.btn-quiet {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  min-height: 44px;
  font-size: 15px;
}

.btn-small {
  min-height: 44px;
  font-size: 15px;
  width: auto;
  padding: 8px 16px;
}

@media (hover: hover) {
  .btn:hover:not([disabled]) {
    filter: brightness(1.1);
  }
}

.progress {
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--text-dim);
}

.start {
  margin-top: 18px;
}

/* ---------- Séance en cours ---------- */

.workout-head {
  text-align: center;
}

.workout-circuit {
  margin-top: 8px;
  font-size: 15px;
  color: var(--text-dim);
}

.clock {
  margin: 14px 0 4px;
  text-align: center;
  font-family: var(--font-body);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: clamp(76px, 24vw, 104px);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--text);
  text-shadow: 0 0 28px rgba(244, 196, 48, 0.25);
}

.clock[data-status='running'] {
  color: var(--gold-soft);
}

.clock[data-status='finished'] {
  color: var(--ember-soft);
  animation: pulse 1.2s ease-in-out infinite;
}

.clock-hint {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  min-height: 1.4em;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.rounds {
  margin-top: 26px;
  text-align: center;
}

.rounds-label {
  font-size: 12px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--text-dim);
}

.rounds-count {
  font-family: var(--font-body);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 88px;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 26px rgba(244, 196, 48, 0.3);
}

.rounds-buttons {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-top: 8px;
}

.btn-round {
  min-height: 76px;
  font-size: 22px;
}

.workout-end {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

/* ---------- Messages ---------- */

.banners {
  display: grid;
  gap: 10px;
}

.banner {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 5px solid var(--text-dim);
  box-shadow: var(--shadow);
  animation: rise 0.35s ease both;
}

.banner[data-tone='success'] {
  border-left-color: var(--green);
}

.banner[data-tone='gold'] {
  border-left-color: var(--gold);
  background: linear-gradient(135deg, rgba(244, 196, 48, 0.12), var(--surface-2) 60%);
}

.banner[data-tone='warning'] {
  border-left-color: var(--gold);
}

.banner[data-tone='error'] {
  border-left-color: var(--ember);
  background: linear-gradient(135deg, rgba(228, 70, 58, 0.14), var(--surface-2) 60%);
}

.banner {
  position: relative;
}

.banner-title {
  font-weight: 700;
  padding-right: 34px;
}

.banner-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
}

.banner-text {
  margin-top: 2px;
  font-size: 14px;
  color: var(--text-dim);
}

.banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* ---------- Mes données ---------- */

.data h2 {
  font-size: 22px;
  color: var(--gold);
}

.data p {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-dim);
}

.data .row {
  margin-top: 14px;
}

.privacy {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 0 8px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Boîte de dialogue ---------- */

dialog {
  width: min(92vw, 440px);
  padding: 22px 20px 18px;
  color: var(--text);
  background: linear-gradient(180deg, var(--surface-3), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

dialog::backdrop {
  background: rgba(3, 6, 15, 0.72);
  backdrop-filter: blur(3px);
}

dialog h2 {
  font-size: 24px;
  color: var(--gold);
}

dialog p {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 15px;
}

.dialog-actions {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

/* ---------- Animations ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}

.card,
.rank {
  animation: rise 0.4s ease both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
