/* -------------------------------------------------- */
/* 1) Reset + Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: 'Roboto', sans-serif;
  color: #e6e1d1;
  line-height: 1.6;
  background: url('../images/fall1_bg.png') center/cover no-repeat fixed;
}

/* -------------------------------------------------- */
/* 2) Hjälpklasser */
.hidden { display: none !important; }
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
.center { text-align: center; }
.section { padding: 60px 0; }

/* -------------------------------------------------- */
/* 3) Hero */
#hero {
  position: relative;
  height: 100vh;
  background: url('../images/bg-texture.jpg') center/cover no-repeat;
}
#hero .overlay,
#hero .hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
}
#hero .container,
#hero .hero-content {
  position: relative;
  z-index: 1;
  top: 50%;
  transform: translateY(-50%);
}
.title {
  font-family: 'Oswald', sans-serif;
  font-size: 4rem;
  letter-spacing: .2em;
  margin-bottom: 20px;
  color: #fff;
}
.tagline {
  font-size: 1.25rem;
  margin-bottom: 40px;
  color: #e6e1d1;
}

/* -------------------------------------------------- */
/* 4) Knappar */
.btn {
  display: inline-block;
  padding: 12px 24px;
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 700;
  border-radius: 4px;
  transition: background .3s, color .3s;
}
.btn-primary {
  background: #e63946;
  color: #fff;
  border: none;
}
.btn-primary:hover {
  background: #d62828;
}
.btn-secondary {
  background: none;
  color: #e6e1d1;
  border: 2px solid #e6e1d1;
}
.btn-secondary:hover {
  background: #e6e1d1;
  color: #0a0a0a;
}
.btn-buy {
  background: linear-gradient(135deg,#e63946,#d62828);
  color: #fff;
  font-size: .95rem;
  border: none;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  padding: 8px 24px;
  transition: transform .2s, box-shadow .2s;
}
.btn-buy:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

/* -------------------------------------------------- */
/* 5) Karusell / Browse */
.carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 2.5rem;
  color: #e6e1d1;
  cursor: pointer;
  width: 50px;
  height: 50px;
  transition: color .2s;
}
.carousel-nav.prev { left: -60px; }
.carousel-nav.next { right: -60px; }
.carousel-nav:hover { color: #fff; }
.card-carousel {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  padding: 10px 10%;
  justify-content: flex-start;
}
.card-carousel::-webkit-scrollbar { display: none; }
.card {
  background: #1f1f1f;
  border-radius: 8px;
  flex: 0 0 80%;
  max-width: 600px;
  overflow: hidden;
  transition: transform .3s, box-shadow .3s;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.7);
}
.card-image {
  height: 300px;
  width: 100%;
  overflow: hidden;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-body {
  flex: 1;
  padding: 20px;
}
.card-body h3 {
  font-size: 1.75rem;
  color: #fff;
  margin-bottom: 10px;
}
.card-body .meta {
  color: #ccc;
  font-size: .9rem;
  margin-bottom: 10px;
}
.card-body .description {
  color: #bbb;
  font-size: .95rem;
  margin-bottom: 20px;
}
.card-buttons {
  margin-top: auto;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* -------------------------------------------------- */
/* 6) Case-grid (Index) */
.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(280px,1fr));
  gap: 20px;
  margin-top: 40px;
}
.case-card {
  background: #1f1f1f;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.case-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}
.case-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.case-body h3 {
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 10px;
}
.case-body .case-meta {
  color: #ccc;
  font-size: .9rem;
  margin-bottom: 10px;
}
.case-body .case-desc {
  color: #bbb;
  font-size: .95rem;
  flex: 1;
}
.case-actions {
  margin-top: auto;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* -------------------------------------------------- */
/* 7) Så här spelar du */
.steps-list {
  list-style: none;
  max-width: 800px;
  margin: 0 auto;
  padding: 0;
}
.steps-list li {
  margin-bottom: 30px;
}
.steps-list h4 {
  font-size: 1.2rem;
  color: #fff;
  margin-bottom: 10px;
}
.steps-list p {
  color: #ccc;
  line-height: 1.5;
}

/* -------------------------------------------------- */
/* 8) FAQ */
.faq-section {
  background: rgba(0,0,0,0.6);
}
.section-title {
  text-align: center;
  font-size: 2rem;
  color: #fff;
  margin-bottom: 40px;
}
.faq-item + .faq-item {
  margin-top: 30px;
}
.faq-item h3 {
  font-size: 1.25rem;
  color: #e6e1d1;
  margin-bottom: 10px;
}
.faq-item p {
  color: #ccc;
  font-size: .95rem;
  line-height: 1.5;
}

/* -------------------------------------------------- */
/* 9) Kontakt */
.contact-section p {
  color: #ccc;
  font-size: 1rem;
}

/* -------------------------------------------------- */
/* 10) Case-detail Header */
.case-header .meta {
  color: #ccc;
  font-size: .9rem;
  margin-bottom: 20px;
}
.case-header .description {
  color: #e6e1d1;
  font-size: 1rem;
  line-height: 1.5;
  margin-top: 10px;
}

/* -------------------------------------------------- */
/* 11) Bevisväska */
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(200px,1fr));
  gap: 20px;
  margin-top: 20px;
}
.evidence-item {
  background: #1f1f1f;
  border-radius: 8px;
  overflow: hidden;
}
.evidence-btn {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg,#e63946,#d62828);
  color: #fff;
  font-weight: 700;
  text-align: left;
  border: none;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
.evidence-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.4);
}
.evidence-content {
  display: none;
  padding: 16px;
  background: #222;
  border-radius: 6px;
  margin-top: 12px;
}
.evidence-item.open .evidence-content {
  display: block;
}
.evidence-content img,
.evidence-content audio,
.evidence-content iframe,
.evidence-content pre {
  width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  display: block;
  margin: 0 auto;
}
.evidence-item.open {
  grid-column: 1 / -1;
}
.evidence-item.open .evidence-content {
  padding: 40px;
  background: rgba(0,0,0,0.85);
}
.evidence-item.open .evidence-content img {
  max-width: 100%;
  max-height: 80vh;
  height: auto;
  display: block;
  margin: 0 auto;
}
.evidence-content iframe {
  width: 100%;
  height: 80vh;
}
.evidence-content pre {
  max-height: 60vh;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.4;
  padding-right: 8px;
}

/*
=================================
12) KARTA (UPPDATERAD MED SMART POSITIONERING)
=================================
*/

/* Behållare för kartan och prickarna */
.map-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.map-container .map-image {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Stil för de röda prickarna */
.map-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: red;
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: transform 0.2s ease;
}

.map-marker:hover {
    transform: translate(-50%, -50%) scale(1.2);
}

/* KORREKTA POSITIONER FÖR MARKÖRER */
.marker-lada {
  top: 70.3%;
  left: 29.5%;
}
.marker-logdans {
  top: 75.7%;
  left: 32.2%;
}
.marker-gomstall {
  top: 72.4%;
  left: 45.1%;
}

/* Stil för informationsrutan som dyker upp */
.map-tooltip {
    display: none; /* Dold som standard */
    position: absolute;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 10px 40px 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    z-index: 10;
    /* transform tas nu bort härifrån och sköts helt av JS */
}

.map-tooltip.visible {
    display: block;
}

/* Stil för stäng-knappen (X) i rutan */
.tooltip-close {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    padding: 5px;
}

/* -------------------------------------------------- */
/* 13) ÖVRIGT */
.intro-frame {
  background: rgba(0, 0, 0, 0.7);
  padding: 40px 20px;
  margin-bottom: 40px;
}
.intro-frame .intro-text {
  color: #e6e1d1;
  font-size: 1.125rem;
  line-height: 1.6;
  max-width: 900px;
  margin: 0 auto;
  border-radius: 8px;
}
.case-header .meta {
  background: rgba(0, 0, 0, 0.7);
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  color: #e6e1d1;
  margin-top: 16px;
  font-size: 0.95rem;
}
.note-input {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  font-size: 1rem;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #e6e1d1;
  resize: vertical;
  box-sizing: border-box;
  margin-bottom: 15px;
}
#theory-input {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  font-size: 1rem;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #e6e1d1;
  resize: vertical;
  margin-top: 20px;
  box-sizing: border-box;
}
.solution-frame {
  background: rgba(0,0,0,0.7);
  border-radius: 8px;
  padding: 30px 0;
  margin-top: -10px;
}
.solution-body {
  max-width: 900px;
  margin: 0 auto;
  color: #e6e1d1;
  font-size: 1rem;
  line-height: 1.6;
}
.solution-body h3 {
  margin-top: 20px;
  margin-bottom: 8px;
  color: #fff;
}
.solution-body ul {
  margin: 0 0 12px 18px;
}
#theory-input,
.note-input {
  margin-top: 12px;
  margin-bottom: 12px;
}
.log-list li {
  position: relative;
  padding: 10px 100px 10px 15px;
  border-bottom: 1px solid #333;
  color: #ddd;
}
.note-entry { display: inline; color: #e6e1d1; }
.note-actions {
  position: absolute;
  top: 10px;
  right: 15px;
}
.note-actions button {
  background: none;
  border: none;
  color: #e63946;
  font-size: .85rem;
  margin-left: 8px;
  cursor: pointer;
  transition: color .2s;
}
.note-actions button:hover { color: #f77; }
#submit-theory:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.text-input {
  width: 100%;
  height: 44px;
  padding: 10px 12px;
  font-size: 1rem;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #e6e1d1;
  box-sizing: border-box;
  margin: 8px 0 12px;
}
.team-input { max-width: 420px; }
.table-wrap { overflow-x: auto; }
.lb-table {
  width: 100%;
  border-collapse: collapse;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
}
.lb-table th, .lb-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #333;
  text-align: left;
  color: #ddd;
  white-space: nowrap;
}
.lb-table thead th {
  color: #fff;
  background: #222;
}
.lb-table tr:nth-child(even) td {
  background: #181818;
}
.my-rank { margin-bottom: 10px; font-weight: 700; }
.meta { color: #ccc; font-size: .95rem; }
.error { color: #ff8d8d; margin: 10px 0; }
.case-stats {
  display: flex;
  justify-content: center;
  margin: -10px 0 20px;
}
.timer-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(20,20,20,0.65);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
}
.chip-icon { font-size: 1.2rem; line-height: 1; opacity: .9; }
.chip-text { display: flex; flex-direction: column; line-height: 1.1; }
.chip-label { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: #bbb; }
.chip-time { font-size: 1.6rem; font-weight: 800; color: #e6e1d1; }
.meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.meta-row .meta { margin: 0; }
.btn-ghost {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.16);
  color: #e6e1d1;
  border-radius: 999px;
  padding: 8px 14px;
  transition: background .2s, border-color .2s, transform .2s;
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.28);
  transform: translateY(-1px);
}
.btn-sm { font-size: .9rem; line-height: 1; }
#leaderboard-public .leaderboard { margin-top: 10px; }
#submit-answer:disabled { opacity:.5; cursor:not-allowed; }
.answer-panel { margin-top: 16px; }
.answer-row {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.answer-input {
  background: #2a2a2a; border: 1px solid #444; border-radius: 6px;
  padding: 10px 12px; color: #e6e1d1; min-width: 220px;
}
.answer-hint { color: #bbb; font-size: .9rem; margin-top: 6px; }
.modal.hidden { display: none; }
.modal { position: fixed; inset: 0; z-index: 9999; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: #1c1c1c; color: #e6e1d1; border: 1px solid #333; border-radius: 10px;
  width: min(920px, 92vw);
  max-height: 80vh; overflow: hidden; display: flex; flex-direction: column;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #333; }
.modal-head h3 { margin: 0; font-size: 1.2rem; }
.modal-close {
  background: none; color: #e6e1d1; border: none; font-size: 1.6rem; cursor: pointer;
}
.modal-body { padding: 14px 16px; overflow: auto; }

/*
=================================
Specifik stil för Midsommarmordet
=================================
*/

body.case-midsommar {
  background-image: url('../images/bg-index.png');  
  background-color: #0a111a;  
  background-size: cover;  
  background-attachment: fixed;  
  background-position: center center;  
}

.evidence-item.visited .evidence-btn {
    background: linear-gradient(135deg, #4a1e22, #6b2f35);
    border: 1px solid #e63946;
}

/* Stil för grupprubriker i bevisväskan */
.evidence-group-title {
    font-family: 'Oswald', sans-serif;
    color: #fff;
    margin-top: 40px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e63946;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Lägg till extra utrymme mellan grupperna */
.evidence-grid + .evidence-group-title {
    margin-top: 60px;
}

/*
=================================
13) MUSIKSPELARE (NY DESIGN)
=================================
*/
#music-player {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 250px;
    background-color: #1f1f1f; /* Matchar bevis-bakgrund */
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.6);
    z-index: 1000;
    user-select: none;
    backdrop-filter: blur(8px);
    background-color: rgba(31, 31, 31, 0.8); /* Mörk glas-effekt */
}

.player-title-bar {
    background: linear-gradient(135deg, #e63946, #d62828); /* Matchar knapp-färgen */
    color: white;
    font-weight: bold;
    padding: 5px 10px;
    font-size: 14px;
    text-align: center;
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.player-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-display {
    background-color: #0a0a0a;
    color: #e6e1d1; /* Matchar sidans textfärg */
    padding: 8px;
    text-align: center;
    border: 1px inset #555;
    border-radius: 4px;
}

.player-time-display {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Oswald', sans-serif;
    line-height: 1;
}

.player-track-info {
    font-size: 0.75rem;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#player-play-pause {
    width: 35px;
    height: 35px;
    background-color: #2a2a2a;
    border: 1px solid #555;
    border-radius: 50%;
    color: #e6e1d1;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

#player-play-pause:hover {
    background-color: #444;
}

.volume-icon {
    font-size: 18px;
    color: #bbb;
}

.player-slider {
    -webkit-appearance: none;
    appearance: none;
    flex-grow: 1;
    height: 8px;
    background: #444;
    outline: none;
    border-radius: 4px;
    cursor: pointer;
}

.player-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #e6e1d1;
    border-radius: 50%;
    transition: background-color 0.2s;
}
.player-slider::-webkit-slider-thumb:hover {
    background: #fff;
}

.player-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #e6e1d1;
    border-radius: 50%;
    transition: background-color 0.2s;
}
.player-slider::-moz-range-thumb:hover {
    background: #fff;
}

/* Responsivitet */
@media (max-width: 768px) {
    #music-player {
        left: 50%;
        transform: translateX(-50%);
        top: auto;
        bottom: 10px;
        width: 90vw;
    }
}

/* Ny stil för logotyp-bilden i headern */
.main-header .logo img {
  height: 100px; /* <-- Justera höjden så den passar din header (som är 70px hög) */
  width: auto;  /* Behåller bildens proportioner automatiskt */
  display: block; /* Tar bort eventuellt extra utrymme under bilden */
}

#fragor-svar .container {
    background-color: rgba(15, 15, 15, 0.85); /* Gråaktig genomskinlig bakgrund */
    backdrop-filter: blur(8px); /* Blur-effekt */
    -webkit-backdrop-filter: blur(8px); /* För Safari */
    border-radius: 8px; /* Lätt rundade hörn */
    padding: 40px; /* Mer padding för att det ska se snyggt ut */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4); /* Lite skugga för djup */
}

#fragor-svar .container,
#kontakt .container {
    /* ... stilar ... */
}

/* Ny bakgrund för Biblioteksmordet */
.case-bibliotek {
    background-image: url('../fall2/images/bibliotek_bg.png'); /* OBS: Du måste skapa denna bild! */
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    /* Du kan lägga till fler stilar här, t.ex. färg på texten */
}

/*
=================================
14) TOPPLISTA - RÄTT/FEL FÄRGER
=================================
*/

.correct-answer {
  color: #7cff9b; /* En ljus, tydlig grön färg */
  font-weight: bold;
  font-size: 1.2rem; /* Lite större för att synas bättre */
}

.incorrect-answer {
  color: #ff7c7c; /* En ljus, tydlig röd färg */
  font-weight: bold;
  font-size: 1.2rem; /* Lite större för att synas bättre */
}