* {
  box-sizing: border-box;
}
:root {
  --page-bg: #f3f4f6;
  --toolbar-bg: #111827;
  --toolbar-text: #e5e7eb;
  --grid-bg: #f9fafb;
  --grid-line: #e5e7eb;
  --block-bg: #ffffff;
  --block-border: #d1d5db;
  --block-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  --text-color: #111827;
  --muted-text-color: #6b7280;
  --primary: #2563eb;
  --primary-soft: rgba(37, 99, 235, 0.35);
  --error: #b91c1c;
  --guide-color: #60a5fa;
  --overlap-color: #f97316;
  --selection-fill: rgba(37, 99, 235, 0.15);

  --header-default: linear-gradient(to right, #111827, #374151);
  --header-red: linear-gradient(to right, #991b1b, #b91c1c);
  --header-orange: linear-gradient(to right, #9a3412, #c2410c);
  --header-green: linear-gradient(to right, #166534, #15803d);
  --header-blue: linear-gradient(to right, #1e40af, #1d4ed8);
  --header-purple: linear-gradient(to right, #6b21a8, #7e22ce);

  --note-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --note-font-size: 20px;
}

body.theme-dark {
  --page-bg: #020617;
  --toolbar-bg: #020617;
  --toolbar-text: #e5e7eb;
  --grid-bg: #020617;
  --grid-line: #1f2937;
  --block-bg: #020617;
  --block-border: #4b5563;
  --block-shadow: 0 6px 14px rgba(0, 0, 0, 0.7);
  --text-color: #b0b8c4;
  --muted-text-color: #9ca3af;
  --primary: #3b82f6;
  --primary-soft: rgba(59, 130, 246, 0.4);
  --error: #f87171;
  --guide-color: #3b82f6;
  --overlap-color: #fb923c;
  --selection-fill: rgba(37, 99, 235, 0.3);

  --header-default: linear-gradient(to right, #0f172a, #1f2937);
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--page-bg);
  color: var(--text-color);
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes fadeOut {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.95);
  }
}

#toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--toolbar-bg);
  color: var(--toolbar-text);
  font-size: 13px;
  flex-wrap: wrap;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 10;
}
#toolbar button {
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: var(--primary);
  color: #f9fafb;
  font-size: 12px;
  white-space: nowrap;
}
#toolbar button:hover {
  background: #1d4ed8;
}
#toolbar button.secondary {
  background: transparent;
  border: 1px solid #4b5563;
  color: var(--toolbar-text);
}
#toolbar button.secondary:hover {
  background: #111827;
}
#toolbar button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
#toolbar button.active svg {
  stroke: white;
}
/* Google Login Button Style */
#googleLoginBtn {
  background: #ffffff;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
#googleLoginBtn:hover {
  background: #f3f4f6;
}
#googleLoginBtn svg {
  width: 14px;
  height: 14px;
}

/* Toolbar Right Section */
.toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
#userInfo {
  font-size: 11px;
  color: #9ca3af;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#toolbar label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
#toolbar select {
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #4b5563;
  background: var(--toolbar-bg);
  color: var(--toolbar-text);
  font-size: 12px;
}

#notification {
  min-height: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--muted-text-color);
}
#notification.info {
  color: #065f46;
}
#notification.error {
  color: var(--error);
}

#grid {
  position: relative;
  flex: 1 1 auto;
  background-color: var(--grid-bg);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 20px 20px;
  overflow: hidden;
  cursor: default;
}
#gridInner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
}
#guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.guide-line {
  position: absolute;
  background: var(--guide-color);
  opacity: 0.8;
}
.guide-line.vertical {
  width: 1px;
  top: -50000px;
  height: 100000px;
}
.guide-line.horizontal {
  height: 1px;
  left: -50000px;
  width: 100000px;
}

#connectionsLayer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}
.connection-path {
  fill: none;
  stroke: #9ca3af;
  stroke-width: 2;
  marker-end: url(#arrowhead);
  pointer-events: stroke;
  cursor: pointer;
  transition: stroke 0.2s;
}
.connection-path:hover {
  stroke: var(--primary);
  z-index: 10;
}
.connection-path.selected {
  stroke: var(--primary);
  stroke-width: 3;
}

/* Connect Mode Cursor */
body.mode-connect #grid {
  cursor: crosshair;
}
body.mode-connect .block {
  cursor: crosshair;
}

#selectionRect {
  position: absolute;
  border: 1px solid var(--primary);
  background: var(--selection-fill);
  pointer-events: none;
  display: none;
}

.block {
  position: absolute;
  width: 480px;
  height: 320px;
  background: var(--block-bg);
  border: 1px solid var(--block-border);
  border-radius: 8px;
  box-shadow: var(--block-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  transition: box-shadow 0.08s ease, border-color 0.08s ease;
  outline: none;
  animation: popIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.block.removing {
  animation: fadeOut 0.15s ease-out forwards;
  pointer-events: none;
}
.block.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
  z-index: 1000 !important;
}
.block.overlap {
  border-color: var(--overlap-color);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.4);
}

.block.image-type .block-content {
  padding: 0;
  overflow: hidden;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.block-image {
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  display: block;
}

.block-header {
  height: 24px;
  background: var(--header-default);
  cursor: move;
  flex-shrink: 0;
  transition: background 0.2s;
}
.block-header.color-default {
  background: var(--header-default);
}
.block-header.color-red {
  background: var(--header-red);
}
.block-header.color-orange {
  background: var(--header-orange);
}
.block-header.color-green {
  background: var(--header-green);
}
.block-header.color-blue {
  background: var(--header-blue);
}
.block-header.color-purple {
  background: var(--header-purple);
}

.block-title {
  padding: 4px 8px;
  font-size: 11px;
  border-bottom: 1px solid var(--block-border);
  background: rgba(0, 0, 0, 0.02);
  color: var(--muted-text-color);
  outline: none;
  cursor: text;
  user-select: text;
  min-height: 22px;
  flex-shrink: 0;
  font-weight: 500;
}
.block-content {
  flex: 1 1 auto;
  padding: 8px 10px 16px;
  font-size: var(--note-font-size);
  font-family: var(--note-font-family);
  line-height: 1.5;
  outline: none;
  overflow: auto;
  cursor: text;
  user-select: text;
  color: var(--text-color);
  white-space: pre-wrap;
}

.block-content::-webkit-scrollbar {
  width: 6px;
}
.block-content::-webkit-scrollbar-track {
  background: transparent;
}
.block-content::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.5);
  border-radius: 3px;
}

.resize-handle {
  position: absolute;
  width: 0;
  height: 0;
  right: 0;
  bottom: 0;
  border-style: solid;
  border-width: 0 0 20px 20px;
  border-color: transparent transparent rgba(148, 163, 184, 0.85) transparent;
  cursor: se-resize;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.block:hover .resize-handle,
.block.resizing .resize-handle {
  opacity: 1;
  pointer-events: auto;
}
.block.dragging {
  opacity: 0.9;
}
.block.resizing {
  opacity: 0.95;
}

.block-timestamp {
  position: absolute;
  left: 8px;
  bottom: 4px;
  font-size: 10px;
  color: var(--muted-text-color);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
body.show-timestamp .block:hover .block-timestamp {
  opacity: 1;
}

#resizeOverlay {
  position: absolute;
  font-size: 10px;
  color: var(--muted-text-color);
  pointer-events: none;
  padding: 0 4px;
  white-space: nowrap;
  display: none;
}
#grid.space-panning {
  cursor: grab;
}
#grid.space-panning.active {
  cursor: grabbing;
}

#toolbarBrand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 12px;
  margin-right: 12px;
  border-right: 1px solid #4b5563;
}
.toolbar-brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  overflow: hidden;
  background: #020617;
  display: flex;
  align-items: center;
  justify-content: center;
}
.toolbar-brand-icon {
  width: 100%;
  height: 100%;
  display: block;
}
.toolbar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0px;
}
.toolbar-brand-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.toolbar-brand-name {
  font-weight: 700;
}
.toolbar-brand-beta {
  font-size: 9px;
  font-weight: 600;
  color: #38bdf8;
}
.toolbar-brand-sub {
  font-size: 9px;
  color: var(--muted-text-color);
  letter-spacing: 0.05em;
}

#footerBar {
  flex: 0 0 auto;
  padding: 6px 12px 8px;
  font-size: 11px;
  color: var(--muted-text-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(15, 23, 42, 0.12);
}
body.theme-dark #footerBar {
  border-top: 1px solid #1f2937;
}
#footerBar a {
  color: inherit;
  text-decoration: none;
}
#footerBar a:hover {
  text-decoration: underline;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.privacy-link {
  color: inherit;
  text-decoration: none;
  opacity: 0.7;
  font-size: 11px;
  cursor: pointer;
}
.privacy-link:hover {
  opacity: 1;
  text-decoration: underline;
}

#contextMenu {
  position: absolute;
  display: none;
  background: var(--toolbar-bg);
  color: var(--toolbar-text);
  border: 1px solid #4b5563;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  padding: 4px 0;
  min-width: 160px;
  z-index: 9999;
  font-size: 12px;
}
#contextMenu .menu-item {
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#contextMenu .menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}
#contextMenu .menu-divider {
  height: 1px;
  background: #4b5563;
  margin: 4px 0;
}
#contextMenu .color-picker {
  display: flex;
  gap: 4px;
  padding: 4px 12px;
}
.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.color-dot:hover {
  transform: scale(1.2);
}
.color-dot.default {
  background: #374151;
}
.color-dot.red {
  background: #b91c1c;
}
.color-dot.orange {
  background: #c2410c;
}
.color-dot.green {
  background: #15803d;
}
.color-dot.blue {
  background: #1d4ed8;
}
.color-dot.purple {
  background: #7e22ce;
}

/* Privacy Overlay Styles */
#privacyOverlay {
  position: fixed;
  inset: 0;
  background: var(--page-bg); /* 다크 모드 반영 */
  color: var(--text-color);
  z-index: 99999;
  padding: 40px;
  overflow-y: auto;
  display: none; /* 기본 숨김 */
}
#privacyOverlay.active {
  display: block !important; /* 활성화 시 보이기 */
}
#privacyOverlay.closing .privacy-container {
  animation: fadeOut 0.2s ease-out forwards !important;
}

.privacy-container {
  max-width: 800px;
  margin: 0 auto 60px;
  padding: 40px;
  background: var(--block-bg);
  border: 1px solid var(--block-border);
  border-radius: 12px;
  box-shadow: var(--block-shadow);
}
#privacyOverlay.active .privacy-container {
  opacity: 0; /* 애니메이션 시작 전 숨김 */
  animation: popIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.privacy-container h1 {
  font-size: 28px;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 12px;
  margin-bottom: 30px;
}
.privacy-container h2 {
  font-size: 18px;
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--primary);
}
.privacy-container p,
.privacy-container li {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 8px;
}
.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--muted-text-color);
  text-decoration: none;
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.back-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Help Overlay Styles */
#helpOverlay {
  position: fixed;
  inset: 0;
  background: var(--page-bg);
  color: var(--text-color);
  z-index: 99999;
  padding: 40px;
  overflow-y: auto;
  display: none;
}
#helpOverlay.active {
  display: block !important;
}
#helpOverlay.closing .help-container {
  animation: fadeOut 0.2s ease-out forwards !important;
}

.help-container {
  max-width: 1100px;
  margin: 0 auto 60px;
  padding: 32px;
  background: var(--block-bg);
  border: 1px solid var(--block-border);
  border-radius: 12px;
  box-shadow: var(--block-shadow);
}
#helpOverlay.active .help-container {
  opacity: 0;
  animation: popIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.help-container h1 {
  font-size: 28px;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 12px;
  margin-bottom: 24px;
}

.help-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--block-border);
  margin-bottom: 24px;
}

.help-tab {
  padding: 12px 24px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  font-size: 15px;
  user-select: none;
  color: var(--muted-text-color);
}

.help-tab:hover {
  color: var(--text-color);
  background: rgba(0, 0, 0, 0.03);
}

body.theme-dark .help-tab:hover {
  background: rgba(255, 255, 255, 0.05);
}

.help-tab.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.help-content {
  position: relative;
}

.help-panel {
  display: none;
}

.help-panel.active {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  animation: fadeIn 0.15s ease-in;
  align-items: start;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.help-section {
  margin-bottom: 0;
  padding: 16px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

body.theme-dark .help-section {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}

.help-section h2 {
  font-size: 16px;
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-section p {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 10px;
  color: var(--text-color);
}

.help-section ul {
  list-style: none;
  padding-left: 0;
}

.help-section ul li {
  font-size: 14px;
  line-height: 1.5;
  padding-left: 16px;
  position: relative;
  margin-bottom: 6px;
}

.help-section ul li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--muted-text-color);
  font-weight: bold;
}

/* Shortcut Table */
.shortcut-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.shortcut-table tr {
  border-bottom: 1px solid var(--block-border);
}

.shortcut-table td {
  padding: 8px 4px;
  font-size: 13px;
}

.shortcut-table td:first-child {
  width: 40%;
  font-weight: 500;
  color: var(--text-color);
}

.shortcut-table td:last-child {
  color: var(--muted-text-color);
}

kbd {
  display: inline-block;
  padding: 3px 8px;
  font-size: 12px;
  font-family: ui-monospace, monospace;
  background: var(--block-border);
  border: 1px solid var(--muted-text-color);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  margin: 0 2px;
}

body.theme-dark kbd {
  background: #1f2937;
  border-color: #4b5563;
}

/* Color Badges */
.color-badge {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.color-badge.default {
  background: linear-gradient(to right, #111827, #374151);
}
.color-badge.red {
  background: linear-gradient(to right, #991b1b, #b91c1c);
}
.color-badge.orange {
  background: linear-gradient(to right, #9a3412, #c2410c);
}
.color-badge.green {
  background: linear-gradient(to right, #166534, #15803d);
}
.color-badge.blue {
  background: linear-gradient(to right, #1e40af, #1d4ed8);
}
.color-badge.purple {
  background: linear-gradient(to right, #6b21a8, #7e22ce);
}

/* Mobile Optimization */
@media (max-width: 768px) {
  /* Hide Desktop-only Toolbar Items */
  #exportBtn,
  #importBtn,
  #connectBtn,
  #snapToggleBtn,
  #viewResetBtn,
  #undoBtn,
  #redoBtn,
  #themeToggleBtn,
  #timestampToggleBtn,
  #toolbar label {
    display: none !important;
  }

  /* Adjust Toolbar Layout */
  #toolbar {
    justify-content: space-between;
    padding: 8px 16px;
  }

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

  #userInfo {
    display: none;
  }

  /* Hide Canvas & Show List View */
  #grid {
    display: none !important;
  }

  #mobileListView {
    display: block !important;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--page-bg);
    -webkit-overflow-scrolling: touch;
  }

  /* Mobile Card Style */
  .mobile-card {
    background: var(--block-bg);
    border: 1px solid var(--block-border);
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: transform 0.1s, opacity 0.3s, margin 0.3s;
    animation: mobileCardFadeIn 0.3s ease-out forwards;
  }

  @keyframes mobileCardFadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .mobile-card.removing {
    animation: mobileCardFadeOut 0.2s ease-out forwards;
    pointer-events: none;
  }

  @keyframes mobileCardFadeOut {
    from {
      opacity: 1;
      transform: scale(1);
    }
    to {
      opacity: 0;
      transform: scale(0.95);
    }
  }

  .mobile-card:active {
    transform: scale(0.98);
  }

  .mobile-card-header {
    height: 8px;
    width: 100%;
  }

  .mobile-card-header.color-default {
    background: var(--header-default);
  }
  .mobile-card-header.color-red {
    background: var(--header-red);
  }
  .mobile-card-header.color-orange {
    background: var(--header-orange);
  }
  .mobile-card-header.color-green {
    background: var(--header-green);
  }
  .mobile-card-header.color-blue {
    background: var(--header-blue);
  }
  .mobile-card-header.color-purple {
    background: var(--header-purple);
  }

  .mobile-card-body {
    padding: 16px;
  }

  .mobile-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
    display: block;
    border-bottom: 1px solid var(--grid-line);
    padding-bottom: 8px;
  }

  .mobile-card-content {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    white-space: pre-wrap;
    max-height: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 8;
    -webkit-box-orient: vertical;
  }

  .mobile-card-content.expanded {
    max-height: none;
    -webkit-line-clamp: unset;
  }

  .mobile-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: var(--muted-text-color);
    font-size: 16px;
    text-align: center;
    gap: 16px;
  }

  .mobile-empty-state p {
    margin: 0;
  }

  .mobile-empty-state .empty-hint {
    font-size: 14px;
    opacity: 0.7;
  }

  .mobile-empty-state .empty-arrow {
    font-size: 32px;
    animation: bounce 2s infinite;
  }

  @keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }

  /* Floating Action Button */
  #mobileQuickAddBtn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    z-index: 1000;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
  }

  #mobileQuickAddBtn:active {
    transform: scale(0.9);
    background: #1d4ed8;
  }

  /* Hide Footer on Mobile to save space */
  #footerBar {
    display: none;
  }

  /* Mobile Edit Overlay */
  #mobileEditOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: flex-end;
  }

  #mobileEditOverlay.active .mobile-edit-container {
    animation: slideUp 0.3s ease-out forwards;
  }

  #mobileEditOverlay.closing .mobile-edit-container {
    animation: slideDown 0.2s ease-in forwards;
  }

  @keyframes slideUp {
    from {
      transform: translateY(100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  @keyframes slideDown {
    from {
      transform: translateY(0);
      opacity: 1;
    }
    to {
      transform: translateY(100%);
      opacity: 0;
    }
  }
  .mobile-edit-container {
    background: var(--block-bg);
    padding: 20px;
    border-radius: 12px 12px 0 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 80vh;
    overflow-y: auto;
  }
  .mobile-edit-container h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: var(--text-color);
  }
  .mobile-edit-container input,
  .mobile-edit-container textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--block-border);
    border-radius: 6px;
    font-size: 16px;
    background: var(--bg-color);
    color: var(--text-color);
  }
  .mobile-edit-container textarea {
    min-height: 120px;
    max-height: 300px;
    resize: vertical;
  }
  .mobile-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
  }
  .mobile-edit-actions button {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 16px;
  }
  #mobileEditCancel {
    background: #ccc;
    color: #333;
  }
  #mobileEditSave {
    background: #007bff;
    color: white;
  }

  /* Mobile Delete Button */
  .mobile-delete-btn {
    background: none;
    border: none;
    color: #ff4444;
    font-size: 24px;
    line-height: 1;
    padding: 0 10px;
    cursor: pointer;
    float: right;
    margin-top: -4px;
  }

  /* Mobile Help Window Optimization */
  .help-container {
    width: 95% !important;
    padding: 16px !important;
    margin: 20px auto !important;
    max-height: 80vh;
    overflow-y: auto;
  }
  .help-panel.active {
    display: flex !important;
    flex-direction: column;
    gap: 16px;
  }
  .help-section {
    min-width: 100%;
  }
}
