* { box-sizing: border-box; }
  html, body {
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
    min-height: 100vh;
  }
  body {
    background:
      repeating-radial-gradient(circle at 15% 25%, rgba(60,35,15,0.15) 0px, transparent 3px),
      repeating-radial-gradient(circle at 70% 60%, rgba(60,35,15,0.12) 0px, transparent 4px),
      repeating-radial-gradient(circle at 40% 80%, rgba(60,35,15,0.1) 0px, transparent 3px),
      linear-gradient(160deg, #C08A5B 0%, #A9744C 50%, #97643F 100%);
    background-size: 40px 40px, 55px 55px, 35px 35px, cover;
  }

  header {
    padding: 18px 30px;
    background: rgba(255,255,255,0.88);
    border-bottom: 3px solid rgba(0,0,0,0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
  }
  header .titel h1 { margin: 0; font-size: 24px; font-weight: bold; color: #1E2A38; }
  header .titel p { margin: 2px 0 0; font-size: 13px; color: #5B5548; }

  .werkzeuge {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    font-family: Arial, sans-serif;
    font-size: 13px;
  }
  button, select, input[type=color] { font-family: Arial, sans-serif; }
  .werkzeuge button, .werkzeuge select, .werkzeuge input[type=color] {
    font-size: 13px;
    padding: 7px 12px;
    border: 1px solid #1E2A38;
    background: #1E2A38;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
  }
  .werkzeuge button.aktiv { background: #7A2E2E; border-color: #7A2E2E; }
  .werkzeuge button:hover { opacity: 0.9; }
  .werkzeuge input[type=color] { padding: 2px; width: 34px; height: 32px; background: none; }
  .werkzeuge input[type=range] { width: 80px; }
  .stift-nur-wenn-aktiv { display: none; align-items: center; gap: 6px; }
  .stift-nur-wenn-aktiv.sichtbar { display: flex; }

  /* Schalter unten rechts; im Bearbeitungs-ausgeblendet-Zustand fast unsichtbar, taucht bei Berührung wieder auf */
  .schalter-sichtbarkeit {
    position: fixed;
    bottom: 16px; right: 16px;
    z-index: 50;
    font-size: 13px;
    padding: 8px 14px;
    border: 1px solid #5B5548;
    background: #fff;
    color: #1E2A38;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 2px 3px 8px rgba(0,0,0,0.25);
    transition: opacity 0.2s;
  }
  .schalter-sichtbarkeit.aktiv { background: #E8E1D2; }
  body.versteckt .schalter-sichtbarkeit { opacity: 0.08; }
  body.versteckt .schalter-sichtbarkeit:hover,
  body.versteckt .schalter-sichtbarkeit:focus {
    opacity: 1;
  }

  .lightbox {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 100;
    align-items: center;
    justify-content: center;
  }
  .lightbox.sichtbar { display: flex; }
  .lightbox img {
    max-width: 92vw;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0,0,0,0.6);
  }
  .lightbox-schliessen {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 101;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    width: 36px; height: 36px;
    font-size: 16px;
    cursor: pointer;
  }

  /* Bearbeitungsmodus ausgeblendet: Kopfleiste und alle Eingabe-/Steuerelemente verschwinden */
  body.versteckt header,
  body.versteckt .neuer-zettel-leiste,
  body.versteckt .neuer-termin-leiste,
  body.versteckt .termin-form,
  body.versteckt .aktionen,
  body.versteckt .resize-griff,
  body.versteckt .farb-waehler {
    display: none !important;
  }
  body.versteckt .buehne { min-height: 100vh; }

  .buehne { position: relative; width: 100%; min-height: calc(100vh - 70px); overflow: hidden; }
  #zeichenflaeche { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
  #zeichenflaeche.aktiv { pointer-events: auto; cursor: crosshair; touch-action: none; }

  .neuer-termin-leiste, .neuer-zettel-leiste {
    position: absolute;
    z-index: 8;
    background: rgba(255,255,255,0.92);
    padding: 8px;
    border-radius: 4px;
    box-shadow: 2px 3px 8px rgba(0,0,0,0.25);
    display: flex;
    gap: 6px;
  }
  .neuer-termin-leiste { top: 20px; left: 20px; }
  .neuer-zettel-leiste { top: 20px; right: 90px; }
  .neuer-termin-leiste select, .neuer-termin-leiste button,
  .neuer-zettel-leiste select, .neuer-zettel-leiste button {
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 3px;
    border: 1px solid #ccc;
    cursor: pointer;
  }
  .neuer-termin-leiste button, .neuer-zettel-leiste button { background: #1E2A38; color: #fff; border-color: #1E2A38; }

  .termin-form {
    position: absolute;
    top: 62px; left: 20px;
    z-index: 8;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255,255,255,0.96);
    padding: 12px;
    border-radius: 4px;
    box-shadow: 2px 3px 8px rgba(0,0,0,0.25);
    width: 210px;
  }
  .termin-form input, .termin-form select {
    font-family: Georgia, serif;
    font-size: 13px;
    padding: 6px 8px;
    border: 1px solid #C9C2AF;
    border-radius: 3px;
  }
  .termin-form button {
    font-family: Arial, sans-serif;
    font-size: 12px;
    padding: 6px 8px;
    border: 1px solid #1E2A38;
    background: #1E2A38;
    color: #fff;
    border-radius: 3px;
    cursor: pointer;
  }

  /* Gemeinsame Optik: Notizzettel, Termine und freie Fotos hängen alle wie angepinnt */
  .zettel, .termin-karte, .foto-frei {
    position: absolute;
    box-shadow: 3px 5px 10px rgba(0,0,0,0.35);
    cursor: grab;
    z-index: 5;
    touch-action: none;
  }
  .zettel:active, .termin-karte:active, .foto-frei:active { cursor: grabbing; }

  .zettel { width: 190px; min-height: 190px; padding: 22px 14px 30px; font-family: 'Segoe Print', 'Bradley Hand', cursive, Georgia, serif; font-size: 15px; line-height: 1.35; color: #3A3226; }
  .zettel textarea {
    width: 100%; height: 70px; border: none; background: transparent; resize: none;
    font-family: inherit; font-size: inherit; color: inherit; outline: none;
  }

  .termin-karte {
    width: 190px;
    min-height: 90px;
    padding: 22px 12px 30px;
    font-family: Georgia, serif;
    font-size: 13px;
    line-height: 1.4;
    color: #2B2620;
  }
  .termin-karte .datum { display: block; font-size: 11px; color: #6B5940; font-family: Arial, sans-serif; margin-bottom: 4px; }
  .termin-karte .titel-text { font-size: 14px; }
  .termin-erledigt {
    display: block;
    margin-top: 8px;
    background: none;
    border: 1px solid rgba(0,0,0,0.3);
    border-radius: 3px;
    padding: 3px 7px;
    font-family: Arial, sans-serif;
    font-size: 11px;
    color: #2B2620;
    cursor: pointer;
  }
  .termin-erledigt:hover { background: rgba(0,0,0,0.06); }
  .termin-karte.vergangen { opacity: 0.55; }
  .termin-karte.vergangen .titel-text { text-decoration: line-through; }
  .termin-karte.erledigt { opacity: 0.5; }
  .termin-karte.erledigt .titel-text { text-decoration: line-through; }
  .termin-bearbeiten-form { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
  .termin-bearbeiten-form input {
    font-family: Georgia, serif;
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid #C9C2AF;
    border-radius: 3px;
  }

  .foto-frei { padding: 10px 10px 26px; background: #FFFDF8; }
  .foto-frei img { display: block; width: 100%; height: 100%; box-sizing: border-box; object-fit: cover; cursor: zoom-in; border-style: solid; }
  .zettel .foto { cursor: zoom-in; box-sizing: border-box; border-style: solid; }

  .rahmen-dicke-keiner { border-width: 0 !important; }
  .rahmen-dicke-duenn { border-width: 2px !important; border-style: solid !important; }
  .rahmen-dicke-dick { border-width: 9px !important; border-style: solid !important; }

  .rahmen-waehler {
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 3px;
    border: 1px solid #ccc;
    cursor: pointer;
    background: #fff;
  }
  .rahmenfarb-reihe { display: flex; gap: 4px; align-items: center; }
  .rahmenfarb-reihe .farb-punkt { width: 13px; height: 13px; }

  .resize-griff {
    position: absolute;
    right: -3px; bottom: -3px;
    width: 14px; height: 14px;
    background: #1E2A38;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 3;
    touch-action: none;
  }
  .foto-behaelter { position: relative; margin-bottom: 6px; display: inline-block; max-width: 100%; }
  .zettel .foto { display: block; width: 100%; height: 100%; object-fit: cover; }
  .foto-input { display: none; }

  .pin {
    position: absolute;
    top: -8px; left: 50%;
    transform: translateX(-50%);
    width: 15px; height: 15px;
    border-radius: 50%;
    box-shadow: 0 2px 3px rgba(0,0,0,0.45), inset -2px -2px 3px rgba(0,0,0,0.25), inset 2px 2px 3px rgba(255,255,255,0.4);
    z-index: 2;
  }
  .foto-frei .pin { background: #444; }

  .aktionen {
    position: absolute;
    bottom: 5px; left: 12px; right: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: Arial, sans-serif;
    font-size: 11px;
  }
  .aktionen button {
    background: none; border: none;
    color: rgba(0,0,0,0.45);
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 11px;
    padding: 2px;
  }
  .aktionen button:hover { color: rgba(0,0,0,0.8); }
  .schrift-waehler { display: flex; gap: 4px; }
  .schrift-waehler button { border: 1px solid rgba(0,0,0,0.25); border-radius: 3px; width: 18px; height: 18px; line-height: 1; padding: 0; }

  .aktionen { flex-wrap: wrap; row-gap: 3px; }
  .farb-waehler { position: absolute; top: -8px; right: -6px; display: flex; gap: 3px; z-index: 4; }
  .farb-punkt {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.3);
    cursor: pointer;
    padding: 0;
  }

  .gelb { background: #F2E4A8; transform: rotate(-2deg); }
  .rosa { background: #F3C9CE; transform: rotate(1.2deg); }
  .mint { background: #C7E4D6; transform: rotate(-1deg); }
  .flieder { background: #DCD7E3; transform: rotate(1.6deg); }
  .blau { background: #BFD6E8; transform: rotate(-1.4deg); }
  .gelb .pin { background: #C0392B; }
  .rosa .pin { background: #E1B21B; }
  .mint .pin { background: #2F6FB0; }
  .flieder .pin { background: #2E8B57; }
  .blau .pin { background: #E8E4DA; }
  .farb-punkt.punkt-gelb { background: #F2E4A8; }
  .farb-punkt.punkt-rosa { background: #F3C9CE; }
  .farb-punkt.punkt-mint { background: #C7E4D6; }
  .farb-punkt.punkt-flieder { background: #DCD7E3; }
  .farb-punkt.punkt-blau { background: #BFD6E8; }

  @media (max-width: 720px) {
    .neuer-termin-leiste { position: static; margin: 12px 12px 0; flex-wrap: wrap; }
    .neuer-zettel-leiste { position: static; margin: 12px; width: fit-content; flex-wrap: wrap; }
    .termin-form { position: static; margin: 0 12px 12px; width: auto; }

    header { padding: 14px 16px; }
    header .titel h1 { font-size: 20px; }
    header .titel p { font-size: 12px; }

    /* Größere Tippflächen für Finger */
    .resize-griff { width: 26px; height: 26px; right: -8px; bottom: -8px; }
    .farb-waehler .farb-punkt, .rahmenfarb-reihe .farb-punkt { width: 20px; height: 20px; }
    .aktionen button, .schrift-waehler button, .termin-erledigt { padding: 6px 9px; font-size: 12px; }
    .schrift-waehler button { width: 26px; height: 26px; }
    .schalter-sichtbarkeit { padding: 10px 16px; font-size: 14px; }
    .lightbox-schliessen { width: 42px; height: 42px; font-size: 18px; }

    /* Zettel, Termine und Fotos etwas schmaler, damit mehrere auf den Bildschirm passen */
    .zettel { width: 155px; min-height: 160px; }
    .termin-karte { width: 155px; }
    .foto-frei { min-width: 140px; }
  }

  @media (pointer: coarse) {
    .resize-griff { width: 24px; height: 24px; right: -8px; bottom: -8px; }
  }

