/* one centered column, every box the same width */
body {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  place-items: unset !important;
  max-width: 540px;
  margin: 0 auto !important;
  padding: 1rem !important;
  gap: 1.5rem;
}

.card {
  width: 100%;
  max-width: 100%;
  position: relative;
  z-index: 1;
}

/* nav row: every item gets the same boxed card style */
nav {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
  width: 100%;
}

nav a,
nav .hrt-counter {
  display: inline-block;
  background: var(--cream);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 0.5rem 0.9rem;
  text-decoration: none;
}

nav a:hover {
  background: var(--ink);
  color: var(--cream);
}

/* flag: no box at all */
.corner-flag {
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  top: 12px !important;
  right: 12px !important;
  width: 56px !important;
}

/* decoration layer, behind the content */
.decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.decor img {
  position: absolute;
  image-rendering: pixelated;
}

/* phones: hide most decorations so they don't cover content */
@media (max-width: 800px) {
  .decor img:nth-child(n+3) { display: none; }
  .decor img { width: 120px !important; opacity: 0.6; }
}

/* keep all nav items on one line, even if wider than the cards */
nav {
  flex-wrap: nowrap;
  width: max-content;
  max-width: 96vw;
  gap: 0.7rem;
}

nav a,
nav .hrt-counter {
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
}

/* small screens: let it wrap again so it doesn't overflow */
@media (max-width: 640px) {
  nav {
    flex-wrap: wrap;
    width: 100%;
  }
}

/* pokeball cursor */
html, body, a, button, * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='%23fff' stroke='%233b2f4a' stroke-width='2'/%3E%3Cpath d='M2 12a10 10 0 0 1 20 0z' fill='%23e63946' stroke='%233b2f4a' stroke-width='2'/%3E%3Crect x='2' y='11' width='20' height='2' fill='%233b2f4a'/%3E%3Ccircle cx='12' cy='12' r='3.5' fill='%23fff' stroke='%233b2f4a' stroke-width='2'/%3E%3C/svg%3E") 12 12, auto !important;
}

/* cursor trail */
.trail {
  position: fixed;
  width: 8px;
  height: 8px;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 1px 1px 0 var(--ink);
  animation: trail-fade 0.7s steps(5) forwards;
}
@keyframes trail-fade {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.3) translateY(10px); }
}

/* game canvases scale down to fit the card */
canvas {
  max-width: 100%;
  height: auto;
}

/* footer badges: a row of 64x64 */
.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}
.badge-img {
  width: 64px !important;
  height: 64px !important;
  object-fit: contain;      /* keeps the shape, so flags don't get squashed */
  image-rendering: pixelated;
}

/* game name highlight, same look as the listening link */
.game-name {
  background: var(--blue);
  padding: 0.1rem 0.4rem;
  font-weight: bold;
}

/* kuromi, top right, just left of the flag */
.corner-kuromi {
  position: fixed;
  top: 120px;
  right: 12px;
  width: min(256px, 20vw);
  height: auto;
  z-index: 1000;
  pointer-events: none;
  image-rendering: pixelated;
}
@media (max-width: 640px) {
  .corner-kuromi { width: 176px; right: 64px; }
}

/* mascot click animations */
.mascot { cursor: pointer; }
.mascot.spin   { animation: mascot-spin 0.8s steps(8) 1 !important; }
.mascot.hop    { animation: mascot-hop 0.6s steps(6) 1 !important; }
.mascot.wiggle { animation: mascot-wiggle 0.6s steps(6) 1 !important; }

@keyframes mascot-spin   { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes mascot-hop    { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-30px); } }
@keyframes mascot-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-15deg); } 75% { transform: rotate(15deg); } }

/* day/night: ease colour changes */
body { transition: background-color 2s; }

/* album art next to the listening text */
[hidden] { display: none !important; }
.listen-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.listen-row p { margin: 0; }
#album-art {
  width: 96px;
  height: 96px;
  flex: none;
  object-fit: cover;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
@media (max-width: 420px) {
  .listen-row { flex-direction: column; }
}

/* mini music player, right side between kuromi and pikachu */
.mini-player {
  position: fixed;
  top: 28%;
  right: 2%;
  width: 16vw;
  min-width: 190px;
  max-width: 260px;
  z-index: 5;
  background: var(--cream);
  border: 4px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 0.7rem 0.8rem;
  text-align: center;
  font-size: 0.9rem;
}
.pl-head { font-weight: bold; margin-bottom: 0.3rem; }
.pl-title {
  background: var(--blue);
  color: #fff;
  padding: 0.15rem 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pl-bar {
  height: 10px;
  margin: 0.6rem 0 0.2rem;
  background: #e8dbe6;
  border: 2px solid var(--ink);
  cursor: pointer;
}
.pl-fill { height: 100%; width: 0; background: #f5a9b8; }
.pl-time { display: flex; justify-content: space-between; font-size: 0.75rem; opacity: 0.7; }
.pl-btns { display: flex; gap: 0.4rem; justify-content: center; margin: 0.5rem 0; }
.pl-btns button {
  font: inherit;
  min-width: 42px;
  padding: 0.3rem 0.5rem;
  color: var(--ink);
  cursor: pointer;
  background: var(--cream);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}
.pl-btns button:active { transform: translate(3px, 3px); box-shadow: none; }
#pl-vol { width: 100%; accent-color: var(--blue); }

/* hide on narrow windows so it never covers the cards */
@media (max-width: 1000px) { .mini-player { display: none; } }

/* pages that opt out of the floating gifs */
body.no-decor .decor { display: none; }

/* ===== phone fixes ===== */
@media (max-width: 640px) {
  .decor { display: none; }
  .corner-kuromi { width: 72px; top: 76px; right: 12px; }
  .card { padding: 1.25rem; }
  #lastfm a { -webkit-box-decoration-break: clone; box-decoration-break: clone; }
}
@media (max-width: 520px) {
  .listen-row { flex-direction: column; }
}

/* ===== phone: no flag/kuromi, bottom music bar ===== */
@media (max-width: 640px) {
  .corner-flag, .corner-kuromi { display: none !important; }
  .mini-player {
    display: block;
    top: auto; left: 8px; right: 8px; bottom: 8px;
    width: auto; min-width: 0; max-width: none;
    padding: 0.5rem 0.7rem;
    box-shadow: 4px 4px 0 var(--ink);
    z-index: 50;
  }
  .pl-head, #pl-vol { display: none; }
  .pl-btns { margin: 0.3rem 0 0; }
  body { padding-bottom: 150px !important; }
}
