:root {
  --bg: #f3ecff;
  --dot: rgba(140, 100, 210, 0.13);
  --surface: #ffffff;
  --ink: #2e2342;
  --muted: #776a8c;
  --line: #e6dbf6;
  --pink: #ff6fa8;
  --pink-dark: #e9508c;
  --violet: #7b5cff;
  --chip: #f1e8fd;
  --stage: #1d1530;
  --radius: 22px;
  --shadow-sm: 0 2px 0 rgba(90, 60, 140, 0.08), 0 6px 18px rgba(90, 60, 140, 0.1);
  --shadow-lg: 0 4px 0 rgba(90, 60, 140, 0.06), 0 18px 40px rgba(90, 60, 140, 0.22);
  --display: 'Baloo 2', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --text: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --wrap: 1240px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--text);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(1000px 420px at 50% -120px, #ffd9ec 0%, transparent 70%),
    radial-gradient(var(--dot) 1.3px, transparent 1.6px);
  background-size: 100% 100%, 22px 22px;
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
svg { width: 1.2em; height: 1.2em; flex: none; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }

/* ------------------------------------------------------------ header */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.top-inner { max-width: var(--wrap); margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 14px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 1.35rem; white-space: nowrap; }
.logo img { border-radius: 12px; box-shadow: var(--shadow-sm); }
.search {
  flex: 1; max-width: 460px; margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: var(--chip); border: 2px solid transparent; border-radius: 999px; padding: 0 16px; height: 44px;
  color: var(--muted); transition: border-color 0.15s, background 0.15s;
}
.search:focus-within { border-color: var(--violet); background: #fff; }
.search input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--ink); outline: none; }
.search input::placeholder { color: var(--muted); font-weight: 600; }
.random {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--violet); color: #fff; font-weight: 800; box-shadow: 0 3px 0 #5a3fd6; transition: transform 0.12s;
}
.random:hover { transform: translateY(-1px); }
.random:active { transform: translateY(2px); box-shadow: 0 1px 0 #5a3fd6; }

main { max-width: var(--wrap); margin: 0 auto; padding: 20px 16px 48px; }

/* ------------------------------------------------------------ buttons */
.btn-play {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--pink); color: #fff; font-family: var(--display); font-weight: 800; font-size: 1.2rem;
  padding: 12px 28px 10px; border-radius: 999px; box-shadow: 0 5px 0 var(--pink-dark), 0 10px 24px rgba(233, 80, 140, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn-play:hover { transform: translateY(-2px) scale(1.03); }
.btn-play:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--pink-dark); }
.btn-play.big { font-size: 1.45rem; padding: 14px 40px 12px; }

/* ------------------------------------------------------------ featured hero */
.feature {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 32px;
  padding: 36px 44px; border-radius: 32px; background: #fff; box-shadow: var(--shadow-lg);
  min-height: 460px;
}
.feature-bg {
  position: absolute; inset: -60px; z-index: -2;
  background-size: cover; background-position: center; filter: blur(46px) saturate(1.3); opacity: 0.85;
  transition: background-image 0.3s;
}
.feature::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.75) 45%, rgba(255, 255, 255, 0.1) 100%);
}
.feature-text, .feature-media { transition: opacity 0.22s, transform 0.22s; }
.feature.swap .feature-text, .feature.swap .feature-media { opacity: 0; transform: translateY(6px); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 800; font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase;
}
.feature h1 { font-size: clamp(2.4rem, 5.5vw, 4.2rem); margin: 14px 0 0; letter-spacing: -0.01em; }
.feature-tagline { margin: 2px 0 0; color: var(--pink-dark); font-family: var(--display); font-weight: 700; font-size: 1.3rem; }
.feature-desc { max-width: 520px; margin: 14px 0 24px; line-height: 1.6; font-size: 1.05rem; color: #4a3d5f; }
.feature-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.feature-note { color: var(--muted); font-weight: 700; font-size: 0.9rem; }
.feature-dots { display: flex; gap: 10px; margin-top: 28px; }
.feature-dots button {
  width: 52px; height: 52px; border-radius: 16px; border: 3px solid #fff; padding: 0; cursor: pointer;
  background-size: cover; background-position: center; box-shadow: var(--shadow-sm); opacity: 0.55;
  transition: opacity 0.15s, transform 0.15s;
}
.feature-dots button:hover { opacity: 0.85; }
.feature-dots button[aria-selected='true'] { opacity: 1; border-color: var(--pink); transform: scale(1.08); }
.feature-media {
  display: block; width: 252px; aspect-ratio: 9 / 16; border-radius: 34px; overflow: hidden;
  border: 7px solid #fff; background: #e9def8; box-shadow: var(--shadow-lg); transform: rotate(2deg);
}
.feature-media video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ------------------------------------------------------------ game grid */
.games { margin-top: 40px; scroll-margin-top: 90px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2, .more h2, .about h2 { font-size: 1.7rem; display: flex; align-items: center; gap: 10px; }
.count { font-family: var(--text); font-size: 0.85rem; font-weight: 800; background: var(--ink); color: #fff; border-radius: 999px; padding: 2px 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 0.9rem; color: var(--ink);
  background: #fff; border-radius: 999px; padding: 8px 16px; box-shadow: var(--shadow-sm); transition: background 0.15s, color 0.15s;
}
.chip:hover { background: var(--chip); }
.chip.on { background: var(--ink); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; }
.tile {
  position: relative; display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.3, 1.5, 0.6, 1), box-shadow 0.2s;
}
.tile[href]:hover, .tile[href]:focus-visible { transform: translateY(-6px) scale(1.025); box-shadow: var(--shadow-lg), 0 0 0 3px var(--pink); outline: none; }
.tile-media { position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--chip); }
.tile-media img, .tile-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-media video { opacity: 0; transition: opacity 0.3s; object-position: 50% 85%; }
.tile.previewing video { opacity: 1; }
.tile-media img { transition: transform 0.4s; }
.tile.hot img { transform: scale(1.06); }
/* Thin loading bar while the preview buffers. */
.tile.hot:not(.previewing) .tile-media::after {
  content: ''; position: absolute; left: 0; top: 0; height: 4px; width: 40%; background: var(--pink);
  border-radius: 0 4px 4px 0; animation: load 0.9s ease-in-out infinite;
}
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.tile-play {
  position: absolute; right: 12px; bottom: 12px; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; background: var(--pink); color: #fff; font-size: 1.1rem;
  box-shadow: 0 4px 0 var(--pink-dark), 0 8px 18px rgba(0, 0, 0, 0.2);
  opacity: 0; transform: translateY(8px) scale(0.8); transition: opacity 0.2s, transform 0.2s;
}
.tile:hover .tile-play, .tile:focus-visible .tile-play, .tile.previewing .tile-play { opacity: 1; transform: none; }
.tile-info { display: flex; flex-direction: column; gap: 1px; padding: 12px 14px 14px; }
.tile-info strong { font-family: var(--display); font-size: 1.2rem; font-weight: 800; line-height: 1.15; }
.tile-info span { color: var(--muted); font-size: 0.88rem; font-weight: 700; }

.tile-soon { background: transparent; box-shadow: none; border: 3px dashed #d4c3ee; }
.tile-soon .tile-media { background: transparent; display: grid; place-content: center; text-align: center; gap: 8px; aspect-ratio: auto; height: 100%; min-height: 200px; }
.soon-mochi { font-size: 2.6rem; filter: grayscale(0.2); }
.soon-text { color: var(--muted); font-weight: 800; line-height: 1.35; }
.empty { text-align: center; color: var(--muted); font-weight: 800; padding: 40px 0; }

.why { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 48px; }
.why div { background: rgba(255, 255, 255, 0.7); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.why b { font-family: var(--display); font-size: 1.15rem; }
.why span { color: var(--muted); line-height: 1.5; }

/* ------------------------------------------------------------ play page */
.stage {
  position: relative; overflow: hidden; isolation: isolate; border-radius: 28px; background: linear-gradient(160deg, #4a3480, var(--stage));
  height: min(80vh, 780px); min-height: 520px; display: grid; place-items: center; padding: 18px;
  box-shadow: var(--shadow-lg);
}
.stage-bg {
  position: absolute; inset: -60px; z-index: -1; background-size: cover; background-position: center;
  filter: blur(50px) saturate(1.6); opacity: 0.6;
}
.stage-frame {
  position: relative; height: 100%; aspect-ratio: 9 / 16; max-width: 100%; border-radius: 22px; overflow: hidden;
  background: #000; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.stage-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; }
.stage.fs { height: 100vh; border-radius: 0; padding: 0; }
.stage.fs .stage-frame { border-radius: 0; }
.stage-cover { position: absolute; inset: 0; }
.stage-cover video { width: 100%; height: 100%; object-fit: cover; display: block; }
.stage-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 10, 40, 0.1) 30%, rgba(20, 10, 40, 0.75) 100%); }
.cover-ui {
  position: absolute; inset: auto 0 0; z-index: 1; padding: 24px 20px 30px;
  display: flex; flex-direction: column; align-items: center; text-align: center; color: #fff;
}
.cover-ui img { width: 84px; height: 84px; border-radius: 24px; border: 4px solid #fff; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); object-fit: cover; }
.cover-ui h1 { font-size: 2.1rem; margin-top: 10px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35); }
.cover-ui p { margin: 0 0 18px; font-weight: 800; opacity: 0.9; }
.cover-ui small { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; font-weight: 700; opacity: 0.85; }

.stage-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px;
  background: var(--surface); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow-sm);
}
.stage-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.stage-title img { border-radius: 12px; object-fit: cover; }
.stage-title strong { display: block; font-family: var(--display); font-size: 1.25rem; line-height: 1.1; }
.stage-title span { color: var(--muted); font-weight: 700; font-size: 0.88rem; }
.stage-tools { display: flex; gap: 8px; }
.tool {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--chip); color: var(--ink); font: inherit; font-weight: 800; font-size: 0.9rem; transition: background 0.15s;
}
.tool:hover { background: #e5d6fb; }

.play-cols { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; margin-top: 24px; align-items: start; }
.about { background: var(--surface); border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow-sm); }
.about p { line-height: 1.7; font-size: 1.05rem; margin: 12px 0 18px; color: #4a3d5f; }
.about dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 18px; }
.about dl div { background: var(--chip); border-radius: 14px; padding: 10px 14px; }
.about dt { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.about dd { margin: 2px 0 0; font-weight: 800; }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags a { display: block; background: var(--ink); color: #fff; border-radius: 999px; padding: 5px 14px; font-size: 0.88rem; font-weight: 800; }
.tags a:hover { background: var(--violet); }
.more h2 { margin-bottom: 14px; }
.grid-small { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-small .tile-info strong { font-size: 1.05rem; }

/* ------------------------------------------------------------ footer */
footer { max-width: var(--wrap); margin: 0 auto; padding: 28px 16px 44px; text-align: center; color: var(--muted); font-size: 0.9rem; }
footer p { margin: 10px 0 0; line-height: 1.6; }
.logo.small { font-size: 1.05rem; color: var(--ink); }
.logo.small img { border-radius: 9px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 899px) {
  .play-cols { grid-template-columns: 1fr; }
  .grid-small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .stage { height: auto; min-height: 0; padding: 0; border-radius: 24px; }
  .stage-frame { width: 100%; height: auto; aspect-ratio: 4 / 5; border-radius: 0; box-shadow: none; }
}

@media (max-width: 759px) {
  .top-inner { gap: 10px; padding: 10px 16px; }
  .logo span { display: none; }
  .search { max-width: none; height: 42px; }
  .random { width: 42px; height: 42px; padding: 0; justify-content: center; }
  .random span { display: none; }
  main { padding-top: 14px; }

  /* Hero becomes a full-bleed video card with the text over it. */
  .feature { grid-template-columns: 1fr; padding: 0; min-height: 0; gap: 0; border-radius: 26px; }
  .feature::before { z-index: 1; background: linear-gradient(180deg, transparent 35%, rgba(25, 12, 45, 0.85) 100%); pointer-events: none; }
  .feature-media { grid-area: 1 / 1; width: 100%; aspect-ratio: 4 / 5; border: 0; border-radius: 0; transform: none; box-shadow: none; }
  .feature.swap .feature-media { transform: none; }
  .feature-text { grid-area: 1 / 1; align-self: end; z-index: 2; padding: 20px; color: #fff; pointer-events: none; }
  .feature-text a, .feature-text button { pointer-events: auto; }
  .feature h1 { font-size: 2.3rem; margin-top: 10px; }
  .feature-tagline { color: #ffc2dc; font-size: 1.1rem; }
  .feature-desc, .feature-note { display: none; }
  .feature-actions { margin-top: 14px; }
  .badge { background: rgba(255, 255, 255, 0.92); color: var(--ink); }
  .feature-dots { position: absolute; top: 16px; right: 16px; margin: 0; flex-direction: column; }
  .feature-dots button { width: 44px; height: 44px; border-radius: 14px; }

  .games { margin-top: 28px; }
  .section-head h2 { font-size: 1.45rem; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 4px 16px 8px; scrollbar-width: none; }
  .chip { white-space: nowrap; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile-info { padding: 10px 12px 12px; }
  .tile-info strong { font-size: 1.05rem; }
  .tile-info span { font-size: 0.8rem; }
  .tile-play { width: 38px; height: 38px; right: 8px; bottom: 8px; }
  .why { margin-top: 32px; }
  .stage-bar { flex-wrap: wrap; }
  .tool span { display: none; }
  .about { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
