:root {
  --bg: #141417;
  --panel: #1d1d22;
  --line: #2c2c34;
  --txt: #e8e8ec;
  --muted: #a5a5b3;
  --acc: #7dd3a8;
  --warn: #e0a458;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}
.brand { font-weight: 700; }
.brand .sub { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 8px; }
.pad-status { font-size: 13px; color: var(--muted); }
.pad-status.on { color: var(--acc); }
main { max-width: 1020px; margin: 0 auto; padding: 20px 16px 40px; }
.lib-head h1 { margin: 0 0 4px; font-size: 24px; }
.hint, .save-note { color: var(--muted); font-size: 13px; }
code { background: #26262e; padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #0c0c0e; }
.card .no-cover {
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c0c0e;
  color: var(--muted);
  font-size: 28px;
}
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.card-body h2 { margin: 0; font-size: 16px; }
.meta { color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 8px; }
button {
  background: var(--acc);
  color: #0c1410;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}
button.ghost { background: transparent; color: var(--txt); border: 1px solid var(--line); font-weight: 400; }
button.danger { background: transparent; color: #e08a8a; border: 1px solid #4a2b2b; font-weight: 400; }
button:hover { filter: brightness(1.08); }
.empty {
  margin-top: 16px;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 16px;
}
.warn {
  margin-top: 12px;
  border: 1px solid #4d3d20;
  background: #241d0e;
  color: #f0c98a;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}
.player-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.now-playing { font-weight: 700; }
#emu-box {
  width: 100%;
  aspect-ratio: 4/3;
  max-height: 72vh;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
#emu-box #game { width: 100%; height: 100%; }
#emu-box:fullscreen { max-height: none; aspect-ratio: auto; border-radius: 0; border: 0; background: #000; }
#emu-box:-webkit-full-screen { max-height: none; aspect-ratio: auto; border-radius: 0; border: 0; background: #000; }
.pad-map { margin-top: 12px; color: var(--muted); }
.friend-box {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
}
.friend-msg { font-size: 22px; font-weight: 700; max-width: 28em; }
#btn-friend-play { font-size: 18px; padding: 14px 44px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }
