:root {
  --bg: #0c5229;
  --felt-light: #16793d;
  --surface: #0a2a19;
  --surface-2: #103823;
  --line: rgba(255, 255, 255, .16);
  --gold-line: rgba(253, 210, 95, .55);
  --text: #ffffff;
  --muted: #cfe2d4;
  --accent: #fdd25f;
  --accent-ink: #2a1a00;
  --wood: #7a2c08;
  --wood-dark: #3f1504;
  --rail: clamp(10px, 4.4vw, 58px);
  --radius: 16px;

  /* Type scale: every font size on the site comes from these */
  --fs-title: 32px;
  --fs-heading: 20px;
  --fs-body: 16px;
  --fs-small: 14px;
  --fs-label: 13px;
  --fs-icon: 18px;
  --fs-input: 16px; /* Stays 16px on phones, or iPhones zoom the page on tap */

  --display: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --body: "Montserrat", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(1100px 720px at 50% 0, var(--felt-light), transparent 75%),
    var(--bg);
  color: var(--text);
  font: 500 var(--fs-body)/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}

/* Table edge: wood rails down both sides */
body::before, body::after {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: var(--rail);
  pointer-events: none;
}

body::before {
  left: 0;
  background: linear-gradient(90deg, var(--wood-dark), var(--wood) 62%, #a4491a 88%, var(--wood-dark));
  box-shadow: 6px 0 16px rgba(0, 0, 0, .45);
}

body::after {
  right: 0;
  background: linear-gradient(270deg, var(--wood-dark), var(--wood) 62%, #a4491a 88%, var(--wood-dark));
  box-shadow: -6px 0 16px rgba(0, 0, 0, .45);
}

/* Decorative roulette wheel in the corner */
.wheel {
  position: fixed;
  right: calc(var(--rail) - 130px);
  bottom: -130px;
  z-index: 0;
  width: 340px;
  height: 340px;
  border: 14px solid var(--wood);
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, #ffe9a8 0 7%, #c8922b 8% 15%, #0f5c30 16% 56%, var(--accent) 57% 60%, transparent 61%),
    repeating-conic-gradient(#a81f33 0 10deg, #141414 10deg 20deg);
  box-shadow: 0 0 0 3px var(--accent), 0 10px 40px rgba(0, 0, 0, .55);
  pointer-events: none;
  animation: spin 90s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.wrap {
  position: relative;
  z-index: 1;
  width: min(1160px + 2 * var(--rail), 100%);
  margin: 0 auto;
  padding: 0 calc(var(--rail) + 20px);
}

/* Hero */
.hero {
  max-width: 680px;
  margin: 0 auto;
  padding: 36px 0 32px;
  text-align: center;
}

h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35em;
  margin: 0;
  font: 800 var(--fs-title)/1.15 var(--display);
  letter-spacing: -.02em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .45);
  text-wrap: balance;
}

.h1-logo {
  display: block;
  flex: none;
  width: 1.3em;
  height: 1.3em;
}

h1 em {
  font-style: normal;
  color: var(--accent);
}

.lede {
  margin: 16px 0 28px;
  color: var(--muted);
  font-size: var(--fs-body);
}

.search {
  position: relative;
  display: block;
}

.search svg {
  position: absolute;
  top: 50%;
  left: 20px;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  color: #5d6660;
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 58px;
  padding: 0 58px 0 52px;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: #fff;
  color: #17201b;
  font: 600 var(--fs-input) var(--body);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.search input::placeholder { color: #5d6660; font-weight: 500; }

/* Our own clear button replaces the browser's built-in one */
.search input::-webkit-search-cancel-button { display: none; }

.search-clear {
  position: absolute;
  top: 50%;
  right: 11px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #e6e9e6;
  color: #17201b;
  font-size: var(--fs-body);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color .15s;
}

.search-clear:hover { background: var(--accent); }

.search-clear[hidden] { display: none; }

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(245, 184, 61, .18);
}

/* App grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  --hue: 40;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
  transition: border-color .18s, transform .18s, background-color .18s;
}

.card:hover {
  border-color: hsl(var(--hue) 70% 55% / .6);
  background: var(--surface-2);
  transform: translateY(-2px);
}

.tile {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(145deg, hsl(var(--hue) 78% 52%), hsl(calc(var(--hue) + 28) 72% 28%));
  color: #fff;
  font: 800 var(--fs-heading)/1 var(--display);
  letter-spacing: -.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.tile.has-logo { display: block; width: 116px; background: none; }

/* Thin bright outline keeps dark logos readable on the card */
.tile img {
  width: 100%;
  height: 100%;
  padding: 3px;
  object-fit: contain;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, .95)) drop-shadow(0 0 1px rgba(255, 255, 255, .6));
}

.name {
  margin: 0;
  font: 600 var(--fs-heading)/1.2 var(--display);
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}

.soon {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font: 600 var(--fs-small)/1.3 var(--body);
  letter-spacing: 0;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}

.dl {
  display: inline-flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  min-height: 60px;
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  font: 700 var(--fs-label)/1.15 var(--body);
  text-align: center;
  text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}

.dl i { font-size: var(--fs-icon); }

a.dl:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.dl[aria-disabled="true"] {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  cursor: not-allowed;
}

a:focus-visible, input:focus-visible, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.empty {
  padding: 56px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty strong { color: var(--text); }

/* Footer */
.foot {
  margin: 56px 0 28px;
  padding: 32px;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-small);
}

.foot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px;
}

.foot h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--text);
  font: 600 var(--fs-heading)/1.2 var(--display);
  letter-spacing: -.01em;
}

.foot p { margin: 0 0 12px; }

.foot ul { margin: 0 0 12px; padding-left: 20px; }

.foot li { margin-bottom: 4px; }

.foot strong { color: var(--text); font-weight: 700; }

.foot a { color: var(--accent); font-weight: 600; }

.age {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font: 700 var(--fs-label)/1 var(--body);
  letter-spacing: 0;
}

.copyright {
  margin: 28px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-small);
  text-align: center;
}

/* Phones: tighter cards, with the buttons on their own full-width row */
@media (max-width: 600px) {
  :root {
    --rail: 8px;
    --fs-title: 24px;
    --fs-heading: 16px;
    --fs-body: 13px;
    --fs-small: 12px;
    --fs-label: 9.5px;
    --fs-icon: 15px;
  }

  .wrap { padding: 0 calc(var(--rail) + 8px); }
  .wheel { display: none; }
  .foot { margin: 20px 0 16px; padding: 14px; line-height: 1.45; }
  .foot h2 { margin-bottom: 6px; }
  .foot p { margin-bottom: 6px; }
  .foot ul { margin-bottom: 6px; padding-left: 16px; }
  .foot li { margin-bottom: 2px; }
  .age { width: 26px; height: 26px; }
  .copyright { margin-top: 12px; padding-top: 10px; }
  .hero { padding: 16px 0 12px; }
  .lede { margin: 4px 0 10px; }
  .search input { height: 44px; }
  .search-clear { width: 30px; height: 30px; right: 8px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .foot-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }

  /* One short row per product: logo on the left, buttons on the right */
  .card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0 10px;
    padding: 6px 10px;
  }

  .tile { grid-row: 1 / span 2; width: 46px; height: 46px; border-radius: 12px; }
  .tile.has-logo { width: 76px; height: 48px; }
  .name { grid-row: 1 / span 2; align-self: center; }

  /* The logo shows the name, so the text is kept only for screen readers and search */
  .name-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .soon { margin-top: 0; }
  .actions { grid-column: 2; grid-row: 1 / span 2; gap: 4px; }
  .dl { gap: 4px; min-height: 46px; padding: 6px 0; font-weight: 500; }
}

@media (max-width: 370px) {
  :root { --fs-label: 9px; }
}

@media (max-width: 350px) {
  .tile.has-logo { width: 58px; }
  .actions { gap: 3px; }
  :root { --fs-label: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .card:hover { transform: none; }
  .wheel { animation: none; }
}
