:root {
  --bg: #0a1410;
  --header: rgba(18, 28, 22, 0.9);
  --tile: #1a1208;
  --line: rgba(201, 162, 39, 0.18);
  --text: #f5ead6;
  --muted: #a89b7a;
  --accent: #c9a227;
  --accent-2: #e8d4a8;
  --gold: #c9a227;
  --gold-bright: #f0d878;
  --wood: #3d2814;
  --felt: #1a3d2e;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201, 162, 39, 0.08), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(26, 61, 46, 0.5), transparent 45%),
    linear-gradient(165deg, #0a1410 0%, var(--felt) 35%, #0d1a14 100%);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.fx { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: drift 18s ease-in-out infinite;
}
.b1 { width: 420px; height: 420px; left: -80px; top: -40px; background: #c9a227; }
.b2 { width: 360px; height: 360px; right: -60px; top: 20%; background: #6b4423; animation-delay: -6s; }
.b3 { width: 300px; height: 300px; left: 30%; bottom: -80px; background: #1a3d2e; animation-delay: -11s; }
.grid-fade {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(201, 162, 39, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 162, 39, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 20%, #000 15%, transparent 72%);
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -14px) scale(1.06); }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 72px;
  padding: 0 24px;
  background: var(--header);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
}
.logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(145deg, #c9a227, #6b4423 55%, #3d2814);
  display: grid;
  place-items: center;
  box-shadow:
    0 0 0 2px rgba(201, 162, 39, 0.35),
    0 0 0 4px rgba(61, 40, 20, 0.5),
    0 8px 20px rgba(0, 0, 0, 0.45);
}
.logo img { width: 100%; height: 100%; display: block; }
.logo span {
  font-family: Cinzel, serif;
  font-weight: 800;
  font-size: 20px;
}
.brand-text { display: grid; line-height: 1.1; }
.brand strong {
  font-family: Cinzel, serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-bright);
}
.brand small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.search {
  flex: 1;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(61, 40, 20, 0.45);
  border: 1px solid rgba(201, 162, 39, 0.22);
  border-radius: 999px;
  padding: 11px 16px;
  color: var(--muted);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25);
}
.search:focus-within {
  border-color: rgba(201, 162, 39, 0.65);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.14), inset 0 2px 6px rgba(0, 0, 0, 0.25);
  color: var(--text);
}
.search input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
  font-weight: 600;
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.live-pill, .gem-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(180deg, rgba(61, 40, 20, 0.9), rgba(35, 22, 11, 0.95));
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
}
.gem-pill b { color: var(--gold-bright); font-family: Cinzel, serif; }
.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(201, 162, 39, 0.45);
  border-radius: 999px;
  padding: 8px 12px;
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.2), rgba(61, 40, 20, 0.9));
  color: var(--gold-bright);
  font-family: Cinzel, serif;
  font-size: 13px;
  font-weight: 700;
}
.name-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 12, 10, 0.72);
  backdrop-filter: blur(8px);
}
.name-gate[hidden] { display: none; }
.name-card {
  width: min(440px, 100%);
  padding: 22px 22px 18px;
  border-radius: 18px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: linear-gradient(180deg, #2a2116, #141910);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.name-kicker {
  margin: 0 0 6px;
  color: var(--gold);
  font-family: Cinzel, serif;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.name-card h3 {
  margin: 0 0 8px;
  font-family: Cinzel, serif;
  font-size: 28px;
}
.name-card p { margin: 0 0 14px; color: var(--muted); }
.name-card input {
  width: 100%;
  margin-bottom: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: rgba(0, 0, 0, 0.28);
}
.name-error { color: #f0a8a8 !important; min-height: 0; }
.name-go, .name-ghost {
  border-radius: 999px;
  padding: 10px 16px;
  font-family: Cinzel, serif;
  font-weight: 800;
}
.name-go {
  border: 0;
  color: #2a1a0c;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
}
.name-ghost {
  border: 1px solid rgba(201, 162, 39, 0.4);
  background: transparent;
  color: var(--text);
}
.name-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.history-list {
  max-height: min(46vh, 360px);
  overflow: auto;
  display: grid;
  gap: 8px;
}
.history-list article {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(201, 162, 39, 0.14);
}
.history-list b { font-family: Cinzel, serif; }
.history-list span, .history-list small, .history-empty { color: var(--muted); }
.history-empty { margin: 0; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c9a227;
  box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.2);
  animation: pulse 1.6s ease infinite;
}
@keyframes pulse {
  50% { box-shadow: 0 0 0 7px rgba(201, 162, 39, 0); }
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 204px 1fr;
  min-height: calc(100vh - 72px);
}
.side {
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: rgba(10, 16, 12, 0.55);
}
.side-label {
  margin: 22px 12px 8px;
  color: var(--muted);
  font-family: Cinzel, serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.nav {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 11px 13px;
  font-weight: 600;
  color: var(--muted);
}
.nav i { width: 18px; font-style: normal; }
.nav:hover { background: rgba(201, 162, 39, 0.08); color: var(--text); }
.nav.active {
  color: var(--gold-bright);
  background: linear-gradient(90deg, rgba(201, 162, 39, 0.22), rgba(107, 68, 35, 0.12));
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.35);
}

.main {
  padding: 26px 30px 40px;
  max-width: 1200px;
}

.featured {
  display: grid;
  grid-template-columns: 1.6fr 0.9fr;
  gap: 16px;
  margin-bottom: 34px;
}
.featured[hidden] { display: none; }
.hero, .mini, .game-card .thumb {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(165deg, #2a1a0c, #1a1208);
  border: 2px solid rgba(201, 162, 39, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(240, 216, 120, 0.12),
    0 0 0 1px rgba(42, 26, 12, 0.8),
    0 16px 36px rgba(0, 0, 0, 0.45);
}
.hero, .mini { display: block; }
.hero {
  min-height: 360px;
  box-shadow:
    inset 0 1px 0 rgba(240, 216, 120, 0.14),
    0 0 0 1px rgba(42, 26, 12, 0.8),
    0 22px 50px rgba(0, 0, 0, 0.5),
    0 0 48px rgba(201, 162, 39, 0.12);
}
.mini-col { display: grid; gap: 16px; }
.mini { min-height: 109px; }
.hero .cover, .mini .cover,
.hero .hover-play, .mini .hover-play,
.thumb .cover, .thumb .hover-play {
  position: absolute;
  inset: 0;
}
.scene { width: 100%; height: 100%; display: block; }
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(240, 216, 120, 0.18) 48%, transparent 58%);
  transform: translateX(-140%);
}
.hero:hover .cover::after,
.mini:hover .cover::after,
.game-card:hover .cover::after {
  transform: translateX(140%);
  transition: transform 0.7s ease;
}
.hero .info, .mini .info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 20px 18px;
  background: linear-gradient(transparent, rgba(10, 14, 10, 0.92));
}
.kicker {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.9), rgba(139, 105, 20, 0.85));
  color: #2a1a0c;
  font-family: Cinzel, serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hero h3, .mini h3 {
  margin: 0;
  font-family: Cinzel, serif;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gold-bright);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.mini h3 { font-size: 17px; }
.meta {
  margin-top: 6px;
  color: rgba(245, 234, 214, 0.85);
  font-size: 14px;
  font-weight: 600;
  max-width: 36ch;
}
.play-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 55%, #a88620);
  color: #2a1a0c;
  border-radius: 999px;
  padding: 10px 18px;
  font-family: Cinzel, serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow: 0 6px 0 #5c3d1e, 0 10px 24px rgba(0, 0, 0, 0.35);
}
.mini .play-chip, .mini .meta, .mini .kicker { display: none; }
.hero, .mini, .game-card {
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.hero:hover, .mini:hover, .game-card:hover {
  transform: translateY(-4px);
}
.game-card:hover .thumb {
  border-color: rgba(201, 162, 39, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(240, 216, 120, 0.16),
    0 0 0 1px rgba(42, 26, 12, 0.8),
    0 18px 36px rgba(0, 0, 0, 0.45),
    0 0 24px color-mix(in srgb, var(--c, var(--gold)) 32%, transparent);
}

.row-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(201, 162, 39, 0.15);
}
.row-head h2 {
  margin: 0;
  font-family: Cinzel, serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-bright);
}
.row-head p { margin: 0; color: var(--muted); font-weight: 600; }
.row-head p b { color: var(--gold); font-family: Cinzel, serif; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px 18px;
}
.game-card { display: block; }
.game-card .thumb { aspect-ratio: 16 / 10; }
.game-card .name {
  margin: 10px 2px 0;
  font-family: Cinzel, serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.03em;
  color: var(--text);
}
.game-card .sub {
  margin: 2px 2px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.hover-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 14, 10, 0.35);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.hover-play span {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #2a1a0c;
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.35), 0 12px 30px rgba(0, 0, 0, 0.4);
}
.game-card:hover .hover-play,
.hero:hover .hover-play { opacity: 1; }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 48px 12px;
  font-weight: 600;
}

.foot {
  margin-top: 42px;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding-top: 16px;
  border-top: 1px solid rgba(201, 162, 39, 0.12);
}

.hi { color: var(--muted); font-weight: 600; font-size: 13px; }
.btn {
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 10px;
  padding: 9px 13px;
  font-family: Cinzel, serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, rgba(61, 40, 20, 0.8), rgba(35, 22, 11, 0.9));
  color: var(--text);
}

.play-shell {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(165deg, #0a1410, var(--felt));
}
.play-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px;
  background: rgba(18, 28, 22, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  transform: translateY(-104%);
  transition: transform 0.2s ease;
}
.play-shell.bar-on .play-bar { transform: none; }
.play-bar .left, .play-bar .right { display: flex; align-items: center; gap: 10px; }
.play-bar h2 {
  margin: 0;
  font-family: Cinzel, serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--gold-bright);
}
.play-bar .hi { font-size: 11px; }
.play-bar .btn { padding: 7px 11px; font-size: 12px; }
.frame-wrap { position: fixed; inset: 0; }
.game-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0a1410;
}
.exit-ask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(8, 14, 10, 0.82);
  backdrop-filter: blur(7px);
}
.play-shell.ask-on .exit-ask { display: grid; }
.exit-card {
  width: min(340px, 100%);
  padding: 22px;
  text-align: center;
  border: 2px solid rgba(201, 162, 39, 0.4);
  border-radius: 14px;
  background: linear-gradient(165deg, #3d2814, #1a1208);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.exit-card h3 {
  margin: 0 0 6px;
  font-family: Cinzel, serif;
  font-size: 22px;
  color: var(--gold-bright);
}
.exit-card p { margin: 0 0 16px; font-size: 13px; opacity: 0.8; }
.exit-row { display: grid; gap: 8px; }
.exit-row .btn { display: block; text-align: center; text-decoration: none; padding: 12px; }
.exit-row .btn.go {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-color: transparent;
  color: #2a1a0c;
}

.app-kicker {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.install-chip {
  display: none;
  border: 1px solid rgba(201, 162, 39, 0.5);
  border-radius: 999px;
  padding: 8px 12px;
  font-family: Cinzel, serif;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #2a1a0c;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
}
body.can-install .install-chip { display: inline-flex; }
.dock { display: none; }

html.standalone body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
html.standalone .site-header {
  top: env(safe-area-inset-top);
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .featured { grid-template-columns: 1fr; }
  .hero { min-height: 240px; }
  .mini-col { grid-template-columns: 1fr 1fr 1fr; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .brand { min-width: auto; }
  .main { padding: 16px 16px 108px; }
  .hover-play { opacity: 0.55; }
  .dock {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 12;
    gap: 4px;
    padding: 8px;
    border-radius: 20px;
    background: rgba(18, 24, 18, 0.94);
    border: 1px solid rgba(201, 162, 39, 0.25);
    backdrop-filter: blur(18px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
  .dock .nav, .dock button {
    width: auto;
    flex-direction: column;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: 14px;
    padding: 8px 4px;
    font-size: 10px;
    font-family: Cinzel, serif;
    font-weight: 700;
    min-height: 48px;
  }
  .dock .nav i, .dock button i { font-style: normal; font-size: 16px; }
  .dock .nav.active {
    color: var(--gold-bright);
    background: linear-gradient(180deg, rgba(201, 162, 39, 0.28), rgba(107, 68, 35, 0.15));
  }
  body.can-install .dock { grid-template-columns: repeat(5, 1fr); }
  body:not(.can-install) .dock { grid-template-columns: repeat(4, 1fr); }
  .play-bar {
    padding-top: calc(7px + env(safe-area-inset-top));
    flex-wrap: wrap;
  }
  .play-bar .right { flex-wrap: wrap; justify-content: flex-end; }
}
@media (max-width: 720px) {
  .site-header { height: auto; padding: 10px 12px; flex-wrap: wrap; }
  .search { max-width: none; order: 3; flex-basis: 100%; }
  .brand-text strong { display: block; font-size: 16px; }
  .live-pill { display: none; }
  .grid { grid-template-columns: 1fr 1fr; gap: 14px 12px; }
  .mini-col { grid-template-columns: 1fr; }
  .hero h3 { font-size: 24px; }
  .header-actions .gem-pill { padding: 6px 8px; font-size: 12px; }
}
