/*
  LE MONDE D'ERNEST - app.css
  Interface (HUD) façon jeu de stratégie posée sur la scène 3D,
  puis le Journal (blog) qui s'ouvre par-dessus l'île.
*/

:root {
  --ink: #f4f1ff;
  --ink-soft: #c9c3e3;
  --ink-mute: #9690b3;
  --glass: rgba(16, 13, 30, 0.72);
  --glass-strong: rgba(16, 13, 30, 0.9);
  --edge: rgba(255, 255, 255, 0.12);
  --edge-strong: rgba(255, 255, 255, 0.22);
  --gold: #f5c451;
  --gold-deep: #c8922a;
  --violet: #8b5cf6;
  --rose: #d946ef;
  --green: #34d399;
  --gradient: linear-gradient(120deg, #8b5cf6, #d946ef);
  --title: "Cinzel", Georgia, serif;
  --text: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b0a12;
  color: var(--ink);
  font-family: var(--text);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }
a { color: #d8c8ff; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene.is-hover { cursor: pointer; }
#scene.is-muted { filter: blur(4px) brightness(0.55) saturate(0.9); }
#scene:active { cursor: grabbing; }

/* Panneaux « verre » réutilisables */
.glass {
  background: var(--glass);
  border: 1px solid var(--edge);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

/* ================= ÉCRAN D'ACCUEIL ================= */
.intro {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background:
    radial-gradient(60rem 40rem at 50% 120%, rgba(139, 92, 246, 0.35), transparent 60%),
    linear-gradient(180deg, rgba(11, 10, 18, 0.35), rgba(11, 10, 18, 0.85));
  transition: opacity 1.1s ease, visibility 1.1s;
}
.intro.is-leaving { opacity: 0; visibility: hidden; }

.intro-card {
  width: min(36rem, 100%);
  text-align: center;
  animation: rise 1.2s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }

.intro-kicker {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
}
.intro h1 {
  margin: 0;
  font-family: var(--title);
  font-weight: 800;
  font-size: clamp(2.8rem, 11vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}
.intro h1 span {
  background: linear-gradient(120deg, #f5c451, #f0abfc 60%, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro-sub {
  margin: 1.5rem auto 1.5rem;
  max-width: 30rem;
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.intro-hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--ink-mute);
}
kbd {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--edge-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
}

.btn-enter {
  position: relative;
  padding: 1rem 2.4rem;
  border: 0;
  border-radius: 999px;
  font-family: var(--title);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  color: #1a1203;
  background: linear-gradient(180deg, #ffe08a, var(--gold) 45%, var(--gold-deep));
  box-shadow: 0 0 0 1px rgba(255, 224, 138, 0.6) inset, 0 12px 40px -8px rgba(245, 196, 81, 0.55);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
.btn-enter:not(:disabled):hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 0 0 1px rgba(255, 224, 138, 0.8) inset, 0 16px 50px -8px rgba(245, 196, 81, 0.75); }
.btn-enter:disabled { filter: grayscale(0.7) brightness(0.7); cursor: progress; }

.intro-alt { margin: 1.5rem 0 0; font-size: 0.9rem; color: var(--ink-mute); }

/* ================= HUD ================= */
.hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud > * { animation: hudIn 0.8s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes hudIn { from { opacity: 0; transform: translateY(-10px); } }

/* Fiche du personnage */
.player {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 1rem 0.7rem 0.7rem;
  border-radius: 1rem;
  background: var(--glass);
  border: 1px solid var(--edge);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.player-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 0.9rem;
  font-family: var(--title);
  font-weight: 800;
  background: var(--gradient);
  box-shadow: 0 0 0 2px rgba(245, 196, 81, 0.75), 0 6px 20px -6px rgba(139, 92, 246, 0.8);
}
.player-level {
  position: absolute;
  bottom: -0.45rem;
  right: -0.45rem;
  padding: 0.05rem 0.35rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  color: #1a1203;
  background: var(--gold);
  border-radius: 6px;
}
.player-name { margin: 0; font-family: var(--title); font-weight: 700; font-size: 1rem; }
.player-class { margin: 0.05rem 0 0.4rem; font-size: 0.78rem; color: var(--ink-mute); }
.xp {
  width: 11rem;
  height: 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.xp-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), #f0abfc);
  transition: width 0.8s cubic-bezier(.2, .8, .2, 1);
}
.xp-text { margin: 0.3rem 0 0; font-family: var(--mono); font-size: 0.68rem; color: var(--ink-mute); }

/* Ressources */
.resources {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.4rem;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  border-radius: 1rem;
  background: var(--glass);
  border: 1px solid var(--edge);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.resources li {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: 0.45rem;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.04);
}
.res-icon { grid-row: span 2; color: var(--gold); font-size: 1.1rem; }
.resources strong { font-size: 0.95rem; line-height: 1.1; }
.res-label { font-size: 0.68rem; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.06em; }
.status-dot {
  grid-row: span 2;
  position: relative;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--green);
}
.status-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
  animation: ping 1.8s ease-out infinite;
}
@keyframes ping { to { transform: scale(2.8); opacity: 0; } }
.res-status strong { color: var(--green); }

/* Quêtes */
.quests {
  position: absolute;
  top: 6.4rem;
  left: 1rem;
  width: 17.5rem;
  border-radius: 1rem;
  background: var(--glass);
  border: 1px solid var(--edge);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}
.quests-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem;
  border: 0;
  background: transparent;
  font-family: var(--title);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.quests-count { font-family: var(--mono); font-size: 0.75rem; color: var(--gold); letter-spacing: 0; }
.quests-list {
  margin: 0;
  padding: 0 0.5rem 0.6rem;
  list-style: none;
  max-height: 45vh;
  overflow-y: auto;
}
.quests.is-collapsed .quests-list { display: none; }
.quest {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  font-size: 0.84rem;
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
}
.quest:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.quest-check {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 4px;
  border: 1.5px solid var(--edge-strong);
  font-size: 0.7rem;
}
.quest.is-done { color: var(--ink-mute); }
.quest.is-done .quest-text { text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.3); }
.quest.is-done .quest-check { background: var(--gold); border-color: var(--gold); color: #1a1203; }
.quest.is-final { margin-top: 0.3rem; color: var(--gold); font-weight: 600; border-top: 1px solid var(--edge); border-radius: 0 0 0.55rem 0.55rem; padding-top: 0.6rem; }
.quest.is-final.is-locked { color: var(--ink-mute); font-weight: 500; }

/* Outils */
.tools {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.tool {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.85rem;
  border: 1px solid var(--edge);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.tool:hover { border-color: var(--gold); transform: scale(1.06); }
.tool svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Barre des lieux */
.dock {
  position: absolute;
  left: 50%;
  bottom: calc(1rem + var(--safe-b));
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  padding: 0.45rem;
  border-radius: 1.2rem;
  background: var(--glass-strong);
  border: 1px solid var(--edge);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.dock ul {
  display: flex;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.dock ul::-webkit-scrollbar { display: none; }
.dock-btn {
  position: relative;
  display: grid;
  place-items: center;
  gap: 0.15rem;
  min-width: 4.4rem;
  padding: 0.45rem 0.4rem 0.4rem;
  border: 1px solid transparent;
  border-radius: 0.85rem;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
}
.dock-btn:hover { background: rgba(255, 255, 255, 0.07); transform: translateY(-3px); }
.dock-btn.is-active { background: rgba(245, 196, 81, 0.14); border-color: rgba(245, 196, 81, 0.5); }
.dock-icon { font-size: 1.3rem; line-height: 1; }
.dock-name { font-size: 0.68rem; color: var(--ink-soft); white-space: nowrap; }
.dock-btn.is-new::after {
  content: "";
  position: absolute;
  top: 0.35rem;
  right: 0.7rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

/* ================= ÉTIQUETTES 3D ================= */
.labels { position: fixed; inset: 0; z-index: 10; pointer-events: none; overflow: hidden; }
.label {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem 0.3rem 0.4rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink);
  background: rgba(16, 13, 30, 0.78);
  border: 1px solid var(--edge);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transform: translate(-50%, -100%);
  transition: opacity 0.25s, border-color 0.2s, background-color 0.2s;
  will-change: transform;
}
.label-icon {
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
}
.label.is-new .label-icon { background: var(--gold); color: #1a1203; box-shadow: 0 0 12px rgba(245, 196, 81, 0.7); }
.label.is-hover, .label.is-active { border-color: var(--gold); background: rgba(40, 28, 70, 0.92); }
.label.is-hidden { opacity: 0; }
.label::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 8px;
  background: inherit;
  border-right: 1px solid var(--edge);
  border-bottom: 1px solid var(--edge);
  transform: translateX(-50%) rotate(45deg);
}

/* ================= PANNEAU ================= */
.panel {
  position: fixed;
  z-index: 30;
  top: 1rem;
  right: 1rem;
  bottom: 1rem;
  width: min(30rem, calc(100% - 2rem));
  display: flex;
  flex-direction: column;
  border-radius: 1.3rem;
  background: rgba(14, 11, 26, 0.9);
  border: 1px solid var(--edge-strong);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: panelIn 0.45s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes panelIn { from { opacity: 0; transform: translateX(30px); } }
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  border-radius: 1.3rem 1.3rem 0 0;
  background: linear-gradient(90deg, var(--gold), var(--rose), var(--violet));
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--edge);
}
.panel-kicker {
  margin: 0 0 0.35rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.panel h2 { margin: 0; font-family: var(--title); font-weight: 700; font-size: 1.65rem; line-height: 1.15; }
.panel-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 0.7rem;
  border: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}
.panel-close:hover { border-color: var(--gold); }
.panel-close svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 1.5rem;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
.panel-body > * + * { margin-top: 1rem; }
.panel-body p { margin: 0; }
.panel-body strong { color: var(--ink); }
.panel-body h3 {
  margin: 1.5rem 0 0.6rem;
  font-family: var(--title);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.panel-body .lead { font-size: 1.05rem; color: var(--ink); }

.panel-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--edge);
}
.panel-nav {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: transparent;
  font-size: 0.85rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.panel-nav:hover { color: var(--ink); border-color: var(--gold); }

/* Contenus du panneau */
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.chips li {
  padding: 0.18rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--edge);
  border-radius: 999px;
}

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.stat {
  padding: 0.75rem 0.9rem;
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--edge);
}
.stat dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute); }
.stat dd { margin: 0.15rem 0 0; color: var(--ink); font-weight: 600; font-size: 0.92rem; }

.skill-row + .skill-row { margin-top: 1rem; }
.skill-row header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.35rem; }
.skill-row h4 { margin: 0; font-size: 0.95rem; color: var(--ink); }
.skill-row .lvl { font-family: var(--mono); font-size: 0.72rem; color: var(--gold); }
.bar { height: 0.4rem; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-bottom: 0.55rem; }
.bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--rose)); animation: grow 1s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }

.list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.6rem; }
.list li { position: relative; padding-left: 1.3rem; }
.list li::before { content: "◆"; position: absolute; left: 0; top: 0.05rem; font-size: 0.7rem; color: var(--gold); }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--edge-strong);
  color: var(--ink-soft);
}
.tag-live { color: var(--green); border-color: rgba(52, 211, 153, 0.45); }
.tag-gold { color: var(--gold); border-color: rgba(245, 196, 81, 0.5); }
.tag-build { color: #fb923c; border-color: rgba(251, 146, 60, 0.5); }

.links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--edge-strong);
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s, transform 0.2s;
}
.link-btn:hover { border-color: var(--gold); transform: translateY(-2px); }
.link-btn.primary { color: #1a1203; border: 0; background: linear-gradient(180deg, #ffe08a, var(--gold) 50%, var(--gold-deep)); }

.mini-cards { display: grid; gap: 0.6rem; }
.mini-card {
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--edge);
}
.mini-card h4 { margin: 0 0 0.25rem; color: var(--ink); font-size: 0.98rem; display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.mini-card p { margin: 0 0 0.5rem; font-size: 0.9rem; }
.mini-card a { font-size: 0.85rem; font-weight: 600; margin-right: 0.8rem; }

.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; padding: 0 0 1.1rem 1.4rem; border-left: 2px solid var(--edge); }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 0.35rem; width: 12px; height: 12px; border-radius: 50%; background: #1b1530; border: 2px solid var(--edge-strong); }
.timeline li.now::before { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 10px rgba(245, 196, 81, 0.7); }
.timeline .when { font-family: var(--mono); font-size: 0.75rem; color: var(--gold); }
.timeline h4 { margin: 0.1rem 0; color: var(--ink); font-size: 0.98rem; }
.timeline p { font-size: 0.9rem; }

.copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.6rem 0.55rem 0.9rem;
  border: 1px dashed var(--edge-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.copy span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy span:last-child { flex: none; padding: 0.15rem 0.6rem; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--ink); font-family: var(--text); font-size: 0.75rem; font-weight: 600; }
.copy:hover { border-color: var(--gold); }

.final {
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  border: 1px solid rgba(245, 196, 81, 0.45);
  background: linear-gradient(135deg, rgba(245, 196, 81, 0.12), rgba(217, 70, 239, 0.1));
  color: var(--ink);
}

/* ================= NOTIFICATIONS ================= */
.toasts {
  position: fixed;
  z-index: 50;
  top: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 1.1rem 0.65rem 0.7rem;
  border-radius: 999px;
  background: rgba(20, 15, 36, 0.92);
  border: 1px solid rgba(245, 196, 81, 0.55);
  box-shadow: 0 12px 40px -10px rgba(245, 196, 81, 0.4);
  animation: toastIn 0.5s cubic-bezier(.2, .8, .2, 1) both, toastOut 0.5s ease 3s forwards;
}
.toast-icon {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe08a, var(--gold-deep));
  color: #1a1203;
  font-size: 1rem;
}
.toast-title { margin: 0; font-size: 0.7rem; font-family: var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); }
.toast-text { margin: 0; font-size: 0.92rem; font-weight: 600; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(0.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

.fallback {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-content: center;
  gap: 1rem;
  text-align: center;
  background: #0b0a12;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 64rem) {
  .quests { width: 15rem; }
  .res-label { display: none; }
}

@media (max-width: 46rem) {
  .player { top: 0.6rem; left: 0.6rem; padding: 0.5rem 0.75rem 0.5rem 0.5rem; }
  .player-avatar { width: 2.6rem; height: 2.6rem; font-size: 0.9rem; }
  .player-class { display: none; }
  .xp { width: 7.5rem; margin-top: 0.3rem; }
  .resources { top: auto; bottom: calc(5.6rem + var(--safe-b)); right: 50%; transform: translateX(50%); }
  .resources li { padding: 0.3rem 0.55rem; }
  .quests { top: 4.9rem; left: 0.6rem; width: 13.5rem; }
  .tools { top: 0.6rem; right: 0.6rem; transform: none; flex-direction: row; }
  .tool { width: 2.4rem; height: 2.4rem; }
  .dock { bottom: calc(0.6rem + var(--safe-b)); max-width: calc(100% - 1.2rem); }
  .dock-btn { min-width: 3.8rem; }

  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 78vh;
    border-radius: 1.3rem 1.3rem 0 0;
    padding-bottom: var(--safe-b);
    animation-name: sheetIn;
  }
  .panel::before { border-radius: 1.3rem 1.3rem 0 0; }
  @keyframes sheetIn { from { opacity: 0; transform: translateY(40px); } }
  .panel-head { padding: 1.2rem 1.2rem 0.9rem; }
  .panel-body { padding: 1rem 1.2rem 1.2rem; }
  .panel h2 { font-size: 1.35rem; }
  .toasts { top: 4.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
