/* css/ordlinjen.css — Ordlinjen-spel: spel-specifika element.
   Modal-frame styrs av .modal-card i style.css (papper-bakgrund via :has(.ordlinjen-root)). */

.ordlinjen-root { padding: 0 0 .5rem; }

.ordlinjen-title { font-size: 1.7rem; margin: 0 0 .25rem; }

/* Intro-text på mode-väljaren (innan spel börjar). */
.ordlinjen-intro {
  color: var(--muted, #6b4a1e);
  font-size: 1rem;
  margin: 0 0 1rem;
  max-width: 38em;
  line-height: 1.4;
}

/* === Mode-väljare === */
.ordlinjen-mode-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: .5rem;
}
.ordlinjen-mode-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ordlinjen-mode-label {
  flex: 1;
  font-size: 1rem;
}
.ordlinjen-mode-picker button {
  font-family: inherit;
  font-size: .95rem;
  padding: 8px 14px;
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(60, 40, 20, .35);
  border-radius: 6px;
  cursor: pointer;
  color: inherit;
}
.ordlinjen-mode-picker button:hover,
.ordlinjen-mode-picker button:focus-visible {
  background: rgba(60, 40, 20, .15);
  outline: none;
}

/* === Högskoleprov: prov-väljare === */
.ordlinjen-prov-heading {
  margin: 1.2rem 0 .5rem;
  font-size: 1rem;
  font-weight: 600;
}
.ordlinjen-prov-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}
/* Tema-rutnätet: bredare kolumner så de 15 temana blir 3x5 i den smalare menyn
   (i stället för 4 kolumner med en tom ruta), och långa etiketter får plats. */
.ordlinjen-theme-grid { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); max-height: none; }
.ordlinjen-prov-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-family: inherit;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(60, 40, 20, .35);
  border-radius: 6px;
  cursor: pointer;
  color: inherit;
  text-align: left;
}
.ordlinjen-prov-btn:hover:not(:disabled),
.ordlinjen-prov-btn:focus-visible {
  background: rgba(60, 40, 20, .15);
  outline: none;
}
.ordlinjen-prov-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.ordlinjen-prov-term { font-size: .95rem; font-weight: 600; }
.ordlinjen-prov-count { font-size: .8rem; opacity: .7; }
.ordlinjen-next-round {
  font-family: inherit;
  font-size: .95rem;
  margin-top: .75rem;
  padding: 8px 18px;
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(60, 40, 20, .35);
  border-radius: 6px;
  cursor: pointer;
  color: inherit;
}
.ordlinjen-next-round:hover,
.ordlinjen-next-round:focus-visible { background: rgba(60, 40, 20, .15); outline: none; }

/* === Spel-skal === */

/* Header med liv + score */
.ordlinjen-game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px dashed rgba(60, 40, 20, .25);
}
.ordlinjen-lives { display: flex; gap: 4px; align-items: baseline; font-size: 1.4rem; }
.ordlinjen-life { color: #c03020; line-height: 1; }
.ordlinjen-life.lost { color: rgba(60, 40, 20, .25); }
/* Kompakt liv-räknare (HP-prov med fler liv än 6): "♥ 9". */
.ordlinjen-lives-count { font-size: 1.1rem; font-weight: 700; color: #c03020; }
.ordlinjen-score {
  font-family: var(--mono, monospace);
  font-size: 1rem;
  color: rgba(60, 40, 20, .8);
  letter-spacing: .05em;
}

/* Aktivkort + prompt (ovanför tidslinjen) */
.ordlinjen-deck-wrap {
  text-align: center;
  margin: 0 0 1.5rem;
}
.ordlinjen-prompt {
  font-size: 1.1rem;
  color: rgba(60, 40, 20, .8);
  margin: 0 0 .75rem;
}
.ordlinjen-prompt-ord {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 1.4rem;
  color: #2a2018;
}
.ordlinjen-deck {
  display: inline-block;
  position: relative;
}

.ordlinjen-hint {
  margin: 0 auto .5rem;
  max-width: 320px;
  font-size: .9rem;
  color: rgba(60, 40, 20, .85);
}
.ordlinjen-hint > summary {
  cursor: pointer;
  list-style: none;
  display: inline-block;
  padding: .25rem .6rem;
  border: 1px dashed rgba(60, 40, 20, .35);
  border-radius: 4px;
  background: rgba(255, 255, 255, .45);
  font-style: italic;
  opacity: .75;
}
.ordlinjen-hint > summary::-webkit-details-marker { display: none; }
.ordlinjen-hint[open] > summary {
  opacity: 1;
  background: rgba(255, 255, 255, .7);
}
.ordlinjen-hint-body {
  margin: .5rem 0 0;
  padding: .5rem .75rem;
  background: rgba(244, 232, 200, .75);
  border-left: 3px solid rgba(120, 80, 30, .35);
  border-radius: 2px;
  text-align: left;
  font-size: .9rem;
  line-height: 1.4;
}

/* Tidslinje-axel ("← tidigare | senare →") */
.ordlinjen-axis {
  display: flex;
  justify-content: space-between;
  font-size: .9rem;
  color: rgba(60, 40, 20, .6);
  margin: 0 .5rem .5rem;
}

/* Tidslinje-ytan: pappersremsa med linjerat block och tonade ändar.
   Bredare modal (940px) ger plats för horisontell linje utan scroll. */
.ordlinjen-timeline-wrap {
  padding: 0;
  margin: 0 0 1rem;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 1.4rem,
      rgba(60, 40, 20, .06) 1.4rem,
      rgba(60, 40, 20, .06) calc(1.4rem + 1px)
    ),
    linear-gradient(to bottom, #f6efd8 0%, #efe7ca 100%);
  border-top: 1px solid rgba(60, 40, 20, .2);
  border-bottom: 1px solid rgba(60, 40, 20, .2);
  box-shadow:
    inset 18px 0 18px -12px rgba(60, 40, 20, .55),
    inset -18px 0 18px -12px rgba(60, 40, 20, .55);
  overflow: visible;
}

.ordlinjen-timeline {
  list-style: none;
  padding: 1.25rem .5rem 1rem;
  margin: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 95px;
  background:
    linear-gradient(to bottom, transparent calc(50% - 1px), rgba(60, 40, 20, .12) calc(50% - 1px), rgba(60, 40, 20, .12) calc(50% + 1px), transparent calc(50% + 1px));
}
.ordlinjen-timeline > li { display: flex; align-items: center; }

/* Drop-zone "+" alltid synlig */
.ordlinjen-gap {
  width: 30px;
  height: 70px;
  background: rgba(255, 255, 255, .35);
  border: 2px dashed rgba(60, 40, 20, .4);
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Caveat', cursive;
  font-size: 1.6rem;
  color: rgba(60, 40, 20, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.ordlinjen-gap:hover,
.ordlinjen-gap:focus {
  background: rgba(255, 220, 80, .55);
  border-color: rgba(120, 80, 30, .8);
  color: #2a2018;
  outline: none;
  transform: scaleY(1.05);
}

/* Under drag: alla gaps lyser svagt (så man ser var de finns).
   Den under markören lyser starkt. */
.is-dragging .ordlinjen-gap {
  background: rgba(255, 220, 80, .25);
  border-color: rgba(120, 80, 30, .7);
  border-style: solid;
  width: 40px;
}
.is-dragging .ordlinjen-gap.dragover {
  background: rgba(255, 200, 50, .85);
  border-color: #8b6c2a;
  color: #2a2018;
  transform: scale(1.12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}

/* Tom tidslinje: stretch drop-zonen */
.ordlinjen-timeline > li:only-child .ordlinjen-gap { min-width: 200px; }

/* Kort på tidslinjen (skeva, "kastade på bord") */
.ordlinjen-card {
  font-family: 'Caveat', cursive;
  background: #fff8e1;
  border: 1px solid rgba(60, 40, 20, .35);
  padding: 6px 10px 8px;
  border-radius: 4px;
  box-shadow: 1px 3px 6px rgba(0, 0, 0, .15);
  text-align: center;
  position: relative;
  min-width: 60px;
  max-width: 90px;
  color: #2a2018;
  transform: rotate(var(--rot, 0deg)) translateY(var(--yoff, 0px));
  margin: 0 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
}
.ordlinjen-card-ord {
  font-size: 1.05rem;
  white-space: nowrap;
}
.ordlinjen-card-year { font-size: 1rem; color: #8b6c3e; margin-top: 2px; font-weight: 600; }
.ordlinjen-card::before {
  /* Tejp i toppen */
  content: "";
  position: absolute;
  top: -6px; left: 50%;
  transform: translateX(-50%) rotate(calc(var(--rot, 0deg) * -0.3));
  width: 36px;
  height: 10px;
  background: rgba(220, 180, 100, .55);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
  border-radius: 1px;
}
[data-theme="dark"] .ordlinjen-card {
  background: #3a3225;
  color: #f4e8c8;
  border-color: rgba(160, 130, 80, .35);
}
[data-theme="dark"] .ordlinjen-card-year { color: #c8a878; }

/* Aktivkortet (i deck:et) — STÖRRE, synligt som "väntar på placering" */
.ordlinjen-active-card {
  font-size: 1.05rem;
  cursor: grab;
  padding: 14px 20px 16px;
  min-width: 120px;
  max-width: 220px;
  box-shadow: 2px 5px 10px rgba(0, 0, 0, .2);
  /* Aktivkortet är inte spridd-skevt — det ligger "framför" på bordet */
  transform: rotate(var(--rot, 0deg));
  margin: 0;
}
.ordlinjen-active-card .ordlinjen-card-ord { font-size: 1.6rem; max-width: 180px; }
.ordlinjen-active-card .ordlinjen-card-year { font-size: 1rem; opacity: .55; }
.ordlinjen-active-card.dragging { opacity: .5; cursor: grabbing; }

/* Fel-feedback (visas i deck-zonen ~1.6s vid felplacering) */
.ordlinjen-feedback {
  display: inline-block;
  padding: 1rem 1.5rem;
  background: rgba(200, 40, 40, .1);
  border: 2px solid rgba(180, 30, 30, .7);
  border-radius: 6px;
  text-align: center;
  animation: ordlinjen-feedback-pop .2s ease;
}
@keyframes ordlinjen-feedback-pop {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.ordlinjen-feedback.wrong .ordlinjen-feedback-head {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  font-weight: 700;
  color: #b02020;
  line-height: 1;
}
.ordlinjen-feedback-body {
  font-size: 1rem;
  color: rgba(60, 40, 20, .85);
  margin-top: .5rem;
}

/* Fineprint (förklaring av åren) */
.ordlinjen-fineprint-wrap { margin-top: 1rem; }
.ordlinjen-fineprint {
  font-size: .8rem;
  color: rgba(60, 40, 20, .55);
  text-align: center;
  font-style: italic;
  margin: 0;
}

/* Resultat-skärm */
.ordlinjen-result { text-align: center; padding: 1rem 0; }
.ordlinjen-result h3 { font-size: 1.4rem; margin: 0 0 .5rem; }
.ordlinjen-emoji {
  font-family: 'Caveat', cursive;
  font-size: 1.6rem;
  letter-spacing: 4px;
  margin: 1rem 0;
}
.ordlinjen-share-btn {
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 24px;
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(60, 40, 20, .35);
  border-radius: 6px;
  cursor: pointer;
  margin-top: .5rem;
  color: inherit;
}
.ordlinjen-share-btn:hover,
.ordlinjen-share-btn:focus-visible {
  background: rgba(60, 40, 20, .15);
  outline: none;
}

/* === Mobil-anpassning === */
@media (max-width: 768px) {
  .ordlinjen-title { font-size: 1.4rem; }

  /* På mobil får vi vertikal stack med scroll inom timeline-ytan */
  .ordlinjen-timeline-wrap {
    max-height: 55vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow:
      inset 0 6px 8px -6px rgba(60, 40, 20, .55),
      inset 0 -6px 8px -6px rgba(60, 40, 20, .55);
  }
  .ordlinjen-timeline {
    flex-direction: column;
    align-items: center;
    padding: 1rem .5rem;
  }
  .ordlinjen-timeline > li { justify-content: center; width: 100%; }
  .ordlinjen-gap { width: 80%; height: 38px; }
  .ordlinjen-card { width: auto; margin: 4px 0; max-width: none; }
  .ordlinjen-card-ord { font-size: 1.2rem; }
  .ordlinjen-card-year { font-size: 1.15rem; }

  .ordlinjen-axis {
    flex-direction: row;
    justify-content: center;
    gap: .25rem;
    padding: .75rem 0 .25rem;
  }
  .ordlinjen-axis-start, .ordlinjen-axis-end { display: none; }
  .ordlinjen-axis::before {
    content: "Tidigast överst, senast nederst";
    font-style: italic;
    opacity: .75;
  }
}

/* === Spel-väljare === */
.game-picker { padding: 1rem 2rem 1.5rem; }
.game-picker-title { margin: 0 0 1rem; font-size: 1.4rem; }
.game-picker-list { display: flex; flex-direction: column; gap: 0.75rem; }
.game-picker-btn {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0.15rem 1rem;
  padding: 1rem 1.25rem;
  text-align: left;
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(60, 40, 20, .35);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background .15s ease, border-color .15s ease;
}
.game-picker-btn:hover,
.game-picker-btn:focus-visible {
  background: rgba(60, 40, 20, .15);
  outline: none;
}
.game-picker-icon { grid-row: 1 / 3; align-self: center; font-size: 2rem; }
.game-picker-label { font-weight: 600; font-size: 1.1rem; }
.game-picker-desc { font-size: 0.9rem; opacity: 0.75; }

/* === Om datat-modal === */
.ordlinjen-about-root {
  padding: 1.5rem 2rem 2rem;
}
.ordlinjen-about-content h3 {
  font-size: 1.5rem;
  margin: 0 0 1rem;
  font-family: 'Caveat', cursive;
  font-weight: 700;
}
.ordlinjen-about-content h4 {
  font-size: 1.1rem;
  margin: 1.5rem 0 .5rem;
  color: #4a3520;
}
.ordlinjen-about-content p {
  font-size: .95rem;
  line-height: 1.5;
  color: #2a2018;
  margin: 0 0 .75rem;
}
.ordlinjen-about-content a { color: #6b4a1e; text-decoration: underline; text-underline-offset: 2px; }
.ordlinjen-about-content a:hover { color: #2a2018; }
.ordlinjen-about-content ul {
  font-size: .9rem;
  line-height: 1.4;
  color: #2a2018;
  padding-left: 1.5rem;
  margin: 0 0 .75rem;
}
.ordlinjen-about-content li {
  margin-bottom: .25rem;
}
.ordlinjen-about-content em {
  font-style: italic;
}
.ordlinjen-about-link {
  color: #6b4a1e;
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
}
.ordlinjen-about-link:hover { color: #4a3520; }

.ordlinjen-histogram {
  margin: 1rem 0 .5rem;
  border: 1px solid rgba(60, 40, 20, .2);
  border-radius: 4px;
  background: rgba(255, 255, 255, .35);
  padding: .5rem;
}
.ordlinjen-histogram-svg {
  width: 100%;
  height: auto;
  max-height: 320px;
}
.ordlinjen-histogram-caption {
  font-size: .85rem;
  color: #6b4a1e;
  font-style: italic;
  text-align: center;
  margin: 0 0 1rem;
}

.ordlinjen-caveat {
  background: rgba(200, 100, 30, .08);
  border-left: 3px solid rgba(180, 80, 20, .6);
  padding: .5rem .75rem;
  margin: .25rem 0 1rem;
}
.ordlinjen-caveat strong { color: #803f10; }

.ordlinjen-about-details {
  display: inline;
  margin-left: .25rem;
}
.ordlinjen-about-details > summary {
  display: inline;
  cursor: pointer;
  color: #6b4a1e;
  text-decoration: underline;
  text-decoration-style: dotted;
  list-style: none;
}
.ordlinjen-about-details > summary::-webkit-details-marker { display: none; }
.ordlinjen-about-details > summary::before { content: ""; }
.ordlinjen-about-details[open] > summary { font-weight: 600; }
.ordlinjen-about-details > .ordlinjen-about-content {
  display: block;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed rgba(60, 40, 20, .25);
  text-align: left;
}
.ordlinjen-about-content .ordlinjen-histogram-caption { text-align: left; }

/* === Tillbaka-knapp (HP-meny) === */
.ordlinjen-back {
  font-family: inherit;
  font-size: .85rem;
  margin-bottom: .5rem;
  padding: 4px 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: .7;
}
.ordlinjen-back:hover, .ordlinjen-back:focus-visible { opacity: 1; outline: none; }

/* Under spel: dölj den redundanta "Ordlinjen"-titeln (mindre kaka på kaka på mobil). */
.ordlinjen-root:has(.ordlinjen-game-header) .ordlinjen-title { display: none; }

/* Toppraden i spelet: tillbaka-knapp + ev. rund-etikett på SAMMA rad. */
.ordlinjen-game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: .35rem;
}
.ordlinjen-game-topbar .ordlinjen-back { margin-bottom: 0; }
/* Rund-etikett (HP välj prov): "Våren 2012 · Runda 2 av 3". */
.ordlinjen-round-label {
  margin: 0;
  font-size: .9rem;
  font-weight: 600;
  color: var(--muted, #6b4a1e);
  text-align: right;
}
