/**
 * MORSE ONLINE – Layout und Design
 * Version 1.4.7 (lesbar / kommentiert)
 *
 * Aufbau:
 * 1. Grundfarben und globale Einstellungen
 * 2. Gehäuse / Kopfbereich
 * 3. Panels und CRT-Bereiche
 * 4. Wasserfall und Legende
 * 5. Steuerungselemente
 * 6. CW-Lampe
 * 7. Analyse- und Textausgabe
 * 8. Hilfe
 * 9. Responsive Anpassungen
 */

/* -------------------------------------------------------------------------- */
/* 1. Grundfarben und globale Einstellungen                                   */
/* -------------------------------------------------------------------------- */

:root {
  font-family: "Courier New", Courier, monospace;

  --phosphor: #0ee000;
  --case: #34342e;
  --case2: #22231f;
  --edge: #777566;
  --screen: #000000;
  --label: #e7e5d1;
  --muted: #a7a797;
  --cream: #d8d5b6;
  --gelb: #e9de58;
  --blue: #6f9db0;
  --red: #b95043;
  --orange: #ff9b35;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #111111;
  color: var(--label);
  font-family: Arial, Helvetica, sans-serif;
}

a:link,
a:visited {
  color: var(--muted);
}

/* -------------------------------------------------------------------------- */
/* 2. Gehäuse / Kopfbereich                                                   */
/* -------------------------------------------------------------------------- */

.machine {
  max-width: 1240px;
  margin: 18px auto;
  padding: 18px;

  background: linear-gradient(145deg, #48483f, #272823 42%, #3a3a33);
  border: 2px solid #777568;
  border-radius: 5px;

  box-shadow:
    0 12px 45px #000000,
    inset 0 0 0 2px #191a17;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 4px 8px 16px;
  border-bottom: 1px solid #777568;
}

h1 {
  margin: 0;
  font-family: "Arial Black", Arial, sans-serif;
  font-size: clamp(27px, 4vw, 44px);
  letter-spacing: 0.08em;
  color: #f1efdc;
  text-shadow: 1px 2px #111111;
}

.header-subtitle {
  margin: 3px 0 1px;
  font: bold 16px Arial, Helvetica, sans-serif;
  letter-spacing: 0.14em;
  color: #f1efdc;
}

header p {
  margin: 4px 0 0;
  font-size: 15px;
  letter-spacing: 0.13em;
  color: #c9c7b4;
}

/* Statuslampe oben rechts. */
.lampbox {
  display: flex;
  align-items: center;
  gap: 9px;

  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.08em;
}

.lampbox i {
  width: 13px;
  height: 13px;
  border-radius: 50%;

  background: #e44739;
  box-shadow:
    0 0 8px #ff3828,
    0 0 2px 2px #171713 inset;
}

.lampbox.running i {
  background: var(--phosphor);
  box-shadow:
    0 0 9px var(--phosphor),
    0 0 2px 2px #171713 inset;
}

main {
  padding: 15px 0 0;
}

/* -------------------------------------------------------------------------- */
/* 3. Panels und CRT-Bereiche                                                 */
/* -------------------------------------------------------------------------- */

.panel {
  position: relative;
  margin-bottom: 13px;
  padding: 30px 14px 14px;

  background: linear-gradient(#3b3b34, #292a25);
  border: 1px solid #777568;

  box-shadow:
    inset 0 0 18px #0005,
    0 2px 5px #0008;
}

.panel-title {
  position: absolute;
  top: 8px;
  left: 14px;

  font: bold 11px Arial, Helvetica, sans-serif;
  letter-spacing: 0.12em;
  color: #f1efdc;
}

.crt {
  background: #171813;
  border-color: #68685d;
}

/* Wasserfall-Canvas bewusst ohne zusätzlichen Glow. */
.crt canvas {
  box-shadow: none;
}

/* Textanzeige behält einen leichten inneren CRT-Effekt. */
.crt textarea {
  box-shadow:
    inset 0 0 22px #0ee00012,
    0 0 0 3px #0b0b09;
}

/* -------------------------------------------------------------------------- */
/* 4. Wasserfall und Legende                                                  */
/* -------------------------------------------------------------------------- */

canvas {
  display: block;
  width: 100%;
  background: #000000;
  border: 1px solid #090a08;
  touch-action: none;
}

#waterfall {
  background: #000000 !important;
  box-shadow: none !important;
  filter: none !important;
}

/* Zusätzliche Pseudo-Effekte im CRT-Bereich sind deaktiviert. */
.crt::before,
.crt::after {
  content: none !important;
  display: none !important;
}

.wf-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;

  color: #9b9b89;
  font: 10px Arial, sans-serif;
}

.legend {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  margin-top: 4px;

  color: var(--phosphor);
  font: 12px "Courier New", monospace;
  text-shadow: none;
}

.legend span:last-child {
  text-align: right;
}

.manual-hint {
  text-align: center;
  color: #aaa994 !important;
  text-shadow: none !important;
  font: 10px Arial, sans-serif;
}

/* -------------------------------------------------------------------------- */
/* 5. Steuerungselemente                                                      */
/* -------------------------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;

  color: #e2e0ca;
  font: bold 11px Arial, Helvetica, sans-serif;
  letter-spacing: 0.04em;
}

select,
input[type="number"] {
  width: 100%;
  padding: 8px;

  background: #11120f;
  color: var(--phosphor);
  border: 1px solid #777568;

  font: 15px "Courier New", monospace;
}

.field-hint {
  color: #9b9b89;
  font: 10px Arial, Helvetica, sans-serif;
  font-weight: normal;
  letter-spacing: 0;
}

.switchrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.switchrow label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;

  padding: 7px 10px;
  background: #1b1c18;
  border: 1px solid #6c6b60;
}

.switchrow input {
  accent-color: var(--phosphor);
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.key,
.filebtn {
  padding: 10px 14px;

  border: 0;
  border-bottom: 4px solid #171713;
  border-right: 2px solid #171713;
  border-radius: 2px;

  color: #111111;
  cursor: pointer;
  box-shadow: inset 0 1px #fff8;

  font: bold 11px Arial, Helvetica, sans-serif;
  letter-spacing: 0.05em;
  text-align: center;
}

.key:active,
.filebtn:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.cream {
  background: var(--cream);
}

.gelb {
  background: var(--gelb);
}

.orange {
  background: var(--orange);
}

.blue {
  background: var(--blue);
}

.red {
  background: var(--red);
  color: #ffffff;
}

.filebtn input {
  display: none;
}

.receiver-lower {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 18px;
  align-items: start;
}

.volume-row {
  max-width: 350px;
  margin-top: 12px;
}

.volume-row input {
  width: 100%;
  accent-color: var(--phosphor);
}

.freq-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;

  color: var(--phosphor);
  font: 12px "Courier New", monospace;
}


.noise-profile-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  background: #151612;
  border: 1px solid #5f5f54;
  color: #d9d7c4;
  font: 11px Arial, Helvetica, sans-serif;
}

.noise-profile-box strong {
  color: var(--phosphor);
  letter-spacing: 0.05em;
}

.noise-profile-box span {
  color: #b9b7a6;
}

.noise-profile-box.learning span {
  color: #ffd27a;
}

.noise-profile-box.active span {
  color: var(--phosphor);
}

/* -------------------------------------------------------------------------- */
/* 6. CW-Lampe                                                                */
/* -------------------------------------------------------------------------- */

.scope-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 10px;
}

.mini-scope-title {
  margin-bottom: 4px;
  font: bold 10px Arial, sans-serif;
  letter-spacing: 0.06em;
}

.cw-lamp {
  width: 84px;
  height: 84px;
  margin: 18px 0 16px;
  border-radius: 50%;
  border: 5px solid #181815;

  background: #3a0b08;
  box-shadow:
    inset 0 0 18px #000000,
    0 0 0 2px #6f6d61;

  transition:
    background 0.04s,
    box-shadow 0.04s;
}

.cw-lamp.on {
  background: #ff2b18;
  box-shadow:
    inset 0 0 12px #ffb09e,
    0 0 18px #ff2b18,
    0 0 34px #c5160b,
    0 0 0 2px #8f8b7a;
}

.mini-scope-hint {
  margin-top: 4px;
  color: #9b9b89;
  font: 9px Arial, sans-serif;
  text-align: center;
}

/* -------------------------------------------------------------------------- */
/* 7. Analyse- und Textausgabe                                                */
/* -------------------------------------------------------------------------- */

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.analysis-grid > div {
  min-height: 64px;
  padding: 10px;

  background: #171813;
  border: 1px solid #66665b;
}

.analysis-grid strong {
  display: block;
  margin-bottom: 8px;

  color: #e7e5d1;
  font: 10px Arial, sans-serif;
  letter-spacing: 0.07em;
}

.analysis-grid span {
  color: var(--phosphor);
  font: 15px "Courier New", monospace;
}

.output-panel textarea {
  width: 100%;
  height: 240px;
  padding: 14px;
  resize: vertical;

  background: #000000;
  color: var(--phosphor);
  border: 1px solid #090a08;

  font: 18px/1.55 "Courier New", monospace;
  text-shadow: 0 0 5px #0ee00066;
}

/* -------------------------------------------------------------------------- */
/* 8. Hilfe                                                                   */
/* -------------------------------------------------------------------------- */

.help h2 {
  margin: 0 0 12px;
  color: #f1efdc;
  font-size: 18px;
}

.help p {
  color: #d0cebc;
  line-height: 1.55;
}

.note {
  margin-top: 14px;
  padding: 12px;

  background: #1b1c18;
  border-left: 4px solid var(--orange);
  color: #d8d5c3;
  line-height: 1.5;
}

/* -------------------------------------------------------------------------- */
/* 9. Responsive Anpassungen                                                  */
/* -------------------------------------------------------------------------- */

@media (max-width: 800px) {
  .machine {
    margin: 0;
    padding: 10px;
    border-radius: 0;
  }

  .grid,
  .analysis-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .receiver-lower {
    grid-template-columns: 1fr;
  }

  .scope-block {
    align-items: flex-start;
  }

  .legend {
    grid-template-columns: 1fr 1fr;
  }

  .manual-hint {
    display: none;
  }

  header {
    align-items: flex-start;
    gap: 10px;
  }

  .lampbox {
    margin-top: 8px;
  }
}

@media (max-width: 520px) {
  .grid,
  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .freq-row {
    justify-content: flex-start;
  }

  .output-panel textarea {
    height: 210px;
  }

  .key,
  .filebtn {
    padding: 10px 11px;
  }

  h1 {
    font-size: 28px;
  }
}
