/* === Cloudinary fonts === */
@font-face {
  font-family: "Prohibition";
  src: url("https://res.cloudinary.com/dufekxhkq/raw/upload/v1754975484/Prohibition-Regular_ikmxte.woff2")
    format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "AvertaSTD";
  src: url("https://res.cloudinary.com/dufekxhkq/raw/upload/v1754975484/AvertaStd-Regular_z8oywc.woff2")
    format("woff2");
  font-display: swap;
}

/* === Bakgrund === */
body {
  margin: 0;
  min-height: 100vh;
  background: url("https://res.cloudinary.com/dufekxhkq/image/upload/v1758874210/Ro%CC%88d_bakgrund_16x9_zmjth9.png")
    no-repeat center/cover;
  font-family: "AvertaSTD", system-ui, -apple-system, Segoe UI, Roboto, Arial,
    sans-serif;
  color: #fff;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 0;
}
* {
  position: relative;
  z-index: 1;
}

@media (max-width: 900px) {
  body {
    background: url("https://res.cloudinary.com/dufekxhkq/image/upload/v1758874547/9x16_il2fgk.png")
      no-repeat center/cover;
  }
}

/* === Header / Banner === */
.brand {
  text-align: center;
  padding: 50px 12px 10px;
}
.brand .top-banner {
  width: 100%;
  max-width: 640px;
  height: auto;
  display: block;
  margin: 0 auto 16px;
}
.brand h1 {
  margin: 0 0 6px;
  font-family: "Prohibition", Impact, sans-serif;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: normal;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}
.brand p {
  margin: 0;
  opacity: 0.9;
  font-family: "AvertaSTD", sans-serif;
}

/* === Layout === */
.app {
  max-width: 900px;
  margin: 20px auto 40px;
  padding: 0 16px;
}

/* === Search field === */
.search-wrap {
  position: relative;
  max-width: 540px;
  margin: 10px auto 22px;
}
#guessInput {
  width: 90%;
  border: 0;
  outline: none;
  font-size: 18px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #ffffffd9;
  color: #111;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}
.suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  list-style: none;
  margin: 0;
  padding: 6px;
  z-index: 20;
  background: #fff;
  color: #111;
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-height: 260px;
  width: 94%;
  overflow: auto;
}
.suggest.hidden {
  display: none;
}
.suggest li {
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
}
.suggest li:hover,
.suggest li.active {
  background: #e2e2e3;
}

/* === Table === */
.board {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
}
.board thead th {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 800;
  padding: 10px 12px;
  text-align: center;
  border-radius: 10px;
  font-family: "AvertaSTD", sans-serif;
}
.board tbody td {
  padding: 12px;
  text-align: center;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.4);
}
.board tbody tr td:first-child {
  border-radius: 12px 0 0 12px;
  text-align: left;
}
.board tbody tr td:last-child {
  border-radius: 0 12px 12px 0;
}

/* === Cell färger === */
.cell.ok {
  background: linear-gradient(#129b69, #119162);
}
.cell.warn {
  background: linear-gradient(#f3c623, #d6b126);
  color: #222;
}
.cell.bad {
  background: linear-gradient(#c84646, #b83f3f);
}

/* === Flip animation === */
.cell {
  opacity: 0;
  transform: rotateX(90deg);
}
.cell.reveal {
  animation: flipIn 0.6s ease forwards;
}
@keyframes flipIn {
  0% {
    opacity: 0;
    transform: rotateX(90deg);
  }
  60% {
    opacity: 1;
    transform: rotateX(-8deg);
  }
  100% {
    opacity: 1;
    transform: rotateX(0);
  }
}
.cell.reveal {
  animation-delay: calc(var(--d, 0) * 0.35s);
}

/* === Hjälptext / Footer === */
.helper {
  text-align: center;
  opacity: 0.85;
  margin: 14px 0 0;
}
.foot {
  text-align: center;
  padding: 18px 0 32px;
  opacity: 0.7;
  font-size: 14px;
}

/* === Responsiv mobil === */
@media (max-width: 760px) {
  .board thead {
    display: none;
  }
  .board tbody td {
    display: block;
    text-align: left;
  }
  .board tbody tr td:first-child {
    border-radius: 12px 12px 0 0;
  }
  .board tbody tr td:last-child {
    border-radius: 0 0 12px 12px;
  }
  .board tbody tr {
    margin-bottom: 12px;
    display: block;
  }
}
/* 🔹 Se till att autosuggest alltid ligger över allt annat */
.suggest {
  position: absolute;
  z-index: 9999; /* högre än tabellen och resten av layouten */
}

.search-wrap {
  position: relative;
  z-index: 1000; /* för att dropdown placeras rätt i flödet */
}
/* === Mobiletiketter för tydligare visning === */
@media (max-width: 760px) {
  .board tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-size: 15px;
    border-radius: 0;
    position: relative;
  }

  /* Visa etikett (rubrik) före varje värde */
  .board tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #fff;
    opacity: 0.8;
  }

  /* Gör tabellen mer kompakt */
  .board tbody tr {
    display: block;
    background: rgba(0, 0, 0, 0.25);
    margin-bottom: 10px;
    border-radius: 12px;
    overflow: hidden;
  }

  /* Anpassa färger och spacing */
  .cell.ok,
  .cell.warn,
  .cell.bad {
    flex: 1;
    text-align: right;
  }
}
.timer {
  font-family: "AvertaSTD", sans-serif;
  font-weight: 700;
  font-size: 14px;
  margin-top: 8px;
  color: #ffffff;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}
.already-played {
  font-family: "AvertaSTD", sans-serif;
  font-size: 16px;
  color: #ffffff;
  margin-top: 6px;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.8s ease;
  text-align: center;
}
.already-played.hidden {
  display: none;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* === Modal för resultat === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}
.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  color: #000;
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
  text-align: center;
}
.modal-content h2 {
  color: #a00;
  font-family: "Prohibition", sans-serif;
  margin-bottom: 1rem;
}
.modal-content label {
  display: block;
  text-align: left;
  margin-top: 0.6rem;
  font-size: 0.9rem;
}
.modal-content input[type="text"],
.modal-content input[type="email"],
.modal-content input[type="tel"] {
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.checkbox {
  margin-top: 8px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.buttons {
  margin-top: 1.2rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}
button.submit {
  background: #d10a10;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}
button.cancel {
  background: #eee;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}
/* === Topplista-popup === */
#topModal .modal-content {
  max-width: 360px;
  text-align: left;
}

#topModal ol {
  padding-left: 1.2em;
  margin: 0.5em 0 1em;
}

#topModal li {
  margin: 4px 0;
  font-size: 0.95em;
}

/* Marginal timer */
.brand p.timer {
  margin-bottom: 10px;
  margin-top: 20px;
}

/* Knapp för att öppna topplistan */
.open-top-btn {
  position: relative; /* inte längre fixed */
  display: block;
  margin: 40px auto 60px; /* lite luft ovan och nedan */
  background: #d10a10;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: background 0.2s ease;
  z-index: 0;
}

.open-top-btn:hover {
  background: #b00808;
  transform: scale(1.05);
}
/* === Spelläge-knappar (Dagens spel / Freeplay) === */
.mode-selector {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.mode-btn {
  font-family: "AvertaSTD", sans-serif; /* 🔹 så den använder samma font */
  font-weight: 700;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08); /* 🔹 mer nedtonad bakgrund */

  color: #fff;
  border: 2px solid #fff;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.mode-btn.active {
  background: #d10a10;
  border-color: #d10a10;
  color: #fff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

.hidden {
  display: none !important;
}

#newFreeBtn {
  display: block;
  margin: 1.5rem auto 0;
  font-family: "AvertaSTD", sans-serif; /* 🔹 så den använder samma font */
  font-weight: 700;
  font-size: 14px;
}
.list-btn {
  font-family: "AvertaStd", sans-serif;
  background: #222;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  margin: 3px;
  transition: background 0.2s ease;
}
.list-btn.active {
  background: #d10a10;
}
#listSelector {
  margin-top: 10px;
}

#listSelector {
  display: none; /* döljs som standard via JS */
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  margin-bottom: 16px;
}

/* === Liga-knappar (SHL / SDHL / SHL & SDHL) === */
.mode-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  margin-bottom: 16px;
}

.mode-buttons button {
  font-family: "AvertaSTD", sans-serif;
  font-weight: 700;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-buttons button:hover {
  background: rgba(255, 255, 255, 0.25);
}

.mode-buttons button.active {
  background: #d10a10;
  border-color: #d10a10;
  color: #fff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}
.plus-one {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  font-family: "Prohibition", "AvertaSTD", sans-serif;
  font-weight: 800;
  font-size: 80px;
  color: #ffcb00;
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.5), 0 0 40px #d10a10;
  opacity: 0;
  pointer-events: none;
  animation: plusOneBig 1s ease-out forwards;
  z-index: 9999;
}

@keyframes plusOneBig {
  0% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(0.4);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -55%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70%) scale(1.4);
  }
}
.plus-one {
  animation: plusOneBig 1.2s ease-out forwards;
}

@keyframes plusOneBig {
  0% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(0.4);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -55%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70%) scale(1.4);
  }
}
/* 🔥 Freeplay streak animationer */
@keyframes streakPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70%) scale(1.6);
  }
}

@keyframes streakPulse {
  0% {
    transform: translate(-50%, -45%) scale(1);
    filter: drop-shadow(0 0 10px #ffcb00);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -45%) scale(1.2);
    filter: drop-shadow(0 0 25px #ffcb00);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -45%) scale(1);
    filter: drop-shadow(0 0 10px #ffcb00);
    opacity: 1;
  }
}

.streak-popup {
  animation: streakPulse 1.4s ease-in-out infinite;
}

.streak-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  font-size: 140px;
  opacity: 0;
  animation: streakPop 1.5s ease-out forwards,
    streakPulse 1s ease-in-out 0.3s infinite alternate;
  z-index: 9999;
  text-shadow: 0 0 25px rgba(255, 203, 0, 0.8), 0 0 50px rgba(255, 80, 0, 0.6);
  pointer-events: none;
  text-align: center;
  color: #fff;
}

.streak-label {
  font-size: 32px;
  font-weight: bold;
  margin-top: 0.2em;
  color: #fff;
  text-shadow: 0 0 15px rgba(0, 0, 0, 0.8);
  animation: fadeUp 1.2s ease-out forwards;
}

@keyframes fadeUp {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  30% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}
/* 🟡 Namnkolumnen har alltid gul bakgrund */
.cell.name-fixed {
  background: linear-gradient(#9d9d9c, #bebcb5);
  color: #ffffff;
}

/* 🌟 Pulserande effekt på rätt rad */
@keyframes correctGlow {
  0% {
    box-shadow: 0 0 0 rgba(0, 255, 0, 0);
    filter: brightness(1);
  }
  40% {
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.7);
    filter: brightness(1.2);
  }
  100% {
    box-shadow: 0 0 0 rgba(0, 255, 0, 0);
    filter: brightness(1);
  }
}

tr.correct-row td.ok {
  animation: correctGlow 1.4s ease-in-out;
}

.daily-count {
  text-align: center;
  font-size: 15px;
  opacity: 0.85;
  margin-top: 10px;
  margin-bottom: 60px;
  font-family: "AvertaSTD", sans-serif;
}
.lhf-menu-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
}
.simple-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(162, 8, 8, 0.85);
  padding: 10px 0;
  opacity: 80%;
  text-align: center;
  z-index: 999999;
}

.simple-nav a {
  color: #fff;
  text-decoration: none;
  margin: 0 16px;
  font-family: "AvertaSTD", sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
}

.simple-nav a:hover {
  color: #ffcb00;
}

#toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #d10a10; /* Luleå Hockey-röd */
  color: #fff;
  padding: 18px 30px;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: "Prohibition", sans-serif;
  display: none;
  z-index: 9999;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.5px;
}

/* === Fixa bakgrundskanten och oönskad scroll === */
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* hindrar horisontell scroll */
  background-color: #7a0000; /* matchar bakgrundsbilden */
}

body {
  position: relative;
  overflow-y: auto; /* tillåt normal scroll men inget extra tomrum */
}

/* Säkerställ att overlayn inte påverkar höjden */
body::before {
  content: "";
  position: fixed; /* ändra från absolute → fixed */
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 0;
  pointer-events: none;
}

/* === Navigationsfält – ska INTE följa med scroll === */
.simple-nav {
  position: relative; /* ändra från fixed → relative */
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(162, 8, 8, 0.85);
  padding: 10px 0;
  text-align: center;
  z-index: 10;
}

/* Om du ändå vill att den ska sitta fast högst upp men inte skymma något */
@supports (position: sticky) {
  .simple-nav {
    position: sticky;
  }
}

/* === Fixa "tom rullning" på mobiler (iPhone etc) === */
@supports (padding: max(0px)) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
