/* =========================================================================
   traeningsmodus.css — træningsmodus (runde 6, 08-10-2026). Ejes af
   traeningsmodus.js. Indlæses automatisk efter app.css (index.php).

   Laget dækker hele skærmen (z 45): over fanerne (30) og pauseuret (40), men
   UNDER arkene (50), rekord-fejringen (58) og beskederne (60) — så oversigten,
   "Byt øvelse", Plus-arket og den gule rekord kommer frem over passet.

   Mobil (stående): video/figur øverst, et hvidt panel nedenfra med sættet.
   PC og vandret telefon: video/figur til venstre, panelet som kort til højre.
   Solgul bruges kun på opsummeringen og rekorderne (fejring).
   ========================================================================= */

/* ------------------------------------------------ knappen på Træning */
.tm-start { min-height: 56px; margin: 2px 0 14px; font-size: 17px; gap: 10px; }
.tm-start svg { width: 18px; height: 18px; }
@media (min-width: 1200px) { .tr-venstre .tm-start { margin: 0 0 12px; } }

/* Siden bag laget: skjult, så dens figurer og videoer går i stå (IntersectionObserver ser dem ikke). */
#side.tm-bag > * { display: none !important; }
body.tm-aaben { overflow: hidden; }

/* ---------------------------------------------------------------- laget */
.tm {
    position: fixed; inset: 0; z-index: 45;
    display: grid; grid-template-rows: auto minmax(0, 1fr);
    height: 100dvh; background: var(--himmel); color: var(--marine);
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
    overscroll-behavior: contain;
}
.tm-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.tm-top { display: grid; grid-template-columns: 46px minmax(0, 1fr) 46px; align-items: center; gap: 10px; padding: 10px 14px 8px; }
.tm-ikon {
    position: relative; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
    background: var(--hvid); color: var(--marine); box-shadow: var(--skygge); transition: background .15s, color .15s;
}
.tm-ikon svg { width: 20px; height: 20px; }
.tm-ikon:hover { color: var(--blaa); }
.tm-ikon.til { background: var(--blaa); color: var(--hvid); box-shadow: none; }
.tm-laas {
    position: absolute; right: -3px; top: -3px; width: 18px; height: 18px; border-radius: 50%;
    display: grid; place-items: center; background: var(--dis); color: var(--blaa-dyb); font-style: normal;
    box-shadow: 0 0 0 2px var(--himmel);
}
.tm-laas svg { width: 11px; height: 11px; }

.tm-frem { display: grid; justify-items: center; gap: 7px; min-width: 0; padding: 4px 6px; border-radius: var(--r-s); }
.tm-frem-tekst { max-width: 100%; font: 700 15.5px/1.2 var(--display); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-streger { display: flex; gap: 4px; width: 100%; max-width: 420px; }
.tm-streger i { flex: 1 1 0; height: 6px; border-radius: 3px; background: var(--dis-2); position: relative; overflow: hidden; }
.tm-streger i.gjort { background: var(--blaa); }
.tm-streger i.nu::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--fyld, 0%); background: var(--blaa); border-radius: inherit; transition: width .3s; }
.tm-streger i.nu { box-shadow: 0 0 0 1.5px var(--blaa); }
.tm-streger i.sprunget { background: var(--dis); }
/* Låst (Plus eller fase): kun en kontur — den er der, men den er ikke med i dag. */
.tm-streger i.laast { background: transparent; box-shadow: inset 0 0 0 1.5px var(--dis-2); }

.tm-krop { min-height: 0; display: grid; }

/* ------------------------------------------------- medie + panel (mobil) */
.tm-delt { display: flex; flex-direction: column; min-height: 0; }
.tm-medie { flex: 1 1 auto; min-height: 140px; display: grid; place-items: center; overflow: hidden; padding: 0 14px; }
.tm-medie > .figur, .tm-medie > .tm-uden-figur { width: 100%; height: 100%; }
.tm .tm-medie .figur.stor { aspect-ratio: auto; width: 100%; height: 100%; max-height: none; margin: 0; border-radius: 0; background: transparent; }
.tm .tm-medie .figur.video video, .tm .tm-medie .figur.video img { object-fit: contain; background: transparent; }
.tm .tm-medie .figur-knap { right: 4px; bottom: 10px; }
.tm-uden-figur { display: grid; place-items: center; }
.tm-uden-figur .buddy-fig { width: min(46%, 200px); height: auto; aspect-ratio: 1; }

.tm-panel {
    flex: none; display: grid; gap: 12px; max-height: 74dvh; overflow-y: auto;
    background: var(--hvid); border-radius: var(--r-l) var(--r-l) 0 0;
    padding: 18px 18px calc(14px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 30px rgba(21, 70, 214, .07);
}
.tm-titel h2 { font-size: clamp(24px, 6.6vw, 30px); line-height: 1.06; }
.tm-titel small { display: block; margin-top: 4px; color: var(--marine-2); font-size: 14px; }

.tm-greb { margin: 8px 0 0; padding: 8px 12px; border-radius: var(--r-s); background: var(--himmel); font-size: 14px; line-height: 1.4; color: var(--marine); }
.tm-greb b { color: var(--blaa); }
.tm-buddy { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; align-items: end; }
.tm-buddy .buddy-fig { width: 40px; height: 40px; }
.tm-buddy .boble { font: 600 15px/1.35 var(--tekst); letter-spacing: 0; padding: 10px 14px; border-radius: 18px 18px 18px 6px; }

.tm-saetlinje { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tm-saetlinje b { font: 700 22px/1 var(--display); letter-spacing: -.02em; }
.tm-saetlinje b span { color: var(--marine-3); font-weight: 600; }
.tm-prikker { display: flex; gap: 6px; }
.tm-prikker i { width: 11px; height: 11px; border-radius: 50%; background: var(--dis); }
.tm-prikker i.gjort { background: var(--blaa); }
.tm-prikker i.nu { background: var(--hvid); box-shadow: inset 0 0 0 2.5px var(--blaa); }

.tm-trin-raekke { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tm-trin-raekke.en { grid-template-columns: minmax(0, 1fr); }
.tm-trin { display: grid; grid-template-columns: 46px minmax(0, 1fr) 46px; align-items: center; height: 70px; border-radius: var(--r-m); background: var(--himmel); }
.tm-trin:focus-within { box-shadow: inset 0 0 0 2px var(--blaa); }
.tm-trin button { height: 70px; border-radius: var(--r-m); font: 600 26px/1 var(--tekst); color: var(--blaa); }
.tm-trin button:active { background: var(--dis); }
.tm-trin label { display: grid; justify-items: center; min-width: 0; }
.tm-trin input {
    width: 100%; min-width: 0; padding: 0; border: 0; outline: none; background: none; text-align: center;
    font: 700 28px/1.1 var(--display); letter-spacing: -.02em; color: var(--marine); font-variant-numeric: tabular-nums;
}
.tm-trin em { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--marine-2); }

.tm-faerdig {
    display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 68px;
    border-radius: 999px; background: var(--blaa); color: var(--hvid);
    font: 700 21px/1 var(--display); letter-spacing: -.01em; transition: background .15s, transform .1s;
}
.tm-faerdig svg { width: 24px; height: 24px; flex: none; }
.tm-faerdig:hover { background: var(--blaa-dyb); }
.tm-faerdig:active { transform: scale(.98); }
.tm-faerdig[disabled] { opacity: .6; pointer-events: none; }

.tm-sek { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 14px; }
.tm-sek button {
    position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 10px;
    border-radius: 999px; color: var(--marine-2); font-weight: 650; font-size: 15px; transition: color .15s;
}
.tm-sek button svg { width: 18px; height: 18px; flex: none; }
.tm-sek button:hover { color: var(--blaa); }
.tm-sek .tm-laas { position: static; box-shadow: none; }

/* --------------------------------------------------------- pause og ure */
.tm-pause { display: grid; justify-items: center; gap: 10px; text-align: center; }
.tm-ring { position: relative; width: min(190px, 46vw); aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; }
/* Kun ringen selv (det direkte barn) drejes — ikke det lille afspil/pause-ikon inde i den. */
.tm-ring > svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.tm-ring .spor { fill: none; stroke: var(--dis); stroke-width: 8; }
.tm-ring .fyld { fill: none; stroke: var(--blaa); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; transition: stroke-dashoffset .25s linear; }
.tm-ring-tekst { position: relative; display: grid; justify-items: center; }
.tm-tid { font: 700 clamp(44px, 13vw, 58px)/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tm-ring small { margin-top: 4px; color: var(--marine-2); font-weight: 600; font-size: 14px; }
.tm-ring-knap { margin-top: 8px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--himmel); color: var(--blaa); font-style: normal; }
.tm-ring-knap svg { width: 14px; height: 14px; }
.tm-ring.stoppet .fyld { stroke: var(--marine-3); }
.tm-naeste { display: grid; gap: 3px; }
.tm-naeste span { font-size: 17px; color: var(--marine-2); }
.tm-naeste b { color: var(--marine); font-weight: 700; }
.tm-naeste small { font-size: 14.5px; color: var(--marine-2); }
/* "Hvordan var sættet?" (12-11-2026): et hak op eller ned i næste sæt for nye og første gang. */
.tm-foelt { display: grid; gap: 8px; justify-items: center; width: 100%; }
.tm-foelt > span { font-weight: 650; color: var(--marine-2); font-size: 15px; }
.tm-foelt > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.tm-foelt button { min-height: 46px; border-radius: 999px; background: var(--himmel); color: var(--blaa); font-weight: 700; font-size: 15px; }
.tm-foelt button:active { background: var(--dis); }
.tm-pause-knapper { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
.tm-pause-knapper .knap { min-height: 58px; font-size: 16.5px; }
.tm-laas-linje {
    display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%;
    padding: 8px 12px; border-radius: var(--r-s); text-align: left; font-size: 13.5px; color: var(--marine-2);
    box-shadow: inset 0 0 0 1.5px var(--dis);
}
.tm-laas-linje svg { width: 15px; height: 15px; color: var(--blaa); }
.tm-laas-linje b { color: var(--blaa); font-size: 13px; }
.tm-beskrivelse { color: var(--marine-2); font-size: 15.5px; line-height: 1.45; }

/* ------------------------------------------- midt på skærmen: intro og slut */
.tm-midt {
    align-self: center; justify-self: center; width: min(100%, 520px); max-height: 100%; overflow-y: auto;
    display: grid; gap: 16px; padding: 10px 18px calc(24px + env(safe-area-inset-bottom));
}
.tm-vent { place-items: center; min-height: 50dvh; }
.tm-vent .buddy-fig { animation: hop 1s ease-in-out infinite; }
.tm-liste { list-style: none; margin: 0; padding: 4px 16px; background: var(--hvid); border-radius: var(--r-m); box-shadow: var(--skygge); }
.tm-liste li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; }
.tm-liste li + li { box-shadow: 0 -1px 0 var(--himmel); }
.tm-liste b { font-weight: 650; }
.tm-liste span { color: var(--marine-2); font-size: 14.5px; white-space: nowrap; }
.tm-tekstknap { justify-self: center; min-height: 44px; padding: 8px 14px; color: var(--blaa); font-weight: 650; }

.tm-slut { justify-items: center; text-align: center; }
.tm-jubel { position: relative; width: 132px; height: 132px; margin-top: 8px; }
.tm-jubel::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--sol); opacity: .55; transform: scale(1.14); }
.tm-jubel .buddy-fig { position: relative; width: 132px; height: 132px; animation: tm-hop .8s ease-in-out .25s 3; }
.tm-jubel i {
    position: absolute; left: 50%; top: 50%; width: 5px; height: 15px; margin: -7px 0 0 -2.5px; border-radius: 3px;
    background: var(--sol); opacity: 0; transform: rotate(var(--r)) translateY(-78px);
    animation: tm-gnist .8s ease-out .2s both;
}
.tm-jubel i:nth-of-type(1) { --r: -75deg; }
.tm-jubel i:nth-of-type(2) { --r: -45deg; animation-delay: .3s; }
.tm-jubel i:nth-of-type(3) { --r: -15deg; }
.tm-jubel i:nth-of-type(4) { --r: 15deg; animation-delay: .3s; }
.tm-jubel i:nth-of-type(5) { --r: 45deg; }
.tm-jubel i:nth-of-type(6) { --r: 75deg; animation-delay: .3s; }
@keyframes tm-hop { 30% { transform: translateY(-12px) rotate(-6deg); } 62% { transform: translateY(0) rotate(5deg); } }
@keyframes tm-gnist {
    0% { opacity: 1; transform: rotate(var(--r)) translateY(-56px) scaleY(.4); }
    100% { opacity: 0; transform: rotate(var(--r)) translateY(-92px) scaleY(1); }
}
.tm-slut-boble { width: 100%; border-radius: 24px; text-align: center; padding: 18px 20px; }
.tm-slut-boble h1 { font-size: clamp(26px, 7.2vw, 34px); color: var(--hvid); }
.tm-tal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; }
.tm-tal-kort { display: grid; gap: 2px; padding: 14px 12px; border-radius: var(--r-m); background: var(--hvid); box-shadow: var(--skygge); }
.tm-tal-kort .tal { font-size: 28px; }
.tm-tal-kort small { color: var(--marine-2); font-weight: 600; font-size: 13.5px; }
.tm-tal-kort.sol { background: var(--sol); box-shadow: none; }
.tm-tal-kort.sol small { color: var(--marine); }
.tm-rekorder { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; width: 100%; }
.tm-rekorder li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; padding: 11px 14px; border-radius: var(--r-s); background: var(--hvid); text-align: left; font-weight: 600; font-size: 15px; line-height: 1.35; }
.tm-rekorder svg { width: 20px; height: 20px; color: var(--sol); }
.tm-slut .tm-faerdig { margin-top: 4px; }

/* --------------------------------------------------------------- arkene */
.tm-oversigt { display: grid; gap: 8px; }
.tm-ov {
    display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%;
    padding: 8px 10px 8px 8px; border-radius: var(--r-m); background: var(--himmel); text-align: left; transition: background .15s;
}
.tm-ov:not([disabled]):hover { background: var(--dis); }
.tm-ov.nu { box-shadow: inset 0 0 0 2px var(--blaa); }
.tm-ov[disabled] { cursor: default; }
.tm-ov[disabled] .tm-ov-navn b { color: var(--marine-2); }
.tm-ov-fig { width: 56px; height: 42px; border-radius: 10px; overflow: hidden; background: var(--hvid); display: block; }
.tm-ov-fig .figur { height: 100%; }
.tm-ov-fig .figur.video img { object-fit: cover; object-position: 50% 32%; }
.tm-ov-navn { min-width: 0; }
.tm-ov-navn b { display: block; font-weight: 650; line-height: 1.25; }
.tm-ov-navn small { display: block; color: var(--marine-2); font-size: 13px; }
.tm-pille {
    display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px;
    background: var(--hvid); color: var(--marine-2); font: 650 12.5px/1 var(--tekst); white-space: nowrap;
}
.tm-pille svg { width: 13px; height: 13px; }
.tm-pille.gjort { color: var(--blaa); }
.tm-pille.nu { background: var(--blaa); color: var(--hvid); }
.tm-pille.plus { background: var(--dis); color: var(--blaa-dyb); }
.tm-byt { display: grid; gap: 12px; }
.tm-byt .figur.stor { margin: 0; }
.tm-byt .figur.video.stor { max-height: 38vh; }
.tm-byt .buddy-hilsen { margin-bottom: 4px; }

/* ------------------------------------- pc og vandret telefon: side om side */
@media (min-width: 900px) and (min-height: 540px), (min-width: 700px) and (orientation: landscape) {
    .tm-top { grid-template-columns: 48px minmax(0, 1fr) 48px; padding: 16px 26px 8px; }
    .tm-frem-tekst { font-size: 16.5px; }
    .tm-delt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); grid-template-rows: minmax(0, 1fr); gap: 26px; padding: 6px 26px 26px; }
    .tm-medie { height: 100%; padding: 0; }
    .tm-panel { align-self: center; max-height: 100%; border-radius: var(--r-l); padding: 24px 24px 22px; gap: 14px; box-shadow: var(--skygge); }
    .tm-ring { width: 210px; }
    .tm-tid { font-size: 62px; }
}
@media (min-width: 1200px) and (min-height: 700px) {
    .tm-delt { grid-template-columns: minmax(0, 1fr) 460px; gap: 40px; padding: 8px 48px 40px; }
    .tm-panel { padding: 28px 28px 24px; }
    .tm-titel h2 { font-size: 34px; }
    .tm-buddy { grid-template-columns: 52px minmax(0, 1fr); }
    .tm-buddy .buddy-fig { width: 52px; height: 52px; }
    .tm-buddy .boble { font-size: 16px; }
    .tm-ring { width: 240px; }
    .tm-tid { font-size: 70px; }
    .tm-midt { width: min(100%, 560px); }
}
/* Lav telefon (SE og mindre): mindre luft, så Færdig altid kan nås uden at rulle. */
@media (max-height: 700px) and (orientation: portrait) {
    .tm-top { padding: 6px 12px 4px; }
    .tm-panel { gap: 9px; padding-top: 14px; }
    .tm-buddy { display: none; }
    .tm-trin, .tm-trin button { height: 60px; }
    .tm-faerdig { min-height: 60px; }
    .tm-ring { width: min(150px, 40vw); }
}
/* Vandret telefon (lav skærm): sættet, tallene og "Færdig" skal kunne nås uden at rulle. Buddys boble
   og undertitlen må vige; uret og knapperne bliver mindre. Står sidst, så den vinder over pc-reglerne. */
@media (orientation: landscape) and (max-height: 500px) {
    .tm-top { grid-template-columns: 40px minmax(0, 1fr) 40px; padding: 6px 18px 2px; }
    .tm-ikon { width: 40px; height: 40px; }
    .tm-delt { gap: 18px; padding: 4px 18px 10px; }
    .tm-panel { gap: 8px; padding: 12px 16px 10px; }
    .tm-buddy, .tm-titel small { display: none; }
    .tm-titel h2 { font-size: 22px; }
    .tm-saetlinje b { font-size: 18px; }
    .tm-trin, .tm-trin button { height: 54px; }
    .tm-trin input { font-size: 24px; }
    .tm-faerdig { min-height: 54px; font-size: 19px; }
    .tm-sek button { min-height: 36px; }
    .tm-pause { gap: 6px; }
    .tm-ring { width: 128px; }
    .tm-tid { font-size: 38px; }
    .tm-pause-knapper .knap { min-height: 48px; }
    .tm-midt { padding-top: 4px; gap: 10px; }
}
