/* Shared site chrome: header, profile, catalog cards, quests, ads, footer.
   Everything is prefixed am- so it cannot collide with a game's own styles. */
:root {
  --am-bg: #15110e;
  --am-panel: #221b15;
  --am-panel-2: #2d241c;
  --am-line: #43372b;
  --am-text: #f3eadf;
  --am-muted: #b5a797;
  --am-accent: #ffb547;
  --am-accent-2: #ff7b3a;
  --am-good: #5fd35f;
  --am-bad: #e8483a;
  --am-radius: 12px;
  --am-font: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, sans-serif;
  color-scheme: dark;
}

.am-page {
  margin: 0;
  background: var(--am-bg);
  color: var(--am-text);
  font-family: var(--am-font);
  -webkit-text-size-adjust: 100%;
}
.am-page *,
.am-page *::before,
.am-page *::after {
  box-sizing: border-box;
}
.am-page a {
  color: var(--am-accent);
}
.am-page [hidden],
.am-card[hidden] {
  display: none !important;
}
.am-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Header ---------- */
.site-header.am-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--am-line);
  background: var(--am-bg);
  font-family: var(--am-font);
}
/* The logo is one file, site/brand/aminuts-games.svg (built by tools/brand.mjs). */
.am-logo {
  display: flex;
  flex: none;
  align-items: center;
  line-height: 0;
  text-decoration: none;
}
.am-logo img {
  display: block;
  width: auto;
  height: 32px;
}
.am-nav {
  display: flex;
  gap: 14px;
  font-size: 14px;
}
.am-nav a {
  color: var(--am-muted) !important;
  text-decoration: none;
}
.am-nav a:hover {
  color: var(--am-text) !important;
}
.am-spacer {
  flex: 1;
}

/* Profile chip: level, XP bar, streak */
.am-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--am-line);
  border-radius: 999px;
  background: var(--am-panel);
  color: var(--am-text) !important;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.1;
}
.am-lvl {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: conic-gradient(var(--am-accent) calc(var(--p, 0) * 1turn), var(--am-panel-2) 0);
  font-weight: 800;
  font-size: 13px;
  position: relative;
}
.am-lvl::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--am-panel);
}
.am-lvl span {
  position: relative;
}
.am-profile-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 92px;
}
.am-profile-title {
  font-weight: 700;
}
.am-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--am-panel-2);
  overflow: hidden;
}
.am-bar > i {
  display: block;
  height: 100%;
  width: calc(var(--p, 0) * 100%);
  background: linear-gradient(90deg, var(--am-accent), var(--am-accent-2));
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.am-streak {
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  color: #ffcf6b;
}
.am-streak[data-cold='true'] {
  color: var(--am-muted);
  filter: grayscale(1);
}

/* ---------- Toasts ---------- */
.am-toasts {
  position: fixed;
  top: 60px;
  right: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  pointer-events: none;
}
.am-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 280px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(34, 27, 21, 0.95);
  border: 1px solid var(--am-line);
  color: var(--am-text);
  font: 600 13px/1.3 var(--am-font);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  animation: am-toast-in 0.25s ease-out, am-toast-out 0.4s ease-in 2.6s forwards;
}
.am-toast b {
  color: var(--am-accent);
}
.am-toast.am-toast-big {
  border-color: var(--am-accent);
  font-size: 15px;
}
@keyframes am-toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}
@keyframes am-toast-out {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* ---------- Home ---------- */
.am-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
  margin: 18px 0;
}
.am-feature {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 250px;
  border-radius: var(--am-radius);
  overflow: hidden;
  border: 1px solid var(--am-line);
  background: var(--am-panel);
  color: var(--am-text) !important;
  text-decoration: none;
}
.am-feature img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.am-feature-body {
  position: relative;
  width: 100%;
  padding: 18px;
  background: linear-gradient(transparent, rgba(10, 8, 6, 0.92) 45%);
}
.am-feature-body small {
  color: var(--am-accent);
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-size: 12px;
}
.am-feature-body h2 {
  margin: 4px 0 6px;
  font-size: 28px;
}
.am-feature-body p {
  margin: 0 0 12px;
  color: #d9ccbd;
  max-width: 520px;
}
.am-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--am-line);
  background: var(--am-panel-2);
  color: var(--am-text) !important;
  font: 700 15px var(--am-font);
  text-decoration: none;
  cursor: pointer;
}
.am-btn-primary {
  background: linear-gradient(180deg, var(--am-accent), var(--am-accent-2));
  border-color: transparent;
  color: #1a120a !important;
}
.am-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.am-panel {
  border: 1px solid var(--am-line);
  border-radius: var(--am-radius);
  background: var(--am-panel);
  padding: 16px;
}
.am-panel h2,
.am-section h2 {
  margin: 0 0 10px;
  font-size: 18px;
}
.am-me {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.am-me-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.am-me-top .am-lvl {
  width: 52px;
  height: 52px;
  font-size: 19px;
}
.am-me-top .am-lvl::before {
  inset: 5px;
}
.am-me-name {
  font-weight: 800;
  font-size: 17px;
}
.am-me-sub {
  color: var(--am-muted);
  font-size: 13px;
}
.am-me .am-bar {
  height: 9px;
}
.am-quests {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.am-quest {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
  font-size: 14px;
}
.am-quest a {
  color: var(--am-text) !important;
}
.am-quest .am-bar {
  grid-column: 1 / -1;
  height: 5px;
}
.am-quest-xp {
  color: var(--am-accent);
  font-weight: 700;
  font-size: 12px;
}
.am-quest[data-done='true'] {
  color: var(--am-muted);
}
.am-quest[data-done='true'] .am-quest-xp::before {
  content: '✓ ';
  color: var(--am-good);
}
.am-chest {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  background: var(--am-panel-2);
}
.am-chest-icon {
  font-size: 30px;
  line-height: 1;
}
.am-chest[data-ready='true'] .am-chest-icon {
  animation: am-wiggle 1.2s ease-in-out infinite;
}
@keyframes am-wiggle {
  0%,
  60%,
  100% {
    transform: rotate(0);
  }
  70% {
    transform: rotate(-12deg);
  }
  80% {
    transform: rotate(10deg);
  }
  90% {
    transform: rotate(-6deg);
  }
}
.am-chest-text {
  flex: 1;
  font-size: 13px;
  color: var(--am-muted);
}
.am-chest-text b {
  display: block;
  color: var(--am-text);
  font-size: 14px;
}

.am-section {
  margin: 22px 0;
}
.am-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.am-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 240px);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}
.am-row > * {
  scroll-snap-align: start;
}

.am-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0 14px;
}
.am-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--am-line);
  background: var(--am-panel);
  color: var(--am-muted);
  font: 600 13px var(--am-font);
  cursor: pointer;
}
.am-chip[aria-pressed='true'] {
  background: var(--am-accent);
  border-color: var(--am-accent);
  color: #1a120a;
}
.am-search {
  flex: 1 1 180px;
  max-width: 280px;
  margin-left: auto;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--am-line);
  background: var(--am-panel);
  color: var(--am-text);
  font: 14px var(--am-font);
}

/* ---------- Cards ---------- */
.am-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.am-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--am-line);
  border-radius: var(--am-radius);
  background: var(--am-panel);
  overflow: hidden;
  color: var(--am-text) !important;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.am-card:hover,
.am-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--am-accent);
}
.am-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--am-panel-2);
  overflow: hidden;
}
.am-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.am-thumb-fallback {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 10px;
  text-align: center;
  font-weight: 800;
  font-size: 22px;
  background: linear-gradient(135deg, hsl(var(--h) 55% 32%), hsl(calc(var(--h) + 40) 60% 18%));
  color: #fff;
}
.am-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--am-accent);
  color: #1a120a;
  font: 800 11px var(--am-font);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.am-badge-mature {
  left: auto;
  right: 8px;
  background: var(--am-bad);
  color: #fff;
}
.am-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px 12px;
  flex: 1;
}
.am-card-title {
  font-weight: 800;
  font-size: 16px;
}
.am-card-tagline {
  color: var(--am-muted);
  font-size: 13px;
  line-height: 1.4;
}
.am-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
  padding-top: 6px;
}
.am-card-tags span {
  font-size: 11px;
  color: var(--am-accent);
  border: 1px solid var(--am-line);
  border-radius: 999px;
  padding: 1px 7px;
}
.am-card-stat {
  font-size: 12px;
  color: var(--am-good);
  font-weight: 700;
}
.am-empty {
  color: var(--am-muted);
  padding: 20px 0;
}

/* ---------- Ads ---------- */
.am-ad,
[data-am-ad] {
  display: block;
  max-width: 100%;
  overflow: hidden;
}
[data-am-state='empty'] {
  display: none !important;
}
.am-ad-grid {
  grid-column: 1 / -1;
}
.am-ad-label {
  font: 600 10px var(--am-font);
  color: var(--am-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 2px;
}
html[data-ads='network'] [data-am-ad][data-am-format='horizontal'] {
  min-height: 110px;
}
html[data-ads='network'] [data-am-ad][data-am-format='rectangle'] {
  min-height: 270px;
}
.am-house {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 970px;
  margin: 0 auto;
  padding: 10px;
  border: 1px dashed var(--am-line);
  border-radius: var(--am-radius);
  background: var(--am-panel);
  color: var(--am-text) !important;
  text-decoration: none;
  font-family: var(--am-font);
}
.am-house img,
.am-house .am-thumb-fallback {
  width: 128px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  flex: none;
  font-size: 13px;
}
.am-house-text {
  flex: 1;
  min-width: 0;
}
.am-house-text small {
  color: var(--am-accent);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.am-house-text b {
  display: block;
  font-size: 16px;
}
.am-house-text span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--am-muted);
  font-size: 13px;
  line-height: 1.35;
}
[data-am-format='rectangle'] .am-house {
  flex-direction: column;
  align-items: stretch;
  max-width: 336px;
  text-align: left;
}
[data-am-format='rectangle'] .am-house img,
[data-am-format='rectangle'] .am-house .am-thumb-fallback {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

/* ---------- Game page additions ---------- */
.am-more {
  max-width: 1100px;
  margin: 28px auto 0;
  padding: 0 16px;
  font-family: var(--am-font);
  color: var(--am-text);
}
.am-more h2 {
  font-size: 18px;
  margin: 0 0 10px;
}
.am-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 6, 4, 0.94);
  font-family: var(--am-font);
  color: var(--am-text);
}
.am-gate-box {
  max-width: 440px;
  padding: 22px;
  border: 1px solid var(--am-line);
  border-radius: var(--am-radius);
  background: var(--am-panel);
  text-align: center;
}
.am-gate-box h2 {
  margin: 0 0 8px;
}
.am-gate-box p {
  color: var(--am-muted);
  line-height: 1.5;
}
.am-gate-box .am-btn {
  margin: 6px;
}

/* ---------- Footer and text pages ---------- */
.am-footer {
  margin-top: 40px;
  padding: 22px 16px 30px;
  border-top: 1px solid var(--am-line);
  color: var(--am-muted);
  font: 13px/1.6 var(--am-font);
  text-align: center;
}
.am-footer a {
  color: var(--am-muted) !important;
  margin: 0 8px;
}
.am-doc {
  max-width: 760px;
  margin: 24px auto;
  padding: 0 16px;
  line-height: 1.6;
}
.am-doc h1 {
  font-size: 28px;
}
.am-doc-logo img {
  display: block;
  width: min(402px, 100%);
  height: auto;
}
.am-doc h2 {
  font-size: 19px;
  margin-top: 26px;
}
.am-doc li {
  margin: 4px 0;
}
.am-badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.am-badge-card {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--am-line);
  background: var(--am-panel-2);
  font-size: 12px;
  color: var(--am-muted);
}
.am-badge-card b {
  display: block;
  color: var(--am-text);
  font-size: 13px;
}
.am-badge-card[data-got='false'] {
  opacity: 0.45;
}
.am-themes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.am-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--am-line);
  cursor: pointer;
  background: linear-gradient(135deg, var(--a), var(--b));
}
.am-swatch[aria-pressed='true'] {
  border-color: var(--am-text);
  box-shadow: 0 0 0 2px var(--am-bg), 0 0 0 4px var(--a);
}
.am-swatch:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

@media (max-width: 800px) {
  .am-hero {
    grid-template-columns: 1fr;
  }
  .am-profile-text {
    display: none;
  }
  .am-profile {
    padding-right: 8px;
  }
  .am-nav {
    display: none;
  }
  .am-search {
    max-width: none;
    margin-left: 0;
  }
  .am-house img,
  .am-house .am-thumb-fallback {
    width: 96px;
    height: 54px;
  }
  .am-feature {
    min-height: 210px;
  }
  .am-feature-body h2 {
    font-size: 23px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .am-card,
  .am-bar > i,
  .am-toast,
  .am-chest-icon {
    transition: none !important;
    animation: none !important;
  }
}
