:root {
  color-scheme: dark;
  --base: #080d15;
  --card: #101a28;
  --fg: #f5f6fa;
  --muted: #bac4d1;
  --edge: #374352;
  --wash: #142339;
  font:
    16px/1.55 system-ui,
    sans-serif;
}
html[data-theme="light"] {
  color-scheme: light;
  --base: #f3f1ea;
  --card: #fffcf3;
  --fg: #111315;
  --muted: #485059;
  --edge: #b9b7af;
  --wash: #eeeae0;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100dvh;
  background: linear-gradient(135deg, var(--base), var(--wash)) fixed;
  color: var(--fg);
}
header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 4vw;
  background: var(--base);
  border-bottom: 1px solid var(--edge);
  flex-wrap: wrap;
}
header img {
  width: 40px;
  height: 40px;
  border-radius: 11px;
}
strong,
h1,
h2,
h3,
nav,
button {
  font-family: ui-rounded, "Arial Narrow", system-ui, sans-serif;
}
header strong {
  letter-spacing: 0.09em;
  font-size: 1.4rem;
}
nav {
  display: flex;
  gap: 0.3rem;
  overflow: auto;
  margin-left: auto;
  max-width: 100%;
}
main {
  max-width: 1040px;
  margin: auto;
  padding: clamp(1rem, 4vw, 3rem);
}
h1 {
  letter-spacing: -0.035em;
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.1;
}
section,
article,
dialog {
  border: 1px solid var(--edge);
  background: var(--card);
  color: var(--fg);
  border-radius: 16px;
  padding: 1.15rem;
  margin: 0.8rem 0;
}
dialog {
  margin: auto;
  width: min(90vw, 520px);
  max-height: 82dvh;
  overflow: auto;
}
dialog::backdrop {
  background: #000a;
}
button,
input,
textarea,
select {
  font: inherit;
  border: 1px solid var(--edge);
  border-radius: 9px;
  padding: 0.55rem 0.8rem;
  background: var(--base);
  color: var(--fg);
}
button {
  cursor: pointer;
  margin: 0.15rem;
}
button:hover,
button[aria-current="page"] {
  border-color: var(--fg);
}
button:disabled {
  opacity: 0.45;
}
label {
  display: grid;
  gap: 0.3rem;
  margin: 0.7rem 0;
}
p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
small {
  color: var(--muted);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 0.7rem;
}
.grid article {
  margin: 0;
}
.image {
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  background: var(--base);
  border-radius: 10px;
}
.thumb,
.terms {
  background: var(--base);
  padding: 1rem;
  border-radius: 9px;
}
.terms {
  white-space: pre-wrap;
  overflow: auto;
  max-height: 45dvh;
}
.thumb {
  display: grid;
  place-items: center;
  min-height: 110px;
}
.auth {
  max-width: 450px;
  margin: 5vh auto;
}
aside:not(:empty) {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--base);
  padding: 0.7rem 1.2rem;
  border-radius: 12px;
  max-width: 90vw;
  z-index: 3;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}
input,
textarea,
select {
  max-width: 100%;
}
@media (max-width: 760px) {
  nav {
    width: 100%;
    margin: 0;
  }
  header {
    gap: 0.35rem;
  }
}
.home-deck {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 1rem;
  padding: 0.75rem 0 1rem;
}
.home-deck article,
.home-grid article {
  border-radius: 22px;
  display: flex;
  min-height: 155px;
  padding: 0;
  background: linear-gradient(145deg, var(--card), var(--wash));
}
.home-deck article {
  flex: 0 0 min(76vw, 360px);
  scroll-snap-align: center;
}
.home-deck button,
.home-grid button {
  width: 100%;
  text-align: left;
  padding: 2rem;
  letter-spacing: 0.04em;
  font:
    600 1.35rem ui-monospace,
    monospace;
  border: 0;
  background: transparent;
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0.65rem;
}
.home-grid article {
  min-height: 84px;
  margin: 0;
}
.home-grid button {
  font-size: 0.95rem;
  padding: 1rem;
}
.collectible {
  position: relative;
  user-select: none;
}
.collectible .remove {
  display: none;
}
.editing .collectible .remove {
  display: block;
  position: absolute;
  right: 0.3rem;
  top: 0.3rem;
  border: 0;
  border-radius: 50%;
  background: #b52d38;
  color: white;
  font-size: 20px;
  line-height: 1;
  width: 34px;
  height: 34px;
  padding: 0;
}
.editing .collectible {
  animation: jiggle 0.22s ease-in-out infinite alternate;
}
.editing .collectible:nth-child(2n) {
  animation-direction: alternate-reverse;
}
@keyframes jiggle {
  from {
    transform: rotate(-0.55deg);
  }
  to {
    transform: rotate(0.55deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .editing .collectible {
    animation: none;
  }
}
.editing .collectible {
  touch-action: none;
}
