body {
    background: #0f172a;
    color: #0f172a;
    font-family: "Segoe UI", system-ui, sans-serif;
}

#map {
    height: 90vh;
    width: 100%;
    position: relative; /* Wichtig für die absolute Positionierung der Overlays */
}

/* FIX: Bereich für die Steuerung nach oben holen */
#controls {
    padding: 10px;
    background: #f8f8f8;
    border-top: 1px solid #ccc;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    position: relative; 
    z-index: 1005;      /* Höher als Overlays */
}

/* FIX: Verhindert, dass Overlays in andere Sektionen ragen */
#accordion-section-4 .content {
    position: relative;
    overflow: hidden; 
}

#controls > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.overlay {
    position: absolute;
    /* Zentrierung exakt mittig zur Map */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); 
    transform-origin: center;
    z-index: 999;
}

#overlayArrows {
    width: 220px;
    height: 220px;
    display: none;
    cursor: grab;
    touch-action: none;
    pointer-events: auto;
}

#overlayArrows:active {
    cursor: grabbing;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

input[type="number"] {
    width: 60px;
}

#overlayImg {
    position: absolute;
    /* Zentrierung exakt mittig zur Map */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transform-origin: center;
    z-index: 999;
    width: 200px;
    cursor: grab;
    touch-action: none;
    pointer-events: auto;
}

#overlayImg:active {
    cursor: grabbing;
}

#centerCoords {
    display: flex;
    flex-direction: column; 
    align-items: center;    
    justify-content: flex-start; 
    text-align: center;     
    
    /* Positionierung über dem Overlay in der Mitte der Map */
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1010;          
    background: rgba(255, 255, 255, 0.8);
    padding: 5px 15px;
    border-radius: 20px;
    margin: 5px auto;
    width: fit-content;     
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); 
    pointer-events: none;   
}

#centerCoords table {
    margin: 0;
    color: #0f172a;
}

/* Responsive Styles */
@media (max-width: 600px) {
  body { font-size: 14px; }
}

@media (min-width: 601px) and (max-width: 1024px) {
  body { font-size: 16px; }
}

@media (min-width: 1025px) {
  body { font-size: 18px; }
}

@media (max-width: 1024px) {
  .control-table {
    display: block;
  }
  .control-table tr, .control-table td {
    display: block;
    width: 100%;
    margin-bottom: 10px;
  }
  input[type="range"], input[type="number"] {
    width: 100%;
  }
}

.control-table td .cell-content {
  display: flex;
  align-items: center;
  gap: 5px;
}

.control-table {
  border-collapse: collapse;
  width: 100%;
}

.control-table td {
  padding: 5px 10px;
  vertical-align: middle;
}

/* Header & Menü */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #222;
    color: white;
    position: relative;
    z-index: 10000; 
}

#appMenuPanel {
    position: fixed;
    top: 64px;
    right: 12px;
    display: none;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(135deg, #1f2a38, #2e3b4e);
    color: #f1f5f9;
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    z-index: 100000;
}

.app-menu-item {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    color: white;
    transition: background 0.2s ease;
}

.app-menu-item:hover {
    background-color: #555;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.flag-dropdown {
    position: relative;
    display: inline-block;
}

.flag-dropdown button {
    background: linear-gradient(135deg, #1f2a38, #2e3b4e);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 16px;
}

.flag-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #222;
    border-radius: 4px;
    margin-top: 5px;
    flex-direction: column;
    min-width: 140px;
    z-index: 9999;
}

.app-menu {
    cursor: pointer;
    font-size: 20px;
    padding: 6px 10px;
    border-radius: 4px;
}

/* Buttons & Controls */
.button {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
    color: #fff;
    background-color: #003a78;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.1s ease;
    position: relative;
    z-index: 1005; 
}

.button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

details {
    position: relative;
    z-index: 1005;
    background: white;
    padding: 5px;
    border-radius: 4px;
}

#declinationMode {
    background-color: #ffffff;
    color: #003a78;
    padding: 8px 30px 8px 12px; 
    border: 2px solid #003a78;
    border-radius: 6px;
    font-size: 14px;
    font-family: "Segoe UI", sans-serif;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23003a78'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

#declinationMode:hover {
    background-color: #003a78;
    color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    transform: translateY(-1px);
}

#manualDeclination {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 8px;
    font-family: inherit;
    color: #0f172a;
    outline: none;
}