:root {
  color-scheme: dark;
  --bg: #11130f;
  --bg-soft: #171913;
  --surface: #1d2019;
  --surface-raised: #24281f;
  --surface-hover: #2b3025;
  --border: #34392d;
  --border-strong: #484f3d;
  --text: #f4f1e8;
  --text-muted: #a8aa9c;
  --text-dim: #74786b;
  --lime: #d9f65a;
  --lime-ink: #1b2107;
  --coral: #ff7657;
  --danger: #ff6b6b;
  --success: #65d6a3;
  --sidebar-width: 248px;
  --cover-ratio: 340 / 483;
  --banner-ratio: 16 / 5;
  --shadow: 0 18px 54px rgb(0 0 0 / 28%);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f1e9;
  --bg-soft: #eae8df;
  --surface: #fffdf7;
  --surface-raised: #f0eee5;
  --surface-hover: #e4e2d8;
  --border: #c9cbc0;
  --border-strong: #aeb2a3;
  --text: #1b2118;
  --text-muted: #586053;
  --text-dim: #7a8174;
  --lime: #c9e83a;
  --lime-ink: #182005;
  --shadow: 0 18px 54px rgb(44 52 34 / 14%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    linear-gradient(rgb(255 255 255 / 2%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 2%) 1px, transparent 1px),
    var(--bg);
  background-size: 64px 64px;
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select,
input[type="file"] {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 24px 18px 18px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: #141610;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  margin: 0 8px 34px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--lime-ink);
  border: 1px solid #e8ff7d;
  border-radius: 8px;
  background: var(--lime);
  box-shadow: inset 0 -3px 0 rgb(0 0 0 / 16%);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
  stroke-width: 2.2;
}

.brand-copy {
  display: grid;
}

.brand-copy strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 19px;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--text-dim);
  font-family: "Space Grotesk", sans-serif;
  font-size: 9px;
  font-weight: 700;
}

.primary-nav,
.sidebar-tools {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-item.is-active {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-raised);
}

.nav-item.is-active svg {
  color: var(--lime);
}

.nav-item span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  min-width: 22px;
  padding: 1px 6px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.sidebar-section {
  margin-top: 30px;
}

.sidebar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 10px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.system-list {
  display: grid;
  gap: 2px;
}

.system-button {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 35px;
  padding: 0 12px;
  color: var(--text-muted);
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.system-button:hover,
.system-button.is-active {
  color: var(--text);
  background: var(--surface);
}

.system-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--system-color, var(--lime));
}

.system-button small {
  color: var(--text-dim);
  font-size: 10px;
}

.sidebar-spacer {
  flex: 1;
  min-height: 24px;
}

.sidebar-tools {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.status-pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-pip.is-ready {
  background: var(--success);
  box-shadow: 0 0 0 3px rgb(101 214 163 / 10%);
}

.status-pip.is-warning {
  background: #ffca72;
  box-shadow: 0 0 0 3px rgb(255 202 114 / 10%);
}

.storage-panel {
  margin-top: 16px;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
}

.storage-head {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.storage-track {
  height: 4px;
  margin: 10px 0 9px;
  overflow: hidden;
  border-radius: 99px;
  background: #292d24;
}

.storage-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--lime);
  transition: width 400ms ease;
}

.storage-meta {
  color: var(--text-dim);
  font-size: 10px;
}

.main-content {
  width: 100%;
  max-width: 1580px;
  min-width: 0;
  margin: 0 auto;
  padding: 0 42px 34px;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: space-between;
  min-height: 106px;
}

.page-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.page-heading h1 {
  margin: 2px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 36px;
  line-height: 1;
  letter-spacing: 0;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--text-dim);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  gap: 9px;
  align-items: center;
  min-width: 0;
}

.search-box {
  display: flex;
  gap: 8px;
  align-items: center;
  width: min(260px, 24vw);
  min-width: 180px;
  height: 40px;
  padding: 0 12px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-soft);
}

.search-box:focus-within {
  color: var(--lime);
  border-color: var(--border-strong);
  background: var(--surface);
}

.search-box input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  border: 0;
  outline: 0;
  background: transparent;
}

.search-box input::placeholder {
  color: var(--text-dim);
}

.button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}

.button-primary {
  color: var(--lime-ink);
  border-color: #e6ff74;
  background: var(--lime);
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 14%);
}

.button-primary:hover {
  background: #e2ff6c;
}

.button-secondary {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.button-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-raised);
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-raised);
}

.mobile-menu {
  display: none;
}

.spotlight {
  position: relative;
  min-height: 290px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgb(17 19 15 / 98%) 0%, rgb(17 19 15 / 74%) 52%, rgb(17 19 15 / 24%) 100%),
    var(--surface);
}

.spotlight-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
}

.spotlight-grid {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(rgb(255 255 255 / 24%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 24%) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(90deg, transparent 30%, #000 100%);
  pointer-events: none;
}

.spotlight-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  width: min(610px, 70%);
  min-height: 290px;
  padding: 42px 48px;
}

.spotlight-badge {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
  padding: 5px 9px;
  color: var(--lime);
  border: 1px solid rgb(217 246 90 / 24%);
  border-radius: 4px;
  background: rgb(217 246 90 / 8%);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.spotlight-badge.is-empty {
  color: var(--text-muted);
  border-color: var(--border);
  background: rgb(255 255 255 / 4%);
}

.spotlight h2 {
  max-width: 720px;
  margin: 0;
  overflow: hidden;
  font-family: "Space Grotesk", sans-serif;
  font-size: 58px;
  line-height: 0.98;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spotlight-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  margin: 18px 0 25px;
  color: var(--text-muted);
  font-size: 12px;
}

.spotlight-meta span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.spotlight-description {
  max-width: 500px;
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.spotlight-actions {
  display: flex;
  gap: 9px;
  align-items: center;
}

.library-section {
  padding-top: 40px;
}

.library-heading {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
}

.library-heading h2 {
  margin: 5px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: 0;
}

.library-summary {
  display: flex;
  gap: 22px;
  color: var(--text-dim);
  font-size: 11px;
}

.library-summary strong {
  margin-right: 5px;
  color: var(--text);
  font-size: 15px;
}

.filter-row {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.platform-filters {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.platform-filters::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 99px;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.filter-chip:hover {
  color: var(--text);
  background: var(--surface);
}

.filter-chip.is-active {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-raised);
}

.filter-chip span {
  color: var(--text-dim);
}

.sort-control {
  display: flex;
  gap: 7px;
  align-items: center;
  flex: 0 0 auto;
  color: var(--text-dim);
}

.sort-control select {
  color: var(--text-muted);
  border: 0;
  outline: 0;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(174px, 1fr));
  gap: 24px 18px;
}

.game-card {
  position: relative;
  min-width: 0;
}

.game-cover {
  position: relative;
  width: 100%;
  aspect-ratio: var(--cover-ratio);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgb(0 0 0 / 13%);
}

.game-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 260ms ease, filter 260ms ease;
}

.game-card:hover .game-cover img {
  transform: scale(1.035);
  filter: brightness(0.74);
}

.cover-placeholder {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: #f7f4e9;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 14%), transparent 42%),
    linear-gradient(160deg, var(--platform-color, #56604a), #151711 72%);
}

.cover-placeholder::before,
.cover-placeholder::after {
  position: absolute;
  content: "";
  border: 1px solid rgb(255 255 255 / 16%);
  transform: rotate(45deg);
}

.cover-placeholder::before {
  width: 75%;
  height: 75%;
}

.cover-placeholder::after {
  width: 54%;
  height: 54%;
}

.cover-placeholder strong {
  position: relative;
  z-index: 1;
  font-family: "Space Grotesk", sans-serif;
  font-size: 36px;
  line-height: 1;
}

.cover-placeholder span {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  color: rgb(255 255 255 / 64%);
  font-size: 8px;
  font-weight: 800;
}

.favorite-button {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 3;
  display: grid;
  width: 31px;
  height: 31px;
  padding: 0;
  place-items: center;
  color: white;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 6px;
  background: rgb(13 15 12 / 70%);
  backdrop-filter: blur(8px);
  cursor: pointer;
  opacity: 0.72;
  transition: opacity 160ms ease, background 160ms ease;
}

.game-cover:hover .favorite-button,
.favorite-button.is-favorite {
  opacity: 1;
}

.favorite-button:hover,
.favorite-button.is-favorite {
  color: var(--coral);
  background: rgb(13 15 12 / 88%);
}

.favorite-button.is-favorite svg {
  fill: currentColor;
}

.play-overlay {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 8px 12px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 6px;
  background: rgb(13 15 12 / 82%);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.game-cover:hover .play-overlay,
.game-cover:focus-within .play-overlay {
  opacity: 1;
  transform: translateY(0);
}

.play-overlay span {
  font-size: 10px;
  font-weight: 800;
}

.play-overlay button {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  color: var(--lime-ink);
  border: 0;
  border-radius: 5px;
  background: var(--lime);
  cursor: pointer;
}

.platform-ribbon {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 2;
  padding: 4px 7px;
  color: white;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 4px;
  background: rgb(13 15 12 / 74%);
  backdrop-filter: blur(8px);
  font-size: 8px;
  font-weight: 800;
}

.game-info {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 11px 2px 0;
}

.game-copy {
  min-width: 0;
}

.game-title-button {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-title-button:hover {
  color: var(--lime);
}

.game-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-dim);
  font-size: 9px;
  white-space: nowrap;
}

.game-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-meta span + span::before {
  margin-right: 6px;
  content: "·";
}

.more-button {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
}

.empty-library {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 440px;
  overflow: hidden;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgb(217 246 90 / 3%), transparent 45%),
    var(--bg-soft);
}

.empty-visual {
  position: relative;
  display: grid;
  width: 170px;
  height: 170px;
  margin-bottom: 24px;
  place-items: center;
}

.empty-ring {
  position: absolute;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
}

.ring-one {
  width: 160px;
  height: 160px;
  border-style: dashed;
  animation: spin 22s linear infinite;
}

.ring-two {
  width: 112px;
  height: 112px;
  border-color: #576044;
}

.empty-core {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  color: var(--lime-ink);
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 12px rgb(217 246 90 / 6%);
}

.empty-core svg {
  width: 30px;
  height: 30px;
}

.empty-library h2 {
  margin: 8px 0 5px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 28px;
}

.empty-library p:not(.section-kicker) {
  margin: 0 0 22px;
  color: var(--text-muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.app-footer {
  display: flex;
  gap: 22px;
  align-items: center;
  justify-content: space-between;
  margin-top: 54px;
  padding-top: 18px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  font-size: 9px;
}

.app-footer span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.app-footer svg {
  width: 13px;
  height: 13px;
}

.mobile-nav,
.scrim {
  display: none;
}

.modal {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: visible;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: transparent;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgb(3 5 3 / 77%);
  backdrop-filter: blur(7px);
}

.modal-wide {
  width: min(880px, calc(100vw - 32px));
}

.modal-shell {
  max-height: calc(100vh - 40px);
  padding: 24px;
  overflow-y: auto;
  border-radius: inherit;
  background: var(--bg-soft);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-header h2 {
  margin: 5px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 26px;
  line-height: 1.1;
}

.modal-copy {
  margin: -8px 0 22px;
  color: var(--text-muted);
}

.modal-copy code {
  padding: 2px 5px;
  color: var(--lime);
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-size: 11px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 22px;
}

.drop-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 30px;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgb(217 246 90 / 4%), transparent 50%),
    var(--surface);
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  color: var(--text);
  border-color: var(--lime);
  background:
    linear-gradient(135deg, rgb(217 246 90 / 8%), transparent 50%),
    var(--surface-raised);
}

.drop-zone input {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.drop-zone strong {
  margin-top: 18px;
  color: var(--text);
  font-size: 15px;
}

.drop-zone > span:nth-of-type(2) {
  margin-top: 5px;
  font-size: 11px;
}

.drop-zone small {
  margin-top: 13px;
  color: var(--text-dim);
  font-size: 9px;
}

.drop-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  color: var(--lime);
  border: 1px solid rgb(217 246 90 / 22%);
  border-radius: 8px;
  background: rgb(217 246 90 / 8%);
}

.drop-icon svg {
  width: 26px;
  height: 26px;
}

.selected-file {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.file-type-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--lime);
  border-radius: 6px;
  background: #292e20;
}

.selected-file div {
  display: grid;
  min-width: 0;
}

.selected-file strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file div span {
  color: var(--text-dim);
  font-size: 10px;
}

.form-fields {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
}

.field > span small {
  color: var(--text-dim);
  font-size: 9px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0 11px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: 0;
  background: var(--surface);
}

.field input,
.field select {
  height: 42px;
}

.field textarea {
  min-height: 78px;
  padding-top: 10px;
  padding-bottom: 10px;
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--border-strong);
  background: var(--surface-raised);
}

.field input[type="file"] {
  height: auto;
  padding: 8px;
  color: var(--text-muted);
  font-size: 10px;
}

.field input[type="file"]::file-selector-button {
  height: 32px;
  margin-right: 9px;
  padding: 0 10px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-raised);
  cursor: pointer;
}

.cover-preview {
  display: none;
  width: 74px;
  aspect-ratio: var(--cover-ratio);
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.cover-preview.is-visible {
  display: flex;
}

.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-preview span {
  display: none;
}

.banner-upload {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: end;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.banner-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: var(--banner-ratio);
  overflow: hidden;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  text-align: center;
  font-size: 9px;
}

.banner-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-preview svg {
  width: 22px;
  height: 22px;
}

.banner-editor {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.banner-editor-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.banner-editor-heading > div {
  display: grid;
  gap: 2px;
}

.banner-editor-heading strong {
  font-size: 11px;
}

.banner-editor-heading span {
  color: var(--text-dim);
  font-size: 9px;
}

.banner-editor .banner-preview {
  margin: 12px 0;
}

.form-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 20px;
  color: var(--text-dim);
  font-size: 10px;
}

.form-note svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-top: 1px;
}

.upload-progress {
  margin-top: 18px;
}

.upload-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 10px;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-raised);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--lime);
  transition: width 120ms linear;
}

.scan-summary {
  margin-top: 18px;
  padding: 14px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  font-size: 11px;
}

.bios-upload-form {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.bios-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.bios-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-soft);
}

.bios-item > span:first-child {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--lime);
  border-radius: 6px;
  background: var(--surface-raised);
}

.bios-item-copy {
  display: grid;
  min-width: 0;
}

.bios-item-copy strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bios-item-copy span {
  color: var(--text-dim);
  font-size: 9px;
}

.bios-empty {
  padding: 28px;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  border-radius: 7px;
  text-align: center;
  font-size: 11px;
}

.split-actions {
  justify-content: space-between;
}

.split-actions > div {
  display: flex;
  gap: 8px;
}

.danger-button {
  color: #ff9c8c;
  border-color: rgb(255 107 107 / 20%);
  background: rgb(255 107 107 / 7%);
}

.danger-button:hover {
  border-color: rgb(255 107 107 / 40%);
  background: rgb(255 107 107 / 12%);
}

.danger-solid {
  color: #260706;
  border-color: #ff8d82;
  background: #ff8173;
}

.game-file-meta {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  padding: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  font-size: 10px;
}

.cheat-summary {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.cheat-summary-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--lime);
  border-radius: 6px;
  background: #292e20;
}

.cheat-summary > div {
  display: grid;
  min-width: 0;
}

.cheat-summary > div strong {
  font-size: 11px;
}

.cheat-summary > div span {
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 9px;
}

.cheat-summary .button {
  min-height: 34px;
}

.cheat-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.cheat-form,
.cheat-list-panel {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.cheat-form {
  display: grid;
  gap: 13px;
}

.cheat-form-heading,
.cheat-list-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.cheat-form-heading strong,
.cheat-list-heading strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
}

.cheat-list-heading span {
  color: var(--text-dim);
  font-size: 9px;
}

.text-button {
  padding: 0;
  color: var(--lime);
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.switch-field {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.switch-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 34px;
  height: 19px;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  background: var(--bg-soft);
  transition: background 150ms ease, border-color 150ms ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  content: "";
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 150ms ease, background 150ms ease;
}

.switch-field input:checked + .switch-track {
  border-color: var(--lime);
  background: rgb(217 246 90 / 14%);
}

.switch-field input:checked + .switch-track::after {
  background: var(--lime);
  transform: translateX(15px);
}

.switch-field input:focus-visible + .switch-track {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.switch-field > span:last-child {
  display: grid;
}

.switch-field strong {
  font-size: 10px;
}

.switch-field small {
  color: var(--text-dim);
  font-size: 8px;
}

.cheat-format-note {
  margin: 0;
  color: var(--text-dim);
  font-size: 9px;
  line-height: 1.55;
}

.cheat-save-button {
  width: 100%;
}

.cheat-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.cheat-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-soft);
}

.cheat-item.is-enabled {
  border-color: rgb(217 246 90 / 24%);
  background:
    linear-gradient(135deg, rgb(217 246 90 / 5%), transparent 55%),
    var(--bg-soft);
}

.cheat-toggle {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
}

.cheat-toggle[aria-pressed="true"] {
  color: var(--lime-ink);
  border-color: var(--lime);
  background: var(--lime);
}

.cheat-toggle svg {
  width: 15px;
  height: 15px;
}

.cheat-item-copy {
  min-width: 0;
}

.cheat-item-copy > strong {
  display: block;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cheat-item-copy > span {
  display: block;
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 8px;
}

.cheat-item-code {
  display: block;
  max-height: 54px;
  margin-top: 8px;
  overflow: hidden;
  color: #c9cfb4;
  font-family: "Consolas", monospace;
  font-size: 9px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.cheat-item-actions {
  display: flex;
  gap: 4px;
}

.cheat-item-actions .icon-button {
  width: 28px;
  height: 28px;
}

.cheat-empty {
  padding: 34px 20px;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  border-radius: 7px;
  text-align: center;
  font-size: 10px;
}

.confirm-modal {
  width: min(440px, calc(100vw - 32px));
}

.confirm-modal .modal-shell {
  text-align: center;
}

.confirm-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 2px auto 18px;
  place-items: center;
  color: var(--danger);
  border: 1px solid rgb(255 107 107 / 20%);
  border-radius: 8px;
  background: rgb(255 107 107 / 8%);
}

.confirm-icon svg {
  width: 24px;
  height: 24px;
}

.confirm-modal h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 23px;
}

.confirm-modal p {
  margin: 8px auto 0;
  color: var(--text-muted);
}

.confirm-modal .modal-actions {
  justify-content: center;
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 13px 14px;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: #20241b;
  box-shadow: var(--shadow);
  animation: toast-in 180ms ease both;
}

.toast.is-error {
  border-color: rgb(255 107 107 / 35%);
}

.toast svg {
  width: 17px;
  height: 17px;
  color: var(--lime);
}

.toast.is-error svg {
  color: var(--danger);
}

.toast span {
  font-size: 11px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 1100px) {
  .main-content {
    padding-right: 28px;
    padding-left: 28px;
  }

  .desktop-action {
    display: none;
  }

  .spotlight-content {
    width: 78%;
    padding: 36px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    transition: transform 220ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .scrim {
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgb(0 0 0 / 56%);
  }

  .scrim.is-open {
    display: block;
  }

  .main-content {
    padding: 0 18px 100px;
  }

  .topbar {
    min-height: 92px;
  }

  .mobile-menu {
    display: inline-grid;
  }

  .search-box {
    width: min(230px, 38vw);
  }

  .mobile-nav {
    position: fixed;
    right: 12px;
    bottom: 12px;
    left: 12px;
    z-index: 22;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: rgb(20 22 16 / 92%);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
  }

  .mobile-nav.is-limited {
    grid-template-columns: repeat(4, 1fr);
  }

  .mobile-nav button {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    color: var(--text-dim);
    border: 0;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-size: 8px;
    font-weight: 700;
  }

  .mobile-nav button.is-active {
    color: var(--text);
    background: var(--surface-raised);
  }

  .mobile-nav button.is-active svg {
    color: var(--lime);
  }

  .mobile-nav svg {
    width: 17px;
    height: 17px;
  }

  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 20px 12px;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding-right: 14px;
    padding-left: 14px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 0;
  }

  .topbar-actions {
    width: 100%;
  }

  .search-box {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .topbar-actions .button span {
    display: none;
  }

  .topbar-actions .button {
    width: 40px;
    padding: 0;
  }

  .spotlight {
    min-height: 330px;
  }

  .spotlight-content {
    width: 100%;
    min-height: 330px;
    padding: 28px 22px;
  }

  .spotlight h2 {
    max-width: 100%;
    font-size: 40px;
    white-space: normal;
  }

  .spotlight-meta {
    margin: 15px 0 20px;
  }

  .library-section {
    padding-top: 30px;
  }

  .library-summary {
    display: none;
  }

  .filter-row {
    align-items: flex-start;
    margin-top: 18px;
  }

  .platform-filters {
    width: calc(100% - 92px);
  }

  .sort-control svg {
    display: none;
  }

  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 10px;
  }

  .favorite-button {
    opacity: 1;
  }

  .game-title-button {
    font-size: 12px;
  }

  .play-overlay {
    display: none;
  }

  .empty-library {
    min-height: 380px;
    padding: 30px 18px;
  }

  .page-heading h1 {
    font-size: 30px;
  }

  .cover-placeholder strong {
    font-size: 30px;
  }

  .app-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .modal-wide {
    width: calc(100vw - 16px);
  }

  .modal-shell {
    max-height: calc(100vh - 16px);
    padding: 18px;
  }

  .upload-layout {
    grid-template-columns: 1fr;
  }

  .banner-upload {
    grid-template-columns: 1fr;
  }

  .drop-zone {
    min-height: 190px;
  }

  .cover-preview {
    display: none !important;
  }

  .bios-upload-form {
    grid-template-columns: 1fr;
  }

  .cheat-layout {
    grid-template-columns: 1fr;
  }

  .split-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .split-actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toast-region {
    right: 12px;
    bottom: 82px;
  }
}

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