/* Grid Pixel Editor - Profesyonel tasarım yazılımı tarzı */

:root {
  --bg-dark: #1e1e1e;
  --bg-panel: #252526;
  --bg-toolbar: #2d2d30;
  --border: #3c3c3c;
  --text: #cccccc;
  --text-dim: #858585;
  --accent: #007acc;
  --accent-hover: #1a8ad4;
  --tool-active: #094771;
  --canvas-bg: #3c3c3c;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-dark);
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  position: fixed;
  inset: 0;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: fixed;
  inset: 0;
}

/* Üst menü — sol/sağ çekmece tetikleyicileri */
.top-bar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  min-height: 36px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 120;
  flex-shrink: 0;
}

.top-bar-brand {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--text);
  pointer-events: none;
  user-select: none;
}

.top-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 36px;
  margin: 0 2px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.top-nav-btn:hover {
  background: var(--bg-toolbar);
}

.top-nav-icon {
  display: block;
  opacity: 0.92;
}

.top-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1400;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
}

.top-drawer-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.top-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  width: min(100vw - 40px, 320px);
  max-width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  z-index: 1410;
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s ease;
}

.top-drawer--left {
  left: 0;
  transform: translateX(-100%);
}

.top-drawer--left.is-open {
  transform: translateX(0);
}

.top-drawer--right {
  right: 0;
  left: auto;
  transform: translateX(100%);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
}

.top-drawer--right.is-open {
  transform: translateX(0);
}

.top-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.top-drawer-title {
  font-weight: 600;
  font-size: 16px;
}

.top-drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-drawer-close:hover {
  background: var(--bg-toolbar);
}

.top-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 16px;
  -webkit-overflow-scrolling: touch;
}

.menu-bar--drawer {
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 2px;
  width: 100%;
}

.menu-bar--drawer .menu-dropdown {
  width: 100%;
}

.menu-bar--drawer .menu-item-trigger {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
}

.menu-bar--drawer .menu-dropdown-panel {
  position: static;
  display: none;
  margin-top: 4px;
  margin-left: 2px;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  max-height: min(50vh, 360px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.menu-bar--drawer .menu-dropdown.open .menu-dropdown-panel {
  display: block;
}

.menu-bar--drawer .menu-item {
  display: flex;
  width: 100%;
  box-sizing: border-box;
}

.menu-bar--drawer-right {
  gap: 6px;
}

.menu-bar--drawer-right .menu-item {
  width: 100%;
}

body.top-drawer-open {
  overflow: hidden;
}

/* Masaüstü: klasik yatay menü (mobil çekmece HTML'i aynı; geniş ekranda şerit gibi) */
@media (min-width: 901px) {
  .top-nav-btn,
  .top-bar-brand {
    display: none !important;
  }

  .top-drawer-backdrop {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .top-drawer {
    position: static !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
    z-index: auto !important;
    display: contents !important;
    transition: none !important;
  }

  .top-drawer--left.is-open,
  .top-drawer--right.is-open {
    transform: none !important;
  }

  .top-drawer-header {
    display: none !important;
  }

  .top-drawer--left .top-drawer-body.menu-bar--drawer {
    display: contents !important;
  }

  .top-drawer--right .top-drawer-body.menu-bar--drawer-right {
    display: flex !important;
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    padding: 0 12px 0 4px !important;
    overflow: visible !important;
    width: auto !important;
    min-height: 0 !important;
  }

  .top-drawer--left .menu-bar--drawer .menu-dropdown {
    width: auto !important;
  }

  .menu-bar--drawer .menu-dropdown {
    position: relative;
    z-index: 1;
  }

  .menu-bar--drawer .menu-dropdown.open {
    z-index: 15001;
  }

  .menu-bar--drawer .menu-item-trigger {
    display: inline-flex !important;
    width: auto !important;
  }

  .menu-bar--drawer .menu-dropdown-panel {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: auto !important;
    margin-top: 2px !important;
    margin-left: 0 !important;
    min-width: 160px !important;
    max-height: min(72vh, 420px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45) !important;
    border: 1px solid var(--border) !important;
    background: var(--bg-panel) !important;
    z-index: 15000 !important;
  }

  .menu-bar--drawer .menu-dropdown.open .menu-dropdown-panel {
    display: block !important;
  }

  .menu-bar--drawer .menu-item {
    display: inline-flex !important;
    width: auto !important;
    flex-shrink: 0;
  }

  .menu-bar--drawer-right .menu-item {
    width: auto !important;
  }

  /* overflow: auto kırpar; açılır menüler tuvalin altında kalır. Taşma için satır kaydırma. */
  .top-bar {
    flex-wrap: wrap !important;
    overflow: visible !important;
    align-items: center !important;
    align-content: center !important;
    gap: 4px !important;
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: 2px;
    z-index: 5000 !important;
    position: relative;
    isolation: isolate;
  }
}

.menu-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  flex: 1;
  width: 100%;
}

.menu-item {
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.menu-item:hover {
  background: var(--bg-toolbar);
}

.menu-icon {
  flex-shrink: 0;
  opacity: 0.9;
}

.menu-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-dropdown-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.menu-item-right {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.menu-item--donate:hover {
  background: linear-gradient(135deg, rgba(190, 24, 93, 0.12), rgba(225, 29, 72, 0.1));
  color: #be185d;
}

.menu-item--donate .menu-icon {
  opacity: 1;
  color: #e11d48;
}

/* Hakkında modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: rgb(0 0 0 / 7%);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 440px;
  width: 100%;
  position: relative;
  padding: 24px;
  border: 1px solid #787878;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-toolbar);
  color: var(--text);
}

.modal-title {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.modal-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.modal-box--video-tutorials {
  max-width: min(92vw, 720px);
}

.modal-body--video-tutorials {
  max-height: min(78vh, 880px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

.video-tutorial-frame-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #0a0a0a;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.video-tutorial-frame-wrap:last-child {
  margin-bottom: 0;
}

.video-tutorial-frame-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.modal-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-body .opt-label {
  display: block;
  margin-bottom: 12px;
}

.modal-body .opt-label-txt {
  display: inline-block;
  min-width: 120px;
}

.modal-hint {
  margin-bottom: 16px;
  color: var(--text-muted, #666);
  font-size: 13px;
}

.modal-body p {
  margin: 0 0 12px 0;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

.donation-modal {
  max-width: 480px;
  border-color: rgba(244, 63, 94, 0.4);
  background: linear-gradient(165deg, var(--bg-panel) 0%, rgba(136, 19, 55, 0.22) 100%);
}

.donation-modal__title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fb7185;
}

.donation-modal__body {
  font-size: 14px;
}

.donation-modal__lead {
  margin: 0 0 14px 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
}

.donation-modal__quote {
  margin: 0 0 16px 0;
  padding: 14px 16px;
  border-left: 4px solid #f43f5e;
  background: rgba(244, 63, 94, 0.08);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text);
  line-height: 1.65;
}

.donation-modal__quote strong {
  font-style: normal;
  color: #fda4af;
}

.donation-modal__note {
  margin: 0 0 12px 0;
  font-size: 13px;
  
}

.donation-modal__contacts {
  padding: 14px 16px;
  border-radius: 8px;
  background: rgb(255 255 255 / 38%);
  border: 1px solid var(--border);
}

.donation-modal__contact {
  margin: 0 0 8px 0;
  font-size: 14px;
}

.donation-modal__contact:last-of-type {
  margin-bottom: 0;
}

.donation-modal__contact a {
  color: #54484c;
  text-decoration: none;
  font-weight: 500;
}

.donation-modal__contact strong {
  color: #2D2226;
}

.donation-modal__contact a:hover {
  text-decoration: underline;
}

.donation-modal__bank {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(30, 32, 36, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.donation-modal__bank-line {
  margin: 0 0 8px 0;
  font-size: 14px;
  line-height: 1.55;
  color: #1e2228;
}

.donation-modal__bank-line:last-child {
  margin-bottom: 0;
}

.donation-modal__bank-line strong {
  color: #12151a;
  font-weight: 600;
}
.text-white {
  color: #fff;
}
.donation-modal__iban {
  display: inline-block;
  margin-top: 2px;
  font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #12151a;
  user-select: all;
  word-break: break-all;
}

.donation-modal__sign {
  margin: 16px 0 0 0 !important;
  font-size: 13px;
  text-align: center;
}

.menu-dropdown {
  position: relative;
}

.menu-dropdown .menu-item-trigger {
  display: inline-block;
}

.menu-dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 160px;
  margin-top: 2px;
  padding: 4px 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
}

.menu-dropdown.open .menu-dropdown-panel {
  display: block;
}

.menu-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  text-align: left;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.menu-dropdown-item:hover {
  background: var(--bg-toolbar);
}

/* Seçenekler / Araç çubuğu - menü altı */
.options-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 8px 12px;
  background: var(--bg-toolbar);
  border-bottom: 1px solid var(--border);
  min-height: 40px;
}

.options-bar-tools {
  display: flex;
  gap: 2px;
}

.opt-tool-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.opt-tool-btn:hover {
  background: var(--border);
  color: #fff;
}

.opt-tool-btn.active {
  background: var(--accent);
  color: #fff;
}

.options-bar-colors,
.options-bar-grid,
.options-bar-selection-tools {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.options-bar-paint-tools.hidden,
.options-bar-selection-tools.hidden {
  display: none !important;
}

.opt-selection-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.opt-selection-mode-btn,
.opt-selection-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-toolbar);
  color: var(--text);
  cursor: pointer;
}

.opt-selection-mode-btn:hover,
.opt-selection-action-btn:hover {
  background: var(--border);
  color: #fff;
}

.opt-selection-mode-btn--active {
  border-color: #60a5fa;
  background: rgba(96, 165, 250, 0.12);
  color: #93c5fd;
}

.opt-selection-mode-btn svg,
.opt-selection-action-btn svg {
  flex-shrink: 0;
  opacity: 0.92;
}

.opt-selection-scope-label {
  gap: 8px;
  align-items: center;
}

.opt-select-modern {
  min-width: 200px;
  max-width: min(280px, 42vw);
  padding: 6px 30px 6px 10px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
  background-color: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2394a3b8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.opt-select-modern:hover {
  border-color: #60a5fa;
}

.opt-select-modern:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.22);
}

.opt-grid-unit-select {
  min-width: 4.5rem;
  width: auto;
  max-width: 96px;
  cursor: pointer;
}

.opt-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
}

.opt-label-txt {
  white-space: nowrap;
}

.opt-swatch {
  display: inline-block;
  width: 24px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 3px;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--border);
}

.opt-swatch:hover {
  opacity: 0.9;
}

.opt-swatch-clickable {
  cursor: pointer;
}

.opt-swatch.no-color {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 6px 6px;
  background-position: 0 0, 3px 0, 3px -3px, 0 3px;
}

.opt-no-color-btn {
  padding: 2px 6px;
  font-size: 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-panel);
  color: var(--text-dim);
  cursor: pointer;
  margin-left: 2px;
}

.opt-no-color-btn:hover {
  background: var(--border);
  color: var(--text);
}

.opt-opacity-range {
  width: 60px;
  height: 6px;
  accent-color: var(--accent);
}

.opt-opacity-value {
  font-size: 11px;
  color: var(--text-dim);
  min-width: 28px;
}

.opt-label-opacity {
  gap: 4px;
}

.opt-color-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.opt-label:has(.opt-swatch-clickable) {
  position: relative;
}

.opt-input {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: #000;
  font-size: 12px;
}

.opt-input:focus {
  outline: none;
  border-color: var(--accent);
}

.opt-select {
  min-width: 200px;
  width: auto;
  cursor: pointer;
}

.opt-input-text {
  width: 180px;
  min-width: 120px;
}

.save-options-fieldset {
  margin: 16px 0 0 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.save-options-fieldset legend {
  padding: 0 8px;
  font-weight: 600;
  color: var(--text);
}

.opt-radio-label {
  display: block;
  margin: 8px 0 0 0;
  font-size: 13px;
  cursor: pointer;
}

.opt-radio-label input {
  margin-right: 8px;
}

.opt-thickness {
  width: 44px;
}

.opt-grid-info {
  color: var(--text-dim);
  margin-right: 4px;
}

.opt-btn-primary {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
}

.opt-btn-primary:hover {
  background: var(--accent-hover);
}

.opt-btn-secondary {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-panel);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
}

.opt-btn-secondary:hover {
  background: var(--border);
}

.opt-btn-secondary.opt-toggle-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.opt-btn-secondary.opt-toggle-btn.active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.opt-btn-danger {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  background: #c62828;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.opt-btn-danger:hover {
  background: #b71c1c;
}

.opt-btn-icon {
  flex-shrink: 0;
}

.options-bar .opt-btn-primary .opt-btn-icon,
.options-bar .opt-btn-secondary .opt-btn-icon {
  flex-shrink: 0;
}

.options-bar .hidden {
  display: none !important;
}

.options-bar-default,
.options-bar-image,
.options-bar-copy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  width: 100%;
}

.bottom-bar-used-colors {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  overflow: visible;
}

.used-colors-label {
  font-size: 12px;
  color: var(--text-muted, #666);
  white-space: nowrap;
}

.used-colors-list {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 2px 0;
  overflow: visible;
}

.used-color-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: visible;
  cursor: pointer;
}

.used-color-symbol {
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  margin-bottom: 2px;
  min-width: 14px;
  text-align: center;
}

.used-color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.2);
  cursor: pointer;
  flex-shrink: 0;
}

.used-color-item .used-color-tooltip {
  visibility: hidden;
  position: absolute;
  z-index: 10000;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  pointer-events: none;
}

.used-color-item:hover .used-color-tooltip {
  visibility: visible;
}

.options-bar-image .opt-label-txt {
  font-weight: 600;
  margin-right: 4px;
}

.opt-link-btn {
  width: 32px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-panel);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.opt-link-btn:hover {
  background: var(--border);
  color: #fff;
}

.opt-link-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Ana alan: sol + merkez + sağ */
.main-area {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sol panel - Araçlar */
.left-panel {
  width: 56px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
}

.panel-title {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding: 0 8px;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tool-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-btn:hover {
  background: var(--bg-toolbar);
  color: #fff;
}

.tool-btn.active {
  background: var(--tool-active);
  color: #fff;
}

.selection-mode-flyout {
  position: fixed;
  z-index: 1100;
  min-width: 208px;
  padding: 4px 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.selection-mode-flyout.hidden {
  display: none !important;
}

.selection-mode-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  text-align: left;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.selection-mode-item:hover {
  background: var(--bg-toolbar);
}

.selection-mode-item--active {
  color: #93c5fd;
  font-weight: 600;
}

/* Merkez - Canvas */
.center-area {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--canvas-bg);
  padding: 16px;
}

.canvas-container {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  position: relative;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: #ffffff;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.canvas-container canvas {
  cursor: crosshair;
}

.canvas-container[data-tool="pan"] canvas {
  cursor: grab;
}

.canvas-container[data-tool="pan"].panning canvas {
  cursor: grabbing;
}

.canvas-container.umay-drag-over {
  outline: 2px dashed var(--accent, #2563eb);
  outline-offset: -2px;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.35);
}

.umay-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.52);
  color: #fff;
  text-align: center;
  padding: 16px;
  pointer-events: auto;
}

.umay-drop-overlay.hidden {
  display: none !important;
}

.umay-drop-text {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  max-width: 90%;
}

.umay-drop-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: umay-spin 0.75s linear infinite;
}

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

/* Sağ panel - Renk paleti */
.right-panel {
  width: 200px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  padding: 12px;
  overflow-y: auto;
}

.right-panel-expand {
  min-height: 0;
}

.right-panel-handle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  margin: 0;
  border: none;
  border-top: 1px solid var(--border);
  background: var(--bg-toolbar);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 0;
  font-family: inherit;
}

.right-panel-handle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.right-panel-handle-chevron {
  flex-shrink: 0;
  opacity: 0.85;
  transition: transform 0.28s ease;
}

@media (min-width: 901px) {
  .right-panel--collapsible .right-panel-expand {
    max-height: none !important;
    opacity: 1 !important;
    overflow: visible !important;
    pointer-events: auto !important;
  }

}

.panel-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.panel-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim, #aaa);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.panel-tab.panel-tab--active {
  background: rgba(0, 102, 255, 0.18);
  border-color: rgba(0, 102, 255, 0.45);
  color: #93c5fd;
}

.right-tab-section.hidden {
  display: none !important;
}

.right-panel .panel-title {
  margin-bottom: 10px;
}

.panel-title-below {
  margin-top: 16px;
}

.ground-color-wrap {
  position: relative;
  margin-bottom: 4px;
}

.ground-color-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim, #aaa);
  cursor: pointer;
  font-size: 13px;
}

.ground-color-trigger:hover {
  border-color: rgba(0, 102, 255, 0.35);
  background: rgba(0, 102, 255, 0.08);
}

.ground-color-preview {
  flex: 1;
  min-height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  background: #ffffff;
}

.ground-color-hint {
  font-size: 12px;
  white-space: nowrap;
  opacity: 0.85;
}

.ground-palette-popover {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-toolbar);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.ground-palette-popover.hidden {
  display: none !important;
}

.ground-picker-heading {
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(147, 197, 253, 0.75);
  margin: 0 0 8px 0;
  font-weight: 600;
}

.ground-color-picker-wrap {
  margin-bottom: 0;
}

.ground-palette-popover .color-picker-sv-wrap,
.ground-palette-popover .color-picker-hue-wrap {
  border-radius: 8px;
  max-width: none;
}

.symbols-hint {
  margin: 0 0 12px 0;
  font-size: 13px;
  color: var(--text-dim, #aaa);
  line-height: 1.5;
}

.symbols-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.symbols-empty {
  grid-column: 1 / -1;
  color: var(--text-dim, #aaa);
  font-size: 13px;
  padding: 10px 6px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  text-align: center;
}

.symbol-thumb {
  padding: 10px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.symbol-thumb:active {
  cursor: grabbing;
}

.symbol-thumb img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.symbol-thumb-label {
  font-size: 12px;
  color: var(--text-dim, #aaa);
  width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Renk seçici - sürekli görünür */
.color-picker-wrap {
  margin-bottom: 4px;
}

.color-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-picker-sv-wrap,
.color-picker-hue-wrap {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: crosshair;
}

.color-picker-sv-wrap {
  width: 100%;
  max-width: 180px;
}

.color-picker-sv {
  display: block;
  width: 100%;
  height: auto;
  max-height: 120px;
  vertical-align: top;
}

.color-picker-hue-wrap {
  width: 100%;
  max-width: 180px;
  cursor: pointer;
}

.color-picker-hue {
  display: block;
  width: 100%;
  height: 12px;
  vertical-align: top;
}

.sv-marker,
.hue-marker {
  position: absolute;
  pointer-events: none;
  box-sizing: border-box;
}

.sv-marker {
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
  left: 0;
  top: 0;
}

.hue-marker {
  width: 10px;
  height: 100%;
  margin-left: -5px;
  border: 2px solid #fff;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
  left: 0;
  top: 0;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-picker-preview {
  width: 36px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.color-picker-eyedropper {
  width: 36px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-toolbar);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-picker-eyedropper:hover {
  background: var(--border);
  color: #fff;
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.palette-swatch {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s, box-shadow 0.1s;
}

.palette-swatch:hover {
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.palette-swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

/* Renk kodu alanları - hex ve RGB */
.color-codes {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-code-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
}

.color-code-label {
  width: 14px;
  flex-shrink: 0;
  color: var(--text-dim);
}

.color-code-input {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-toolbar);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
}

.color-code-input:focus {
  outline: none;
  border-color: var(--accent);
}

.color-code-hex {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.color-code-rgb {
  max-width: 64px;
}

/* Alt bar - Zoom */
.bottom-bar {
  min-height: 24px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  overflow: visible;
}

.zoom-indicator {
  font-size: 12px;
  color: var(--text-dim);
}

.bottom-bar-stats {
  margin-left: 16px;
  font-size: 12px;
  color: var(--text-dim);
}

.page-switcher {
  margin: 0 auto;
  display: flex;
  gap: 4px;
}

.page-btn {
  min-width: 24px;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-dim);
  cursor: pointer;
}

.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.page-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  padding: 4px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-dim);
  cursor: pointer;
}
.page-add-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.bottom-bar .used-colors-label {
  font-size: 12px;
  color: var(--text-dim);
}

/* Dropdown menüler (Dosya/Düzenle/Görünüm/İçe Aktar) - basit kullanım için gizli input */
input[type="file"] {
  display: none;
}

/* =============================================================================
   Mobil / tablet — uygulama benzeri kabuk (≤900px). Masaüstü (geniş ekran) değişmez.
   ============================================================================= */
@media (max-width: 900px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  .app {
    position: fixed;
    width: 100%;
    height: 100%;
    height: 100dvh;
    min-height: -webkit-fill-available;
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .top-bar {
    flex-shrink: 0;
    min-height: 44px;
  }

  .top-nav-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .menu-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 4px 8px;
    gap: 2px;
  }

  .menu-bar::-webkit-scrollbar {
    height: 3px;
  }

  .menu-item {
    padding: 8px 8px;
    font-size: 12px;
    flex-shrink: 0;
    min-height: 44px;
    box-sizing: border-box;
  }

  .menu-item .menu-icon {
    width: 20px;
    height: 20px;
  }

  .menu-dropdown-panel {
    max-height: min(72vh, 420px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-width: min(96vw, 320px);
  }

  .options-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding: 6px 10px;
    min-height: 44px;
    align-items: flex-start;
    scrollbar-width: thin;
  }

  .options-bar-default {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 10px;
    min-width: min-content;
  }

  .options-bar-colors,
  .options-bar-grid,
  .options-bar-selection-tools {
    flex-wrap: nowrap;
    flex-shrink: 0;
  }

  .opt-grid-info {
    display: none;
  }

  .opt-select-modern {
    min-width: 160px;
    max-width: 70vw;
    font-size: 11px;
  }

  .opt-selection-toolbar {
    flex-wrap: nowrap;
  }

  .opt-selection-mode-btn span,
  .opt-selection-action-btn span {
    display: none;
  }

  .opt-selection-mode-btn,
  .opt-selection-action-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    justify-content: center;
  }

  .opt-selection-scope-label .opt-label-txt {
    display: none;
  }

  .main-area {
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  .center-area {
    order: 1;
    flex: 1;
    min-height: 0;
    padding: 8px;
    align-items: stretch;
    justify-content: center;
  }

  .canvas-container {
    border-radius: 8px;
    max-height: 100%;
  }

  .right-panel {
    order: 2;
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 0;
    overflow: visible;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
  }

  .right-panel.right-panel--collapsible {
    max-height: none;
  }

  .right-panel-expand {
    order: 1;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease;
    padding: 8px 10px;
    flex: 1 1 auto;
    min-height: 0;
  }

  .right-panel.right-panel--collapsible.right-panel--collapsed .right-panel-expand {
    max-height: 0 !important;
    opacity: 0;
    pointer-events: none;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
  }

  .right-panel.right-panel--collapsible:not(.right-panel--collapsed) .right-panel-expand {
    max-height: min(42vh, 300px);
    opacity: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .right-panel-handle {
    display: flex;
    order: 2;
  }

  .right-panel--collapsible:not(.right-panel--collapsed) .right-panel-handle-chevron {
    transform: rotate(180deg);
  }

  .left-panel {
    order: 3;
    width: 100%;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    padding: 6px 8px;
    gap: 4px;
    border-right: none;
    border-top: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
    background: var(--bg-panel);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
  }

  .left-panel .panel-title {
    display: none;
  }

  .toolbar {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .tool-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    border-radius: 10px;
  }

  .tool-btn svg {
    width: 22px;
    height: 22px;
  }

  .bottom-bar {
    flex-wrap: wrap;
    row-gap: 4px;
    padding: 6px 10px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0));
    min-height: 40px;
    flex-shrink: 0;
  }

  .bottom-bar-stats {
    margin-left: 8px;
    font-size: 11px;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .active-tool-indicator {
    font-size: 11px;
    max-width: 38vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bottom-bar-used-colors {
    width: 100%;
    order: 10;
    margin-top: 4px;
  }

  .selection-mode-flyout {
    max-width: min(92vw, 260px);
  }

  body.app-shell {
    touch-action: manipulation;
  }

  .modal-overlay {
    padding: 0 12px;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .modal-box {
    width: 100%;
    max-width: 100%;
    max-height: min(90vh, 720px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px 14px 0 0;
    margin-bottom: 0;
  }
}
