/* Chouette ! — the screens outside a game. */

/* ---------------------------------------------------------- level pick -- */

.level-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding-top: 4vh;
  text-align: center;
}
.level-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.brand-name {
  display: inline-block;
  margin: 4px 0 0;
  font-size: clamp(2.6rem, 9vw, 3.6rem);
  background: linear-gradient(120deg, var(--ink), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tag { margin: 2px 0 0; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }

.level-card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  padding: 28px 22px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.level-question { margin: 0; font-size: clamp(1.35rem, 5.4vw, 1.9rem); line-height: 1.2; }
.level-sub { margin: 0; color: var(--muted); font-size: 0.94rem; line-height: 1.5; }

.level-select {
  appearance: none;
  width: 100%;
  padding: 16px 46px 16px 18px;
  border-radius: var(--radius);
  border: 2px solid var(--panel-line);
  background: var(--panel-solid);
  color: var(--ink);
  font: 700 1.05rem var(--font);
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%),
                    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 24px) calc(50% + 2px), calc(100% - 18px) calc(50% + 2px);
  background-size: 7px 7px, 7px 7px;
  background-repeat: no-repeat;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.level-select:hover { border-color: var(--accent); }
.level-select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(79, 123, 255, 0.25); }
.level-select option { background: var(--panel-solid); color: var(--ink); }

.level-blurb { margin: 0; min-height: 1.4em; color: var(--gold); font-weight: 700; }
.level-foot { color: var(--muted); font-size: 0.85rem; margin: 0; }

/* -------------------------------------------------------------- topbar -- */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  margin-bottom: 18px;
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
}
.who {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  border-radius: 12px;
}
.who:hover { background: rgba(255, 255, 255, 0.07); }
.who-avatar {
  font-size: 1.7rem;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--panel-solid);
  border-radius: 14px;
  border: 1px solid var(--panel-line);
}
.who-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.who-text strong { font-size: 0.95rem; }
.who-text small { color: var(--muted); font-size: 0.78rem; }

.xp-wrap { flex: 1 1 160px; min-width: 140px; }
.xp-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  border: 1px solid var(--panel-line);
}
.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
.xp-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  animation: sheen 2.6s linear infinite;
}
@keyframes sheen { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.xp-text { display: block; color: var(--muted); font-size: 0.74rem; margin-top: 4px; }
.topstats { display: flex; gap: 8px; }

/* ---------------------------------------------------------------- home -- */

.home { display: flex; flex-direction: column; gap: 22px; }

.hello-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.hello-text h2 { margin: 0 0 4px; font-size: 1.3rem; }
.hello-text p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.section-head h3 { margin: 0; font-size: 1.1rem; }
.section-note { color: var(--muted); font-size: 0.85rem; }

.level-chip {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font: 700 0.82rem var(--font);
  cursor: pointer;
}
.level-chip:hover { background: rgba(255, 255, 255, 0.14); }

.quest {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  margin-bottom: 8px;
}
.quest.done { border-color: rgba(46, 230, 168, 0.5); background: rgba(46, 230, 168, 0.08); }
.quest-icon { font-size: 1.3rem; }
.quest-mid { flex: 1; min-width: 0; }
.quest-text { font-weight: 700; font-size: 0.94rem; }
.quest-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  margin: 6px 0 3px;
  overflow: hidden;
}
.quest-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--good), var(--accent));
  transition: width 0.5s ease;
}
.quest-count { color: var(--muted); font-size: 0.75rem; }
.quest-prize { font-weight: 800; color: var(--gold); font-size: 0.9rem; white-space: nowrap; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.game-card {
  --card: var(--accent);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-line);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--card) 26%, transparent), transparent 70%),
    var(--panel-solid);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.2s ease;
}
.game-card:hover { transform: translateY(-3px); box-shadow: 0 8px 0 rgba(0, 0, 0, 0.35); filter: brightness(1.08); }
.game-card:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.game-icon {
  font-size: 1.9rem;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 32%, transparent);
  border: 1px solid color-mix(in srgb, var(--card) 55%, transparent);
  flex: 0 0 auto;
}
.game-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.game-name { font-size: 1rem; }
.game-tag { color: var(--muted); font-size: 0.8rem; }
.game-best { color: var(--gold); font-size: 0.75rem; font-weight: 700; }

.theme-yellow { --card: #ffc857; }
.theme-pink { --card: #ff5fa2; }
.theme-purple { --card: #b58bff; }
.theme-red { --card: #ff6b5c; }
.theme-blue { --card: #4f7bff; }
.theme-teal { --card: #1fd1c3; }
.theme-orange { --card: #ff8c42; }
.theme-green { --card: #2ee6a8; }
.theme-crimson { --card: #ff2e5f; }

.home-actions { display: flex; flex-direction: column; gap: 12px; }
.wide-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease;
}
.wide-card:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-2px); }
.wide-card.locked { opacity: 0.6; }
.wide-icon { font-size: 1.7rem; }
.wide-body { display: flex; flex-direction: column; gap: 3px; }
.wide-body small { color: var(--muted); font-size: 0.85rem; }
.review-card { border-color: rgba(46, 230, 168, 0.35); }

.action-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.12s ease, background 0.2s ease;
}
.mini-card:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-2px); }
.mini-icon { font-size: 1.5rem; }
.mini-label { font-size: 0.85rem; }

/* ------------------------------------------------------------- results -- */

.results { display: flex; flex-direction: column; gap: 16px; align-items: stretch; text-align: center; }
.results-head { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.results-icon { font-size: 3.4rem; animation: popIn 0.4s cubic-bezier(0.22, 1, 0.36, 1); }
.results-head h2 { margin: 0; font-size: 1.9rem; }
.results-sub { margin: 0; color: var(--muted); font-weight: 700; }

.results-score {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.results-score-value {
  align-self: center;
  font: 800 3.2rem/1 var(--display);
  background: linear-gradient(120deg, var(--gold), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.results-score-label { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; }

.results-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rstat {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rstat-icon { font-size: 1.1rem; }
.rstat strong { font-size: 1.05rem; }
.rstat small { color: var(--muted); font-size: 0.7rem; }

.results-rewards { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.reward {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 200, 87, 0.12);
  border: 1px solid rgba(255, 200, 87, 0.4);
  font-weight: 800;
  animation: popIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.reward:nth-child(2) { animation-delay: 0.1s; }
.reward:nth-child(3) { animation-delay: 0.2s; }
.reward-icon { font-size: 1.2rem; }

.promo {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(255, 200, 87, 0.2), rgba(79, 123, 255, 0.2));
  border: 1px solid var(--gold);
}
.promo span { font-size: 2.2rem; }
.promo div { text-align: left; display: flex; flex-direction: column; }
.promo small { color: var(--gold); font-weight: 700; }

.streak-note { color: var(--gold); font-weight: 800; }

.results-quests, .results-badges { text-align: left; }
.results-quests h3, .results-badges h3 { margin: 0 0 8px; font-size: 1rem; }
.badge-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.results-actions { display: flex; gap: 10px; margin-top: 6px; }
.results-actions .btn { flex: 1; }

/* -------------------------------------------------------- shop & pages -- */

.page-title { margin: 0 0 4px; font-size: 1.6rem; }
.page-sub { margin: 0 0 20px; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.shop-head { margin: 22px 0 10px; font-size: 1.05rem; }

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.shop-card, .avatar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.12s ease, border-color 0.2s ease;
}
.shop-card:hover, .avatar-card:hover { transform: translateY(-3px); }
.shop-card.active, .avatar-card.active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 200, 87, 0.3); }
.shop-card small, .avatar-card small { color: var(--muted); font-weight: 700; font-size: 0.8rem; }
.shop-card.owned small { color: var(--good); }
.swatch { display: flex; width: 100%; height: 34px; border-radius: 10px; overflow: hidden; }
.swatch span { flex: 1; }

.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
.avatar-face { font-size: 2rem; }

/* -------------------------------------------------------------- badges -- */

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-line);
  background: var(--panel);
  text-align: center;
  align-items: center;
}
.badge-icon { font-size: 1.9rem; }
.badge strong { font-size: 0.92rem; }
.badge small { color: var(--muted); font-size: 0.76rem; line-height: 1.35; }
.badge.locked { opacity: 0.5; }
.badge.earned { border-color: rgba(255, 200, 87, 0.45); background: rgba(255, 200, 87, 0.08); }
.badge-date { color: var(--gold); font-size: 0.7rem; font-style: normal; }

/* ------------------------------------------------------------- profile -- */

.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  margin-bottom: 18px;
}
.profile-avatar {
  font-size: 2.6rem;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-line);
}
.profile-meta h2 { margin: 0 0 4px; font-size: 1.3rem; }
.profile-meta p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.stat-box {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}
.stat-icon { font-size: 1.2rem; }
.stat-box strong { font-size: 1.25rem; }
.stat-box small { color: var(--muted); font-size: 0.75rem; text-align: center; }

.record-list { display: flex; flex-direction: column; gap: 8px; }
.record-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
}
.record-icon { font-size: 1.4rem; }
.record-mid { flex: 1; display: flex; flex-direction: column; }
.record-mid small { color: var(--muted); font-size: 0.78rem; }
.record-best { font-weight: 800; color: var(--gold); }

.weak-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.weak-chip {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 92, 122, 0.12);
  border: 1px solid rgba(255, 92, 122, 0.4);
  font-size: 0.85rem;
  font-weight: 700;
}

.settings { display: flex; flex-direction: column; gap: 8px; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  font-weight: 700;
  font-size: 0.94rem;
}

@media (max-width: 520px) {
  .results-stats { grid-template-columns: repeat(2, 1fr); }
  .game-grid { grid-template-columns: 1fr; }
  .topbar { gap: 8px; }
  .xp-wrap { order: 3; flex-basis: 100%; }
}
