/* Home page layout. Colors, tiles, buttons and the backdrop come from /shared/theme.css. */

.home-layout {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 20px;
  padding: calc(28px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}

@media (min-width: 860px) {
  .home-layout {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    column-gap: 56px;
  }
}

/* Hero */

.hero {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
  width: 100%;
}

.title-tiles {
  --tile-size: 38px;
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
}

@media (min-width: 860px) {
  .title-tiles { --tile-size: 52px; gap: 10px; }
}

/* Tiles are placed with translateX so they can slide past each other when the title scrambles */
.tile-row {
  position: relative;
  display: block;
  height: calc(var(--tile-size) * 1.15);
}

.tile-row .tile {
  position: absolute;
  top: 0;
  left: 0;
  transition: transform 0.55s cubic-bezier(0.2, 0.9, 0.25, 1.2);
}

.tile-row.pop { animation: titlePop 0.45s ease-out; }

@keyframes titlePop {
  40% { transform: scale(1.06); }
}

.tagline {
  margin: 0;
  max-width: 320px;
  text-wrap: balance;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.4;
  color: var(--on-dark-muted);
}

.live {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-weight: 600;
  font-size: 13px;
}

.live i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--go-light);
  animation: ping 1.6s infinite;
}

@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); }
  70%, 100% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
}

/* Demo round */

.demo {
  --tile-size: 36px;
  width: 100%;
  max-width: 340px;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 16px 12px 14px;
  border-radius: 16px;
  /* Solid enough (plus blur) that the drifting letters don't show through the demo */
  background: rgba(20, 18, 28, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.demo-who {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-dark-muted);
}

.demo-tiles, .demo-slots { display: flex; gap: 6px; }

.demo-tiles .tile { transition: opacity 0.2s ease, transform 0.25s ease; }
.demo-tiles .tile.used { opacity: 0.28; transform: scale(0.92); }

.demo-slot {
  width: var(--tile-size);
  height: calc(var(--tile-size) * 1.15);
  display: grid;
  place-items: center;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-tile);
  font-weight: 900;
  font-size: 20px;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.demo-slot.filled { border-style: solid; border-color: rgba(255, 255, 255, 0.75); }
.demo-slot.win { background: var(--go); border-color: var(--go); transform: translateY(-3px); }

.demo-result {
  margin: 0;
  height: 20px;
  font-weight: 700;
  font-size: 13px;
  line-height: 20px;
  color: #a7f3d0;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.demo-result.show { opacity: 1; transform: none; }
.demo-result b { margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--go); color: #fff; }

/* Short phone screens: keep the form above the fold */
@media (max-width: 859px) and (max-height: 760px) {
  .demo { display: none; }
}

/* Start card */

/* Single column: the hero fills the space above and the start card sits at the bottom, clear of the screen edge */
@media (max-width: 859px) {
  .home-layout {
    grid-template-rows: 1fr auto;
    align-content: stretch;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  }

  .hero { align-self: center; }
  .start { align-self: end; }
}

.start {
  width: 100%;
  max-width: 400px;
  display: grid;
  justify-items: center;
  gap: 16px;
}

.start-card {
  width: 100%;
  padding: 20px;
  display: grid;
  gap: 8px;
}

.field-label {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.field {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 2px solid var(--field-line);
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
  font: 600 16px var(--font);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field:focus, .code-box:focus {
  outline: none;
  border-color: var(--jam);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 95, 168, 0.18);
}

.mode {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.code-boxes {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.code-box {
  width: 100%;
  min-width: 0;
  height: 58px;
  padding: 0;
  text-align: center;
  text-transform: uppercase;
  border: 2px solid var(--field-line);
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
  font: 800 24px var(--font);
  caret-color: var(--jam);
}

.link-btn {
  justify-self: center;
  padding: 6px;
  border: 0;
  background: none;
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.soon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.soon span {
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Drifting letters */

.drift {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.drift .tile {
  position: absolute;
  bottom: -80px;
  --tile-size: var(--s);
  opacity: var(--o);
  filter: blur(var(--b));
  box-shadow: none;
  animation: rise var(--d) linear var(--delay) infinite;
}

@keyframes rise {
  from { transform: translateY(0) rotate(var(--r1)); }
  to { transform: translateY(calc(-100vh - 160px)) rotate(var(--r2)); }
}
