/* 1.2 Codes – Morsetabelle und Morsegerät im Vollbild */

/* ---------- Seite ---------- */

.morse-buehne {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .9fr);
  gap: 28px; align-items: center; padding: 10px 0 40px;
}
.morse-buehne .vorspann { margin-bottom: 24px; }
.zeichen-inline { font-weight: 800; color: var(--akzent-tief); }
.knopf-gross { padding: 15px 26px; font-size: 17px; border-radius: 13px; }
.knopf-gross svg { width: 20px; height: 20px; }

.regel-karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 22px;
}
.regel-karte h2 { font-size: 19px; margin-bottom: 12px; }
.regeln { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 15px; }
.regeln li { display: flex; align-items: center; gap: 12px; }
.regel-bild { width: 88px; flex: none; display: flex; align-items: center; }
.regel-bild b { display: block; height: 12px; border-radius: 6px; background: var(--akzent); }
.regel-bild .p { width: 12px; }
.regel-bild .s { width: 36px; }
.luecke { display: block; height: 12px; border: 1.5px dashed var(--rand-stark); border-radius: 6px; }
.luecke.l3 { width: 36px; }
.luecke.l7 { width: 76px; }
.regel-tipp { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--rand); font-size: 14px; color: var(--gedaempft); }
kbd {
  font-family: var(--schrift-mono); font-size: 12.5px; padding: 1px 7px; border-radius: 6px;
  border: 1px solid var(--rand-stark); border-bottom-width: 2px; background: var(--flaeche-2); color: var(--tinte);
}

.abschnitt-kopf { display: flex; align-items: baseline; gap: 16px; margin: 10px 0 18px; }
.abschnitt-kopf h2 { margin: 0; font-size: clamp(24px, 3vw, 30px); }
.abschnitt-kopf .linie { flex: 1; height: 1px; background: var(--rand); }

.tabelle { display: grid; gap: 18px; }
.tabelle-block {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 18px 20px 20px;
}
.tabelle-kopf { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tabelle-kopf h3 { margin: 0; font-size: 17px; }
.tabelle-gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

.kachel {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 96px; padding: 14px 10px 16px; border-radius: 14px;
  background: var(--flaeche-2); border: 1px solid transparent;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.kachel:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--akzent) 45%, var(--rand)); background: var(--akzent-zart); }
.kachel-zeichen { font-size: 30px; font-weight: 720; line-height: 1; letter-spacing: -.01em; color: var(--tinte); }
.kachel .code { min-height: 10px; }

.code { display: flex; align-items: center; justify-content: center; gap: 4px; }
.code b { display: block; height: 10px; border-radius: 5px; background: var(--akzent); flex: none; }
.code .p { width: 10px; }
.code .s { width: 20px; }

.beispiel {
  display: flex; flex-wrap: wrap; align-items: center; gap: 22px 32px; margin-top: 18px;
  padding: 24px; border-radius: var(--radius);
  background: linear-gradient(120deg, var(--akzent-zart), var(--flaeche) 75%);
  border: 1px solid color-mix(in srgb, var(--akzent) 25%, var(--rand));
}
.beispiel-text { flex: 1 1 260px; }
.beispiel-text .augenbraue { margin-bottom: 4px; }
.beispiel-text h3 { font-size: 22px; margin-bottom: 4px; }
.beispiel-text p:last-child { margin: 0; color: var(--tinte-2); font-size: 15.5px; }
.beispiel-wort { display: flex; gap: 10px; }
.beispiel-wort .kachel { width: 104px; background: var(--flaeche); border-color: var(--rand); box-shadow: var(--schatten); }

@media (max-width: 520px) {
  .tabelle-block { padding: 16px 14px; }
  .tabelle-gitter { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
  .kachel { padding-left: 6px; padding-right: 6px; }
  .kachel { min-height: 84px; }
  .kachel-zeichen { font-size: 26px; }
  .code { gap: 3px; }
  .code b { height: 7px; }
  .code .p { width: 7px; }
  .code .s { width: 15px; }
  .beispiel-wort .kachel { width: 88px; }
}

@media (max-width: 760px) {
  .morse-buehne { grid-template-columns: 1fr; }
}

/* ---------- Morsegerät (Vollbild) ---------- */

.geraet {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1000;
  background: #05070c; color: #cfd6e4;
  font-family: var(--schrift);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  touch-action: none; overscroll-behavior: none;
}
html.geraet-offen, html.geraet-offen body { overflow: hidden; }

.geraet-flaeche {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: #05070c; cursor: pointer;
  transition: background-color 20ms linear;
}
.geraet.an .geraet-flaeche { background: #ffffff; }

/* Leiste oben */
.geraet-leiste {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
  pointer-events: none;
}
.geraet-leiste > * { pointer-events: auto; }
.g-luecke { flex: 1; }
.g-knopf, .g-schalter {
  display: inline-flex; align-items: center; gap: 9px;
  font: inherit; font-size: 16px; font-weight: 600;
  padding: 10px 16px; border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,.08); color: #e6ebf5; border: 1px solid rgba(255,255,255,.14);
  touch-action: manipulation;
}
.g-knopf svg { width: 19px; height: 19px; }
.g-knopf:hover, .g-schalter:hover { background: rgba(255,255,255,.14); }
.g-knopf-klein { padding: 7px 13px; font-size: 14.5px; }
.g-schiene {
  width: 38px; height: 22px; border-radius: 11px; position: relative; flex: none;
  background: rgba(255,255,255,.18); transition: background .15s;
}
.g-punkt {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s;
}
.g-schalter[aria-checked="true"] .g-schiene { background: var(--akzent); }
.g-schalter[aria-checked="true"] .g-punkt { transform: translateX(16px); }

/* Wenn es leuchtet, werden Leiste und Schrift dunkel, damit man sie weiter sieht */
.geraet.an .g-knopf, .geraet.an .g-schalter { background: rgba(0,0,0,.06); color: #0b1530; border-color: rgba(0,0,0,.14); }
.geraet.an .g-schiene { background: rgba(0,0,0,.2); }
.geraet.an .g-schalter[aria-checked="true"] .g-schiene { background: var(--akzent); }

.geraet-hinweis {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  margin: 0; text-align: center; font-size: clamp(18px, 2.6vw, 24px);
  color: rgba(255,255,255,.34); pointer-events: none; transition: opacity .4s;
}
.geraet.benutzt .geraet-hinweis { opacity: 0; }
.nur-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .nur-touch { display: inline; }
  .nur-maus { display: none; }
}

/* Morse-Leser unten */
.leser {
  position: absolute; left: 0; right: 0; bottom: 0; pointer-events: none;
  padding: 0 max(20px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  text-align: center; color: #e6ebf5;
}
.geraet.an .leser { color: #0b1530; }
.leser-aktuell {
  min-height: 1.2em; font-family: var(--schrift-mono); font-weight: 800;
  font-size: clamp(44px, 9vw, 96px); line-height: 1.1; letter-spacing: .12em; color: #61A2FF;
}
.geraet.an .leser-aktuell { color: var(--akzent-tief); }
.leser-aktuell .werdend { opacity: .45; }
.leser-text {
  min-height: 1.25em; margin: 6px auto 14px; max-width: 22ch;
  font-size: clamp(40px, 8vw, 88px); font-weight: 750; letter-spacing: .06em; line-height: 1.15;
  overflow-wrap: anywhere; white-space: pre-wrap;
}
.leser-text .unbekannt { opacity: .4; }
.leser-text:empty::before { content: "…"; opacity: .25; }
.leser-zeile { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 18px; font-size: 14px; }
.leser-zeile > * { pointer-events: auto; }
.leser-tempo { opacity: .6; font-family: var(--schrift-mono); }
.leser-regler { display: inline-flex; align-items: center; gap: 8px; opacity: .8; }
.leser-regler input { width: 150px; accent-color: var(--akzent); touch-action: manipulation; }

@media (max-width: 560px) {
  .g-knopf, .g-schalter { padding: 9px 11px; font-size: 14.5px; gap: 7px; }
  .g-schiene { width: 32px; height: 19px; }
  .g-punkt { width: 13px; height: 13px; }
  .g-schalter[aria-checked="true"] .g-punkt { transform: translateX(13px); }
}

.beispiel-weiter { margin-top: 22px; }
