:root {
  --bg-main: #0c1620;
  --text-light: #ecf6ff;
  --line: #2d3e53;
  --panel-bg: rgba(7, 14, 22, 0.86);
  --accent: #53d8ff;
  --accent-strong: #33c5f7;
  --danger: #ff6a77;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-main);
  color: var(--text-light);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#app {
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 100svh;
  overflow: hidden;
}

#workspaceWrap {
  position: relative;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 18% 16%, rgba(83, 216, 255, 0.1), rgba(83, 216, 255, 0) 42%),
    radial-gradient(circle at 82% 80%, rgba(91, 255, 206, 0.08), rgba(91, 255, 206, 0) 48%),
    linear-gradient(180deg, rgba(3, 10, 18, 0.08), rgba(3, 10, 18, 0.16));
}

body.uml-classdiagram-page.has-graph-background::before {
  background:
    radial-gradient(120% 92% at 88% 10%, rgba(103, 255, 194, 0.16) 0%, rgba(103, 255, 194, 0) 34%),
    radial-gradient(95% 82% at 16% 20%, rgba(126, 176, 255, 0.14) 0%, rgba(126, 176, 255, 0) 42%),
    linear-gradient(180deg, rgba(8, 18, 24, 0.18), rgba(6, 12, 19, 0.62)),
    linear-gradient(125deg, rgba(13, 26, 32, 0.26), rgba(5, 10, 18, 0.82));
}

body.uml-classdiagram-page #graph-canvas {
  opacity: 0.62;
  filter: saturate(0.78) hue-rotate(24deg);
}

body.uml-classdiagram-page #workspaceWrap {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    radial-gradient(circle at 80% 14%, rgba(111, 255, 198, 0.13), rgba(111, 255, 198, 0) 32%),
    radial-gradient(circle at 18% 18%, rgba(127, 170, 255, 0.12), rgba(127, 170, 255, 0) 36%),
    linear-gradient(145deg, rgba(11, 21, 31, 0.66), rgba(7, 14, 23, 0.28));
  background-size: 120px 120px, 120px 120px, auto, auto, auto;
}

body.uml-classdiagram-page #workspaceWrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent 18%),
    linear-gradient(90deg, transparent 0%, rgba(115, 255, 213, 0.04) 48%, transparent 100%);
  opacity: 0.92;
}

body.uml-classdiagram-page #workspaceWrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 72px);
  opacity: 0.34;
}

body.uml-classdiagram-page,
body.uml-classdiagram-page #inspectorPanel,
body.uml-classdiagram-page #infoDock,
body.uml-classdiagram-page .list,
body.uml-classdiagram-page .builder-list,
body.uml-classdiagram-page #topToolbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(111, 237, 204, 0.5) rgba(8, 18, 27, 0.76);
}

body.uml-classdiagram-page::-webkit-scrollbar,
body.uml-classdiagram-page #inspectorPanel::-webkit-scrollbar,
body.uml-classdiagram-page #infoDock::-webkit-scrollbar,
body.uml-classdiagram-page .list::-webkit-scrollbar,
body.uml-classdiagram-page .builder-list::-webkit-scrollbar,
body.uml-classdiagram-page #topToolbar::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body.uml-classdiagram-page::-webkit-scrollbar-track,
body.uml-classdiagram-page #inspectorPanel::-webkit-scrollbar-track,
body.uml-classdiagram-page #infoDock::-webkit-scrollbar-track,
body.uml-classdiagram-page .list::-webkit-scrollbar-track,
body.uml-classdiagram-page .builder-list::-webkit-scrollbar-track,
body.uml-classdiagram-page #topToolbar::-webkit-scrollbar-track {
  background: rgba(7, 16, 24, 0.68);
  border-radius: 999px;
  border: 1px solid rgba(112, 149, 167, 0.16);
}

body.uml-classdiagram-page::-webkit-scrollbar-thumb,
body.uml-classdiagram-page #inspectorPanel::-webkit-scrollbar-thumb,
body.uml-classdiagram-page #infoDock::-webkit-scrollbar-thumb,
body.uml-classdiagram-page .list::-webkit-scrollbar-thumb,
body.uml-classdiagram-page .builder-list::-webkit-scrollbar-thumb,
body.uml-classdiagram-page #topToolbar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid rgba(7, 16, 24, 0.82);
  background:
    linear-gradient(180deg, rgba(134, 236, 255, 0.84), rgba(111, 245, 197, 0.76));
  box-shadow:
    inset 0 0 0 1px rgba(226, 255, 248, 0.16),
    0 0 12px rgba(111, 245, 197, 0.1);
}

body.uml-classdiagram-page::-webkit-scrollbar-thumb:hover,
body.uml-classdiagram-page #inspectorPanel::-webkit-scrollbar-thumb:hover,
body.uml-classdiagram-page #infoDock::-webkit-scrollbar-thumb:hover,
body.uml-classdiagram-page .list::-webkit-scrollbar-thumb:hover,
body.uml-classdiagram-page .builder-list::-webkit-scrollbar-thumb:hover,
body.uml-classdiagram-page #topToolbar::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, rgba(154, 242, 255, 0.94), rgba(131, 255, 211, 0.9));
}

#diagramHost {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(110, 146, 177, 0.25);
  border-radius: 0;
  touch-action: none;
  cursor: grab;
}

#diagramHost.is-panning {
  cursor: grabbing;
}

#diagramHost::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(80, 112, 142, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 112, 142, 0.13) 1px, transparent 1px);
  background-size: 30px 30px;
}

body.uml-classdiagram-page #diagramHost::before {
  background-image:
    linear-gradient(rgba(112, 144, 162, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(112, 144, 162, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(99, 255, 201, 0.03), transparent 46%, rgba(127, 170, 255, 0.025) 100%);
  background-size: 30px 30px, 30px 30px, 100% 100%;
}

#edgeLayer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  z-index: 1;
  pointer-events: auto;
  transform-origin: 0 0;
  will-change: transform;
}

#edgeGroup {
  pointer-events: auto;
}

.uml-edge-path {
  stroke: rgba(159, 220, 255, 0.96);
  stroke-width: 2.1;
  fill: none;
  pointer-events: none;
}

.uml-edge-path.is-dashed {
  stroke-dasharray: 6 5;
}

.uml-edge-path.is-selected {
  stroke: #fff2a7;
  stroke-width: 3;
}

.uml-edge-hit {
  stroke: rgba(255, 255, 255, 0.001);
  stroke-width: 20;
  fill: none;
  cursor: pointer;
  pointer-events: stroke;
}

.uml-edge-label {
  fill: #d8ecff;
  font-size: 11px;
  font-weight: 600;
  text-anchor: middle;
  user-select: none;
  pointer-events: auto;
  cursor: pointer;
}

#classLayer {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform-origin: 0 0;
  will-change: transform;
}

.uml-class {
  position: absolute;
  width: 248px;
  min-height: 132px;
  border: 1px solid color-mix(in srgb, var(--class-color, #53d8ff) 32%, rgba(122, 165, 196, 0.28));
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(10, 20, 30, 0.98), rgba(8, 17, 26, 0.95));
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.34),
    0 0 0 1px color-mix(in srgb, var(--class-color, #53d8ff) 18%, rgba(113, 197, 237, 0.08)),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  color: #e9f5ff;
  cursor: grab;
  touch-action: none;
  user-select: none;
  overflow: visible;
  isolation: isolate;
  transition: border-color 140ms ease, box-shadow 180ms ease;
}

.uml-class::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 17px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 24%),
    radial-gradient(circle at 18% 14%, color-mix(in srgb, var(--class-color, #53d8ff) 28%, white 12%), transparent 36%),
    linear-gradient(165deg, color-mix(in srgb, var(--class-color, #53d8ff) 16%, rgba(15, 27, 39, 0.88)), rgba(9, 18, 28, 0.9) 54%, rgba(5, 12, 20, 0.96));
  pointer-events: none;
  z-index: 0;
}

.uml-class::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: -18px;
  height: 56px;
  border-radius: 999px;
  background: radial-gradient(circle, color-mix(in srgb, var(--class-color, #53d8ff) 42%, rgba(255, 255, 255, 0.18)) 0%, transparent 72%);
  opacity: 0.52;
  filter: blur(18px);
  pointer-events: none;
  z-index: 0;
}

.uml-class > * {
  position: relative;
  z-index: 1;
}

.uml-class:active {
  cursor: grabbing;
}

.uml-class:hover {
  border-color: color-mix(in srgb, var(--class-color, #53d8ff) 48%, rgba(164, 211, 238, 0.4));
  box-shadow:
    0 24px 44px rgba(0, 0, 0, 0.38),
    0 0 0 1px color-mix(in srgb, var(--class-color, #53d8ff) 22%, rgba(113, 197, 237, 0.1)),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.uml-class.is-selected {
  border-color: rgba(126, 245, 220, 0.94);
  box-shadow:
    0 24px 46px rgba(0, 0, 0, 0.44),
    0 0 0 1px rgba(126, 245, 220, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.uml-class.is-connect-source {
  border-color: rgba(255, 230, 127, 0.98);
  box-shadow:
    0 24px 46px rgba(0, 0, 0, 0.44),
    0 0 0 1px rgba(255, 230, 127, 0.56),
    inset 0 1px 0 rgba(255, 248, 217, 0.14);
}

.uml-connector {
  position: absolute;
  z-index: 5;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--class-color, #53d8ff) 34%, rgba(126, 198, 234, 0.78));
  background:
    radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, rgba(13, 27, 40, 0.98), rgba(8, 18, 27, 0.98));
  color: rgba(227, 246, 255, 0.98);
  font-size: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
  padding: 0;
  box-shadow:
    0 0 0 2px rgba(7, 16, 25, 0.9),
    0 8px 18px rgba(0, 0, 0, 0.34);
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease, color 120ms ease;
}

.uml-connector::before,
.uml-connector::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.uml-connector::before {
  width: 10px;
  height: 2px;
}

.uml-connector::after {
  width: 2px;
  height: 10px;
}

.uml-connector:hover,
.uml-connector:focus-visible {
  border-color: rgba(158, 246, 207, 0.98);
  box-shadow:
    0 0 0 2px rgba(7, 16, 25, 0.9),
    0 0 0 5px rgba(112, 238, 210, 0.22),
    0 10px 20px rgba(0, 0, 0, 0.38);
}

.uml-connector.is-source {
  border-color: rgba(255, 231, 138, 0.96);
  background:
    radial-gradient(circle at 32% 30%, rgba(255, 252, 227, 0.28), rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, rgba(42, 34, 8, 0.98), rgba(28, 22, 8, 0.98));
  color: rgba(255, 243, 196, 0.98);
}

.uml-connector-top {
  left: 50%;
  top: 0;
  transform: translate(-50%, -58%);
}

.uml-connector-right {
  right: 0;
  top: 50%;
  transform: translate(58%, -50%);
}

.uml-connector-bottom {
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 58%);
}

.uml-connector-left {
  left: 0;
  top: 50%;
  transform: translate(-58%, -50%);
}

.uml-class-header {
  display: grid;
  gap: 6px;
  padding: 13px 14px 12px;
  border-top-left-radius: 17px;
  border-top-right-radius: 17px;
  overflow: hidden;
  background-clip: padding-box;
  clip-path: inset(0 round 17px 17px 0 0);
  border-bottom: 1px solid rgba(120, 166, 196, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 36%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(18, 30, 43, 0.04)),
    color-mix(in srgb, var(--class-color, #53d8ff) 38%, rgba(15, 29, 41, 0.48));
}

.uml-class-header::after {
  content: "";
  width: 54px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--class-color, #53d8ff) 82%, white 8%), rgba(255, 255, 255, 0.12));
  box-shadow: 0 0 14px color-mix(in srgb, var(--class-color, #53d8ff) 34%, transparent);
}

.uml-class-name {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #eff8ff;
  word-break: break-word;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.18);
}

.uml-class-section {
  margin: 0;
  display: grid;
  gap: 5px;
  padding: 11px 14px 12px;
  border-bottom: 1px solid rgba(120, 166, 196, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 32%),
    linear-gradient(180deg, rgba(10, 19, 29, 0.16), rgba(6, 13, 22, 0.04));
}

.uml-class-section:last-child {
  border-bottom: 0;
  border-bottom-left-radius: 17px;
  border-bottom-right-radius: 17px;
}

.uml-class-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.uml-class-section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--class-color, #53d8ff) 54%, #dcefff);
}

.uml-class-section-label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--class-color, #53d8ff) 72%, white 10%);
  box-shadow: 0 0 0 3px rgba(109, 205, 245, 0.12);
}

.uml-class-section-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(168, 212, 235, 0.18);
  background: rgba(6, 14, 22, 0.52);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: #cfe6f7;
}

.uml-class-item {
  display: block;
  position: relative;
  padding-left: 13px;
  font-size: 12px;
  line-height: 1.4;
  color: #d9e9f7;
  word-break: break-word;
}

.uml-class-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--class-color, #53d8ff) 70%, white 8%);
  box-shadow: 0 0 8px color-mix(in srgb, var(--class-color, #53d8ff) 34%, transparent);
}

.uml-class-item.is-muted {
  padding-left: 0;
  color: #9eb3c7;
  font-style: italic;
}

.uml-class-item.is-muted::before {
  content: none;
}

#homeButton {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  border-radius: 8px;
  border: 1px solid rgba(170, 205, 238, 0.45);
  background: rgba(6, 15, 24, 0.82);
  color: #efffe7;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 12px;
  backdrop-filter: blur(4px);
}

#langToggleBtn {
  position: absolute;
  top: 56px;
  right: 16px;
  z-index: 15;
  min-width: 136px;
  border-radius: 8px;
  border: 1px solid rgba(170, 205, 238, 0.45);
  background: rgba(6, 15, 24, 0.82);
  color: #efffe7;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
  text-align: left;
  backdrop-filter: blur(4px);
}

.lang-toggle-title {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(210, 228, 244, 0.86);
}

.lang-toggle-values {
  display: inline-flex;
  gap: 5px;
}

.lang-toggle-option {
  opacity: 0.65;
}

.lang-toggle-option.is-active {
  opacity: 1;
}

#topToolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  width: min(980px, calc(100vw - 52px));
  padding: 10px 12px;
  border: 1px solid rgba(122, 164, 194, 0.28);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(7, 18, 29, 0.9), rgba(7, 16, 26, 0.78));
  backdrop-filter: blur(10px);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(146, 197, 223, 0.06);
}

.toolbar-btn,
.toolbar-select {
  border-radius: 10px;
  border: 1px solid #4d95c5;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(13, 28, 39, 0.92);
  color: #e1f5ff;
}

.toolbar-btn {
  cursor: pointer;
}

.toolbar-select {
  min-width: 182px;
  cursor: pointer;
}

.toolbar-btn:disabled,
.toolbar-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.toolbar-btn-strong {
  border-color: #4dd6d2;
}

#addClassBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-color: rgba(119, 255, 166, 0.68);
  color: #e6fff0;
  background: rgba(8, 24, 18, 0.84);
  box-shadow:
    0 0 12px rgba(85, 255, 145, 0.22),
    inset 0 0 0 1px rgba(179, 255, 208, 0.14);
}

#addClassBtn::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
  font-weight: 900;
  color: #ddffe8;
  border: 1px solid rgba(120, 255, 165, 0.95);
  background: radial-gradient(circle at 35% 30%, rgba(121, 255, 156, 0.9), rgba(36, 162, 74, 0.92));
  box-shadow:
    0 0 8px rgba(102, 255, 153, 0.8),
    0 0 16px rgba(102, 255, 153, 0.35),
    inset 0 0 5px rgba(214, 255, 228, 0.68);
  flex: 0 0 auto;
}

#addClassBtn:hover {
  background: rgba(10, 31, 22, 0.9);
  border-color: rgba(119, 255, 166, 0.84);
  box-shadow:
    0 0 18px rgba(85, 255, 145, 0.3),
    inset 0 0 0 1px rgba(179, 255, 208, 0.2);
}

#addClassBtn:disabled {
  box-shadow: none;
}

.toolbar-btn-secondary {
  opacity: 0.82;
  border-color: rgba(108, 152, 184, 0.72);
  background: rgba(11, 23, 33, 0.78);
}

.toolbar-btn-small {
  min-width: 88px;
}

.toolbar-file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toolbar-btn.is-active {
  border-color: #9eeea0;
  background: rgba(19, 50, 40, 0.94);
  color: #e9ffe2;
}

#importJsonInput {
  display: none;
}

.menu {
  position: relative;
}

.menu-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 218px;
  display: none;
  gap: 4px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(133, 170, 202, 0.35);
  background: rgba(7, 16, 26, 0.94);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
}

.menu.open .menu-list {
  display: grid;
}

.menu-item {
  border: 1px solid rgba(120, 158, 189, 0.36);
  border-radius: 8px;
  background: rgba(12, 24, 36, 0.9);
  color: #e7f2ff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}

.menu-divider {
  display: block;
  height: 1px;
  margin: 4px 2px;
  background: rgba(118, 154, 181, 0.22);
}

#emptyUmlAddClassBtn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 12;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 260px;
  border-radius: 14px;
  border: 1px solid rgba(119, 255, 166, 0.58);
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 800;
  color: #e6fff0;
  background: rgba(8, 24, 18, 0.84);
  box-shadow:
    0 0 16px rgba(85, 255, 145, 0.26),
    inset 0 0 0 1px rgba(179, 255, 208, 0.16);
  cursor: pointer;
  transition: transform 0.16s ease, background 0.2s ease, box-shadow 0.2s ease;
}

#emptyUmlAddClassBtn:hover {
  transform: translate(-50%, -51%);
  background: rgba(10, 31, 22, 0.9);
  box-shadow:
    0 0 22px rgba(85, 255, 145, 0.34),
    inset 0 0 0 1px rgba(179, 255, 208, 0.24);
}

#emptyUmlAddClassBtn[hidden] {
  display: none !important;
}

.empty-uml-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  font-size: 1.22rem;
  line-height: 1;
  font-weight: 900;
  color: #ddffe8;
  border: 1px solid rgba(120, 255, 165, 0.95);
  background: radial-gradient(circle at 35% 30%, rgba(121, 255, 156, 0.9), rgba(36, 162, 74, 0.92));
  box-shadow:
    0 0 10px rgba(102, 255, 153, 0.9),
    0 0 20px rgba(102, 255, 153, 0.45),
    inset 0 0 6px rgba(214, 255, 228, 0.72);
  flex: 0 0 auto;
}

#hint {
  position: absolute;
  left: 16px;
  bottom: 94px;
  z-index: 13;
  width: min(320px, calc(100vw - 32px));
  font-size: 0.78rem;
  line-height: 1.45;
  padding: 12px 13px;
  border-radius: 14px;
  background: rgba(8, 17, 26, 0.8);
  border: 1px solid rgba(148, 185, 216, 0.22);
  backdrop-filter: blur(8px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.2);
}

#quickActions {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 14;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(320px, calc(100vw - 32px));
}

.quick-btn {
  min-width: 0;
  border-radius: 10px;
  border: 1px solid rgba(121, 175, 205, 0.72);
  background: rgba(10, 22, 34, 0.92);
  color: #e6f6ff;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.1;
  padding: 10px 11px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.quick-btn.quick-btn-danger {
  border-color: rgba(255, 113, 136, 0.82);
  background: rgba(70, 22, 28, 0.94);
  color: #ffe4e7;
}

#inspectorPanel {
  position: absolute;
  left: 14px;
  top: 108px;
  z-index: 13;
  width: min(336px, calc(100vw - 28px));
  max-height: calc(100vh - 226px);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(7, 16, 26, 0.94), rgba(7, 16, 26, 0.78));
  backdrop-filter: blur(12px);
  padding: 14px;
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(144, 193, 224, 0.05);
}

#inspectorPanel h2 {
  margin: 0;
  font-size: 1rem;
}

.panel-eyebrow {
  margin: 0 0 10px;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(180, 213, 239, 0.72);
}

.selection-card,
.editor-section,
.dock-section {
  border-radius: 14px;
  border: 1px solid rgba(132, 169, 201, 0.18);
  background: rgba(9, 19, 30, 0.7);
  box-shadow: inset 0 0 0 1px rgba(135, 191, 225, 0.03);
}

.selection-card {
  padding: 12px 12px 11px;
}

.editor-section {
  margin-top: 10px;
  padding: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.section-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #edf6ff;
}

#inspectorPanel[data-selection-mode="none"] #classEditorSection,
#inspectorPanel[data-selection-mode="none"] #relationEditorSection {
  opacity: 0.72;
}

#inspectorPanel[data-selection-mode="relation"] #classEditorSection,
#inspectorPanel[data-selection-mode="class"] #relationEditorSection {
  opacity: 0.58;
}

.muted {
  margin: 0;
  color: #9eafc2;
  font-size: 0.74rem;
}

.field {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.field label {
  font-size: 0.76rem;
  font-weight: 600;
  color: #d5e3f3;
}

.field input[type="text"],
.field input[type="color"],
.field textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(88, 113, 133, 0.92);
  padding: 9px 10px;
  font-size: 0.8rem;
  color: #f2f7ff;
  background: rgba(5, 11, 17, 0.92);
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.field input[type="text"]:focus,
.field input[type="color"]:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(120, 230, 219, 0.9);
  box-shadow: 0 0 0 3px rgba(91, 214, 197, 0.12);
}

.field input:disabled,
.field textarea:disabled,
.field select:disabled {
  opacity: 0.62;
}

.field textarea {
  resize: vertical;
  min-height: 64px;
}

.field-hint {
  margin: 2px 0 0;
  font-size: 0.7rem;
  line-height: 1.35;
  color: rgba(168, 190, 210, 0.88);
}

#classAttributesInput,
#classMethodsInput {
  display: none;
}

.builder-list {
  display: grid;
  gap: 8px;
  max-height: 190px;
  overflow: auto;
  margin-top: 2px;
  padding-right: 2px;
}

#classAttributesBuilder.builder-list {
  gap: 10px;
}

.builder-empty {
  border: 1px dashed rgba(117, 153, 183, 0.46);
  border-radius: 8px;
  background: rgba(8, 15, 24, 0.6);
  color: #9db2c6;
  font-size: 0.73rem;
  line-height: 1.32;
  padding: 7px 8px;
}

.builder-row,
.method-param-row,
.method-head {
  display: grid;
  gap: 6px;
  align-items: center;
}

.builder-row {
  grid-template-columns: minmax(0, 1fr) minmax(112px, 34%) auto;
}

.attribute-editor {
  border: 1px solid rgba(88, 129, 158, 0.34);
  border-radius: 12px;
  background: rgba(7, 16, 25, 0.7);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.attribute-editor-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.attribute-editor-bottom {
  display: block;
}

.attribute-editor .builder-select-wrap {
  width: 100%;
}

.method-editor {
  border: 1px solid rgba(92, 128, 156, 0.34);
  border-radius: 12px;
  background: rgba(7, 16, 25, 0.7);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.method-head {
  grid-template-columns: minmax(0, 1fr) minmax(112px, 32%) auto;
}

.method-return-type {
  display: grid;
  gap: 5px;
}

.method-return-type-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #c5d9eb;
}

.method-params-wrap {
  display: grid;
  gap: 5px;
}

.method-params-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.method-params-title {
  color: #c9dbec;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.method-param-row {
  grid-template-columns: minmax(0, 1fr) minmax(108px, 34%) auto;
}

.builder-input,
.builder-select,
.builder-custom-type {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(88, 113, 133, 0.92);
  padding: 8px 10px;
  font-size: 0.78rem;
  line-height: 1.2;
  color: #f2f7ff;
  background: rgba(5, 11, 17, 0.92);
}

.builder-input:focus,
.builder-select:focus,
.builder-custom-type:focus {
  outline: none;
  border-color: rgba(120, 230, 219, 0.9);
  box-shadow: 0 0 0 3px rgba(91, 214, 197, 0.12);
}

.builder-select-wrap {
  display: grid;
  gap: 5px;
}

.builder-custom-type {
  display: none;
}

.builder-custom-type.is-visible {
  display: block;
}

.builder-add-btn,
.builder-inline-add,
.builder-remove-btn {
  border-radius: 8px;
  border: 1px solid rgba(108, 181, 218, 0.65);
  background: rgba(12, 27, 41, 0.92);
  color: #dff3ff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.05;
  padding: 7px 9px;
  cursor: pointer;
}

.builder-remove-btn {
  border-color: rgba(233, 145, 150, 0.72);
  background: rgba(48, 18, 23, 0.92);
  min-width: 34px;
  width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  padding: 0;
}

.builder-inline-add {
  min-width: 84px;
  padding: 6px 8px;
}

.builder-add-btn:disabled,
.builder-inline-add:disabled,
.builder-remove-btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.builder-danger-btn {
  border-color: rgba(255, 119, 140, 0.78);
  background: rgba(66, 20, 28, 0.94);
  color: #ffe6eb;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip-btn {
  border-radius: 999px;
  border: 1px solid rgba(110, 176, 205, 0.5);
  background: rgba(10, 24, 35, 0.86);
  color: #dcf1ff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 7px 10px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.chip-btn:hover,
.chip-btn:focus-visible {
  outline: none;
  border-color: rgba(133, 241, 212, 0.82);
  background: rgba(14, 35, 44, 0.94);
  transform: translateY(-1px);
}

.chip-btn.is-active {
  border-color: rgba(255, 231, 138, 0.72);
  background: rgba(39, 36, 16, 0.62);
  color: #fff3b4;
}

.chip-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

#relationControls[hidden] {
  display: none !important;
}

.panel-actions {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.action-btn {
  border-radius: 10px;
  border: 1px solid #4dd6d2;
  background: rgba(16, 44, 52, 0.94);
  color: #e8feff;
  padding: 10px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.action-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.action-btn-danger {
  border-color: rgba(255, 106, 119, 0.8);
  background: rgba(70, 22, 28, 0.95);
  color: #ffe4e7;
}

#infoDock {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 300px;
  max-height: 48vh;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(7, 16, 26, 0.94), rgba(7, 16, 26, 0.78));
  backdrop-filter: blur(12px);
  z-index: 13;
  padding: 14px;
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(144, 193, 224, 0.05);
}

.dock-header {
  margin-bottom: 10px;
}

#infoDock h3 {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: #d5deea;
}

.stats-strip {
  margin: 0 0 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #d6ecff;
  background: #112031;
  border: 1px solid #2f475f;
}

.status-copy {
  line-height: 1.45;
}

.dock-section {
  padding: 12px;
}

.dock-section + .dock-section {
  margin-top: 10px;
}

.list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  font-size: 0.74rem;
  max-height: 132px;
  overflow-y: auto;
}

.list li {
  margin-bottom: 6px;
  color: #d9ecff;
}

.list li:last-child {
  margin-bottom: 0;
}

.list-item-btn {
  width: 100%;
  border: 1px solid rgba(91, 121, 145, 0.56);
  border-radius: 10px;
  background: rgba(9, 18, 28, 0.86);
  color: #d9ecff;
  font-size: 0.75rem;
  line-height: 1.35;
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.list-item-btn:hover,
.list-item-btn:focus-visible {
  outline: none;
  border-color: rgba(131, 214, 245, 0.82);
  background: rgba(11, 24, 37, 0.96);
}

.list-item-btn.is-selected {
  color: #fff3b4;
  border-color: rgba(255, 231, 138, 0.7);
  background: rgba(39, 36, 16, 0.62);
}

#zoomControls.zoom-dock {
  position: absolute;
  top: 108px;
  right: 16px;
  z-index: 15;
  width: 110px;
  border-radius: 10px;
  border: 1px solid rgba(133, 170, 202, 0.35);
  background: rgba(7, 16, 26, 0.88);
  backdrop-filter: blur(7px);
  padding: 8px;
  display: grid;
  gap: 7px;
}

.zoom-status-btn {
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(112, 170, 203, 0.42);
  background: rgba(11, 22, 34, 0.84);
  color: #dff4ff;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  padding: 7px 6px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.zoom-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.zoom-action-btn {
  border-radius: 8px;
  border: 1px solid rgba(111, 192, 223, 0.66);
  background: rgba(15, 31, 45, 0.92);
  color: #e6f7ff;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  min-height: 32px;
  cursor: pointer;
}

@media (max-width: 1080px) {
  #topToolbar {
    width: calc(100vw - 24px);
  }

  #homeButton {
    top: 10px;
    right: 10px;
  }

  #langToggleBtn {
    top: 50px;
    right: 10px;
    min-width: 118px;
    padding: 5px 9px;
  }

  #zoomControls.zoom-dock {
    top: 100px;
    right: 10px;
  }

  #inspectorPanel {
    top: 100px;
    left: 10px;
  }

  #infoDock {
    right: 10px;
    bottom: 10px;
  }
}

@media (max-width: 760px) {
  #workspaceWrap {
    padding-bottom: calc(env(safe-area-inset-bottom) + 142px);
  }

  #topToolbar {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: max(8px, calc(env(safe-area-inset-bottom) + 6px));
    transform: none;
    width: auto;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding: 8px;
    scrollbar-width: thin;
  }

  .toolbar-btn,
  .toolbar-select {
    min-width: 128px;
    flex: 0 0 auto;
  }

  .menu-list {
    left: auto;
    right: 0;
    min-width: min(260px, calc(100vw - 16px));
  }

  #homeButton {
    top: max(8px, calc(env(safe-area-inset-top) + 4px));
    right: 8px;
    min-width: 72px;
    font-size: 0.75rem;
  }

  #langToggleBtn {
    top: max(46px, calc(env(safe-area-inset-top) + 42px));
    right: 8px;
    min-width: 112px;
  }

  #zoomControls.zoom-dock {
    top: max(96px, calc(env(safe-area-inset-top) + 92px));
    right: 8px;
    width: 102px;
    padding: 7px;
  }

  .zoom-status-btn {
    font-size: 0.7rem;
    padding: 6px 5px;
  }

  .zoom-action-btn {
    min-height: 30px;
    font-size: 0.95rem;
  }

  #inspectorPanel {
    top: max(98px, calc(env(safe-area-inset-top) + 94px));
    left: 8px;
    right: 116px;
    width: auto;
    max-height: 36svh;
    padding: 8px;
  }

  .field input[type="text"],
  .field textarea {
    font-size: 16px;
  }

  .builder-input,
  .builder-select,
  .builder-custom-type {
    font-size: 16px;
  }

  #emptyUmlAddClassBtn {
    min-width: 0;
    width: min(420px, calc(100vw - 20px));
    padding: 12px 14px;
    font-size: 0.94rem;
  }

  #infoDock {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: calc(env(safe-area-inset-bottom) + 56px);
    max-height: 24svh;
  }

  #hint {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: calc(env(safe-area-inset-bottom) + 180px);
    font-size: 0.7rem;
    line-height: 1.25;
  }

  #quickActions {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: calc(env(safe-area-inset-bottom) + 120px);
  }

  .uml-class {
    width: 220px;
    min-height: 122px;
  }
}

@media (max-width: 520px) {
  .toolbar-btn,
  .toolbar-select {
    min-width: 116px;
    font-size: 0.76rem;
    padding: 8px 10px;
  }

  #zoomControls.zoom-dock {
    width: 96px;
  }

  #inspectorPanel {
    max-height: 40svh;
    right: 104px;
  }

  #infoDock {
    max-height: 28svh;
  }

  .selection-card,
  .editor-section,
  .dock-section {
    border-radius: 12px;
  }

  .builder-row,
  .method-head,
  .method-param-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .builder-row .builder-remove-btn,
  .method-head .builder-remove-btn,
  .method-param-row .builder-remove-btn {
    width: 100%;
  }
}

@media (hover: none) and (pointer: coarse) and (max-height: 560px) {
  #workspaceWrap {
    padding-bottom: calc(env(safe-area-inset-bottom) + 102px);
  }

  #topToolbar {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: max(8px, calc(env(safe-area-inset-bottom) + 6px));
    transform: none;
    width: auto;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding: 4px 2px;
    scrollbar-width: thin;
  }

  .toolbar-btn,
  .toolbar-select {
    min-width: 110px;
    padding: 8px 10px;
    font-size: 0.72rem;
    flex: 0 0 auto;
  }

  #zoomControls.zoom-dock {
    top: max(8px, calc(env(safe-area-inset-top) + 4px));
  }

  #inspectorPanel {
    top: max(84px, calc(env(safe-area-inset-top) + 80px));
    max-height: calc(100svh - 166px);
  }

  #hint,
  #infoDock {
    display: none;
  }

  #quickActions {
    bottom: calc(env(safe-area-inset-bottom) + 56px);
  }
}
