:root {
  --bg: #f7ebe3;
  --bg-card: #fbf3ed;
  --bg-card-2: #f3e4da;
  --ink: #1c1412;
  --muted: #8a7a72;
  --red: #b04a4d;
  --red-deep: #9a3d41;
  --red-soft: #e8c5c4;
  --line: #ead9cf;
  --hero-dark: #0c0a0a;
  --tabbar: #faf2eb;
  --stage-1: #e0cbbd;
  --stage-2: #c9b0a0;
  --stage-3: #b89a88;
  --switch-track: #d9c8bc;
  --switch-knob: #ffffff;
  --serif: "Libre Baskerville", "Times New Roman", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --phone-w: 390px;
  --radius: 18px;
  --radius-sm: 14px;
}

html[data-theme="dark"] {
  --bg: #161210;
  --bg-card: #221c19;
  --bg-card-2: #2a2320;
  --ink: #f3ebe4;
  --muted: #a8988e;
  --red: #d07072;
  --red-deep: #e08a8a;
  --red-soft: #4a2e2e;
  --line: #3a322e;
  --tabbar: #1a1512;
  --stage-1: #2a2220;
  --stage-2: #1a1512;
  --stage-3: #0e0c0b;
  --switch-track: #b04a4d;
  --switch-knob: #f7ebe3;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  background: var(--stage-2);
  background-image: radial-gradient(ellipse at 50% 35%, var(--stage-1) 0%, var(--stage-2) 60%, var(--stage-3) 100%);
  font-family: var(--sans);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s ease, color 0.25s ease;
}

button,
a {
  font: inherit;
  color: inherit;
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
}

.stage {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* ——— Téléphone ——— */
.phone {
  width: min(var(--phone-w), calc(100vw - 24px));
  height: min(844px, calc(100dvh - 24px));
  background: var(--bg);
  border-radius: 44px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 0 3px #1a1410,
    0 0 0 10px #8a7364,
    0 0 0 12px #c4a990,
    0 28px 60px rgba(40, 28, 16, 0.32);
  transition: background 0.35s ease, color 0.25s ease;
}

html[data-theme="dark"] .phone {
  box-shadow:
    0 0 0 3px #0a0807,
    0 0 0 10px #3a322e,
    0 0 0 12px #5a4e48,
    0 28px 60px rgba(0, 0, 0, 0.55);
}

/* Hub sans barre statut : header aéré + tabbar collée en bas */
.phone.hub-top {
  padding-top: 20px;
  height: min(844px, calc(100dvh - 24px));
}
.phone.hub-top > .scroll {
  flex: 1 1 auto;
  min-height: 0;
}
.phone.hub-top > .tabbar {
  flex: 0 0 auto;
  display: grid;
  z-index: 20;
  min-height: 58px;
}
.phone.hub-top > .home-indicator {
  flex: 0 0 auto;
  height: 14px;
}
.phone.hub-top > .home-indicator::after {
  bottom: 4px;
  width: 104px;
  height: 4px;
}

/* ——— Status ——— */
.status {
  flex-shrink: 0;
  height: 52px;
  padding: 12px 22px 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  position: relative;
  z-index: 5;
  background: var(--bg);
}

.status-time {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  padding-top: 2px;
}

.notch {
  width: 126px;
  height: 34px;
  background: #0a0a0a;
  border-radius: 20px;
  margin-top: -2px;
  position: relative;
}

.notch::after {
  content: "";
  position: absolute;
  right: 28px;
  top: 11px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1a2230;
  box-shadow: inset 0 0 0 2px #0e1520;
}

.status-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
  color: var(--ink);
}

/* ——— Scroll ——— */
.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 12px 12px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--red) var(--bg-card-2);
}

.scroll::-webkit-scrollbar {
  width: 6px;
}

.scroll::-webkit-scrollbar-track {
  background: var(--bg-card-2);
  border-radius: 99px;
  margin: 8px 0;
}

.scroll::-webkit-scrollbar-thumb {
  background: var(--red);
  border-radius: 99px;
}

.scroll::-webkit-scrollbar-thumb:hover {
  background: var(--red-deep);
}

/* ——— Brand ——— */
.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-top: 2px;
}

.logo {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.05;
  color: var(--ink);
}

.logo .dot {
  color: var(--red);
}

.tagline {
  margin-top: 4px;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

.brand-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

/* ——— Theme switch ——— */
.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-size: 0;
  line-height: 0;
  color: transparent;
  overflow: hidden;
}

.theme-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch .track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--switch-track);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: background 0.3s ease;
}

.theme-switch .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--switch-knob);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
  display: grid;
  place-items: center;
  font-size: 12px;
  line-height: 1;
  color: #8a6a40;
}

.theme-switch .knob::before {
  content: "☀";
}

.theme-switch input:checked + .track {
  background: var(--red);
}

.theme-switch input:checked + .track .knob {
  transform: translateX(22px);
  color: #3a3550;
}

.theme-switch input:checked + .track .knob::before {
  content: "☾";
}

.theme-switch input:focus-visible + .track {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

html[data-theme="dark"] .tab:not(.active) img.tab-ico {
  filter: invert(1) brightness(0.92);
  opacity: 0.85;
}

html[data-theme="dark"] .status-right {
  color: var(--ink);
}

.theme-switch.on-dark .track {
  background: rgba(255, 255, 255, 0.25);
}

.theme-switch.on-dark input:checked + .track {
  background: var(--red);
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--ink);
  position: relative;
  border-radius: 50%;
}

.icon-btn img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.quick-ico img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.tab img.tab-ico {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
  margin-bottom: 1px;
}

.quest-ico img,
.stat-card .si img,
.menu-tile > img.tile-ico {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.quest-ico {
  overflow: hidden;
}

.quest-ico img {
  width: 42px;
  height: 42px;
}

.icon-btn .badge {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid var(--bg);
}

/* ——— Hero ——— */
.hero {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  min-height: 268px;
  background: var(--hero-dark);
  color: #fff;
  margin-bottom: 14px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: 70% center;
  opacity: 0.95;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    rgba(8, 6, 6, 0.96) 0%,
    rgba(8, 6, 6, 0.88) 38%,
    rgba(8, 6, 6, 0.35) 68%,
    rgba(8, 6, 6, 0.15) 100%
  );
}

.hero-bookmark {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  display: grid;
  place-items: center;
}

.hero-body {
  position: relative;
  z-index: 1;
  padding: 18px 16px 16px;
  max-width: 72%;
}

.hero-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #d98a8a;
  margin-bottom: 8px;
}

.hero-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 10px;
}

.hero-meta {
  display: flex;
  justify-content: space-between;
  max-width: 210px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 8px;
}

.hero-progress {
  height: 5px;
  width: 210px;
  max-width: 100%;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
  margin-bottom: 14px;
}

.hero-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c45a5c, #e08a88);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--red);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(140, 40, 45, 0.28);
}

.hero-actions {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
}

.hero-cta {
  width: auto;
  min-width: 0;
  padding-left: 20px;
  padding-right: 20px;
}

.hero-tags {
  position: absolute;
  right: 12px;
  bottom: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  font-size: 10px;
  font-weight: 600;
  color: #fff;
}

.tag-diff .dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 2px;
}

.tag-diff .dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

.tag-diff .dots i.on {
  background: #d98a8a;
}

/* ——— Quick grid ——— */
.quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.quick-card {
  position: relative;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 12px 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 1px 0 rgba(80, 40, 30, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.6);
  min-height: 108px;
  text-decoration: none;
  color: inherit;
}

.quick-card .dot-notif {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.quick-ico {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  color: var(--red-deep);
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.quick-label {
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 700;
  color: var(--red-deep);
  line-height: 1.2;
  margin-bottom: 3px;
}

.quick-sub {
  font-size: 9.5px;
  color: var(--muted);
  line-height: 1.25;
}

.mini-bar {
  display: block;
  width: 70%;
  height: 3px;
  border-radius: 99px;
  background: var(--line);
  margin-top: 6px;
  overflow: hidden;
}

.mini-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red-deep), #d07070);
  border-radius: inherit;
}

/* ——— Blocks ——— */
.block {
  margin-bottom: 16px;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.block-head h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.see-all {
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
  white-space: nowrap;
}

.see-all span {
  font-size: 14px;
}

/* ——— Quest card ——— */
.quest-card {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px 12px 12px 10px;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.quest-ico {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  display: grid;
  place-items: center;
}

.quest-title {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 8px;
}

.quest-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red-deep), #d88a88);
}

.frac {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

.quest-reward {
  background: var(--bg-card-2);
  border-radius: 10px;
  padding: 6px 8px;
  text-align: center;
  font-size: 10px;
  line-height: 1.25;
  color: var(--red);
  min-width: 64px;
}

.quest-reward strong {
  display: block;
  font-weight: 700;
}

.quest-reward span {
  display: block;
  font-weight: 500;
  opacity: 0.9;
}

.quest-chev {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

/* ——— Event ——— */
.event-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  min-height: 148px;
  background-size: cover;
  background-position: center;
  color: #fff;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.event-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(10, 8, 8, 0.88) 0%, rgba(10, 8, 8, 0.45) 55%, rgba(10, 8, 8, 0.2) 100%);
}

.event-body {
  position: relative;
  z-index: 1;
}

.event-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #d98a8a;
  margin-bottom: 4px;
}

.event-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.event-timer {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
}

.event-cta {
  position: relative;
  z-index: 1;
  align-self: flex-end;
  padding: 9px 14px;
  font-size: 12px;
}

/* ——— Cases ——— */
.cases {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  scrollbar-width: none;
}

.cases::-webkit-scrollbar {
  display: none;
}

.case-card {
  flex: 0 0 148px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 8px 8px 10px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}

.case-cover {
  position: relative;
  height: 88px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  background-color: #1a1a1a;
  margin-bottom: 8px;
}

.case-card h4 {
  font-family: var(--serif);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 8px;
  min-height: 2.5em;
}

.case-foot {
  display: flex;
  align-items: center;
  gap: 8px;
}

.case-foot .bar {
  flex: 1;
}

.case-foot.meta {
  color: var(--muted);
  font-size: 11px;
  gap: 4px;
}

.case-foot.meta svg {
  color: var(--red);
}

.lock {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
}

/* ——— Tab bar ——— */
.tabbar {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 8px 6px 4px;
  background: var(--tabbar);
  border-top: 1px solid var(--line);
  position: relative;
  z-index: 10;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 2px 6px;
}

.tab svg {
  opacity: 0.9;
}

.tab.active {
  color: var(--red);
}

.home-indicator {
  flex-shrink: 0;
  height: 22px;
  background: var(--tabbar);
  position: relative;
}

.home-indicator::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  width: 120px;
  height: 5px;
  border-radius: 99px;
  background: #1c1412;
}

/* Quêtes — carte compacte accueil */
a.hq-card {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 16px;
  padding: 14px 14px 12px;
  border-radius: 18px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  font: inherit;
}
a.hq-card .hq-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
a.hq-card .hq-card-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
}
a.hq-card .hq-card-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
a.hq-card .hq-card-bar {
  display: block;
  height: 4px;
  border-radius: 99px;
  background: var(--bg-card-2);
  overflow: hidden;
  margin-bottom: 12px;
}
a.hq-card .hq-card-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
  font-style: normal;
}
a.hq-card .hq-card-mission {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}
a.hq-card .hq-card-meta {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
}
a.hq-card .hq-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
a.hq-card .hq-card-reward {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
a.hq-card .hq-card-go {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--red);
}
