:root {
  --bg-page: #e8ebe4;
  --bg-primary: #ffffff;
  --bg-secondary: #f5f7f3;
  --bg-tertiary: #e8ebe4;
  --bg-card: #ffffff;
  --header-bg: #047d59;
  --header-text: #ffffff;
  --text-primary: #1f2d1c;
  --text-secondary: #4a5a47;
  --text-tertiary: #7a8a77;
  --accent: #c45d3e;
  --accent-hover: #a84d32;
  --accent-light: rgba(196, 93, 62, 0.1);
  --accent-glow: rgba(196, 93, 62, 0.25);
  --green-accent: #047d59;
  --green-light: rgba(4, 125, 89, 0.1);
  --green-hover: #036347;
  --success: #4a9d6e;
  --warning: #d4a84b;
  --border: rgba(4, 125, 89, 0.12);
  --border-strong: rgba(4, 125, 89, 0.2);
  --shadow-sm: 0 1px 3px rgba(31, 45, 28, 0.06);
  --shadow-md: 0 4px 16px rgba(31, 45, 28, 0.1);
  --shadow-lg: 0 8px 32px rgba(31, 45, 28, 0.12);
  --shadow-xl: 0 20px 60px rgba(31, 45, 28, 0.18);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --toolbar-active-bg: #fde68a;
  --toolbar-active-text: #92400e;
  --toolbar-active-border: #f59e0b;
  --page-max: 1280px;
  --header-height: 40px;
  --menu-height: 32px;
  --toolbar-height: 44px;
  --font-ui: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-editor: "Lora", Georgia, serif;
  --font-mono: "JetBrains Mono", monospace;
  --transition-fast: 0.12s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.dark {
  --bg-page: #1a1d19;
  --bg-primary: #232723;
  --bg-secondary: #2a2f2a;
  --bg-tertiary: #333933;
  --bg-card: #2a2f2a;
  --header-bg: #047d59;
  --header-text: #f0f4ee;
  --text-primary: #f0f4ee;
  --text-secondary: #b8c4b5;
  --text-tertiary: #7a8a77;
  --accent: #e07a5f;
  --accent-hover: #f08a6e;
  --accent-light: rgba(224, 122, 95, 0.12);
  --accent-glow: rgba(224, 122, 95, 0.2);
  --green-accent: #05a676;
  --green-light: rgba(5, 166, 118, 0.12);
  --green-hover: #06bf88;
  --border: rgba(5, 166, 118, 0.15);
  --border-strong: rgba(5, 166, 118, 0.25);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.45);
}

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

html,
body {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition-normal),
    color var(--transition-normal);
  display: block;
  padding: 4px 20px 16px;
}

/* Main Container - Centered Window */
.notepad-container {
  width: 100%;
  max-width: var(--page-max);
  height: calc(100vh - 20px);
  max-height: 980px;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  margin: 0 auto;
}

/* === COMPACT TOP BAR === */
.header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-icon {
  font-size: 16px;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.25px;
  white-space: nowrap;
}

.header-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.tab-scroll {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.tab-scroll-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  color: var(--header-text);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.tab-scroll-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.tab-scroll-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.tab-scroll-btn.hidden {
  display: none;
}

/* Tab Bar - now INSIDE header, more compact */
.tab-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  min-height: 0;
  padding: 0 4px;
  background: transparent;
  border-bottom: none;
  flex: 1;
  min-width: 0;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.mobile-menu-btn {
  display: none;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--header-text);
  font-size: 16px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.mobile-menu-btn:hover {
  background: rgba(0, 0, 0, 0.12);
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  min-width: 110px;
  max-width: 200px;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
  font-size: 11px;
}

@keyframes tabSlideIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tabPop {
  0% {
    opacity: 0.7;
    transform: translateY(-6px) scale(0.96);
    box-shadow: 0 0 0 rgba(4, 125, 89, 0);
  }
  60% {
    opacity: 1;
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 10px 24px rgba(4, 125, 89, 0.25);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 rgba(4, 125, 89, 0);
  }
}

.tab.newly-created {
  animation: tabPop 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
  border-color: var(--border-strong);
  background: linear-gradient(180deg, rgba(4, 125, 89, 0.12), rgba(4, 125, 89, 0)), var(--bg-primary);
}

.tab.newly-created .tab-icon {
  color: var(--green-accent);
}

.tab:hover {
  background: var(--bg-card);
}

.tab.active {
  background: var(--bg-primary);
  border-color: var(--border-strong);
  z-index: 1;
}

.tab.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--bg-primary);
}

.tab.pinned::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10px;
  right: 10px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--green-accent));
  border-radius: 0 0 3px 3px;
}

.tab-icon {
  font-size: 11px;
  color: var(--text-tertiary);
}

.tab-name {
  flex: 1;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-unsaved {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.tab-unsaved.visible {
  opacity: 1;
}

.tab-close {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 9px;
  color: var(--text-tertiary);
  opacity: 0;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.tab:hover .tab-close {
  opacity: 1;
}

.tab-close:hover {
  background: #c42b1c;
  color: white;
}

.new-tab-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--header-text);
  font-size: 14px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.new-tab-btn:hover {
  background: rgba(0, 0, 0, 0.12);
}

.new-tab-btn:active {
  transform: scale(0.95);
}

.new-tab-btn.pulse {
  animation: newNotePulse 0.42s ease-out;
  background: rgba(255, 255, 255, 0.18);
}

@keyframes newNotePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45);
  }
  60% {
    transform: scale(1.08);
    box-shadow: 0 0 0 12px rgba(255, 255, 255, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tab.newly-created,
  .new-tab-btn.pulse {
    animation: none;
  }
}

.tab-bar-spacer {
  flex: 1;
  min-width: 8px;
}

.notes-count-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--header-text);
  background: rgba(0, 0, 0, 0.16);
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.tab-bar-search {
  display: flex;
  align-items: center;
  margin-left: 6px;
  position: relative;
  flex-shrink: 0;
}

.tab-bar-search input {
  width: 130px;
  padding: 5px 9px 5px 26px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--header-text);
  transition: all var(--transition-fast);
}

.tab-bar-search input:focus {
  outline: none;
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--green-accent);
  box-shadow: 0 0 0 2px var(--green-light);
  width: 170px;
}

.tab-bar-search input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.tab-bar-search i {
  position: absolute;
  left: 10px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  pointer-events: none;
}

/* Mobile Sidebar */
.mobile-sidebar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--bg-secondary);
  z-index: 1001;
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}

.mobile-sidebar.open {
  transform: translateX(0);
}

.mobile-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--header-bg);
  color: var(--header-text);
}

.mobile-sidebar-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-sidebar-close {
  background: none;
  border: none;
  color: var(--header-text);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.8;
}

.mobile-sidebar-close:hover {
  opacity: 1;
}

.mobile-sidebar-actions {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.mobile-new-note-btn {
  width: 100%;
  padding: 10px 14px;
  background: var(--green-accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 6px rgba(4, 125, 89, 0.25);
}

.mobile-new-note-btn:hover {
  background: var(--green-hover);
}

.mobile-search-container {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.mobile-search-box {
  position: relative;
}

.mobile-search-box input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.mobile-search-box input:focus {
  outline: none;
  border-color: var(--green-accent);
  box-shadow: 0 0 0 3px var(--green-light);
}

.mobile-search-box input::placeholder {
  color: var(--text-tertiary);
}

.mobile-search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 14px;
}

.mobile-notes-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-notes-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.mobile-notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 16px;
  -webkit-overflow-scrolling: touch;
}

.mobile-notes-list::-webkit-scrollbar {
  width: 5px;
}

.mobile-notes-list::-webkit-scrollbar-track {
  background: transparent;
}

.mobile-notes-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.mobile-note-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.mobile-note-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.mobile-note-card.active {
  border-color: var(--green-accent);
  background: var(--green-light);
  box-shadow: var(--shadow-md);
}

.mobile-note-card.pinned::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 12px;
  right: 12px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--green-accent));
  border-radius: 0 0 3px 3px;
}

.mobile-note-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
}

.mobile-note-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-note-pin {
  color: var(--accent);
  font-size: 10px;
  margin-left: 6px;
  opacity: 0;
}

.mobile-note-card.pinned .mobile-note-pin {
  opacity: 1;
}

.mobile-note-preview {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 8px;
}

.mobile-note-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 10px;
  color: var(--text-tertiary);
}

.mobile-note-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Delete animation */
.delete-anim {
  position: fixed;
  width: 160px;
  height: 160px;
  bottom: 26px;
  right: 26px;
  pointer-events: none;
  z-index: 1500;
  display: none;
}

.delete-anim .delete-paper {
  position: absolute;
  top: 16px;
  left: 12px;
  width: 46px;
  height: 58px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translate(0, 0) rotate(0deg) scale(1);
}

.delete-anim .delete-paper::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  height: 2px;
  background: var(--text-tertiary);
  box-shadow: 0 10px 0 var(--text-tertiary), 0 20px 0 var(--text-tertiary);
  opacity: 0.5;
}

.delete-anim .delete-basket {
  position: absolute;
  right: 6px;
  bottom: 0;
  width: 54px;
  height: 42px;
  border: 2px solid var(--border-strong);
  border-radius: 0 0 14px 14px;
  background: var(--bg-secondary);
  display: grid;
  place-items: center;
  color: #c42b1c;
  box-shadow: var(--shadow-md);
}

.delete-anim .delete-basket i {
  font-size: 16px;
}

.delete-anim.run {
  display: block;
}

.delete-anim.run .delete-paper {
  animation: deleteFly 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.delete-anim.run .delete-basket {
  animation: deleteCatch 0.7s ease forwards;
}

@media (max-width: 640px) {
  .delete-anim {
    width: 120px;
    height: 120px;
    bottom: 12px;
    right: 12px;
  }
}

@keyframes deleteFly {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(-6deg) scale(1);
  }
  40% {
    opacity: 1;
    transform: translate(32px, 26px) rotate(8deg) scale(0.95);
  }
  100% {
    opacity: 0;
    transform: translate(86px, 66px) rotate(18deg) scale(0.55);
  }
}

@keyframes deleteCatch {
  0% {
    transform: translateY(0);
  }
  55% {
    transform: translateY(4px);
  }
  100% {
    transform: translateY(0);
  }
}

.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.mobile-sidebar-overlay.visible {
  opacity: 1;
}

/* App Layout */
.app-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Main Editor Area */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-primary);
  overflow: hidden;
}

/* Menu Bar - compact */
.menu-bar {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 6px;
  height: 30px;
  flex-shrink: 0;
}

.menu-item {
  position: relative;
  padding: 4px 9px;
  font-size: 15px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  border-radius: var(--radius-sm);
}

.menu-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.menu-item.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 1000;
  display: none;
  animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.menu-item.active .menu-dropdown {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.dropdown-item:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.dropdown-item:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

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

.dropdown-item i {
  width: 16px;
  margin-right: 8px;
  color: var(--text-tertiary);
}

.dropdown-item .shortcut {
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}
.dropdown-item.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Toolbar */
.toolbar {
  padding: 4px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-primary);
  flex-wrap: nowrap;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.toolbar::-webkit-scrollbar {
  display: none;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 0 4px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

.clipboard-group {
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  margin-right: 4px;
}

.toolbar-group:last-child {
  border-right: none;
}

.toolbar-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.toolbar-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.toolbar-btn.active {
  background: var(--toolbar-active-bg);
  color: var(--toolbar-active-text);
  box-shadow: inset 0 0 0 1px var(--toolbar-active-border);
  font-weight: 700;
}

.toolbar-select {
  padding: 3px 6px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-ui);
}

.toolbar-select:focus {
  outline: none;
  border-color: var(--green-accent);
}

/* Find Bar */
.find-bar {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.editor-header .toolbar {
  flex: 1 1 auto;
  margin: 0 8px;
  padding: 0;
  border: none;
  background: transparent;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 320px;
}

.editor-header .toolbar-group {
  padding: 0 4px;
}

.find-bar.open {
  display: flex;
}

.find-input {
  flex: 1;
  min-width: 100px;
  max-width: 180px;
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ui);
}

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

.find-count {
  font-size: 10px;
  color: var(--text-tertiary);
  min-width: 50px;
}

.find-btn {
  padding: 5px 10px;
  font-size: 11px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all var(--transition-fast);
}

.find-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--border-strong);
}

/* Back to Top */
.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-primary);
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 50;
}

.back-to-top:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* Stats Panel */
.stats-panel {
  position: fixed;
  right: 18px;
  bottom: 70px;
  width: 220px;
  background: var(--bg-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  display: none;
  gap: 8px;
  z-index: 50;
}

.stats-panel.visible {
  display: grid;
}

.stats-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}

.stats-row:last-child {
  border-bottom: none;
}

.stats-reset {
  margin-top: 8px;
  justify-self: center;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.stats-reset:hover {
  color: var(--text-primary);
  border-color: var(--border);
}

@media (max-width: 767px) {
  .back-to-top {
    display: none !important;
  }
}

/* Editor Container */
.editor-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  background: var(--bg-primary);
  min-height: 0;
}

.editor-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  -webkit-overflow-scrolling: touch;
}

.editor-scroll::-webkit-scrollbar {
  width: 8px;
}

.editor-scroll::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.editor-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.editor-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.editor {
  max-width: 100%;
  min-height: 100%;
  font-family: var(--font-editor);
  font-size: 16px;
  line-height: 1.68;
  color: var(--text-primary);
  outline: none;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-tertiary);
  pointer-events: none;
  font-style: italic;
}

@media (max-width: 767px) {
  .editor {
    line-height: 1.62;
  }
}

.editor h1,
.editor h2,
.editor h3 {
  font-family: var(--font-ui);
  font-weight: 700;
  margin: 24px 0 12px;
  line-height: 1.25;
}

.editor h1 {
  font-size: 1.8em;
}
.editor h2 {
  font-size: 1.4em;
}
.editor h3 {
  font-size: 1.15em;
  font-weight: 600;
}

.editor p {
  margin-bottom: 12px;
}

.editor ul,
.editor ol {
  margin: 12px 0;
  padding-left: 22px;
}

/* Checklist rows */
.editor .check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  line-height: 1.4;
}

.editor li {
  margin-bottom: 5px;
}

.editor blockquote {
  border-left: 4px solid var(--accent);
  margin: 16px 0;
  padding: 12px 18px;
  background: var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.editor code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-secondary);
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--accent);
}

.editor *:not(pre) {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.editor pre {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-tertiary);
  padding: 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 16px 0;
}

.editor pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 0.95em;
}

.editor .code-block {
  white-space: pre;
  overflow: auto;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.06);
}

.dark .editor .code-block {
  background: rgba(255, 255, 255, 0.08);
}

.editor a {
  color: var(--green-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.editor hr {
  border: none;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--border-strong),
    transparent
  );
  margin: 28px 0;
}

.editor input[type="checkbox"] {
  margin-right: 8px;
  accent-color: var(--green-accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* Status Bar */
.status-bar {
  padding: 5px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  background: var(--bg-secondary);
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.status-left,
.status-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.status-right .status-item {
  min-width: 56px;
}

.save-status {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  min-width: 56px;
}

.save-status.saving {
  color: var(--warning);
}

.save-status.saved i {
  color: var(--success);
}

.status-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.status-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-secondary);
}

/* SEO Content */
.seo-wrap {
  width: 100%;
  max-width: var(--page-max);
  margin: 72px auto 88px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 20px 24px;
}

.seo-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.seo-headline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  text-align: center;
}
.seo-domain {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.seo-tagline {
  font-size: 15px;
  color: var(--text-secondary);
}
.seo-cta-row {
  display: flex;
  justify-content: center;
  margin: 6px 0 16px;
}
.seo-cta {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.seo-tile {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.seo-tile i {
  color: var(--green-accent);
  margin-top: 2px;
}

.seo-section-block {
  margin: 24px 0;
}

.seo-section-block h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.seo-section-block p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.72;
  margin-bottom: 14px;
}

.seo-list {
  list-style: none;
  padding-left: 0;
  margin: 12px 0 20px;
  display: grid;
  gap: 12px;
  font-size: 15px;
  color: var(--text-secondary);
}

.seo-list li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 12px;
  align-items: flex-start;
}

.seo-list li i {
  color: var(--green-accent);
  margin-top: 2px;
}

.faq-list strong {
  color: var(--text-primary);
}

.seo-footer {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-tertiary);
}

.seo-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.seo-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

.seo-links a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Command Palette */
.cmd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 16px 40px;
  z-index: 1200;
}

.cmd-overlay.open {
  display: flex;
}

.cmd-panel {
  width: min(720px, 100%);
  background: var(--bg-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cmd-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.cmd-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 14px;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.cmd-input:focus {
  outline: none;
  border-color: var(--green-accent);
  box-shadow: 0 0 0 2px var(--green-light);
}

.cmd-list {
  max-height: 360px;
  overflow-y: auto;
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: 13px;
  color: var(--text-primary);
}

.cmd-item:last-child {
  border-bottom: none;
}

.cmd-item:hover,
.cmd-item.active {
  background: var(--bg-secondary);
}

.cmd-kind {
  font-size: 12px;
  color: var(--text-tertiary);
  min-width: 68px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cmd-meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Connection Banner */
.connection-banner {
  position: fixed;
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  z-index: 60;
}

.connection-banner.offline {
  border-color: #e57373;
  background: #fff5f5;
  color: #b33a3a;
}

/* Welcome State */
.welcome-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 30px 48px;
  min-height: calc(
    100vh - var(--header-height) - var(--menu-height) - var(--toolbar-height) -
      80px
  );
  text-align: center;
  background: linear-gradient(
    180deg,
    var(--bg-primary) 0%,
    var(--bg-secondary) 100%
  );
  overflow-y: auto;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--green-light) 0%, transparent 70%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  animation: welcomePulse 3s ease-in-out infinite;
}

@keyframes welcomePulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.welcome-icon i {
  font-size: 32px;
  color: var(--green-accent);
}

.welcome-title {
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.welcome-desc {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 340px;
  line-height: 1.5;
  margin-bottom: 28px;
}

.welcome-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.welcome-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.welcome-btn:hover {
  border-color: var(--green-accent);
  box-shadow: var(--shadow-md);
}

.welcome-btn.primary {
  background: var(--green-accent);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(4, 125, 89, 0.25);
}

.welcome-btn.primary:hover {
  background: var(--green-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(4, 125, 89, 0.3);
}

/* Editor View hidden initially */
.editor-view {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.editor-view.active {
  display: flex;
}

/* Editor Header */
.editor-header {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-primary);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.editor-title-input {
  flex: 0 0 220px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
  min-width: 0;
  max-width: 340px;
}

.editor-title-input::placeholder {
  color: var(--text-tertiary);
}

.editor-header-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.header-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  position: relative;
}

.header-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.header-btn.active {
  color: var(--accent);
  background: var(--accent-light);
}

.header-btn .tooltip {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 10px;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 100;
}

.header-btn:hover .tooltip {
  opacity: 1;
}

/* Focus Mode */
.focus-mode .header,
.focus-mode .menu-bar,
.focus-mode .toolbar,
.focus-mode .editor-header,
.focus-mode .status-bar {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.focus-mode:hover .header,
.focus-mode:hover .menu-bar,
.focus-mode:hover .toolbar,
.focus-mode:hover .editor-header,
.focus-mode:hover .status-bar {
  opacity: 1;
  pointer-events: auto;
}

/* Fullscreen Mode */
.fullscreen .notepad-container {
  max-width: none;
  max-height: none;
  height: 100vh;
  border-radius: 0;
  border: none;
}

body.fullscreen {
  padding: 0;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  padding: 20px;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 400px;
  width: 100%;
  transform: scale(0.95);
  transition: transform var(--transition-normal);
  max-height: 80vh;
  overflow: auto;
}

.modal-overlay.open .modal {
  transform: scale(1);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.modal-body p {
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

.btn.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c62828;
}

.btn-primary {
  background: var(--green-accent);
  color: white;
}

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

/* Shortcuts Grid */
.shortcuts-grid {
  display: grid;
  gap: 8px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
}

.shortcut-label {
  color: var(--text-secondary);
  font-size: 12px;
}

.shortcut-keys {
  display: flex;
  gap: 3px;
}

.key {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-primary);
}

/* Symbol Grid */
.symbol-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}

.symbol-btn {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.symbol-btn:hover {
  background: var(--green-light);
  border-color: var(--green-accent);
}

/* Modal Input */
.modal-input {
  width: 100%;
  padding: 9px 11px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  margin-bottom: 10px;
  font-family: var(--font-ui);
}

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

.modal-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.trash-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
}

.trash-item {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.trash-meta {
  flex: 1;
  min-width: 0;
}

.trash-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trash-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.trash-preview {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  max-height: 3.6em;
  overflow: hidden;
}

.trash-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.trash-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.trash-empty i {
  font-size: 20px;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}
.toast .toast-action {
  margin-left: auto;
  background: transparent;
  color: var(--bg-primary);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.toast .toast-action:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

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

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

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-menu-export {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 150px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all var(--transition-fast);
  z-index: 200;
}

.dropdown.open .dropdown-menu-export {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Hidden File Input */
.hidden-input {
  display: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  body {
    padding: 0;
  }

  .notepad-container {
    height: 100vh;
    max-height: none;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .tab {
    display: none;
  }

  .tab-bar-search {
    display: none;
  }

  .notes-count-badge {
    display: none;
  }

  .tab-scroll-btn {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .mobile-sidebar {
    display: flex;
  }

  .header {
    padding: 8px 10px;
  }

  .editor-header {
    flex-wrap: nowrap;
    align-items: center;
  }

  .editor-title-input {
    flex: 1 1 auto;
    max-width: 100%;
  }

  .editor-header-actions {
    width: auto;
    justify-content: flex-end;
  }

  /* Hide last-edited time on mobile */
  #lastEdited {
    display: none;
  }

  .header-btn#pinBtn,
  .header-btn#focusBtn {
    display: none;
  }
  #mobileCopyBtn {
    display: inline-flex !important;
  }
  #mobileClearBtn {
    display: inline-flex !important;
  }

  .toolbar,
  .menu-bar,
  .find-bar {
    display: none !important;
  }

  .editor-scroll {
    padding: 16px;
  }

  .editor {
    font-size: 16px;
  }

  .welcome-state {
    padding: 24px 16px 28px;
    min-height: auto;
  }

  .welcome-title {
    font-size: 22px;
  }

  .welcome-actions {
    flex-direction: column;
    width: 100%;
  }

  .welcome-btn {
    width: 100%;
    justify-content: center;
  }

  .menu-item {
    padding: 5px 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  .editor-header {
    padding: 8px 12px;
  }

  .header-btn .tooltip {
    display: none;
  }

  /* Keep status metrics visible on mobile, just wrap them */
  .status-right {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  .symbol-grid {
    grid-template-columns: repeat(8, 1fr);
  }
}

@media (max-width: 480px) {
  .editor-header-actions {
    gap: 1px;
  }

  .header-btn {
    padding: 6px 7px;
  }

  .toolbar-group {
    padding: 0 4px;
  }

  .toolbar-btn {
    padding: 6px 6px;
  }

  .find-btn {
    padding: 4px 6px;
  }
}

/* Print Styles */
@media print {
  @page {
    margin: 12mm;
  }

  .header,
  .menu-bar,
  .toolbar,
  .editor-header,
  .status-bar,
  .mobile-sidebar,
  .mobile-sidebar-overlay {
    display: none !important;
  }

  body {
    padding: 0;
    background: white;
  }

  .notepad-container {
    max-width: none;
    width: auto;
    height: auto;
    box-shadow: none;
    border: none;
  }

  .app-body,
  .main,
  .editor-container,
  .editor-scroll {
    height: auto;
    overflow: visible;
    min-height: 0;
  }

  .main {
    background: white;
  }

  .editor {
    color: black;
    max-width: none;
    padding: 0 12mm;
  }
}

/* Ad Space Indicator (for larger screens) */
@media (min-width: 1400px) {
  body {
    padding: 8px 80px 20px;
  }
}

/* Desktop/Laptop: page-level scroll & sticky chrome */
@media (min-width: 1024px) {
  html,
  body {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100%;
  }

  .notepad-container {
    height: auto;
    max-height: none;
    overflow: visible;
    min-height: calc(100vh - 40px);
  }

  .app-body,
  .main,
  .editor-container {
    overflow: visible;
    height: auto;
    min-height: 70vh;
  }

  .editor-scroll {
    overflow: visible;
    max-height: none;
    min-height: 70vh;
  }

  .header {
    position: sticky;
    top: 0;
    z-index: 40;
  }

  .menu-bar {
    position: sticky;
    top: var(--header-height);
    z-index: 39;
  }

  .toolbar {
    position: sticky;
    top: calc(var(--header-height) + var(--menu-height));
    z-index: 38;
  }

  .find-bar {
    position: sticky;
    top: calc(
      var(--header-height) + var(--menu-height) + var(--toolbar-height)
    );
    z-index: 37;
  }
}
