/* ============================================================
   RitPlay · App Shell — navegação inferior + hub estilo app.
   Estrutura inspirada na referência RITPLAY-WEB, traduzida para
   a paleta oficial (coral #ff523d + tons pêssego). Carregado
   depois de styles.css e app-polish.css.
   ============================================================ */

:root {
  --shell-ink: #2a201d;
  --shell-muted: rgba(58, 40, 36, 0.62);
  --shell-card-bg: #fffdfc;
  --shell-card-border: rgba(76, 37, 31, 0.12);
  --shell-coral: #ff523d;
  --shell-coral-soft: #ffe3dc;
  --shell-warm: #c2533f;
  --shell-gold: #d98a1f;
  --shell-gold-soft: #fdedd2;
  --shell-deep: #7a4438;
  --shell-deep-soft: #f3e2dc;
  --shell-nav-height: 64px;
}

[data-theme="dark"] {
  --shell-ink: #f5ece8;
  --shell-muted: rgba(245, 236, 232, 0.6);
  --shell-card-bg: #2e2421;
  --shell-card-border: rgba(255, 255, 255, 0.09);
  --shell-coral-soft: rgba(255, 82, 61, 0.18);
  --shell-gold-soft: rgba(217, 138, 31, 0.16);
  --shell-deep-soft: rgba(255, 255, 255, 0.07);
}

/* ============================================================
   Barra de navegação inferior
   ============================================================ */

#shell-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2147483000;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  height: calc(var(--shell-nav-height) + env(safe-area-inset-bottom, 0px));
  padding: 4px 8px env(safe-area-inset-bottom, 0px);
  background: rgba(31, 23, 21, 0.96);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -8px 28px rgba(24, 13, 10, 0.24);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

[data-theme="dark"] #shell-bottom-nav {
  background: rgba(20, 15, 14, 0.97);
}

#shell-bottom-nav.shell-nav-hidden {
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
}

.shell-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  color: rgba(255, 244, 240, 0.66);
  -webkit-tap-highlight-color: transparent;
}

.shell-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 28px;
  border-radius: 12px;
  transition: background-color 0.22s ease, color 0.22s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.shell-nav-icon svg {
  width: 20px;
  height: 20px;
}

.shell-nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}

.shell-nav-item.is-active {
  color: var(--shell-coral);
}

.shell-nav-item.is-active .shell-nav-icon {
  background: rgba(255, 82, 61, 0.2);
  transform: translateY(-2px) scale(1.06);
  color: var(--shell-coral);
}

.shell-nav-item.is-active .shell-nav-label {
  font-weight: 700;
}

.shell-nav-item:active .shell-nav-icon {
  transform: scale(0.88);
}

/* ============================================================
   Hub (menu Início) — vira página inteira, não diálogo
   ============================================================ */

#app-root-menu {
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 121, 102, 0.16), transparent 60%),
    var(--bg-color, #fff5f2) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  padding: 0 !important;
  overflow-y: auto;
}

.shell-hub {
  width: 100% !important;
  max-width: 470px !important;
  margin: 0 auto;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 12px 16px calc(var(--shell-nav-height) + env(safe-area-inset-bottom, 0px) + 24px) !important;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
  animation: none !important;
  text-align: left;
}

.shell-hub > * {
  flex-shrink: 0;
}

.shell-hub h3,
.shell-hub h4,
.shell-hub h5,
.shell-hub p,
.shell-bento-copy {
  text-align: left;
}


/* Topbar com marca */
.shell-hub-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px;
}

.shell-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shell-brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(255, 82, 61, 0.3);
}

.shell-brand-name {
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.18em;
  color: var(--shell-ink);
}

.shell-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--shell-deep-soft);
  color: var(--shell-deep);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.shell-chip--accent {
  background: var(--shell-coral-soft);
  color: var(--shell-coral);
  border: 1px solid rgba(255, 82, 61, 0.25);
}

/* Cards base */
.shell-card {
  background: var(--shell-card-bg);
  border: 1px solid var(--shell-card-border);
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(76, 37, 31, 0.08);
  color: var(--shell-ink);
}

[data-theme="dark"] .shell-card {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

/* Painel de perfil no topo */
.shell-profile-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 24px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.shell-profile-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.shell-profile-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--shell-coral);
  box-shadow: 0 4px 14px rgba(255, 82, 61, 0.28);
  flex-shrink: 0;
}

.shell-profile-copy {
  min-width: 0;
}

.shell-profile-name-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.shell-profile-name-row strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--shell-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 165px;
  text-transform: capitalize;
}

.shell-profile-patent {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}

.shell-patent-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.shell-profile-patent span {
  font-size: 12px;
  font-weight: 600;
  color: var(--shell-muted);
}

.shell-profile-points {
  text-align: right;
  flex-shrink: 0;
}

.shell-kicker {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--shell-muted);
}

.shell-profile-points strong {
  display: block;
  margin-top: 2px;
  font-size: 21px;
  font-weight: 800;
  background: linear-gradient(120deg, #ff523d, #c2533f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}

.shell-patent-progress {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 8px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 82, 61, 0.11);
  overflow: hidden;
}

.shell-patent-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff523d, #ffc15c);
}

.shell-mission-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  padding: 13px 15px;
  cursor: pointer;
}

.shell-mission-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--shell-coral);
  background: rgba(255, 82, 61, 0.1);
}

.shell-mission-icon svg {
  width: 22px;
  height: 22px;
}

.shell-mission-card strong {
  display: block;
  font-size: 13px;
  font-weight: 900;
  color: var(--shell-ink);
}

.shell-mission-card p {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--shell-muted);
}

/* Título de seção */
.shell-section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--shell-ink);
  margin: 2px 2px -4px;
}

/* Bento grid */
.shell-bento {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px !important;
  margin-top: 0 !important;
}

.shell-bento-card {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  padding: 16px !important;
  text-align: left !important;
  cursor: pointer;
  background: var(--shell-card-bg) !important;
  border: 1px solid var(--shell-card-border) !important;
  min-height: 130px;
}

.shell-bento-card--wide {
  grid-column: span 2;
  min-height: 140px;
}

.shell-bento-card--row {
  grid-column: span 2;
  flex-direction: row !important;
  align-items: center;
  min-height: 0;
  padding: 14px 16px !important;
}

.shell-bento-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shell-bento-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.shell-bento-copy h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--shell-ink);
}

.shell-bento-copy p {
  margin: 4px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--shell-muted);
}

.shell-icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  flex-shrink: 0;
}

.shell-icon-tile svg {
  width: 22px;
  height: 22px;
}

.shell-icon-tile--coral {
  background: var(--shell-coral-soft);
  color: var(--shell-coral);
  border: 1px solid rgba(255, 82, 61, 0.18);
}

.shell-icon-tile--warm {
  background: rgba(194, 83, 63, 0.12);
  color: var(--shell-warm);
  border: 1px solid rgba(194, 83, 63, 0.16);
}

.shell-icon-tile--gold {
  background: var(--shell-gold-soft);
  color: var(--shell-gold);
  border: 1px solid rgba(217, 138, 31, 0.2);
}

.shell-icon-tile--deep {
  background: var(--shell-deep-soft);
  color: var(--shell-deep);
  border: 1px solid rgba(122, 68, 56, 0.16);
}

@keyframes shellPulseBadge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.shell-pill-live {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--shell-coral);
  background: var(--shell-coral-soft);
  border: 1px solid rgba(255, 82, 61, 0.25);
  padding: 3px 10px;
  border-radius: 999px;
  animation: shellPulseBadge 2s ease-in-out infinite;
}

.shell-go {
  font-size: 12px;
  font-weight: 700;
  color: var(--shell-coral);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Dica do mestre */
.shell-tip {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(120deg, rgba(255, 82, 61, 0.08), rgba(194, 83, 63, 0.06)) !important;
}

.shell-tip-icon {
  color: var(--shell-coral);
  flex-shrink: 0;
  margin-top: 2px;
}

.shell-tip-icon svg {
  width: 20px;
  height: 20px;
}

.shell-tip h5 {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--shell-ink);
}

.shell-tip p {
  margin: 4px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--shell-muted);
}

.shell-tip p strong {
  color: var(--shell-coral);
}

/* Entradas escalonadas do hub */
@keyframes shellRise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

#app-root-menu:not(.hidden) .shell-profile-panel { animation: shellRise 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.04s both; }
#app-root-menu:not(.hidden) .shell-section-title { animation: shellRise 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both; }
#app-root-menu:not(.hidden) .shell-bento > :nth-child(1) { animation: shellRise 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.14s both; }
#app-root-menu:not(.hidden) .shell-bento > :nth-child(2) { animation: shellRise 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both; }
#app-root-menu:not(.hidden) .shell-bento > :nth-child(3) { animation: shellRise 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.26s both; }
#app-root-menu:not(.hidden) .shell-bento > :nth-child(4) { animation: shellRise 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.32s both; }
#app-root-menu:not(.hidden) .shell-tip { animation: shellRise 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both; }

/* ============================================================
   Ranking — reskin estilo referência (cards limpos, tabs pill)
   ============================================================ */

#ranking-cloud-modal.ranking-screen-root {
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 121, 102, 0.16), transparent 60%),
    var(--bg-color, #fff5f2) !important;
}

#ranking-cloud-modal .ranking-screen {
  max-width: 470px;
  margin: 0 auto;
}

#ranking-cloud-modal .ranking-screen-heading h3 {
  color: var(--shell-ink) !important;
  text-shadow: none !important;
  font-size: 20px !important;
  letter-spacing: 0.04em;
}

#ranking-cloud-modal .ranking-screen-heading p {
  color: var(--shell-muted) !important;
}

#ranking-cloud-modal .ranking-screen-back {
  background: var(--shell-card-bg) !important;
  color: var(--shell-ink) !important;
  border: 1px solid var(--shell-card-border) !important;
  border-radius: 999px !important;
  box-shadow: 0 4px 14px rgba(76, 37, 31, 0.1) !important;
}

/* Tabs em pill container */
#ranking-cloud-tabs.ranking-tabs {
  background: var(--shell-card-bg) !important;
  border: 1px solid var(--shell-card-border) !important;
  border-radius: 14px !important;
  padding: 4px !important;
  gap: 4px !important;
  box-shadow: 0 4px 14px rgba(76, 37, 31, 0.06);
}

#ranking-cloud-tabs .ranking-tab {
  flex: 1;
  border-radius: 10px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: var(--shell-muted) !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  transition: background-color 0.2s ease, color 0.2s ease;
}

#ranking-cloud-tabs .ranking-tab.is-active {
  background: var(--shell-coral-soft) !important;
  color: var(--shell-coral) !important;
  border-color: rgba(255, 82, 61, 0.3) !important;
}

/* Cards de resumo */
#ranking-cloud-summary .ranking-summary-card {
  background: var(--shell-card-bg) !important;
  border: 1px solid var(--shell-card-border) !important;
  border-radius: 16px !important;
  box-shadow: 0 6px 24px rgba(76, 37, 31, 0.07) !important;
}

#ranking-cloud-summary .ranking-summary-title {
  color: var(--shell-muted) !important;
}

#ranking-cloud-summary .ranking-summary-value {
  color: var(--shell-ink) !important;
}

#ranking-cloud-summary .ranking-summary-sub {
  color: var(--shell-muted) !important;
}

#ranking-cloud-summary .ranking-summary-card {
  min-width: 0;
  overflow: hidden;
}

#ranking-cloud-summary .ranking-summary-title,
#ranking-cloud-summary .ranking-summary-value,
#ranking-cloud-summary .ranking-summary-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Painel da lista */
#ranking-cloud-modal .ranking-leaderboard-shell {
  background: var(--shell-card-bg) !important;
  border: 1px solid var(--shell-card-border) !important;
  border-radius: 20px !important;
  box-shadow: 0 10px 30px rgba(76, 37, 31, 0.08) !important;
}

#ranking-cloud-modal .ranking-leaderboard-mode-intro strong {
  color: var(--shell-ink) !important;
}

#ranking-cloud-modal .ranking-leaderboard-mode-intro span {
  color: var(--shell-muted) !important;
}

#ranking-cloud-modal .ranking-leaderboard-head span {
  color: var(--shell-muted) !important;
}

/* Linhas: cards claros e neutros, destaque sutil para o pódio */
#ranking-cloud-modal .ranking-leaderboard-row {
  background: var(--shell-card-bg) !important;
  border: 1px solid var(--shell-card-border) !important;
  border-radius: 14px !important;
  box-shadow: 0 3px 12px rgba(76, 37, 31, 0.06) !important;
  background-image: none !important;
}

#ranking-cloud-modal .ranking-leaderboard-row.is-top {
  border-color: rgba(217, 138, 31, 0.45) !important;
  background: linear-gradient(120deg, rgba(253, 237, 210, 0.7), var(--shell-card-bg) 55%) !important;
}

#ranking-cloud-modal .ranking-leaderboard-row.is-me {
  border-color: rgba(255, 82, 61, 0.45) !important;
  background: linear-gradient(120deg, rgba(255, 227, 220, 0.75), var(--shell-card-bg) 60%) !important;
  position: relative;
}

#ranking-cloud-modal .ranking-leaderboard-row.is-me::after {
  content: "VOCÊ";
  position: absolute;
  top: 0;
  right: 0;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  background: var(--shell-coral);
  color: #fff;
  padding: 2px 8px;
  border-radius: 0 12px 0 10px;
}

#ranking-cloud-modal .ranking-leaderboard-rank {
  color: var(--shell-ink) !important;
  font-weight: 800 !important;
  text-shadow: none !important;
}

#ranking-cloud-modal .ranking-leaderboard-player-copy strong {
  color: var(--shell-ink) !important;
}

#ranking-cloud-modal .ranking-leaderboard-patent span {
  color: var(--shell-muted) !important;
  text-shadow: none !important;
}

#ranking-cloud-modal .ranking-leaderboard-combo,
#ranking-cloud-modal .ranking-leaderboard-precision {
  color: var(--shell-ink) !important;
  text-shadow: none !important;
}

#ranking-cloud-modal .ranking-leaderboard-score span {
  color: var(--shell-coral) !important;
  font-weight: 800 !important;
  text-shadow: none !important;
}

/* ============================================================
   Menu de Exercícios — cards estilo lista da referência
   ============================================================ */

#exercise-library-modal .exercise-selection-card {
  position: relative;
  border-radius: 16px !important;
  border: 1px solid var(--shell-card-border) !important;
  background: var(--shell-card-bg) !important;
  box-shadow: 0 4px 16px rgba(76, 37, 31, 0.07) !important;
  padding: 16px 40px 16px 16px !important;
  text-align: left;
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease;
}

#exercise-library-modal .exercise-selection-card:active {
  transform: scale(0.98);
  border-color: rgba(255, 82, 61, 0.4) !important;
}

#exercise-library-modal .exercise-selection-card::after {
  content: "›";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  color: var(--shell-coral);
  font-weight: 700;
}

#exercise-library-modal .online-cadence-title {
  color: var(--shell-ink) !important;
  font-weight: 800 !important;
}

/* ============================================================
   Telas que convivem com a nav: respiro inferior
   ============================================================ */

#exercise-library-modal .modal-content,
#ranking-cloud-modal {
  padding-bottom: calc(var(--shell-nav-height) + env(safe-area-inset-bottom, 0px) + 18px) !important;
}

body.shell-profile-page {
  padding-bottom: calc(var(--shell-nav-height) + env(safe-area-inset-bottom, 0px) + 12px);
}

@media (prefers-reduced-motion: reduce) {
  #shell-bottom-nav,
  .shell-nav-icon,
  .shell-hub *,
  .shell-pill-live {
    animation: none !important;
    transition: none !important;
  }
}
