/* topman-ds v1.0 — TOPMANIDMB Design System
 * Shared CSS skin for all games — brand imprint in ONE file.
 * Drop <link rel="stylesheet" href="/ds/topman-ds.css"> into any game.
 *
 * Usage: games/{title}/index.html
 *   Add: <link rel="stylesheet" href="/ds/topman-ds.css">
 *   The DS injects: brand header, XP profile bar, sound toggle, theme vars.
 */

:root {
  /* Brand tokens */
  --tm-navy: #0a1426;
  --tm-navy2: #0d1b33;
  --tm-navy3: #122544;
  --tm-gold: #FFCB2D;
  --tm-gold-soft: #ffe082;
  --tm-blue: #5BB8F5;
  --tm-blue-deep: #2c7fc4;
  --tm-red: #ff5470;
  --tm-green: #39d98a;
  --tm-ink: #eef4ff;
  --tm-muted: #8aa0c2;
  --tm-line: rgba(91,184,245,.16);
  --tm-card: rgba(255,255,255,.03);
  --tm-ease: cubic-bezier(.22,1,.36,1);
  --tm-radius: 14px;
  --tm-safe-top: env(safe-area-inset-top, 14px);
  --tm-safe-bottom: env(safe-area-inset-bottom, 14px);

  /* XP/Profile */
  --tm-xp-max: 40;
  --tm-xp-bar: 0%;
}

/* ====== BRAND HEADER (auto-injected) ====== */
.tm-brand {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 6px;
  margin: 0 max(8px, 2vw);
}
.tm-brand__icon {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 6px;
  overflow: hidden;
}
.tm-brand__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(255,203,45,.4));
}
.tm-brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.tm-brand__name {
  font-family: 'Kanit', sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .3px;
  background: linear-gradient(100deg, var(--tm-gold), var(--tm-gold-soft));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tm-brand__sub {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 8px;
  letter-spacing: .3em;
  color: var(--tm-blue);
  text-transform: uppercase;
}

/* ====== XP PROFILE BAR ====== */
.tm-profile {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px max(8px, 2vw);
  margin-bottom: 8px;
  background: var(--tm-card);
  border: 1px solid var(--tm-line);
  border-radius: 12px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  color: var(--tm-muted);
  transition: opacity .3s;
}
.tm-profile.hidden {
  opacity: 0;
  pointer-events: none;
  height: 0;
  padding: 0;
  margin: 0;
  border: none;
}
.tm-profile__rank {
  font-weight: 700;
  color: var(--tm-ink);
  font-size: 13px;
  white-space: nowrap;
}
.tm-profile__xpbar {
  flex: 1;
  height: 6px;
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  overflow: hidden;
  min-width: 40px;
}
.tm-profile__xpbar-fill {
  height: 100%;
  width: var(--tm-xp-bar);
  border-radius: 6px;
  background: linear-gradient(90deg, var(--tm-blue), var(--tm-gold));
  box-shadow: 0 0 8px rgba(91,184,245,.4);
  transition: width .5s var(--tm-ease);
}
.tm-profile__xp {
  font-weight: 700;
  color: var(--tm-gold);
  font-size: 13px;
  white-space: nowrap;
}
.tm-profile__streak {
  font-size: 12px;
  white-space: nowrap;
}

/* ====== SOUND TOGGLE ====== */
.tm-sound-btn {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--tm-line);
  border-radius: 10px;
  background: var(--tm-card);
  color: var(--tm-muted);
  font-size: 18px;
  cursor: pointer;
  transition: .2s;
  margin-left: auto;
}
.tm-sound-btn:active {
  transform: scale(.92);
}
.tm-sound-btn.on {
  color: var(--tm-gold);
  border-color: rgba(255,203,45,.3);
}

/* ====== CTA BUTTON (brand) ====== */
.tm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Kanit', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--tm-navy);
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--tm-gold), var(--tm-gold-soft));
  box-shadow: 0 8px 24px rgba(255,203,45,.35);
  transition: transform .2s var(--tm-ease), box-shadow .25s;
  white-space: nowrap;
}
.tm-btn:active {
  transform: scale(.96);
}
.tm-btn:hover {
  box-shadow: 0 12px 34px rgba(255,203,45,.5);
}
.tm-btn--ghost {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.2);
  color: var(--tm-ink);
  box-shadow: none;
}
.tm-btn--ghost:active {
  background: rgba(255,255,255,.05);
}
.tm-btn--blue {
  background: linear-gradient(135deg, var(--tm-blue), var(--tm-blue-deep));
  color: #fff;
  box-shadow: 0 8px 24px rgba(91,184,245,.35);
}

/* ====== GAME CARD (catalog) ====== */
.tm-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(180deg, var(--tm-navy3), var(--tm-navy2));
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
  padding: 14px 12px 12px;
  text-decoration: none;
  color: var(--tm-ink);
  transition: transform .18s, border-color .18s, box-shadow .18s;
  overflow: hidden;
}
.tm-card:active {
  transform: scale(.97);
}
.tm-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,203,45,.5);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.tm-card__ico {
  font-size: 28px;
  line-height: 1;
}
.tm-card__title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}
.tm-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}
.tm-chip {
  font-size: 11px;
  color: var(--tm-muted);
  border: 1px solid var(--tm-line);
  border-radius: 999px;
  padding: 2px 8px;
}
.tm-card__play {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--tm-blue);
  letter-spacing: .5px;
}
.tm-card__rec {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--tm-navy);
  background: linear-gradient(135deg, var(--tm-gold), #ffd95e);
  border-radius: 999px;
  padding: 2px 8px;
}

/* ====== PILLAR COLORS ====== */
.tm-pillar--GUARD { --tm-accent: var(--tm-green); }
.tm-pillar--AI    { --tm-accent: var(--tm-blue); }
.tm-pillar--DETECT { --tm-accent: var(--tm-gold); }
.tm-pillar--PLAY   { --tm-accent: var(--tm-red); }

/* ====== REDUCED MOTION ====== */
@media (prefers-reduced-motion: reduce) {
  .tm-profile__xpbar-fill, .tm-card {
    transition: none !important;
  }
  * { animation-duration: 0s !important; }
}

/* ====== FOOTER ====== */
.tm-footer {
  margin-top: 24px;
  padding: 16px 8px;
  border-top: 1px solid var(--tm-line);
  color: var(--tm-muted);
  font-size: 11px;
  text-align: center;
  line-height: 1.6;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: .08em;
}
.tm-footer a {
  color: var(--tm-blue);
  text-decoration: none;
}
