/* ===============================================
   TEIL 1: STILE VOM AUFMASS-TOOL (Final: Logo 440px rechts)
===============================================*/

/* Grundlegende Stile */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  margin: 0;
  padding: 85px 12px 12px 12px; 
  background: #f5f6f8;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  transition: padding-top 0.2s ease-out;
}

body {
    padding-top: 228px;
}

body.controls-open {
    padding-top: 336px;
}

body.toolbox-hidden {
    padding-top: 180px;
}

/* 1. Die Zeile zentriert den Titel und Button */
.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: center; /* ZENTRIERT Titel & Button */
  position: relative;      /* Wichtig: Ankerpunkt fÃ¼r das Logo */
}

.toolbar-row:first-child {
  margin-bottom: 8px;
  gap: 15px; 
}

/* 2. Das Logo wird "absolut" positioniert */
.logo-wrapper {
    position: absolute; /* Nimmt das Logo aus dem Fluss -> Titel bleibt mittig */
    
    left: 50%;          /* Startet in der Mitte des Bildschirms */
    top: 50%;           /* Vertikal mittig */
    transform: translateY(-50%); /* Exakte vertikale Zentrierung */
    
    margin-left: 440px; /* HIER EINGESTELLT: Exakt 440px */
    z-index: 200;
}

.logo-wrapper label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08); 
    transition: transform 0.1s, box-shadow 0.1s;
}

.logo-wrapper label:hover {
    transform: scale(1.02);
    border-color: #bbb;
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

.logo-wrapper img {
    height: 60px; 
    width: auto;
    object-fit: contain;
    display: block;
}

.logo-hint {
    font-size: 9px;
    color: #999;
    margin-top: 2px;
    font-weight: 500;
}

/* Auf Handy/Tablet: Logo unter den Titel, alles normal zentriert */
@media (max-width: 900px) {
    .logo-wrapper {
        position: relative; /* ZurÃ¼ck in den normalen Fluss */
        left: auto;
        top: auto;
        transform: none;
        margin: 10px auto;
        margin-left: auto;
    }
    .logo-wrapper img {
        height: 50px; 
    }
}
/* ------------------------ */

.fixed-controls-wrapper {
    position: fixed;
    top: 170px;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 99;
    background: #f5f6f8; 
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fixed-controls-wrapper > .controls-container,
.fixed-controls-wrapper > .toggle-container {
    width: 100%;
    max-width: 1200px;
}

h2 {
  margin: 6px 0 12px 0;
  text-align: center;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 1200px;
}
.tab {
  background: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  cursor: pointer;
  white-space: nowrap;
}
.tab.active {
  background: #0b66ff;
  color: #fff;
}

/* Panel-Styles */
.floating-panel {
  display: none;
  position: fixed;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  z-index: 210; 
  text-align: left;
  border: 1px solid #ddd;
}
.floating-panel h4 {
  margin: 0 0 12px 0;
  text-align: center;
}

#dist-winkel-panel {
  top: 50%;
  transform: translate(-50%, -50%);
  /* Breite etwas erhöhen für das neue Layout */
  min-width: 320px;
}

/* Neue Flex-Row Styles für das Panel */
.panel-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    width: 100%;
}

/* Styles für Edit-Panel Zeilen mit Schloss */
.edit-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
    width: 100%;
}

.edit-row label {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
}

.lock-btn {
    background-color: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 1.2em;
    padding: 4px;
    min-height: 0;
    min-width: 0;
    margin: 0 0 0 5px;
    line-height: 1;
}

.lock-btn:hover {
    background-color: #f0f0f0;
    border-radius: 4px;
}

.lock-btn.locked {
    background-color: #ffeebb;
    border-color: #e0c080;
    border-radius: 4px;
}

/* DIE NEUEN BUTTONS: 4 Stück nebeneinander */
.quick-angle-buttons {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    margin-bottom: 10px;
    margin-top: 5px;
}

.quick-angle-buttons button {
    flex: 1;
    font-size: 16px; /* Größere Pfeile */
    padding: 8px 2px;
    margin: 0;
    background-color: #f0f4ff;
    border: 1px solid #cce0ff;
    font-weight: bold;
    color: #0b66ff;
}

.quick-angle-buttons button:hover {
    background-color: #dbeaff;
}

.floating-panel label {
  display: flex;
  align-items: center;
  margin-bottom: 0; /* Geändert, da jetzt in Row */
  gap: 5px;
}

/* Damit die Inputs in der Row rechtsbündig sind */
.floating-panel .panel-input-row input[type="number"],
.floating-panel .edit-row input[type="number"] {
    margin-left: auto;
}

.floating-panel .calc-btn {
  min-height: 0;
  height: 30px;
  width: 30px;
  padding: 2px;
  font-size: 16px;
  margin: 0;
}

/* Haupt-Button größer machen */
.primary-action-btn.big-btn {
    padding: 12px;
    font-size: 1.1em;
    margin-top: 10px;
}

.floating-panel .primary-action-btn {
  width: 100%;
  background-color: #0b66ff;
  color: white;
  font-weight: bold;
  padding: 10px;
  margin-top: 5px;
}
.floating-panel .primary-action-btn:hover {
  background-color: #0056d6;
}

.floating-panel h4,
#edit-panel h4,
#calculator-modal h4 {
  cursor: grab;
  user-select: none;
}

.floating-panel.dragging h4,
#edit-panel.dragging h4,
#calculator-modal.dragging h4 {
  cursor: grabbing;
}

#skizze, #aufmassblatt, #materialbedarf, #view-2d {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1200px;
}
#aufmassblatt, #materialbedarf, #view-2d {
  display: none;
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  width: 95%;
  text-align: left;
  box-sizing: border-box;
}
#materialbedarf {
    align-items: center;
}
#view-2d {
    background: none;
    padding: 0;
    box-shadow: none;
    width: 100%;
}

.controls-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  margin-bottom: 0;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.2s ease-out;
  overflow: hidden;
}

.controls-container.is-hidden {
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    opacity: 0;
    visibility: hidden;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  justify-content: center;
}

.controls-row label, .controls-row button {
  margin: 0;
}
.controls-row label {
   white-space: nowrap;
   display: inline-flex;
   align-items: center;
}
.controls-row .calc-btn {
    min-height: 0;
    height: 30px;
    width: 30px;
    padding: 2px;
    font-size: 16px;
    margin-left: 3px;
    line-height: 1;
}

.actions {
  display: flex;
  gap: 15px;
  align-items: center;
}
.small {
  font-size: 13px;
  color: #444;
}

.canvas-container {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #ccc;
  background: #fff;
  display: flex;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

#skizze canvas {
  background: #fff;
  display: block;
  margin: 0;
  max-width: none;
  cursor: grab;
}

#edit-panel {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  max-width: 90%;
  min-width: 300px;
  text-align: left;
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  z-index: 10;
  margin-top: 0;
}
#edit-panel h4 { margin: 4px 0 8px 0; }
#edit-panel label { margin-right: 0; }
#edit-panel button { margin-top: 8px; margin-right: 5px; }

#aufmassblatt > div:first-child {
   width: 100%;
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-bottom: 10px;
   flex-wrap: wrap;
   gap: 10px;
}
#aufmassblatt h3 { margin: 0; }

#skizzen-list { width: 100%; }

.skizze-block {
  border: 1px solid #e6e9ef;
  padding: 10px;
  margin-bottom: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fafbff;
  border-radius: 6px;
}
.skizze-block img {
  width: 280px;
  height: 180px;
  object-fit: contain;
  border: 1px solid #ddd;
  background: #fff;
  flex-shrink: 0;
}
.skizze-meta {
  flex: 1;
  min-width: 200px;
}
table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 8px;
}
th, td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: center;
  font-size: 13px;
}
th {
  background: #f0f8ff;
}

button, select, input {
   padding: 8px 10px;
   min-height: 38px;
   font-size: 14px;
   margin: 4px;
   border: 1px solid #ccc;
   border-radius: 8px;
   background-color: #fff;
   box-sizing: border-box;
}

input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active  {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #000 !important; 
}

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

button {
  background-color: #f8f9fa;
  cursor: pointer;
  color: #212529;
  transition: background-color 0.15s ease-in-out;
}
button:hover {
  background-color: #e9ecef;
}
button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background-color: #f8f9fa;
}

.main-toolbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #f5f6f8;
  padding: 8px 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  z-index: 100;
  transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

.main-toolbar.is-collapsed {
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.main-toolbar.is-collapsed .toolbar-row:nth-child(2),
.main-toolbar.is-collapsed .toolbar-row:nth-child(3) {
    display: none;
}

body.main-toolbar-collapsed .fixed-controls-wrapper {
    top: 50px;
}
body.main-toolbar-collapsed {
    padding-top: 216px;
}
body.main-toolbar-collapsed.controls-hidden {
    padding-top: 108px;
}
body.main-toolbar-collapsed.toolbox-hidden {
    padding-top: 60px;
}

.toolbar-divider {
  border-left: 1px solid #ccc;
  height: 25px;
  margin: 0 5px;
}

#view-2d #label-rotation-panel {
    cursor: grab;
    user-select: none;
}
#view-2d #label-rotation-panel.dragging {
    cursor: grabbing;
}

.winkel-kompass {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 1px solid #ccc;
  border-radius: 50%;
  margin: 0;
  padding: 0;
  background: #f9f9f9;
  box-sizing: border-box;
}

.kompass-pfeil {
  font-size: 20px;
  font-weight: bold;
  color: #e74c3c;
  transform: rotate(0deg);
  transition: transform 0.2s ease-out;
  line-height: 1;
  user-select: none;
}

.toggle-container {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    margin-top: 10px;
    margin-bottom: 10px;
    transition: margin-top 0.2s ease-out;
}

.toggle-button {
    padding: 0;
    font-size: 16px;
    min-height: 38px; 
    height: 38px;
    width: 38px;
    line-height: 38px;
    border-radius: 50%;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    margin: 0;
    text-align: center;
}
.toggle-button:hover {
    background-color: #e0e0e0;
}

#main-toolbar-toggle-btn {
    font-size: 20px;
}

.controls-container.is-hidden + .toggle-container {
    margin-top: 0;
}

#panel-actions-dist-winkel,
#panel-finished-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    width: 100%;
}

#panel-actions-dist-winkel button,
#panel-finished-actions button {
    flex: 1;
}

#btn-panel-undo {
    background-color: #f0f0f0;
}

@media (max-width: 1024px) {
    #dist-winkel-panel {
        top: 297px;
        left: 15px;
        transform: none;
        /* Width removed to allow auto sizing with min-width */
    }
    
    #skizze.controls-hidden #dist-winkel-panel {
        top: 159px; 
    }
    
    #edit-panel {
        top: 297px; 
        left: 15px; 
        transform: none; 
        width: 300px; 
        min-width: 300px;
    }
    
    #skizze.controls-hidden #edit-panel {
        top: 159px; 
    }
    
    #calculator-modal {
        top: 380px; 
        left: 15px;
        transform: none;
    }
    
    #skizze.controls-hidden #calculator-modal {
        top: 250px; 
    }
    
    .controls-row .scale-buttons button {
        min-height: 44px;
        min-width: 44px;
        font-size: 14px;
    }
    
    .controls-row .calc-btn {
        min-height: 44px;
        height: 44px;
        width: 44px;
        font-size: 22px;
    }
    
    .floating-panel .calc-btn {
        min-height: 44px;
        height: 44px;
        width: 44px;
        font-size: 22px;
    }
    
    .winkel-kompass {
        min-height: 44px;
        height: 44px;
        width: 44px;
    }
    
    .kompass-pfeil {
        font-size: 24px;
    }
    
    button, select, input {
       min-height: 44px;
       font-size: 16px;
    }
    
    .toggle-button {
        min-height: 44px;
        height: 44px;
        width: 44px;
        line-height: 44px;
        font-size: 20px;
        border-radius: 50%;
    }
}

#view-2d #buttons {
  margin-bottom: 0; 
}

#view-2d .toggle-container {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    margin-top: 10px;
    margin-bottom: 10px;
    transition: margin-top 0.2s ease-out;
}

#view-2d .controls-container.is-hidden + .toggle-container {
    margin-top: 0; 
}

#view-2d #buttons.controls-container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

#view-2d .toggle-button {
    padding: 0;
    font-size: 16px;
    min-height: 38px;
    height: 38px;
    width: 38px;
    line-height: 38px;
    border-radius: 50%;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    margin: 0;
    text-align: center;
}
#view-2d .toggle-button:hover {
    background-color: #e0e0e0;
}

#view-2d #measure-btn.active {
  background-color: #28a745;
  color: white;
  border-color: #218838;
  font-weight: bold;
}

#view-2d #measure-btn.active:hover {
  background-color: #218838;
}

#snap-90-degree-btn {
    font-weight: bold;
    background-color: #f0f0f0;
    border: 1px solid #bbb;
}

#snap-90-degree-btn:hover {
    background-color: #e0e0e0;
}

#snap-90-degree-btn.active {
    background-color: #0b66ff;
    color: white;
    border-color: #0056d6;
}

.hide-for-export button {
    display: none !important;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }
  html, body {
    width: 210mm;
    height: 297mm;
    margin: 0 auto;
    background: white;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    padding: 0;
  }
  * { box-sizing: border-box; max-width: 100%; }
  button, nav, .no-print, .tabs, .controls-container, #edit-panel, #export-choice-modal, #accessory-choice-modal, #calculator-modal, #window-choice-modal, #window-size-prefix-modal, #window-size-suffix-modal, #tile-choice-modal, .main-toolbar { display: none !important; }
  h2 { display: none; }
  #skizze { display: none !important; }
  #aufmassblatt {
      display: block !important;
      box-shadow: none;
      border: none;
      width: 100%;
      padding: 0;
      margin: 0;
  }
   #materialbedarf {
       display: block !important;
       box-shadow: none;
       border: none;
       width: 100%;
       padding: 0;
       margin: 0;
       page-break-before: always;
   }
   .skizze-block {
      page-break-inside: avoid;
      border: 1px solid #ccc;
      background: #fff;
   }
   .skizze-block img { border: 1px solid #bbb; }
}

#export-choice-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  padding: 25px 35px;
  border-radius: 8px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
  z-index: 20;
  text-align: center;
  border: 1px solid #ccc;
}
#export-choice-modal h4 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.2em;
}
#export-choice-modal div {
  margin-bottom: 10px;
}
#export-choice-modal button {
  margin: 5px 8px;
  min-width: 110px;
  cursor: pointer;
}

#accessory-choice-modal,
#window-choice-modal,
#window-size-prefix-modal,
#window-size-suffix-modal,
#tile-choice-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  padding: 25px 35px;
  border-radius: 8px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
  z-index: 20;
  text-align: center;
  border: 1px solid #ccc;
  max-width: 400px;
}

#accessory-choice-modal h4,
#window-choice-modal h4,
#window-size-prefix-modal h4,
#window-size-suffix-modal h4,
#tile-choice-modal h4 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.2em;
}

#accessory-item-buttons,
#window-item-buttons,
#window-size-prefix-buttons,
#window-size-suffix-buttons,
#tile-item-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

#accessory-item-buttons button,
#window-item-buttons button,
#window-size-prefix-buttons button,
#window-size-suffix-buttons button,
#tile-item-buttons button {
  margin: 0;
  min-width: 130px;
  cursor: pointer;
}
#window-size-prefix-buttons button,
#window-size-suffix-buttons button {
    min-width: 60px;
}

#calculator-modal {
    position: fixed;
    top: 180px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    z-index: 200;
    border: 1px solid #ccc;
    width: 260px;
}
#calculator-modal h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
    text-align: center;
}
#calc-formula-display {
    width: 100%;
    box-sizing: border-box;
    text-align: right;
    font-size: 0.9em;
    color: #555;
    padding: 2px 8px;
    margin-bottom: 2px;
    min-height: 1.2em;
    word-wrap: break-word;
}
#calc-display {
    width: 100%;
    box-sizing: border-box;
    text-align: right;
    font-size: 1.4em;
    padding: 8px;
    margin-bottom: 10px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.calc-buttons button {
    min-height: 40px;
    margin: 0;
    font-size: 1.1em;
}
.calc-buttons .calc-equal {
    grid-column: span 2;
    background-color: #0b66ff;
    color: white;
}
.calc-buttons .calc-equal:hover {
    background-color: #0056d6;
}
.calc-buttons .calc-use {
    grid-column: span 2;
    background-color: #28a745;
    color: white;
}
.calc-buttons .calc-use:hover {
    background-color: #218838;
}

.scale-buttons {
  display: inline-flex;
  gap: 4px;
  margin-left: -2px;
  margin-right: 5px;
}

.scale-buttons button {
  padding: 4px 8px;
  min-height: 30px;
  height: 30px;
  font-size: 13px;
  margin: 0;
  line-height: 1;
}

@media (max-width: 600px) {
    .scale-buttons {
        margin-left: 0;
        margin-right: 0;
    }
}

.formula {
  font-size: 0.9em;
  color: #555;
  font-weight: 400;
  font-style: italic;
  margin-left: 8px;
  display: inline;
}

@media (max-width: 600px) {
  .formula {
    display: block;
    margin-left: 10px;
    margin-top: 4px;
  }
}

.material-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  justify-content: center;
  width: 100%;
  flex-wrap: wrap;
}
.material-filters button {
  min-width: 100px;
  background: #fff;
  border: 1px solid #ccc;
}
.material-filters button.active {
  background: #0b66ff;
  color: #fff;
  border-color: #0b66ff;
}

#material-list-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#material-block {
  width: 100%;
  max-width: 600px;
}

/* ===============================================
   TEIL 2: STILE VON 2D-APP (Angepasst & gescoped)
===============================================*/

#view-2d #container {
  border: 1px solid #999;
  width: 100%;
  box-sizing: border-box;
  height: 800px;
  background: #fff;
}
#view-2d #buttons {
  padding: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  margin-bottom: 10px;
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
}
#view-2d #load-input {
  display: none;
}
#view-2d #load-label {
  background: #e0e0e0;
  border: 1px solid #ccc;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
}
#view-2d #load-label:hover {
  background: #d5d5d5;
}

#view-2d button {
  padding: 5px 10px;
  font-size: 14px;
  cursor: pointer;
  min-height: 0;
  margin: 0;
}

#view-2d #rotation-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 15px; 
}

#view-2d #rotation-panel label {
  font-size: 13px;
  color: #222;
}

#view-2d input[type=number] {
  width: 60px;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  min-height: 0;
  margin: 0;
}
#view-2d .rot-btn {
  width: 36px;
  padding: 4px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #f8f8f8;
  font-size: 13px;
}
#view-2d .rot-btn:hover {
  background: #eee;
}
#view-2d .small-btn {
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid #bbb;
  border-radius: 6px;
  background: #fafafa;
}
#view-2d .small-btn:hover {
  background: #eee;
}
#view-2d #zoom-indicator {
  position: fixed;
  bottom: 10px;
  right: 14px;
  background: #000a;
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  z-index: 100;
}

#view-2d #label-rotation-panel {
  position: fixed;
  display: none;
  background: #ffffffcc;
  backdrop-filter: blur(6px);
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
  z-index: 100;
  display: none; 
  gap: 5px;
}

#view-2d #label-rotation-panel button {
  padding: 3px 8px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #f8f8f8;
  cursor: pointer;
}
#view-2d #label-rotation-panel button:hover {
  background: #eee;
}

#view-2d .scale-btn-2d {
    padding: 4px 8px;
    font-size: 13px;
    min-height: 0;
    margin: 0;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-weight: 500;
}
#view-2d .scale-btn-2d.active {
    background: #0b66ff;
    color: white;
    border-color: #0b66ff;
    font-weight: bold;
}
#view-2d .scale-btn-2d:not(.active):hover {
    background: #e0e0e0;
}