@font-face { font-family: "Roboto"; src: url("../assets/fonts/Roboto-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Roboto"; src: url("../assets/fonts/Roboto-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Roboto"; src: url("../assets/fonts/Roboto-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("../assets/fonts/PlayfairDisplay-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("../assets/fonts/PlayfairDisplay-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("../assets/fonts/PlayfairDisplay-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("../assets/fonts/Cinzel-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("../assets/fonts/Cinzel-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Berkshire Swash"; src: url("../assets/fonts/BerkshireSwash-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Michroma"; src: url("../assets/fonts/Michroma-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Pirata One"; src: url("../assets/fonts/PirataOne-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "UnifrakturCook"; src: url("../assets/fonts/UnifrakturCook-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

.draw-panel-copy {
  color: var(--color-text);
  font-size: 0.86rem;
  line-height: 1.45;
  opacity: 0.78;
  margin: -4px 0 0;
}

.draw-panel-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-top: 12px;
  border-radius: 8px;
  background:
    linear-gradient(45deg, #202126 25%, transparent 25%),
    linear-gradient(-45deg, #202126 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #202126 75%),
    linear-gradient(-45deg, transparent 75%, #202126 75%);
  background-color: #15161a;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  box-sizing: border-box;
}

.draw-panel-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.draw-panel-actions {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.draw-delete-panel-btn {
  justify-content: center;
  color: #d86b68;
}

.draw-delete-panel-btn[hidden] {
  display: none !important;
}

.draw-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.74);
  z-index: 5000;
  box-sizing: border-box;
}

.draw-modal.show {
  display: flex;
}

.draw-modal-shell {
  width: min(96vw, 1500px);
  height: min(92vh, 980px);
  display: flex;
  flex-direction: column;
  background: var(--color-panel);
  border: 1px solid #2d2e33;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.42);
}

.draw-toolbar {
  position: relative;
  z-index: 20;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  background: #15161a;
  border-bottom: 1px solid #2b2c31;
  box-sizing: border-box;
  overflow: visible;
}

.draw-toolbar-left,
.draw-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  position: relative;
}

.draw-toolbar-right {
  margin-left: auto;
}

.draw-toolbar-divider {
  width: 1px;
  height: 28px;
  background: #33353b;
  margin: 0 4px;
}

.draw-tool-btn,
.draw-close-btn {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  opacity: 0.82;
  transition: background 0.16s ease, opacity 0.16s ease;
}

.draw-tool-btn:hover,
.draw-close-btn:hover,
.draw-tool-btn.active,
.draw-action-btn:focus-visible {
  opacity: 1;
  background: #2a2b31;
  border-color: transparent;
  outline: none;
}

.draw-tool-btn:disabled {
  cursor: default;
  opacity: 0.34;
}

.draw-tool-btn:disabled:hover {
  background: transparent;
  border-color: transparent;
}

.draw-tool-btn img,
.draw-close-btn img {
  width: 21px;
  height: 21px;
  object-fit: contain;
  filter: brightness(1.7);
}

.draw-color-dot {
  width: 22px;
  height: 22px;
  margin: 0;
  position: relative;
  overflow: hidden;
  background-image: linear-gradient(135deg, transparent calc(50% - 1px), rgba(255,255,255,0.95) calc(50% - 1px), rgba(255,255,255,0.95) calc(50% + 1px), transparent calc(50% + 1px));
}

.draw-color-dot.element-color-picker:hover {
  transform: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.2);
}

.draw-color-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--color-text);
  font-size: 0.82rem;
  white-space: nowrap;
  cursor: default;
}

.draw-color-dot:not(.is-transparent) {
  background-image: none !important;
}

.draw-color-dot.is-transparent {
  background-color: #999 !important;
  background-image:
    linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%),
    linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%) !important;
  background-position: 0 0, 4px 4px;
  background-size: 8px 8px;
}

.draw-size-control,
.draw-check-control {
  display: inline-flex;
  align-items: center;
  color: var(--color-text);
  font-size: 0.82rem;
  white-space: nowrap;
}

.draw-size-control {
  gap: 7px;
}

.draw-check-control {
  gap: 5px;
  margin-left: 8px;
}

.draw-line-style {
  position: relative;
  flex: 0 0 64px;
  margin-left: 2px;
}

.draw-line-style-toggle {
  width: 64px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 7px;
  color: var(--color-text);
  background: #202126;
  border: 1px solid #45464c;
  border-radius: 6px;
  cursor: pointer;
}

.draw-line-style-toggle:hover,
.draw-line-style.open .draw-line-style-toggle {
  border-color: var(--color-accent);
}

.draw-line-style-sample {
  display: block;
  width: 32px;
  height: 2px;
  background: #e9e9ec;
}

.draw-line-style-sample[data-line-style-sample="dashed"] {
  background: repeating-linear-gradient(to right, #e9e9ec 0 7px, transparent 7px 11px);
}

.draw-line-style-sample[data-line-style-sample="dotted"] {
  height: 3px;
  background: repeating-linear-gradient(to right, #e9e9ec 0 2px, transparent 2px 4px);
}

.draw-line-style-caret {
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-top-color: #e9e9ec;
  transform: translateY(2px);
}

.draw-line-style-menu {
  display: none;
  top: calc(100% + 5px);
  left: 0;
  right: auto;
  min-width: 64px;
  padding: 4px;
  z-index: 30;
}

.draw-line-style.dropdown.open > .draw-line-style-menu {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.draw-line-style-menu .draw-line-style-option {
  width: 56px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.draw-line-style-menu .draw-line-style-option:hover,
.draw-line-style-menu .draw-line-style-option.active {
  background: #35363c;
}

.draw-line-style-menu .draw-line-style-sample {
  width: 46px;
}

.draw-size-control input {
  width: 130px;
}

.draw-size-control strong {
  min-width: 18px;
  text-align: left;
  font-weight: 600;
}

.draw-check-control input {
  accent-color: #1473e6;
}

.draw-text-btn {
  min-height: 38px;
  padding: 0 13px;
  justify-content: center;
}

.draw-save-btn {
  height: 44px !important;
  min-height: 44px;
  padding: 10px 20px !important;
  justify-content: center;
  background: transparent !important;
  color: #ffffff !important;
  border: 2px solid var(--color-accent) !important;
  border-radius: 24px !important;
  font-size: var(--font-size-base);
  font-weight: 400;
  box-sizing: border-box;
  transition: background 0.25s ease, border-color 0.25s ease, opacity 0.16s ease;
}

.draw-save-btn:hover,
.draw-save-btn:focus-visible {
  background: var(--color-accent) !important;
  color: #ffffff !important;
  box-shadow: none !important;
  outline: none;
}

.draw-save-btn:disabled {
  cursor: default;
  opacity: 0.55;
  background: transparent !important;
}

.draw-stage-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #0e0f11;
  overflow: auto;
}

.draw-zoom-overlay {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border-radius: 28px;
  background: rgba(26, 27, 31, 0.92);
  border: 1px solid rgba(45, 46, 51, 0.9);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

.draw-zoom-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  opacity: 0.82;
  transition: background 0.16s ease, opacity 0.16s ease;
}

.draw-zoom-btn:hover,
.draw-zoom-btn:focus-visible,
.draw-zoom-btn.active {
  opacity: 1;
  background: #2a2b31;
  outline: none;
}

.draw-zoom-btn:disabled {
  cursor: default;
  opacity: 0.34;
}

.draw-zoom-divider {
  width: 24px;
  height: 1px;
  margin: 2px 0;
  background: #33353b;
}

.draw-zoom-btn img {
  width: 23px;
  height: 23px;
  object-fit: contain;
  filter: brightness(1.7);
}

.draw-shape-tool,
.draw-edit-tool {
  width: 34px;
  height: 34px;
}

.draw-shape-tool-main,
.draw-edit-tool-main {
  padding: 0;
}

.draw-shape-tool-main .shape-tool-flyout-cue,
.draw-edit-tool-main .shape-tool-flyout-cue {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 9px;
  height: 9px;
  filter: brightness(1.45);
  pointer-events: none;
}

.draw-shape-tool-flyout {
  top: 50%;
  left: calc(100% + 8px);
  z-index: 25;
  gap: 4px;
  padding: 5px;
  border-radius: 24px;
}

.draw-shape-tool:not(.open):focus-within .draw-shape-tool-flyout {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scaleX(0.92);
}

.draw-shape-tool-flyout .shape-tool-option {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--color-text);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.draw-shape-tool-flyout .shape-tool-option:hover,
.draw-shape-tool-flyout .shape-tool-option.active {
  background: #2a2b31;
}

.draw-shape-tool-flyout .shape-tool-option img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: brightness(1.7);
}

.draw-edit-tool-flyout {
  left: calc(100% + 8px);
}

.draw-edit-tool:not(.open):focus-within .draw-edit-tool-flyout {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scaleX(0.92);
}

#drawTextureCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  background: #111;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
  touch-action: none;
}

.draw-modal.is-panning #drawTextureCanvas {
  cursor: grab;
}

.draw-modal.is-pan-dragging #drawTextureCanvas {
  cursor: grabbing;
}

.draw-stage-loader {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(14, 15, 17, 0.68);
  backdrop-filter: blur(2px);
  color: #ffffff;
  font-size: 0.95rem;
  text-align: center;
}

.draw-text-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 1 auto;
}

.draw-text-controls[hidden],
.draw-text-divider[hidden],
.draw-text-editor[hidden] { display: none !important; }
.draw-text-controls select,
.draw-text-controls input[type="number"] {
  height: 30px;
  min-width: 0;
  color: var(--color-text);
  background: #202126;
  border: 1px solid #393a40;
  border-radius: 6px;
  padding: 0 7px;
  box-sizing: border-box;
}
.draw-text-controls select { width: 132px; }
.draw-text-controls input[type="number"] { width: 58px; }
.draw-text-style-btn {
  width: 30px;
  height: 30px;
  color: var(--color-text);
  background: #202126;
  border: 1px solid #393a40;
  border-radius: 6px;
  cursor: pointer;
}
.draw-text-style-btn[hidden] { display: none !important; }
#drawTextBold,
#drawTextBold strong { font-weight: 700 !important; }
#drawTextItalic,
#drawTextItalic em { font-style: italic !important; }
.draw-text-style-btn.active { background: #41434b; border-color: #1473e6; }
.draw-text-outline { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 12px; }
.draw-text-editor {
  position: absolute;
  z-index: 15;
  min-width: 160px;
  min-height: 42px;
  padding: 2px 4px;
  color: #fff;
  background: rgba(20, 22, 27, 0.82);
  border: 1px solid #1473e6;
  border-radius: 3px;
  outline: 0;
  resize: both;
  white-space: pre;
  overflow: auto;
  transform-origin: left bottom;
  box-sizing: border-box;
}

.draw-stage-loader[hidden] {
  display: none !important;
}

.draw-loader-spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: #1473e6;
  animation: draw-loader-spin 0.8s linear infinite;
}

@keyframes draw-loader-spin {
  to {
    transform: rotate(360deg);
  }
}

.draw-modal.is-busy .draw-tool-btn,
.draw-modal.is-busy .draw-close-btn,
.draw-modal.is-busy .draw-save-btn,
.draw-modal.is-busy .draw-zoom-btn,
.draw-modal.is-busy .draw-size-control,
.draw-modal.is-busy .draw-check-control {
  pointer-events: none;
}

.draw-modal.is-busy #drawTextureCanvas {
  pointer-events: none;
}

.draw-modal.is-busy #drawClearBtn {
  pointer-events: auto;
}

.draw-status {
  min-height: 34px;
  padding: 8px 16px;
  color: var(--color-text);
  font-size: 0.8rem;
  opacity: 0.72;
  background: #15161a;
  border-top: 1px solid #2b2c31;
  box-sizing: border-box;
}

.draw-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 7000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
  box-sizing: border-box;
}

.draw-confirm-box {
  width: min(360px, 92vw);
  padding: 18px;
  border-radius: 8px;
  background: var(--color-panel);
  border: 1px solid #2d2e33;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  color: #ffffff;
  box-sizing: border-box;
}

.draw-confirm-box p {
  margin: 0 0 16px;
  color: var(--color-text);
  font-size: 0.92rem;
  line-height: 1.4;
}

.draw-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.draw-confirm-actions .btn-flat,
.draw-confirm-actions .btn-round {
  min-height: 38px;
  padding: 0 18px !important;
}

.pcr-app {
  z-index: 6000 !important;
}

@media (max-width: 1400px) {
  .draw-modal {
    padding: 8px;
  }

  .draw-modal-shell {
    width: 100vw;
    height: 100vh;
  }

  .draw-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .draw-toolbar-left,
  .draw-toolbar-right {
    width: 100%;
    flex-wrap: wrap;
  }

  .draw-toolbar-right {
    margin-left: 0;
  }
}
