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

    :root {
      --bg: #ffffff;
      --bg-secondary: #f8f9fa;
      --bg-elevated: #ffffff;
      --text: #1a1a1a;
      --text-secondary: #6b7280;
      --text-tertiary: #9ca3af;
      --border: #e5e7eb;
      --border-light: #f3f4f6;
      --accent: #3b82f6;
      --accent-hover: #2563eb;
      --accent-light: #dbeafe;
      --success: #10b981;
      --warning: #f59e0b;
      --error: #ef4444;
      --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
      --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
      --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
      --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
      --radius: 12px;
      --radius-sm: 8px;
      --radius-lg: 16px;
      --radius-xl: 24px;
      --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @media (prefers-color-scheme: dark) {
      :root {
        --bg: #0a0a0a;
        --bg-secondary: #111111;
        --bg-elevated: #1a1a1a;
        --text: #f9fafb;
        --text-secondary: #d1d5db;
        --text-tertiary: #9ca3af;
        --border: #374151;
        --border-light: #1f2937;
        --accent: #3b82f6;
        --accent-hover: #60a5fa;
        --accent-light: #1e3a8a;
        --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.25);
        --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
        --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
        --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.4);
      }
    }

    html {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
      font-size: 16px;
      line-height: 1.6;
      color-scheme: light dark;
      background: var(--bg);
      color: var(--text);
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
    }

    body {
      background: linear-gradient(135deg, var(--bg) 0%, var(--bg-secondary) 100%);
      color: var(--text);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      position: relative;
    }

    body::before {
      content: '';
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: radial-gradient(circle at 20% 80%, var(--accent-light) 0%, transparent 50%),
                  radial-gradient(circle at 80% 20%, var(--accent-light) 0%, transparent 50%);
      opacity: 0.3;
      pointer-events: none;
      z-index: -1;
    }


    /* Buttons */
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
      padding: 0.5rem 1rem;
      font-size: 0.875rem;
      font-weight: 600;
      line-height: 1;
      border: none;
      border-radius: var(--radius-sm);
      cursor: pointer;
      transition: var(--transition);
      text-decoration: none;
      white-space: nowrap;
    }

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

    .btn-primary:hover {
      background: var(--accent-hover);
      transform: translateY(-2px);
      box-shadow: var(--shadow-xl);
    }

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

    .btn-secondary:hover {
      background: var(--border-light);
      transform: translateY(-2px);
      box-shadow: var(--shadow-lg);
    }

    .btn-ghost {
      background: transparent;
      color: var(--text-secondary);
      padding: 0.5rem;
    }

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

    .btn-icon {
      width: 36px;
      height: 36px;
      padding: 0;
    }

    /* Toolbar */
    .toolbar {
      background: var(--bg-elevated);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 0.5rem;
      margin-bottom: 1rem;
      display: flex;
      gap: 0.25rem;
      flex-wrap: wrap;
      box-shadow: var(--shadow);
      position: sticky;
      top: 20px;
      z-index: 90;
    }

    .toolbar-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 40px;
      height: 40px;
      padding: 0;
      background: var(--bg-secondary);
      border: 1px solid transparent;
      border-radius: var(--radius-sm);
      color: var(--text-secondary);
      cursor: pointer;
      transition: var(--transition);
      position: relative;
    }

    .toolbar-btn:hover {
      background: var(--accent);
      color: white;
      transform: translateY(-2px);
      box-shadow: var(--shadow-lg);
    }

    .toolbar-btn:active {
      transform: translateY(0);
    }

    .toolbar-btn.active {
      background: var(--accent);
      color: white;
    }

    .toolbar-btn svg {
      width: 20px;
      height: 20px;
    }

    .toolbar-separator {
      width: 1px;
      background: var(--border);
      margin: 0 0.5rem;
      align-self: stretch;
    }

    .toolbar-tooltip {
      position: absolute;
      bottom: calc(100% + 8px);
      left: 50%;
      transform: translateX(-50%);
      background: var(--bg-elevated);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      padding: 0.375rem 0.75rem;
      font-size: 0.75rem;
      font-weight: 600;
      white-space: nowrap;
      opacity: 0;
      pointer-events: none;
      transition: var(--transition);
      box-shadow: var(--shadow-lg);
      z-index: 1000;
    }

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

    /* Main Content */
    .main {
      flex: 1;
      max-width: 1000px;
      width: 100%;
      margin: 0 auto;
      padding: 2rem 1.5rem;
    }

    /* Editor Container */
    .editor-container {
      position: relative;
      min-height: 70vh;
    }

    /* WYSIWYG Editor */
    .editor {
      background: var(--bg-elevated);
      border: 1px solid var(--border);
      border-radius: var(--radius-xl);
      padding: 2rem;
      min-height: 70vh;
      font-size: 1.125rem;
      line-height: 1.75;
      color: var(--text);
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
      box-shadow: var(--shadow-lg);
      overflow-y: auto;
    }

    
    .editor:empty::before {
      content: 'Start typing your note...';
      color: var(--text-tertiary);
      pointer-events: none;
    }

    /* Editor content styles */
    .editor h1 { font-size: 2rem; font-weight: 700; margin: 1.5rem 0 1rem; }
    .editor h2 { font-size: 1.5rem; font-weight: 600; margin: 1.25rem 0 0.75rem; }
    .editor h3 { font-size: 1.25rem; font-weight: 600; margin: 1rem 0 0.5rem; }
    .editor p { margin: 0.75rem 0; }
    .editor ul, .editor ol { margin: 0.75rem 0; padding-left: 1.5rem; }
    .editor li { margin: 0.25rem 0; }
    .editor blockquote {
      border-left: 4px solid var(--accent);
      padding-left: 1rem;
      margin: 1rem 0;
      color: var(--text-secondary);
      font-style: italic;
    }
    .editor code {
      background: var(--accent-light);
      color: var(--accent);
      padding: 0.125rem 0.375rem;
      border-radius: 4px;
      font-family: 'SF Mono', Monaco, Consolas, monospace;
      font-size: 0.875em;
    }
    .editor a {
      color: var(--accent);
      text-decoration: underline;
      text-underline-offset: 2px;
    }
    .editor hr {
      border: none;
      border-top: 1px solid var(--border);
      margin: 1.5rem 0;
    }

    /* Markdown Styles */
    .md-h1 {
      font-size: 2.25rem;
      font-weight: 700;
      line-height: 1.2;
      margin: 2rem 0 1rem;
      color: var(--text);
    }

    .md-h2 {
      font-size: 1.875rem;
      font-weight: 600;
      line-height: 1.3;
      margin: 1.75rem 0 0.75rem;
      color: var(--text);
    }

    .md-h3 {
      font-size: 1.5rem;
      font-weight: 600;
      line-height: 1.3;
      margin: 1.5rem 0 0.5rem;
      color: var(--text);
    }

    .md-h4 {
      font-size: 1.25rem;
      font-weight: 600;
      line-height: 1.4;
      margin: 1.25rem 0 0.5rem;
      color: var(--text);
    }

    .md-h5 {
      font-size: 1.125rem;
      font-weight: 600;
      line-height: 1.4;
      margin: 1rem 0 0.5rem;
      color: var(--text);
    }

    .md-h6 {
      font-size: 1rem;
      font-weight: 600;
      line-height: 1.5;
      margin: 1rem 0 0.5rem;
      color: var(--text-secondary);
    }

    .md-p {
      margin: 1rem 0;
    }

    .md-code {
      background: var(--accent-light);
      color: var(--accent);
      padding: 0.125rem 0.375rem;
      border-radius: 4px;
      font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
      font-size: 0.875em;
    }

    .md-codeblock {
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1rem;
      margin: 1.5rem 0;
      overflow-x: auto;
      font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
      font-size: 0.875rem;
    }

    .md-bold {
      font-weight: 600;
    }

    .md-italic {
      font-style: italic;
    }

    .md-strike {
      text-decoration: line-through;
    }

    .md-url {
      color: var(--accent);
      text-decoration: underline;
      text-decoration-thickness: 1px;
      text-underline-offset: 2px;
      transition: var(--transition);
    }

    .md-url:hover {
      color: var(--accent-hover);
    }

    /* Menu */
    .menu {
      position: fixed;
      bottom: 2rem;
      right: 2rem;
      background: var(--bg-elevated);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 0.5rem;
      box-shadow: var(--shadow-xl);
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
      min-width: 200px;
      opacity: 0;
      transform: translateY(10px) scale(0.95);
      pointer-events: none;
      transition: var(--transition);
      z-index: 1000;
    }

    .menu.visible {
      opacity: 1;
      transform: translateY(0) scale(1);
      pointer-events: auto;
    }

    .menu-item {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0.75rem 1rem;
      border-radius: var(--radius-sm);
      color: var(--text);
      text-decoration: none;
      font-size: 0.875rem;
      font-weight: 500;
      transition: var(--transition);
      cursor: pointer;
      border: none;
      background: transparent;
      width: 100%;
      text-align: left;
    }

    .menu-item:hover {
      background: var(--bg-secondary);
      transform: translateX(2px);
    }

    .menu-item svg {
      width: 18px;
      height: 18px;
      opacity: 0.7;
    }

    /* FAB */
    .fab {
      position: fixed;
      bottom: 2rem;
      right: 2rem;
      width: 64px;
      height: 64px;
      background: var(--accent);
      color: white;
      border: none;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: var(--shadow-xl);
      transition: var(--transition);
      z-index: 999;
    }

    .fab:hover {
      background: var(--accent-hover);
      transform: scale(1.1) rotate(90deg);
      box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.5);
    }

    .fab svg {
      width: 28px;
      height: 28px;
      transition: var(--transition);
    }

    .fab.active svg {
      transform: rotate(45deg);
    }

    /* Toast */
    .toast {
      position: fixed;
      top: 1.5rem;
      right: 1.5rem;
      background: var(--bg-elevated);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1rem 1.5rem;
      box-shadow: var(--shadow-lg);
      display: flex;
      align-items: center;
      gap: 0.75rem;
      opacity: 0;
      transform: translateY(-10px);
      pointer-events: none;
      transition: var(--transition);
      z-index: 1001;
    }

    .toast.visible {
      opacity: 1;
      transform: translateY(0);
      pointer-events: auto;
    }

    .toast-icon {
      width: 20px;
      height: 20px;
      flex-shrink: 0;
    }

    .toast.success .toast-icon {
      color: var(--success);
    }

    .toast.error .toast-icon {
      color: var(--error);
    }

    .toast-message {
      font-size: 0.875rem;
      font-weight: 500;
    }

    /* Loading */
    .loading {
      position: relative;
      pointer-events: none;
      opacity: 0.6;
    }

    .loading::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 32px;
      height: 32px;
      margin: -16px 0 0 -16px;
      border: 2px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }

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

    /* Responsive */
    @media (max-width: 768px) {
      .main {
        padding: 1rem;
        padding-top: 2rem;
      }

      .editor {
        padding: 2rem;
        font-size: 1rem;
        min-height: 60vh;
      }

      .fab {
        bottom: 1rem;
        right: 1rem;
        width: 48px;
        height: 48px;
      }

      .menu {
        bottom: 1rem;
        right: 1rem;
      }

      .toast {
        top: 1rem;
        right: 1rem;
        left: 1rem;
      }

      .btn-text {
        display: none;
      }
    }

    /* Print */
    @media print {
      .fab,
      .menu,
      .toast {
        display: none !important;
      }

      .editor {
        border: none;
        box-shadow: none;
        padding: 0;
      }
    }

    /* Accessibility */
    @media (prefers-reduced-motion: reduce) {
      * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
      }
    }

    .focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }

    /* Modal */
    .modal-overlay {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0, 0, 0, 0.7);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.3s ease, visibility 0.3s ease;
      z-index: 2000;
      padding: 1rem;
    }
    .modal-overlay.visible {
      opacity: 1;
      visibility: visible;
    }
    .modal {
      background: var(--bg-elevated);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 1.5rem;
      width: 100%;
      max-width: 400px;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
      transform: translateY(15px) scale(0.98);
      opacity: 0;
      transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
      color: var(--text);
    }
    .modal-overlay.visible .modal {
      transform: translateY(0) scale(1);
      opacity: 1;
    }
    
    /* Entrance animations */
    .modal-overlay.visible .share-option-group {
      animation: modalItemFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both 0.1s;
    }
    
    .modal-overlay.visible .share-btn:nth-child(1) {
      animation: modalItemFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both 0.15s;
    }
    
    .modal-overlay.visible .share-btn:nth-child(2) {
      animation: modalItemFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both 0.2s;
    }
    
    @keyframes modalItemFadeIn {
      from {
        opacity: 0;
        transform: translateY(10px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }
    .modal-title {
      font-size: 1.25rem;
      font-weight: 600;
      margin-bottom: 0.5rem;
    }
    .modal-body {
      margin-bottom: 1.5rem;
      color: var(--text-secondary);
      font-size: 0.875rem;
      line-height: 1.5;
    }
    .input-field {
      width: 100%;
      padding: 0.75rem 1rem;
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      color: var(--text);
      font-size: 1rem;
      outline: none;
      transition: var(--transition);
      margin-top: 0.5rem;
      font-family: inherit;
    }
    .input-field:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px var(--accent-light);
    }
    .modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 0.75rem;
      margin-top: 1.5rem;
    }

    /* Share Modal Specific Styles */
    .share-modal-content {
      max-width: 440px;
      padding: 0;
      overflow: hidden;
      border: 1px solid var(--border);
      background: linear-gradient(to bottom, var(--bg-elevated), var(--bg-secondary));
    }

    .modal-header {
      padding: 1.75rem 1.75rem 1rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .modal-subtitle {
      color: var(--text-tertiary);
      font-size: 0.95rem;
      margin-bottom: 1.75rem;
      line-height: 1.5;
    }

    .btn-close {
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      color: var(--text-tertiary);
      cursor: pointer;
      width: 32px;
      height: 32px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: var(--transition);
    }

    .btn-close:hover {
      background: var(--bg-elevated);
      color: var(--text);
      transform: rotate(90deg);
    }

    .btn-close svg {
      width: 18px;
      height: 18px;
    }

    .share-modal-content .modal-body {
      padding: 1.75rem;
      margin-bottom: 0;
    }

    .share-option-group {
      margin-bottom: 2rem;
    }

    .share-label {
      font-size: 0.75rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--text-tertiary);
      margin-bottom: 0.75rem;
      display: block;
    }

    .select-wrapper {
      position: relative;
      display: flex;
      align-items: center;
    }

    .share-select {
      appearance: none;
      margin-top: 0;
      cursor: pointer;
      padding: 0.875rem 1.25rem;
      padding-right: 3rem;
      font-weight: 500;
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      border-radius: 12px;
      width: 100%;
      font-size: 0.95rem;
    }

    .share-select:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 4px var(--accent-light);
    }

    .select-icon {
      position: absolute;
      right: 1.25rem;
      width: 18px;
      height: 18px;
      color: var(--text-tertiary);
      pointer-events: none;
    }

    .share-actions {
      display: flex;
      flex-direction: column;
      gap: 1.25rem;
    }

    .share-btn {
      display: flex;
      align-items: center;
      gap: 1.25rem;
      padding: 1.25rem;
      border-radius: 16px;
      border: 1px solid var(--border);
      background: var(--bg-elevated);
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
      text-align: left;
      width: 100%;
      position: relative;
      overflow: hidden;
    }

    .share-btn::after {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0; bottom: 0;
      background: var(--accent);
      opacity: 0;
      transition: opacity 0.2s ease;
      z-index: 0;
    }

    .share-btn:hover::after {
      opacity: 0.03;
    }

    .share-btn-icon {
      width: 48px;
      height: 48px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
      z-index: 1;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .share-btn-icon svg {
      width: 24px;
      height: 24px;
    }

    .share-btn-text {
      display: flex;
      flex-direction: column;
      z-index: 1;
    }

    .share-btn-text span {
      font-weight: 600;
      font-size: 1.05rem;
      color: var(--text);
      margin-bottom: 0.25rem;
    }

    .share-btn-text small {
      font-size: 0.8rem;
      color: var(--text-tertiary);
    }

    .share-btn-primary .share-btn-icon {
      background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
      color: white;
    }

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

    .share-btn:hover {
      transform: translateY(-4px) scale(1.02);
      box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.3);
      border-color: var(--accent);
    }

    .share-btn-primary:hover .share-btn-icon {
      transform: scale(1.1);
      box-shadow: 0 0 20px var(--accent-light);
    }

    .share-btn-secondary:hover .share-btn-icon {
      background: var(--text);
      color: var(--bg);
      transform: scale(1.1);
    }

    .share-btn:active {
      transform: translateY(-1px) scale(0.98);
    }
    
    /* Status Bar */
    .status-bar {
      border-top: 1px solid var(--border);
      padding: 0.5rem 1.5rem;
      display: flex;
      justify-content: flex-start;
      gap: 1.5rem;
      color: var(--text-tertiary);
      font-size: 0.75rem;
      font-weight: 500;
      font-variant-numeric: tabular-nums;
      border-bottom-left-radius: var(--radius-xl);
      border-bottom-right-radius: var(--radius-xl);
      background: var(--bg-secondary);
      opacity: 0.8;
    }

    .editor-container {
      display: flex;
      flex-direction: column;
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow-lg);
      background: var(--bg-elevated);
      border: 1px solid var(--border);
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .editor {
      border: none;
      box-shadow: none;
      border-bottom-left-radius: 0;
      border-bottom-right-radius: 0;
      min-height: calc(70vh - 40px);
    }