:root {
  --bar-bg: #e8c547; /* eskiz sarısı: #f2e01a da olabilir. */
  --btn-face: #f5f7fa;
  --ink: #000;
}

html,
body {
  overflow: clip;
}

body {
  margin: 0;
  padding: 0;
  background-color: #f0f0f0;
}

#container.marquee-active,
#container.marquee-active * {
  cursor: crosshair !important;
}

#topbar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bar-bg);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  user-select: none;

  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  transition:
    transform 0.18s ease,
    opacity 0.18s ease,
    visibility 0s;
}

#topbar.topbar-closed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(-16px);
  transition:
    transform 0.18s ease,
    opacity 0.18s ease,
    visibility 0s linear 0.18s;
}

.tb-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--btn-face);
  border: 2px solid var(--ink);
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 0.06s ease,
    background 0.12s ease;
}
.tb-btn:hover:not(:disabled) {
  background: #fff;
  transform: translateY(-1px);
}
.tb-btn:active:not(:disabled) {
  transform: scale(0.96);
}
.tb-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.tb-btn:focus-visible {
  outline: 3px solid #242424;
  outline-offset: 2px;
}
.tb-sep {
  width: 2px;
  height: 30px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 1px;
}

.tb-wrap {
  position: relative;
}
#deco-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0; /* buton sağ uçta, menü sağa hizalı açilsin */
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
  padding: 8px;
  background: var(--bar-bg, #e8c547);
  border: 2px solid #000;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}
#deco-menu[hidden] {
  display: none;
} /* önemli: display:flex [hidden]'ı ezer */
.deco-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--btn-face, #f5f7fa);
  border: 2px solid #000;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
}
.deco-item:hover {
  background: #fff;
}

.deco-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.deco-item:hover:not(:disabled) {
  background: #fff;
}

#project-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0; /* buton solda → menü sağa doğru büyüsün (deco'nun tersi) */
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 250px;
  max-height: 340px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bar-bg, #e8c547);
  border: 2px solid #000;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  scrollbar-width: thin;
  scrollbar-color: #000 transparent;
}
#project-menu[hidden] {
  display: none;
} /* display:flex [hidden]'ı ezer — sigorta */
.pm-new {
  padding: 8px 10px;
  border: 2px solid #000;
  border-radius: 8px;
  background: var(--btn-face, #f5f7fa);
  font-weight: 700;
  cursor: pointer;
}
.pm-new:hover {
  background: #fff;
}
.pm-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 2px solid transparent;
  border-radius: 8px;
}
.pm-row.pm-active {
  border-color: #000;
  background: rgba(255, 255, 255, 0.55);
}
.pm-open {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  border: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pm-open:hover {
  text-decoration: underline;
}
.pm-act {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 2px solid #000;
  border-radius: 8px;
  background: var(--btn-face, #f5f7fa);
  cursor: pointer;
}
.pm-act:hover:not(:disabled) {
  background: #fff;
}
.pm-act:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pm-empty {
  padding: 8px 10px;
  font-size: 13px;
  opacity: 0.8;
}

.pm-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 5px 8px;
  border: 2px solid #000;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  outline: none;
}
.pm-input:focus {
  box-shadow: 0 0 0 3px rgba(232, 197, 71, 0.6);
}

#inspector {
  position: fixed;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  box-sizing: border-box;
  width: 270px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--panel-bg, #9fd3e2);
  border: 3px solid #000;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  z-index: 15;
  user-select: none;
  scrollbar-width: thin;
  scrollbar-color: #000 transparent;

  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
  transition:
    transform 0.18s ease,
    opacity 0.18s ease,
    visibility 0s;
}

#inspector.insp-closed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%) translateX(-16px);
  transition:
    transform 0.18s ease,
    opacity 0.18s ease,
    visibility 0s linear 0.18s;
}

#inspector::-webkit-scrollbar {
  width: 8px;
}
#inspector::-webkit-scrollbar-track {
  background: transparent;
}
#inspector::-webkit-scrollbar-thumb {
  background: #000;
  border-radius: 4px;
}
#inspector[hidden] {
  display: none;
} /* display:flex [hidden]'ı ezer — sigorta */
.insp-title {
  font-weight: 700;
  font-size: 14px;
  padding-bottom: 6px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.35);
}
.insp-placeholder {
  background: var(--btn-face, #f5f7fa);
  border: 2px solid #000;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  opacity: 0.75;
}

.insp-section,
.insp-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.insp-dd {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 2px solid #000;
  border-radius: 8px;
  background: var(--btn-face, #f5f7fa);
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.insp-dd:hover {
  background: #fff;
}
.dd-caret {
  margin-left: auto;
  opacity: 0.6;
}
.dd-popup {
  position: fixed;
  z-index: 60;
  min-width: 180px;
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: var(--panel-bg, #9fd3e2);
  border: 2px solid #000;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transition:
    opacity 0.14s ease,
    transform 0.14s ease; /* açılış VE kapanış */
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: #000 transparent;
}
/* Chrome, Edge, Safari */
.dd-popup::-webkit-scrollbar {
  width: 8px;
}
.dd-popup::-webkit-scrollbar-track {
  background: transparent;
}
.dd-popup::-webkit-scrollbar-thumb {
  background: #000;
  border-radius: 4px;
}
.dd-popup::-webkit-scrollbar-thumb:hover {
  background: #333;
}
.dd-popup.dd-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.dd-item:hover {
  background: rgba(255, 255, 255, 0.7);
}
.dd-item-active,
.dd-item-active:hover {
  border-color: #000;
  background: #e8c547;
}
.dd-icon {
  font-size: 15px;
  line-height: 1;
}
.dd-swatch {
  width: 14px;
  height: 14px;
  border: 2px solid #000;
  border-radius: 4px;
  flex: 0 0 auto;
}
.dd-label {
  flex: 1 1 auto;
}

.insp-btn {
  text-align: center;
  font-weight: 700;
  border: 2px solid #000;
  border-radius: 8px;
  background: var(--btn-face, #f5f7fa);
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.insp-btn:hover {
  background: #fff;
}
.insp-btn-danger {
  background: #e25c6e;
  color: #fff;
}
.insp-btn-danger:hover {
  background: #c2445a;
}

.insp-row-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.insp-btn-active,
.insp-btn-active:hover {
  background: #e8c547;
}

#limit-warning {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #e25c6e;
  color: #fff;
  border: 2px solid #000;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  z-index: 40;
  pointer-events: none;
}

.insp-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.insp-btn-bold {
  font-weight: 800;
}
.insp-btn-underline {
  text-decoration: underline;
}
.insp-color {
  width: 100%;
  height: 34px;
  padding: 2px;
  border: 2px solid #000;
  border-radius: 8px;
  background: var(--btn-face, #f5f7fa);
  cursor: pointer;
}

.insp-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.insp-btn-italic {
  font-style: italic;
}
.insp-btn-highlight {
  background: #fdf3c0;
}
.insp-btn-highlight:hover {
  background: #fff8dc;
}
.insp-row-3 > .insp-btn,
.insp-row-3 > input[type="color"] {
  width: 100%;
  box-sizing: border-box;
}
.insp-row-3 > input[type="color"] {
  width: 100%;
  height: 100%;
  min-height: 34px;
  padding: 4px;
  box-sizing: border-box;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200; /* her şeyin üstü: topbar 20, dd-popup 60, context 1000 */
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.modal-overlay.modal-open {
  opacity: 1;
}
.modal-box {
  width: min(340px, calc(100vw - 32px));
  background: var(--bar-bg, #e8c547);
  border: 3px solid #000;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(10px) scale(0.97);
  transition: transform 0.15s ease;
}
.modal-overlay.modal-open .modal-box {
  transform: translateY(0) scale(1);
}
.modal-title {
  font-weight: 800;
  font-size: 15px;
}
.modal-input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 2px solid #000;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  background: var(--btn-face, #f5f7fa);
  outline: none;
}
.modal-input:focus {
  box-shadow: 0 0 0 3px rgba(232, 197, 71, 0.6);
}
.modal-error {
  font-size: 12px;
  font-weight: 700;
  color: #a1122b;
}
.modal-message {
  font-size: 14px;
  line-height: 1.4;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal-btn {
  padding: 8px 12px;
  border: 2px solid #000;
  border-radius: 8px;
  background: var(--btn-face, #f5f7fa);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.modal-btn:hover {
  background: #fff;
}
.modal-btn-ok {
  background: #e8c547;
}
.modal-btn-ok:hover {
  background: #f2d76b;
}
.modal-btn-danger {
  background: #e25c6e;
  color: #fff;
}
.modal-btn-danger:hover {
  background: #c2445a;
}

.modal-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 2px solid #000;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  background: var(--btn-face, #f5f7fa);
  outline: none;
  resize: none;
  min-height: 96px;
}
.modal-textarea:focus {
  box-shadow: 0 0 0 3px rgba(232, 197, 71, 0.6);
}
.modal-label {
  font-size: 12px;
  font-weight: 700;
}
.modal-note {
  font-size: 11px;
  line-height: 1.4;
  opacity: 0.7;
}
