/* Pizza Bros Pizza Cup — felt letter board, neon sign, gingham, order tickets */
:root {
  --felt: #181410;
  --felt-ridge: #221c16;
  --letter: #f3e9d2;
  --tomato: #d6402e;
  --tomato-deep: #a92c1e;
  --basil: #4e8a5a;
  --mozz: #f2e4c4;
  --ticket: #f7efdd;
  --ink: #2a2118;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--felt);
  color: var(--letter);
  font-family: "Barlow", system-ui, sans-serif;
  min-height: 100vh;
}

/* ---------- neon sign ---------- */
.sign-wrap { text-align: center; padding: 2.2rem 1rem 1.2rem; }
.neon-sign {
  font-family: "Yellowtail", cursive;
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  color: #ffb3a7;
  text-shadow:
    0 0 6px #ff6b54,
    0 0 18px #ff3b1f,
    0 0 42px rgba(255, 59, 31, 0.55);
  animation: flicker 9s infinite;
}
@keyframes flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: .55; }
  94% { opacity: 1; }
  96.5% { opacity: .75; }
  97% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .neon-sign { animation: none; }
}
.sign-sub {
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: .35em;
  font-size: clamp(.7rem, 2.4vw, 1rem);
  color: var(--mozz);
  margin-top: .4rem;
  text-transform: uppercase;
}

/* ---------- gingham strip ---------- */
.gingham {
  height: 22px;
  background:
    repeating-linear-gradient(90deg, var(--tomato) 0 22px, transparent 22px 44px),
    repeating-linear-gradient(0deg, var(--tomato) 0 11px, transparent 11px 22px),
    #fff;
  background-blend-mode: multiply;
  opacity: .9;
}

main { max-width: 880px; margin: 0 auto; padding: 1.4rem 1rem 3rem; }

.demo-banner {
  background: var(--basil);
  color: #fff;
  padding: .5rem .9rem;
  border-radius: 6px;
  font-size: .85rem;
  margin-bottom: 1.2rem;
  text-align: center;
}
.demo-banner.error { background: var(--tomato-deep); }
.demo-banner code { font-family: monospace; background: rgba(0,0,0,.25); padding: 0 .3em; border-radius: 3px; }

/* ---------- headings ---------- */
.board-heading, .rail-heading {
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: .18em;
  font-size: 1.5rem;
  color: var(--mozz);
  margin: 1.6rem 0 .7rem;
  text-transform: uppercase;
}
.board-heading.small { font-size: 1.1rem; }
.flame { filter: drop-shadow(0 0 6px rgba(255,120,40,.8)); }

/* ---------- live ticket rail ---------- */
.ticket-rail {
  display: flex;
  gap: .9rem;
  overflow-x: auto;
  padding-bottom: .6rem;
  scrollbar-width: thin;
}
.ticket {
  flex: 0 0 230px;
  background: var(--ticket);
  color: var(--ink);
  border-radius: 4px;
  padding: .7rem .8rem .8rem;
  position: relative;
  box-shadow: 0 3px 0 rgba(0,0,0,.4);
  /* perforated ticket top */
  -webkit-mask: radial-gradient(circle 5px at 10px 0, transparent 98%, #000) -10px 0 / 20px 100%;
          mask: radial-gradient(circle 5px at 10px 0, transparent 98%, #000) -10px 0 / 20px 100%;
}
.ticket .order-no {
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: .1em;
  font-size: .75rem;
  color: var(--tomato-deep);
  display: flex;
  justify-content: space-between;
}
.ticket .minute { font-weight: 700; }
.ticket .line {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 1.02rem;
  padding: .18rem 0;
}
.ticket .line .g { font-family: "Bebas Neue", sans-serif; font-size: 1.25rem; }

/* ---------- letter board ---------- */
.letter-board {
  background:
    repeating-linear-gradient(0deg, var(--felt-ridge) 0 2px, var(--felt) 2px 52px);
  border: 10px solid #0d0a07;
  border-radius: 8px;
  box-shadow: inset 0 0 26px rgba(0,0,0,.7), 0 4px 18px rgba(0,0,0,.5);
  padding: .4rem .9rem;
}
.row {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  height: 52px;
  cursor: pointer;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(1.15rem, 3.6vw, 1.55rem);
  letter-spacing: .06em;
}
.row .rank { width: 1.8em; color: var(--tomato); }
.row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .leader-dots {
  flex: 1;
  border-bottom: 3px dotted rgba(243, 233, 210, .35);
  transform: translateY(-7px);
  min-width: 20px;
}
.row .slices { color: var(--mozz); }
.row .slices .unit { font-size: .6em; letter-spacing: .15em; color: rgba(243,233,210,.7); margin-left: .25em; }
.row.house { color: #9aa89e; }
.row.house .rank { color: #5d7263; }
.row:focus-visible { outline: 3px solid var(--basil); outline-offset: -3px; border-radius: 4px; }

/* team flags beside each name */
.team-flags { display: inline-flex; gap: 3px; align-self: center; flex-shrink: 0; }
.flag { display: inline-block; vertical-align: -2px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
@media (max-width: 480px) {
  .team-flags .flag { width: 15px; height: 11px; }
  .team-flags { overflow: hidden; max-width: 96px; } /* Morty's 9 minnows truncate, not overflow */
}

/* rank movement + live provisional slices */
.row .move { font-size: .55em; align-self: center; margin-left: .1em; }
.row .move.up { color: var(--basil); }
.row .move.down { color: var(--tomato); }
.row .live-extra {
  font-size: .5em;
  letter-spacing: .12em;
  color: #ffd27a;
  white-space: nowrap;
  align-self: center;
  margin-right: .4em;
}

/* expandable team detail */
.detail {
  display: none;
  font-family: "Barlow", sans-serif;
  font-size: .85rem;
  letter-spacing: 0;
  color: var(--mozz);
  padding: .2rem 0 .8rem 2.4em;
}
.detail.open { display: block; }
.detail { overflow-x: auto; } /* 7-column table scrolls on narrow phones */
.detail table { border-collapse: collapse; width: 100%; max-width: 520px; }
.detail td, .detail th { padding: .15rem .55rem .15rem 0; text-align: left; font-weight: 400; }
.detail th { color: rgba(243,233,210,.72); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; }
.detail .out { opacity: .45; text-decoration: line-through; }
.detail tr.out td { opacity: .45; text-decoration: line-through; }
.detail td.num { text-align: right; }
.detail .nextup { margin-top: .35rem; color: rgba(243,233,210,.75); font-size: .8rem; }

/* ---------- menus (fixtures/results) ---------- */
.menus { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
@media (max-width: 640px) { .menus { grid-template-columns: 1fr; } }
.menu-list { list-style: none; }
.menu-list li {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  padding: .32rem 0;
  font-size: .92rem;
  border-bottom: 1px solid rgba(243,233,210,.08);
}
.menu-list .when {
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: .08em;
  color: var(--basil);
  min-width: 4.6em;
  white-space: nowrap;
  flex-shrink: 0;
}
.menu-list .score { margin-left: auto; font-weight: 700; color: var(--mozz); white-space: nowrap; }
.menu-list .pens { font-weight: 400; font-size: .78rem; color: rgba(243,233,210,.6); }

/* the house dog */
.dog {
  display: inline-block;
  font-size: .8em;
  margin-left: .35em;
  vertical-align: baseline;
  line-height: 1;
}

/* match titles linked to the FIFA match centre */
a.match-link {
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.menu-list a.match-link:hover { color: var(--mozz); text-decoration-style: solid; }
.ticket a.match-link:hover { color: var(--basil); text-decoration-style: solid; }

/* ---------- group boards ---------- */
.groups-wrap summary { cursor: pointer; list-style: none; }
.groups-wrap summary::after { content: " \25BE"; color: var(--basil); }
.groups-wrap[open] summary::after { content: " \25B4"; }
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: .9rem;
  margin-top: .5rem;
}
.group-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(243,233,210,.12);
  border-radius: 6px;
  padding: .6rem .7rem;
}
.group-card h3 {
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: .14em;
  font-size: .95rem;
  color: var(--basil);
  margin-bottom: .35rem;
  text-transform: uppercase;
}
.group-card table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.group-card th {
  text-align: left;
  font-size: .65rem;
  color: rgba(243,233,210,.72);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 400;
}
.group-card td, .group-card th { padding: .14rem 0 .14rem 0; }
.group-card .num { text-align: right; padding-left: .35rem; }
.group-card tr.thru td:first-child { color: var(--mozz); font-weight: 600; }

/* ---------- celebrations ---------- */
.celebration {
  color: #fff;
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: .08em;
  font-size: 1.15rem;
  text-align: center;
  padding: .6rem .9rem;
  border-radius: 6px;
  margin-bottom: 1.2rem;
}
.celebration.champ {
  background: var(--tomato);
  animation: glowpulse 1.6s ease-in-out infinite;
}
.celebration.ultra { background: var(--basil); animation: glowpulse 1.1s ease-in-out infinite; }
@keyframes glowpulse {
  0%, 100% { box-shadow: 0 0 6px rgba(255,120,40,.55); }
  50% { box-shadow: 0 0 24px rgba(255,120,40,.95); }
}
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i {
  position: absolute;
  top: -16px;
  width: 8px;
  height: 14px;
  opacity: .9;
  animation: confetti-fall linear infinite;
}
@keyframes confetti-fall {
  to { transform: translateY(105vh) rotate(720deg); }
}
@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
  .celebration.champ, .celebration.ultra { animation: none; }
}

/* ---------- draw card ---------- */
.card.draw-card {
  background: var(--ticket);
  color: var(--ink);
  border-radius: 6px;
  padding: 1.2rem 1.4rem;
  text-align: center;
}
.card.draw-card p { margin: .5rem 0 1rem; }
.draw-btn {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.25rem;
  letter-spacing: .12em;
  background: var(--tomato);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: .6rem 1.6rem;
  cursor: pointer;
}
.draw-btn:hover { background: var(--tomato-deep); }
.draw-btn:focus-visible { outline: 3px solid var(--basil); outline-offset: 2px; }

/* ---------- house rules ---------- */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: .9rem;
}
.rule-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(243,233,210,.14);
  border-radius: 6px;
  padding: .7rem .85rem;
}
.rule-card h3 {
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: .12em;
  font-size: 1rem;
  color: var(--basil);
  margin-bottom: .4rem;
  text-transform: uppercase;
}
.rule-card ul { list-style: none; }
.rule-card li {
  font-size: .85rem;
  padding: .22rem 0;
  border-bottom: 1px dotted rgba(243,233,210,.12);
}
.rule-card li:last-child { border-bottom: none; }
.rule-card b { color: var(--mozz); }

/* ---------- footer ---------- */
.footer {
  margin-top: 2.2rem;
  font-size: .78rem;
  color: rgba(243,233,210,.7);
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  justify-content: space-between;
  align-items: baseline;
}

.detail .namebonus {
  margin-top: .35rem;
  color: var(--basil);
  font-size: .8rem;
}

/* ---------- the receipt ---------- */
.receipt-wrap summary { cursor: pointer; list-style: none; }
.receipt-wrap summary::after { content: " \25BE"; color: var(--basil); }
.receipt-wrap[open] summary::after { content: " \25B4"; }
.receipt {
  background: #fdfaf2;
  color: var(--ink);
  font-family: "Courier New", monospace;
  font-size: .78rem;
  max-width: 560px;
  margin: .4rem auto 0;
  padding: 1rem .9rem 1.2rem;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
  /* torn bottom edge */
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7px), 96% 100%, 92% calc(100% - 7px), 88% 100%, 84% calc(100% - 7px), 80% 100%, 76% calc(100% - 7px), 72% 100%, 68% calc(100% - 7px), 64% 100%, 60% calc(100% - 7px), 56% 100%, 52% calc(100% - 7px), 48% 100%, 44% calc(100% - 7px), 40% 100%, 36% calc(100% - 7px), 32% 100%, 28% calc(100% - 7px), 24% 100%, 20% calc(100% - 7px), 16% 100%, 12% calc(100% - 7px), 8% 100%, 4% calc(100% - 7px), 0 100%);
}
.receipt-head, .receipt-foot {
  text-align: center;
  letter-spacing: .12em;
  border-bottom: 1px dashed #999;
  padding-bottom: .5rem;
  margin-bottom: .5rem;
}
.receipt-foot { border-bottom: none; border-top: 1px dashed #999; margin-top: .5rem; padding-top: .5rem; margin-bottom: 0; }
.receipt ul { list-style: none; max-height: 340px; overflow-y: auto; }
.receipt li { display: flex; gap: .45rem; padding: .22rem 0; border-bottom: 1px dotted #ddd; align-items: baseline; }
.receipt .ts { color: #666; flex-shrink: 0; width: 4.4em; }
.receipt .who { font-weight: 700; flex-shrink: 0; max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt .what { flex: 1; }
.receipt .pts { font-weight: 700; white-space: nowrap; }
.receipt li.ultra { background: #fff3d6; }
.receipt li.ultra .what::before { content: "\1F422 "; }
