/* ==========================================================================
   Minecraft stats site
   Bright, playful, texture-accented. Motion is entrance-only: things animate
   once as they scroll into view and then settle. No loops, no autoplay.
   ========================================================================== */

:root {
  /* Palette - pulled loosely from the game's own block colours */
  --grass:   #56b949;
  --diamond: #35c9c0;
  --gold:    #f5b73f;
  --redstone:#ee4b55;
  --lapis:   #4a6fe5;
  --amethyst:#a356f0;
  --emerald: #17c964;
  --coal:    #2b2f3a;

  --ink:     #23262f;
  --ink-soft:#5b6272;
  --ink-faint:#8a90a0;

  --card:    #ffffff;
  --line:    #e8e6ef;
  --bg:      #fbf7f2;

  --radius:  18px;
  --radius-sm: 12px;
  --shadow:    0 2px 4px rgba(35,38,47,.04), 0 8px 24px rgba(35,38,47,.07);
  --shadow-lg: 0 4px 8px rgba(35,38,47,.05), 0 18px 44px rgba(35,38,47,.12);

  --font: ui-rounded, "SF Pro Rounded", "Segoe UI Variable", "Segoe UI",
          -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg);
  /* Soft playful wash behind everything */
  background-image:
    radial-gradient(1100px 520px at 12% -8%, rgba(86,185,73,.16), transparent 60%),
    radial-gradient(900px 460px at 88% 2%, rgba(74,111,229,.14), transparent 62%),
    radial-gradient(760px 420px at 50% 100%, rgba(163,86,240,.10), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.015em; }

/* --- top bar ------------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: saturate(1.5) blur(14px);
  background: rgba(251,247,242,.82);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }

.brand-cube {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(140deg, var(--grass), var(--emerald));
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.16), 0 3px 8px rgba(86,185,73,.4);
}

.brand-text { font-size: 1.05rem; letter-spacing: -.02em; }

.brand-version {
  font-size: .68rem;
  font-weight: 700;
  color: var(--ink-faint);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}

.players { display: flex; gap: 7px; flex: 1; flex-wrap: wrap; }

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: #fff;
  box-shadow: 0 1px 3px rgba(35,38,47,.08);
  font: inherit;
  font-weight: 650;
  font-size: .86rem;
  color: var(--ink);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.player-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.player-chip[aria-current="true"] { border-color: var(--grass); }

.tone-picker { display: inline-flex; align-items: center; gap: 8px; }

.tone-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-faint);
}

select#tone-select {
  font: inherit;
  font-weight: 650;
  font-size: .84rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

/* --- avatars ------------------------------------------------------------ */

.avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: #d9d5e4;
  flex: 0 0 auto;
  object-fit: cover;
}

.avatar-fallback {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: .8rem;
  flex: 0 0 auto;
}

/* --- item icons --------------------------------------------------------- */

/* Minecraft art is 16px - keep the pixels crisp rather than smeared. */
.icon {
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor;
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

.icon-wrap {
  width: 34px; height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.icon-tile {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: .82rem;
  flex: 0 0 auto;
  letter-spacing: -.02em;
}

/* --- layout ------------------------------------------------------------- */

main { max-width: 1180px; margin: 0 auto; padding: 30px 22px 70px; }

section { margin-bottom: 54px; }

.section-head { margin-bottom: 18px; }

.section-head h2 { font-size: 1.5rem; font-weight: 800; }

.section-sub {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: .92rem;
  max-width: 62ch;
}

/* --- loading / empty ---------------------------------------------------- */

.loading, .empty {
  max-width: 1180px;
  margin: 0 auto;
  padding: 90px 22px;
  text-align: center;
  color: var(--ink-soft);
}

.loading-blocks { display: inline-flex; gap: 6px; margin-bottom: 16px; }

.loading-blocks span {
  width: 15px; height: 15px;
  border-radius: 4px;
  background: var(--grass);
  animation: hop .9s ease-in-out infinite;
}

.loading-blocks span:nth-child(2) { background: var(--diamond); animation-delay: .12s; }
.loading-blocks span:nth-child(3) { background: var(--gold);    animation-delay: .24s; }
.loading-blocks span:nth-child(4) { background: var(--amethyst);animation-delay: .36s; }

@keyframes hop {
  0%, 100% { transform: translateY(0); opacity: .55; }
  50%      { transform: translateY(-9px); opacity: 1; }
}

.empty code {
  font-family: var(--mono);
  font-size: .86em;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
}

/* --- hero --------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 26px;
  align-items: center;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  margin-bottom: 46px;
  position: relative;
  overflow: hidden;
}

/* Faint diagonal sheen so the card isn't a flat white slab */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(86,185,73,.07), transparent 42%,
                              rgba(74,111,229,.07));
  pointer-events: none;
}

.hero-id { display: flex; align-items: center; gap: 18px; position: relative; }

.hero-avatar {
  width: 92px; height: 92px;
  border-radius: 20px;
  background: #d9d5e4;
  box-shadow: var(--shadow);
  object-fit: cover;
  image-rendering: pixelated;
}

.hero-avatar-fallback {
  width: 92px; height: 92px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 2.1rem;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.hero-id h1 { font-size: 2rem; font-weight: 850; letter-spacing: -.03em; }

.hero-sub { margin: 2px 0 0; color: var(--ink-faint); font-size: .88rem; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 14px;
  position: relative;
}

.hero-stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hero-stat-top { display: flex; align-items: center; gap: 8px; }

.hero-stat-value {
  font-size: 1.5rem;
  font-weight: 850;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

.hero-stat-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-faint);
}

/* --- highlight reel ----------------------------------------------------- */

.reel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 16px;
}

.reel-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 4px solid var(--accent, var(--grass));
  transition: transform .18s ease, box-shadow .18s ease;
}

.reel-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.reel-head { display: flex; align-items: center; gap: 12px; }

.reel-headline {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.25;
}

.reel-body { margin: 0; color: var(--ink-soft); font-size: .92rem; }

/* --- awards ------------------------------------------------------------- */

.awards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 14px;
}

.award {
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 13px;
  transition: transform .18s ease, box-shadow .18s ease;
}

.award:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.award-text { min-width: 0; }

.award-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-faint);
}

.award-winner {
  font-weight: 800;
  font-size: .98rem;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- explorer ----------------------------------------------------------- */

.explorer-controls {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tabs { display: flex; gap: 7px; flex-wrap: wrap; flex: 1; }

.tab {
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .15s ease;
}

.tab:hover { border-color: var(--ink-faint); color: var(--ink); }

.tab[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.search {
  font: inherit;
  font-size: .88rem;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  min-width: 180px;
  color: var(--ink);
}

.search:focus { outline: 2px solid var(--diamond); outline-offset: 1px; }

.stat-list {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  overflow: hidden;
}

.stat-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  position: relative;
  transition: background .14s ease;
}

.stat-row:hover { background: var(--bg); }

/* The bar sits underneath the row content as a soft fill */
.stat-bar {
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  border-radius: 10px;
  background: var(--bar, rgba(86,185,73,.16));
  width: 0;
  transition: width .8s cubic-bezier(.22,.8,.3,1);
  z-index: 0;
}

/* Content sits above the bar. The bar is excluded here and re-declared as
   absolute below - a bare `.stat-row > *` would otherwise outrank `.stat-bar`
   and pull it back into the grid flow, shifting the label and value columns. */
.stat-row > * { position: relative; z-index: 1; }

.stat-row > .stat-bar {
  position: absolute;
  z-index: 0;
}

.stat-label {
  font-weight: 650;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: .92rem;
  letter-spacing: -.02em;
}

.stat-note {
  grid-column: 2 / 4;
  font-size: .78rem;
  color: var(--ink-faint);
  margin-top: -4px;
}

/* --- advancement rings -------------------------------------------------- */

.rings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.ring {
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.ring svg { width: 76px; height: 76px; transform: rotate(-90deg); }

.ring-track { fill: none; stroke: var(--line); stroke-width: 8; }

.ring-value {
  fill: none;
  stroke: var(--accent, var(--grass));
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(.22,.8,.3,1);
}

.ring-label {
  font-size: .74rem;
  font-weight: 750;
  text-transform: capitalize;
  letter-spacing: .02em;
}

.ring-detail {
  font-size: .72rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.ring-criteria {
  font-size: .68rem;
  color: var(--ink-faint);
  opacity: .8;
  font-variant-numeric: tabular-nums;
  margin-top: -4px;
}

.adv-list {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
}

.adv-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background .14s ease;
}

.adv-row:hover { background: var(--bg); }

.adv-title { font-weight: 650; font-size: .92rem; }

.adv-desc {
  font-size: .78rem;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adv-progress {
  font-size: .78rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  white-space: nowrap;
}

.adv-complete { color: var(--emerald); }

.adv-more {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 11px;
  font: inherit;
  font-weight: 700;
  font-size: .86rem;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.adv-more:hover { color: var(--ink); border-color: var(--ink-faint); }

/* --- footer ------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  color: var(--ink-faint);
  font-size: .82rem;
}

/* --- entrance animation ------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s ease, transform .5s cubic-bezier(.22,.8,.3,1);
}

.reveal.shown { opacity: 1; transform: none; }

/* --- responsive --------------------------------------------------------- */

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding: 22px; }
  .hero-id h1 { font-size: 1.6rem; }
  .hero-avatar, .hero-avatar-fallback { width: 72px; height: 72px; }
  main { padding: 22px 15px 60px; }
  .topbar-inner { padding: 9px 15px; gap: 10px; }
  .reel-grid { grid-template-columns: 1fr; }

  /* Keep the player switcher on one line and scrollable rather than letting
     chips stack into a block that pushes the toolbar away. */
  .players { flex-wrap: nowrap; overflow-x: auto; min-width: 0; }
  .player-chip { padding: 3px 10px 3px 3px; font-size: .78rem; white-space: nowrap; }
  .avatar, .avatar-fallback { width: 24px; height: 24px; border-radius: 7px; }
  .tone-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
