:root {
  --bg: #11140f;
  --panel: rgba(18, 20, 16, 0.94);
  --card: #1f241b;
  --border: #343c2c;
  --text: #e8e4d8;
  --muted: #9a9686;
  --good: #8fd16a;
  --bad: #ff6b5a;
  --info: #e8c66a;
  --accent: #e8913a;
  --danger: #b8342a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, 'Segoe UI', sans-serif;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The stage keeps the playfield aspect ratio (400×720) and fills as much of the screen as possible. */
#stage {
  position: relative;
  width: min(100vw, calc(100dvh * 400 / 720));
  height: min(100dvh, calc(100vw * 720 / 400));
  overflow: hidden;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ---------- HUD ---------- */

#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: max(8px, env(safe-area-inset-top)) 10px 6px;
  background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0));
  pointer-events: none;
}
#hud button { pointer-events: auto; }

.hud-row {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  white-space: nowrap;
}
.hud-row + .hud-row { margin-top: 4px; }
.hud-day { font-weight: 700; color: var(--accent); margin-right: auto; }
.hud-row .count-up { color: var(--good); font-weight: 700; }
.hud-row .count-down { color: var(--bad); font-weight: 700; }
.hud-row.bars label { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.hud-row.bars .bar { flex: 1; }
.raid-info .hint { margin-left: auto; font-size: 11px; color: var(--muted); }

.hud-btn {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 2px 8px;
  font: inherit;
}

/* ---------- Panel (bottenark) ---------- */

#panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  /* Grows with its content, up to just below the HUD, so screens rarely need scrolling. */
  max-height: calc(100% - 66px - env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-top: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -6px 24px rgba(0,0,0,0.5);
}
#panel.collapsed .panel-body { display: none; }

.panel-toggle {
  align-self: center;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 4px 16px;
}

.panel-body {
  overflow-y: auto;
  scrollbar-color: var(--border) transparent;
  padding: 0 12px max(12px, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

h2 { font-size: 16px; margin: 4px 0 10px; }
h3 { font-size: 14px; margin: 14px 0 6px; color: var(--muted); }
p { margin: 6px 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.card-head .stats { margin-left: auto; font-size: 11px; color: var(--muted); }

.tag { font-size: 10px; padding: 1px 6px; border-radius: 8px; background: #333; }
.tag.bad { background: rgba(255,107,90,0.2); color: var(--bad); }

.bar {
  position: relative;
  height: 12px;
  background: rgba(0,0,0,0.5);
  border-radius: 6px;
  overflow: hidden;
}
.bar > div { height: 100%; background: var(--good); transition: width 0.15s; }
.bar.house > div { background: #d9a441; }
.bar.fence > div { background: #a0784a; }
.bar > span {
  position: absolute; inset: 0;
  font-size: 9px; line-height: 12px; text-align: center;
  color: #fff; text-shadow: 0 0 2px #000;
}
.card .bar { margin-bottom: 6px; }

select, button {
  font: inherit;
  color: var(--text);
  background: #2a3123;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
select { width: 100%; margin-top: 4px; }
button:disabled { opacity: 0.4; }
button.small { padding: 4px 8px; font-size: 12px; }

button.primary {
  display: block;
  width: 100%;
  margin: 12px 0 4px;
  padding: 12px;
  font-weight: 700;
  background: var(--accent);
  border-color: var(--accent);
  color: #1b1208;
}
button.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff; }

.field { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; }
.row { display: flex; gap: 8px; margin-top: 6px; }
.row > button { flex: 1; }
.row > button.primary { margin: 0; }  /* side by side: same height as the other buttons */
.row.wrap { flex-wrap: wrap; }
.row.wrap > button { flex: 0 0 auto; }

.hint { font-size: 12px; color: var(--muted); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.info { color: var(--info); }

.notice {
  background: rgba(232, 198, 106, 0.08);
  border: 1px solid rgba(232, 198, 106, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 13px;
}
.notice.bad { background: rgba(255,107,90,0.08); border-color: rgba(255,107,90,0.35); color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #2a3123; border: 1px solid var(--border); }
button.chip:active { background: #3a4430; }

.report { list-style: none; padding: 0; margin: 0 0 8px; }
.report li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.4; }
.report li.new { animation: report-in 0.6s ease-out; }
@keyframes report-in { from { opacity: 0; transform: translateY(6px); } }
.report li.waiting { border-bottom: 0; color: var(--muted); letter-spacing: 3px; }
.report li.waiting span { animation: report-dot 1.2s infinite; }
.report li.waiting span:nth-child(2) { animation-delay: 0.2s; }
.report li.waiting span:nth-child(3) { animation-delay: 0.4s; }
@keyframes report-dot { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

/* ---------- Survivor tiles ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
  min-width: 0;
}
.tile:active { transform: scale(0.97); }
.tile-name { font-weight: 700; font-size: 13px; }
.tile-sub {
  font-size: 11px;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile-sub.bad { color: var(--bad); }
.tile .bar.mini { width: 100%; height: 6px; }
.tile .bar.mini span { display: none; }
.badges { position: absolute; top: 4px; right: 6px; font-size: 11px; letter-spacing: 1px; }

.avatar {
  --h: 30;
  width: 38px; height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: hsl(var(--h) 35% 32%);
  border: 2px solid hsl(var(--h) 45% 55%);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.age { font-size: 0.8em; font-weight: 400; color: var(--muted); }
.avatar.small { width: 24px; height: 24px; font-size: 10px; border-width: 1px; }
.avatar.large { width: 48px; height: 48px; font-size: 16px; }
.avatar.hero {
  flex: 0 0 50%;
  width: 50%; height: auto;
  aspect-ratio: 1;
  border-radius: 14px;
  border-width: 2px;
  font-size: 40px;
}

/* Survivor modal header: portrait left, info right. */
.survivor-hero { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.hero-info { flex: 1; min-width: 0; }
/* Everyone in a row above the portrait: tap to switch. */
.crew-row { display: flex; align-items: flex-start; gap: 6px; margin: -4px -6px 10px 0; }
.crew { flex: 1; display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 2px; scrollbar-width: none; }
.crew-pick { position: relative; flex: 0 0 auto; padding: 0; border: none; background: none; border-radius: 50%; }
.crew-pick .avatar { filter: grayscale(1) brightness(0.7); transition: filter 0.15s; }
.crew-pick.active .avatar { filter: none; box-shadow: 0 0 0 2px var(--accent); }
.crew-alert, .idle-badge {
  display: grid; place-items: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); color: #1b1208;
  font-size: 11px; font-weight: 800; line-height: 1;
}
.crew-alert { position: absolute; top: -3px; right: -3px; }
.crew-task {
  position: absolute; bottom: -3px; right: -5px;
  padding: 0 2px; border-radius: 6px;
  background: rgba(13, 11, 20, 0.85);
  font-size: 10px; line-height: 14px; letter-spacing: -2px;
}
.idle-badge { display: inline-grid; vertical-align: middle; }
.hero-info h2 { margin: 0 0 2px; font-size: 17px; line-height: 1.2; }
.hero-info .stat-row { margin: 2px 0 6px -6px; }
.hero-info .bar { margin-bottom: 8px; }
.hero-info .chips { margin-bottom: 0; }

/* ---------- Building info ---------- */

.tier-list { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; }
.tier-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.tier-list li.good strong { color: var(--good); }

/* ---------- Confirm ---------- */

.warn-list { list-style: none; padding: 0; margin: 0 0 12px; font-size: 13px; }
.warn-list li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.warn-list button { margin-left: 4px; }

/* ---------- Night summary ---------- */

.notice.night { line-height: 1.45; }
.night-damage { font-size: 12px; color: var(--muted); margin-top: 4px; }
.epitaph { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); font-size: 13px; }
.epitaph em { color: var(--muted); }

/* ---------- Raid orders ---------- */

.raid-orders { display: flex; flex-wrap: wrap; gap: 6px; }
.range-legend span { margin-right: 6px; white-space: nowrap; }
.raid-orders button.active { border-color: var(--accent); background: rgba(232, 145, 58, 0.25); color: #fff; }

/* ---------- Cheat menu ---------- */

.cheat-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.cheat-btn small { color: var(--muted); margin-left: 3px; }
.cheat-btn.done { border-color: rgba(143, 209, 106, 0.5); color: var(--good); }

/* ---------- Update banner ---------- */

.update-banner {
  position: absolute;
  top: 66px; left: 10px; right: 10px;
  z-index: 60;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--accent);
  font-size: 13px;
}

/* ---------- Toast (cheat feedback) ---------- */

.toast {
  position: absolute;
  top: 70px; left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: #1a1208;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  animation: toast 2.6s ease-out forwards;
}
.toast.achievement { background: #e8c66a; white-space: normal; width: max-content; max-width: 90%; text-align: center; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -8px); } 10%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* ---------- Modal ---------- */

#modal {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.55);
  animation: fade 0.15s ease-out;
}
#modal[hidden] { display: none; }

.modal {
  width: 100%;
  max-height: 88%;
  overflow-y: auto;
  padding: 12px 14px max(16px, env(safe-area-inset-bottom));
  background: #171b13;
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.6);
  animation: slide-up 0.18s ease-out;
}

.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.modal-title { flex: 1; min-width: 0; }
.modal-title h2 { margin: 0; }
.icon-btn { padding: 4px 10px; font-size: 18px; line-height: 1; background: transparent; }
.icon-btn.close { margin-left: 4px; }

.task-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.task-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  font-size: 12px;
}
.task-icon { font-size: 20px; }
.task-btn.active { border-color: var(--accent); background: rgba(232, 145, 58, 0.18); color: #fff; }
.task-btn:not(.active) { opacity: 0.5; }

/* The chosen task's options (what to build/craft/invent). */
.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 8px; }
.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 7px 9px;
  font-size: 13px;
  text-align: left;
}
.choice small { font-size: 11px; color: var(--muted); }
.choice-grid.three { grid-template-columns: repeat(3, 1fr); }
.choice .choice-info { color: var(--text); opacity: 0.85; }
.ammo-box {
  display: inline-block;
  margin: 1px 0;
  padding: 1px 6px;
  border: 1px solid rgba(232, 198, 106, 0.5);
  border-radius: 5px;
  background: rgba(232, 198, 106, 0.12);
  color: var(--info);
  font-size: 11px;
  font-weight: 700;
}
.ammo-box.bad { color: var(--bad); border-color: rgba(255, 107, 90, 0.5); background: rgba(255, 107, 90, 0.12); }
.list .ammo-box { margin-left: 6px; }
.choice.active { opacity: 1; border-color: var(--accent); background: rgba(232, 145, 58, 0.18); color: #fff; }
.choice:disabled { opacity: 0.3; }

.list { list-style: none; padding: 0; margin: 0; }
.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

@keyframes fade { from { opacity: 0; } }
@keyframes slide-up { from { transform: translateY(30px); opacity: 0; } }

/* ---------- Splash ---------- */

#splash {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  background: #0d0b14 url(../assets/splash.jpg) center top / cover no-repeat;
  transition: opacity 0.4s;
}
#splash[hidden] { display: none; }
#splash.leaving { opacity: 0; pointer-events: none; }

.splash-actions {
  width: 100%;
  padding: 60px 24px max(28px, env(safe-area-inset-bottom));
  background: linear-gradient(rgba(13, 11, 20, 0), rgba(13, 11, 20, 0.92) 45%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.splash-actions button { width: 100%; padding: 12px; }
.splash-actions button.primary { margin: 0; font-size: 16px; }

/* ---------- Stats, skills, traits ---------- */

.stat-row { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12px; margin: 2px 0 6px; }
.stat-row .stat {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
}
.stat-row .stat:active { background: #2a3123; }
.stat-row .stat.bad { color: var(--bad); }
.modal-title .stat-row { margin: 2px 0 0 -6px; }

.background { font-size: 12px; font-style: italic; margin: 4px 0 8px; }
.background span { font-style: normal; color: var(--muted); }


.stat-value { font-size: 14px; }
.stat-uses { margin: 0; padding-left: 18px; font-size: 13px; }
.stat-uses li { margin-bottom: 4px; }
.stat-scale { width: 100%; border-collapse: collapse; font-size: 13px; }
.stat-scale th { text-align: left; font-weight: 400; font-size: 11px; color: var(--muted); }
.stat-scale td, .stat-scale th { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.stat-scale tr.current td { background: rgba(232, 145, 58, 0.18); font-weight: 700; }

.chip.trait { border-color: rgba(143, 209, 106, 0.4); }
.chip.legend { border-color: #e8c66a; color: #ffe08a; background: rgba(232, 198, 106, 0.15); }
.chip.knows { border-color: rgba(232, 198, 106, 0.5); color: var(--info); }
.chip.wound { border-color: rgba(255, 107, 90, 0.4); color: var(--bad); }

.skills-box { margin: 4px 0 8px; font-size: 12px; }
.skills-box summary { color: var(--muted); cursor: pointer; padding: 4px 0; }
.gear-box { margin: 10px 0 4px; font-size: 12px; }
.gear-box summary { color: var(--muted); cursor: pointer; padding: 6px 0; }
.gear-box[open] summary { margin-bottom: 2px; }
.skills { display: grid; gap: 4px; margin-top: 4px; }
.skill { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; }
.skill-bar.weak > div { background: #b8893a; }

/* ---------- Tech tree ---------- */

/* Branches: each <li> draws a vertical line down to its next sibling and an elbow to its own node. */
.tree-root { font-size: 13px; font-weight: 700; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0 0 0 10px; }
.tree li { position: relative; padding: 8px 0 0 18px; }
.tree li::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-left: 2px solid var(--border);
}
.tree li:last-child::before { bottom: auto; height: 27px; }
.tree li::after {
  content: '';
  position: absolute;
  left: 0; top: 26px;
  width: 16px;
  border-top: 2px solid var(--border);
}
.tree li.lit::after { border-color: var(--good); }
.tree .node { margin-bottom: 0; }
.tree .node .hint { margin: 2px 0 0; }
h3 small { font-weight: 400; font-size: 11px; }
.node-hidden { background: transparent; border-style: dashed; border-left-width: 1px; color: var(--muted); }
.chip.unknown { background: transparent; border-style: dashed; color: var(--muted); }
.node {
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 8px;
}
.node-done { border-left-color: var(--good); }
.node-open { border-left-color: var(--info); }
.node-locked { border-left-color: #555; opacity: 0.85; }
.node-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.node-state { font-size: 11px; color: var(--muted); }
.node-progress { margin: 6px 0; }
.node-progress .bar { height: 8px; }
.node-progress .bar span { display: none; }
.node-reqs { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 4px 0; font-size: 12px; }
.req.ok { color: var(--good); }
.req.missing { color: var(--bad); }
.node-unlocks { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Score ---------- */

.score-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.score-table td { padding: 4px 2px; border-bottom: 1px solid var(--border); }
.score-table td:nth-child(2), .score-table td:nth-child(3) { text-align: right; color: var(--muted); }
.score-table tr.sub td { color: var(--muted); }
.score-table tr.total td { font-size: 16px; font-weight: 800; color: var(--accent); border-bottom: 0; }
.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.row > .btn-link, .row > .primary { flex: 1; }
.hud-day small { color: var(--muted); font-weight: 400; }

/* ---------- Splash (start page) ---------- */

.splash-link, .splash-btn {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  background: rgba(13, 11, 20, 0.6);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}
.splash-link { align-self: center; margin-bottom: 4px; }
.splash-player { margin: 0 0 4px; text-align: center; font-size: 13px; color: var(--muted); }
.splash-player strong { color: var(--text); }
.guest-badge { display: block; font-size: 11px; color: var(--info); }
.diff { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 8px 4px; font-weight: 700; }
.diff small { font-weight: 400; font-size: 10px; color: var(--muted); }
.diff-casual { width: 100%; }
.diff-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.diff-grid .diff { width: 100%; padding: 8px 2px; }
.diff-easy { border-color: #4f7a3a; }
.diff-normal { border-color: #8a7a3a; }
.diff-hard { border-color: #a0602a; }
.diff-brutal { border-color: #a03a2a; }
.diff-infernal { border-color: #b02a4a; }
.diff-insane { border-color: #7a2ab0; }
/* Picking start bonuses: the difficulty buttons step aside for the list. */
#splash.picking .diff, #splash.picking .diff-grid, #splash.picking [data-go="continue"] { display: none; }
.perk-picker { background: rgba(13, 11, 20, 0.85); border: 1px solid rgba(255,255,255,0.15); border-radius: 12px; padding: 10px 12px; }
.perk-picker h3 { margin: 0 0 6px; color: var(--text); }
.perk-list { display: grid; gap: 4px; max-height: 45vh; overflow-y: auto; }
.perk { display: flex; gap: 8px; align-items: flex-start; padding: 6px 4px; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.perk input { margin-top: 3px; accent-color: var(--accent); }
.perk small { color: var(--muted); }
.perk:has(input:disabled) { opacity: 0.5; }
.perk-actions { display: flex; gap: 8px; margin-top: 8px; }
.perk-actions button { flex: 1; }
.splash-account { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 4px; }
.splash-version { margin: 4px 0 0; text-align: center; font-size: 10px; color: var(--muted); }
.splash-version a { color: var(--muted); }

/* ---------- Locked difficulties, achievements tab (start screen) ---------- */

.diff { position: relative; }
.diff.locked { opacity: 0.55; border-style: dashed; color: var(--muted); background: rgba(20, 20, 20, 0.6); }
.diff.locked small { color: var(--muted); }
.diff-won { position: absolute; top: 3px; right: 6px; font-size: 11px; color: var(--good); }
.diff-tip { margin: 0; text-align: center; font-size: 12px; color: var(--info); }
.diff-tip[hidden] { display: none; }

/* Slides in from the right edge, below the support tab. */
.ach-drawer {
  position: absolute;
  right: 0;
  top: calc(12% + 120px);
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  transform: translateX(260px);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.ach-drawer.open { transform: translateX(0); }
.ach-drawer .ach-tab {
  writing-mode: vertical-lr;
  margin-right: -1px;
  padding: 10px 6px;
  position: relative;
  z-index: 1;
  background: rgba(0, 0, 0, 0.55);
  color: #ffe08a;
  border: 1px solid rgba(232, 198, 106, 0.7);
  border-right: none;
  border-radius: 6px 0 0 6px;
  font-size: 16px;
  letter-spacing: 1px;
}
.ach-box {
  width: 260px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 14px 16px 12px;
  background: rgba(13, 11, 20, 0.96);
  border: 1px solid rgba(232, 198, 106, 0.7);
  border-radius: 0 0 0 12px;
  font-size: 13px;
}
.ach-title { margin: 0 0 8px; font-weight: 700; color: #ffe08a; }
.ach-empty, .ach-secret { margin: 6px 0; font-size: 12px; color: var(--muted); }
.ach-item { border-bottom: 1px solid var(--border); padding: 6px 0; }
.ach-item summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.ach-item.earned summary { color: var(--good); }
.ach-item p { margin: 4px 0 0; font-size: 12px; }
.ach-item .ach-next { color: var(--muted); }
.ach-footer { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; }
.ach-footer a { color: var(--muted); }
