/* ---------------------------------------------------
   Eunomia – Diagramm-Editor im KaytusOS-Stil
   (Farben und Schriften aus style.css, Knöpfe/Dialoge aus haster.css)
--------------------------------------------------- */

.window--eunomia {
  width: min(1600px, 97vw);
  height: min(960px, calc(100vh - var(--taskbar-height) - 24px));
  max-height: min(960px, calc(100vh - var(--taskbar-height) - 24px));
}

/* Maximiert: ganze Fläche über der Taskleiste */
.window--eunomia.is-max {
  top: 0;
  left: 0;
  transform: none;
  width: 100vw;
  height: calc(100vh - var(--taskbar-height));
  max-height: calc(100vh - var(--taskbar-height));
}

.window__btn--max::before {
  content: '';
  width: 9px;
  height: 7px;
  border: 1px solid currentColor;
  border-top-width: 2px;
}

.window--eunomia.is-max .window__btn--max::before {
  width: 7px;
  height: 5px;
  box-shadow: 2px -2px 0 -1px var(--panel-bg), 2px -2px 0 0 currentColor;
}

.eunomia {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.eunomia [hidden] {
  display: none !important;
}

/* ---------- Leiste ---------- */

.eu-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, .25);
  flex-shrink: 0;
}

.eu-file {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
  max-width: 260px;
  margin-right: auto;
}

.eu-file__name {
  max-width: 100%;
  padding: 0;
  border: 1px dashed transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: text;
  overflow: hidden;
  font-family: var(--font-retro);
  font-size: 20px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eu-file__name:hover,
.eu-file__name:focus-visible {
  border-color: var(--line-strong);
  outline: none;
}

.eu-file__input {
  width: 100%;
  padding: 0 2px;
  border: 1px solid var(--accent-cold);
  background: rgba(0, 0, 0, .4);
  color: var(--ink);
  font-family: var(--font-retro);
  font-size: 20px;
  line-height: 1;
  outline: none;
}

.eu-caret {
  width: 7px;
  height: 5px;
  margin-left: 4px;
  vertical-align: middle;
  fill: currentColor;
}

.eu-menu {
  z-index: 12;
  max-height: calc(100% - 8px);
  overflow-y: auto;
}

.eu-menu__sep {
  height: 1px;
  margin: 4px 2px;
  background: var(--line);
}

.eu-menu .haster-menu__item {
  padding-left: 26px;
  white-space: nowrap;
}

.eu-menu .haster-menu__item.is-on::before {
  content: '';
  float: left;
  width: 8px;
  height: 8px;
  margin: 3px 0 0 -16px;
  background: currentColor;
}

.eu-menu .haster-menu__item:disabled {
  opacity: .35;
  cursor: default;
  background: transparent;
  color: var(--ink);
}

.eu-label {
  cursor: grab;
}

.eu-label.is-sel {
  stroke: var(--accent-cold);
  stroke-width: 1;
  stroke-dasharray: 3 2;
  vector-effect: non-scaling-stroke;
}

.eu-login {
  width: min(360px, 100%);
}

.eu-file__where {
  overflow: hidden;
  color: var(--ink-dim);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eu-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.eu-label {
  margin-right: 2px;
  color: var(--ink-dim);
  font-family: var(--font-display);
  font-size: 7px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.eu-icobtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 4px 6px;
}

.eu-ico {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.eu-zoom {
  min-width: 52px;
}

/* ---------- Aufteilung ---------- */

.eu-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 196px;
}

.eu-palette,
.eu-props {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  padding: 12px 10px;
  overflow-y: auto;
}

.eu-palette {
  gap: 2px;
  overflow-x: hidden;
  border-right: 1px solid var(--line);
}

.eu-palette__sub {
  margin-top: 22px !important;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.eu-props {
  overflow-x: hidden;
  border-left: 1px solid var(--line);
  gap: 12px;
}

.eunomia h3 {
  margin: 0 0 4px;
}

.eu-tool {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
  padding: 3px 4px;
  text-align: left;
  border: 1px dashed transparent;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-retro);
  font-size: 17px;
  line-height: 1;
  cursor: grab;
}

.eu-tool svg {
  flex-shrink: 0;
  width: 36px;
  height: 25px;
  fill: rgba(255, 176, 102, .08);
  stroke: var(--ink);
  stroke-width: 1.6;
}

.eu-tool span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eu-tool__t {
  stroke-width: 3;
}

.eu-tool__dash {
  stroke-dasharray: 5 4;
}

.eu-tool__head {
  fill: var(--ink);
  stroke: none;
}

.eu-tool path:not(.eu-tool__head) {
  fill-rule: evenodd;
}

.eu-tool:hover,
.eu-tool:focus-visible {
  border-color: var(--line-strong);
  background: #fc812f26;
}

.eu-tool:focus-visible {
  outline: 1px solid var(--accent-cold);
  outline-offset: 1px;
}

.eu-tool:active {
  cursor: grabbing;
}

/* ---------- Zeichenfläche ---------- */

.eu-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #0f0704;
  outline: none;
  touch-action: none;
}

.eu-stage:focus-visible {
  box-shadow: inset 0 0 0 1px var(--accent-cold);
}

.eu-stage.is-drop {
  box-shadow: inset 0 0 0 2px var(--accent-cold);
}

.eu-stage.is-pan .eu-svg {
  cursor: grab;
}

.eu-stage.is-panning .eu-svg {
  cursor: grabbing;
}

.eu-svg {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
}

#euGrid circle {
  fill: rgba(255, 176, 102, .16);
}

.eu-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink-dim);
  font-family: var(--font-retro);
  font-size: 22px;
  opacity: .5;
  pointer-events: none;
}

.eu-hit {
  fill: transparent;
  stroke: transparent;
}

.eu-edge .eu-hit {
  stroke-width: 14;
  stroke-linecap: round;
}

.eu-shape {
  cursor: move;
}

.eu-edge {
  cursor: pointer;
}

.eu-edge.is-sel line:not(.eu-hit) {
  filter: drop-shadow(0 0 3px var(--accent-cold));
  stroke-width: 3;
}

.eu-edge:hover line:not(.eu-hit) {
  filter: drop-shadow(0 0 2px rgba(255, 106, 26, .7));
}

.eu-shape text,
.eu-edge text {
  pointer-events: none;
}

.eu-sel,
.eu-target,
.eu-marquee {
  fill: none;
  stroke: var(--accent-cold);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.eu-sel {
  stroke-dasharray: 4 3;
}

.eu-target {
  stroke-width: 2;
}

.eu-marquee {
  fill: rgba(255, 106, 26, .08);
  stroke-dasharray: 3 3;
}

.eu-temp {
  stroke: var(--accent-cold);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.eu-handle {
  fill: #000;
  stroke: var(--accent-cold);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.eu-handle--nw, .eu-handle--se { cursor: nwse-resize; }
.eu-handle--ne, .eu-handle--sw { cursor: nesw-resize; }
.eu-handle--n, .eu-handle--s { cursor: ns-resize; }
.eu-handle--e, .eu-handle--w { cursor: ew-resize; }

.eu-port {
  fill: rgba(255, 106, 26, .35);
  stroke: var(--accent-cold);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  cursor: crosshair;
}

.eu-port:hover {
  fill: var(--accent-cold);
}

.eu-edit {
  position: absolute;
  z-index: 3;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 1px dashed var(--accent-cold);
  background: transparent;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  font-family: 'Cascadia Code', Consolas, 'SF Mono', ui-monospace, monospace;
  text-align: center;
  resize: none;
  outline: none;
  overflow: hidden;
}

.eu-cell {
  fill: rgba(255, 106, 26, .12);
  stroke: var(--accent-cold);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.eu-colgrip {
  fill: transparent;
  cursor: col-resize;
}

.eu-colgrip:hover {
  fill: rgba(255, 106, 26, .35);
}

.eu-end {
  fill: #000;
  stroke: var(--accent-cold);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  cursor: move;
}

.eu-end:hover {
  fill: var(--accent-cold);
}

/* ---------- Eigenschaften ---------- */

.eu-prop {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.eu-hint {
  margin: 0;
  color: var(--ink-dim);
  font-size: 12px;
}

.eu-swatches {
  display: grid;
  grid-template-columns: repeat(6, 22px);
  gap: 4px;
}

.eu-swatch,
.eu-color {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line-strong);
  cursor: pointer;
}

.eu-swatch.is-on {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.eu-swatch:focus-visible,
.eu-color:focus-visible {
  outline: 1px solid var(--accent-cold);
  outline-offset: 2px;
}

.eu-swatch--none {
  background:
    linear-gradient(135deg, transparent 45%, #ff4d4d 45%, #ff4d4d 55%, transparent 55%),
    #000;
}

.eu-color {
  background: transparent;
}

.eu-color::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.eu-color::-webkit-color-swatch {
  border: 0;
}

.eu-size {
  width: 48px;
  padding: 3px 4px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-retro);
  font-size: 18px;
  line-height: 1;
  text-align: center;
  -moz-appearance: textfield;
}

.eu-size::-webkit-inner-spin-button,
.eu-size::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.eu-size:focus-visible {
  outline: 1px solid var(--accent-cold);
  outline-offset: 1px;
}

.eu-font {
  align-items: center;
  flex-wrap: nowrap;
}

.eu-b,
.eu-i {
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 13px;
  text-transform: none;
}

.eu-b {
  font-weight: bold;
}

.eu-i {
  font-style: italic;
}

.eu-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.eu-msg {
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 4;
  margin: 0;
  padding: 0 8px;
  transform: translateX(-50%);
  background: var(--panel-bg);
  pointer-events: none;
}

.eu-msg:empty {
  display: none;
}

/* ---------- Haster-Ordnerwahl ---------- */

.eu-dialog {
  z-index: 10;
}

.eu-pick {
  width: min(640px, 100%);
}

.eu-pick__main {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  height: min(320px, 46vh);
  border: 1px solid var(--line);
}

.eu-pick__side {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.eu-pick__side .haster-nav.is-on {
  background: #fc812f41;
  border-color: var(--line-strong);
}

.eu-pick__view {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.eu-pick__crumbs {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-dim);
  font-family: var(--font-retro);
  font-size: 18px;
  overflow-x: auto;
  white-space: nowrap;
}

.eu-pick__crumbs .haster-link {
  margin: 0;
  padding: 0;
  font-size: inherit;
}

.eu-pick__list {
  flex: 1;
  padding: 6px;
  overflow-y: auto;
}

.eu-pick__list .eu-hint {
  padding: 6px;
}

.eu-pick__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 6px;
  border: 1px dashed transparent;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-retro);
  font-size: 18px;
  line-height: 1.1;
  text-align: left;
  cursor: pointer;
}

.eu-pick__item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eu-pick__item:hover,
.eu-pick__item:focus-visible {
  border-color: var(--line-strong);
  background: #fc812f26;
}

.eu-pick__ico {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.eu-pick__item.is-dir .eu-pick__ico {
  width: 26px;
}

.eu-pick__foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.eu-pick .haster-msg:empty {
  display: none;
}

/* ---------- Schmal ---------- */

@container (max-width: 760px) {
  .eu-main {
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .eu-props {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    max-height: 150px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .eu-tool span {
    display: none;
  }

  .eu-tool {
    justify-content: center;
  }

  .eu-file {
    max-width: none;
    width: 100%;
  }

  .eu-pick__main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .eu-pick__side {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: 90px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .window--eunomia:not(.is-max) {
    width: 96vw;
    height: 88vh;
    max-height: 88vh;
  }
}
