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

:root {
  /* Base variables */
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.1);
  --secondary-color: #64748b;
  --danger-color: #dc2626;
  --danger-hover: #b91c1c;
  --success-color: #16a34a;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --focus-ring: 0 0 0 3px var(--primary-light);

  /* Page theme variables (default dark) */
  --page-bg: #0f172a;
  --container-bg: #1e293b;
  --border-color: #334155;
  --bg-light: #1e293b;
  --bg-white: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --input-bg: #0f172a;
  --input-border: #334155;
  --card-bg: #1e293b;

  /* Header/nav theme */
  --nav-bg: linear-gradient(135deg, #050f2e 0%, #06184e 100%);
  --header-bg: linear-gradient(135deg, #06184e 0%, #0a2463 50%, #071b48 100%);

  /* Editor theme variables */
  --editor-bg: #1f2937;
  --editor-text: #e5e7eb;
  --editor-border: #4b5563;
  --editor-toolbar-bg: #374151;
  --editor-line-number: #6b7280;
  --editor-gutter: #374151;
}

/* Theme: Light */
[data-theme="light"] {
  --page-bg: #f1f5f9;
  --container-bg: #ffffff;
  --border-color: #e2e8f0;
  --bg-light: #f8fafc;
  --bg-white: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --input-bg: #ffffff;
  --input-border: #e2e8f0;
  --card-bg: #ffffff;
  --editor-bg: #ffffff;
  --editor-text: #24292f;
  --editor-border: #d0d7de;
  --editor-toolbar-bg: #f6f8fa;
  --editor-line-number: #8b949e;
  --editor-gutter: #f6f8fa;
}

/* Theme: Dark (Default) */
[data-theme="dark"] {
  --page-bg: #0f172a;
  --container-bg: #1e293b;
  --border-color: #334155;
  --bg-light: #1e293b;
  --bg-white: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --input-bg: #0f172a;
  --input-border: #334155;
  --card-bg: #1e293b;
  --editor-bg: #1f2937;
  --editor-text: #e5e7eb;
  --editor-border: #4b5563;
  --editor-toolbar-bg: #374151;
  --editor-line-number: #6b7280;
  --editor-gutter: #374151;
}

/* Theme: Dracula */
[data-theme="dracula"] {
  --page-bg: #1e1f29;
  --container-bg: #282a36;
  --border-color: #44475a;
  --bg-light: #282a36;
  --bg-white: #282a36;
  --text-primary: #f8f8f2;
  --text-secondary: #6272a4;
  --input-bg: #21222c;
  --input-border: #44475a;
  --card-bg: #282a36;
  --editor-bg: #282a36;
  --editor-text: #f8f8f2;
  --editor-border: #44475a;
  --editor-toolbar-bg: #21222c;
  --editor-line-number: #6272a4;
  --editor-gutter: #21222c;
}

/* Theme: Monokai */
[data-theme="monokai"] {
  --page-bg: #1e1f1c;
  --container-bg: #272822;
  --border-color: #49483e;
  --bg-light: #272822;
  --bg-white: #272822;
  --text-primary: #f8f8f2;
  --text-secondary: #90908a;
  --input-bg: #1e1f1c;
  --input-border: #49483e;
  --card-bg: #272822;
  --editor-bg: #272822;
  --editor-text: #f8f8f2;
  --editor-border: #49483e;
  --editor-toolbar-bg: #1e1f1c;
  --editor-line-number: #90908a;
  --editor-gutter: #1e1f1c;
}

/* Theme: Nord */
[data-theme="nord"] {
  --page-bg: #242933;
  --container-bg: #2e3440;
  --border-color: #3b4252;
  --bg-light: #2e3440;
  --bg-white: #2e3440;
  --text-primary: #eceff4;
  --text-secondary: #81a1c1;
  --input-bg: #242933;
  --input-border: #3b4252;
  --card-bg: #2e3440;
  --editor-bg: #2e3440;
  --editor-text: #d8dee9;
  --editor-border: #3b4252;
  --editor-toolbar-bg: #242933;
  --editor-line-number: #616e88;
  --editor-gutter: #242933;
}

/* Theme: Solarized Dark */
[data-theme="solarized-dark"] {
  --page-bg: #001e26;
  --container-bg: #002b36;
  --border-color: #073642;
  --bg-light: #002b36;
  --bg-white: #002b36;
  --text-primary: #93a1a1;
  --text-secondary: #657b83;
  --input-bg: #001e26;
  --input-border: #073642;
  --card-bg: #002b36;
  --editor-bg: #002b36;
  --editor-text: #839496;
  --editor-border: #073642;
  --editor-toolbar-bg: #001e26;
  --editor-line-number: #586e75;
  --editor-gutter: #001e26;
}

/* Theme: Solarized Light */
[data-theme="solarized-light"] {
  --page-bg: #eee8d5;
  --container-bg: #fdf6e3;
  --border-color: #eee8d5;
  --bg-light: #fdf6e3;
  --bg-white: #fdf6e3;
  --text-primary: #073642;
  --text-secondary: #657b83;
  --input-bg: #fdf6e3;
  --input-border: #eee8d5;
  --card-bg: #fdf6e3;
  --editor-bg: #fdf6e3;
  --editor-text: #657b83;
  --editor-border: #eee8d5;
  --editor-toolbar-bg: #eee8d5;
  --editor-line-number: #93a1a1;
  --editor-gutter: #eee8d5;
}

/* Theme: One Dark (Atom) */
[data-theme="one-dark"] {
  --page-bg: #1b1d23;
  --container-bg: #282c34;
  --border-color: #3e4451;
  --bg-light: #282c34;
  --bg-white: #282c34;
  --text-primary: #abb2bf;
  --text-secondary: #636d83;
  --input-bg: #21252b;
  --input-border: #3e4451;
  --card-bg: #282c34;
  --editor-bg: #282c34;
  --editor-text: #abb2bf;
  --editor-border: #3e4451;
  --editor-toolbar-bg: #21252b;
  --editor-line-number: #636d83;
  --editor-gutter: #21252b;
}

/* Theme: VS Code Dark */
[data-theme="vscode-dark"] {
  --page-bg: #1e1e1e;
  --container-bg: #252526;
  --border-color: #3c3c3c;
  --bg-light: #252526;
  --bg-white: #252526;
  --text-primary: #d4d4d4;
  --text-secondary: #858585;
  --input-bg: #1e1e1e;
  --input-border: #3c3c3c;
  --card-bg: #252526;
  --editor-bg: #1e1e1e;
  --editor-text: #d4d4d4;
  --editor-border: #3c3c3c;
  --editor-toolbar-bg: #252526;
  --editor-line-number: #858585;
  --editor-gutter: #252526;
}

/* Theme: Vim (Gruvbox Dark) */
[data-theme="vim"] {
  --page-bg: #1d2021;
  --container-bg: #282828;
  --border-color: #3c3836;
  --bg-light: #282828;
  --bg-white: #282828;
  --text-primary: #ebdbb2;
  --text-secondary: #928374;
  --input-bg: #1d2021;
  --input-border: #3c3836;
  --card-bg: #282828;
  --editor-bg: #282828;
  --editor-text: #ebdbb2;
  --editor-border: #3c3836;
  --editor-toolbar-bg: #1d2021;
  --editor-line-number: #928374;
  --editor-gutter: #1d2021;
}

/* Theme: Tokyo Night */
[data-theme="tokyo-night"] {
  --page-bg: #16161e;
  --container-bg: #1a1b26;
  --border-color: #292e42;
  --bg-light: #1a1b26;
  --bg-white: #1a1b26;
  --text-primary: #c0caf5;
  --text-secondary: #565f89;
  --input-bg: #16161e;
  --input-border: #292e42;
  --card-bg: #1a1b26;
  --editor-bg: #1a1b26;
  --editor-text: #a9b1d6;
  --editor-border: #292e42;
  --editor-toolbar-bg: #16161e;
  --editor-line-number: #565f89;
  --editor-gutter: #16161e;
}

/* Theme: Catppuccin Mocha */
[data-theme="catppuccin"] {
  --page-bg: #11111b;
  --container-bg: #1e1e2e;
  --border-color: #313244;
  --bg-light: #1e1e2e;
  --bg-white: #1e1e2e;
  --text-primary: #cdd6f4;
  --text-secondary: #a6adc8;
  --input-bg: #181825;
  --input-border: #313244;
  --card-bg: #1e1e2e;
  --editor-bg: #1e1e2e;
  --editor-text: #cdd6f4;
  --editor-border: #313244;
  --editor-toolbar-bg: #181825;
  --editor-line-number: #6c7086;
  --editor-gutter: #181825;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--page-bg);
  min-height: 100vh;
  padding: 20px;
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  background: var(--container-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: background-color 0.3s ease;
}

/* Sticky Navigation Bar */
.sticky-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, #050f2e 0%, #06184e 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  backdrop-filter: blur(10px);
}

.nav-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo {
  height: 32px;
  width: auto;
}

.btn-share-nav {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.btn-share-nav:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-share-nav:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4);
}

.btn-share-nav i {
  font-size: 13px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Header / Hero Section */
header {
  background: linear-gradient(135deg, #020617 0%, #0f172a 50%, #020617 100%);
  color: white;
  padding: 20px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 300px;
  background: radial-gradient(
    ellipse at center,
    rgba(37, 99, 235, 0.1) 0%,
    rgba(99, 102, 241, 0.05) 40%,
    transparent 70%
  );
  pointer-events: none;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  z-index: 1;
}

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

.hero-tagline {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
  line-height: 1.3;
}

.hero-description {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
  line-height: 1.4;
}

.hero-features {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.hero-feature {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s;
}

.hero-feature:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.hero-feature i {
  font-size: 10px;
  color: #60a5fa;
}

header p {
  opacity: 0.85;
  font-size: 14px;
}


/* Snippet Chain */
.snippet-chain {
  padding: 16px 32px;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-color);
  display: none;
}

.snippet-chain.visible {
  display: block;
}

.snippet-chain h3 {
  margin-bottom: 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chain-items {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chain-item {
  background: var(--bg-white);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.chain-item:hover {
  border-color: var(--primary-color);
  background: #eff6ff;
}

.chain-item.current {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  font-weight: 500;
}

.chain-arrow {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Editor Section */
.editor-section {
  padding: 24px 32px;
  position: relative;
  transition: all 0.3s ease;
}

/* Collapsed editor state (when viewing shared snippet) */
.editor-section.collapsed {
  display: none;
}

/* Edit button bar shown when editor is collapsed */
.edit-bar {
  display: none;
  padding: 16px 32px;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.edit-bar.visible {
  display: flex;
}

.edit-bar-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

.edit-bar-info i {
  color: var(--primary-color);
}

.btn-edit {
  background: var(--primary-color);
  color: white;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-edit:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-edit:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Drag and drop overlay */
.editor-section.drag-over {
  background: rgba(59, 130, 246, 0.05);
}

.editor-section.drag-over::before {
  content: "\f56f";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% - 20px));
  font-size: 48px;
  color: var(--primary-color);
  z-index: 101;
  pointer-events: none;
  opacity: 0.8;
}

.editor-section.drag-over::after {
  content: "Drop file to upload";
  position: absolute;
  inset: 24px;
  border: 2px dashed var(--primary-color);
  border-radius: var(--radius-lg);
  background: rgba(59, 130, 246, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 60px;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-color);
  z-index: 100;
  pointer-events: none;
}

.snippet-title-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.snippet-title-section label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
}

.label-hint {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 13px;
}

.snippet-title-section input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  transition: all 0.2s;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text-primary);
}

.snippet-title-section input:hover {
  border-color: var(--secondary-color);
}

.snippet-title-section input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: var(--focus-ring);
}

/* File Tabs */
.file-tabs {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.tabs-container {
  flex: 1;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.tabs-container::-webkit-scrollbar {
  height: 4px;
}

.tabs-container::-webkit-scrollbar-track {
  background: var(--bg-light);
  border-radius: 2px;
}

.tabs-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.tabs-container::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}

.file-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  min-width: 100px;
  position: relative;
  font-size: 13px;
  color: var(--text-secondary);
}

.file-tab:hover {
  background: var(--bg-light);
  color: var(--text-primary);
}

.file-tab.active {
  background: var(--bg-white);
  border-color: var(--border-color);
  border-bottom-color: var(--primary-color);
  color: var(--text-primary);
  font-weight: 500;
}

.file-tab-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-tab-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.file-tab-close:hover {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger-color);
}

.add-file-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Controls */
.controls {
  margin-bottom: 16px;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 120px;
  gap: 16px;
}

.control-group {
  margin-bottom: 0;
}

.control-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 13px;
}

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

#languageSelect,
#fileName,
#lineNumber {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  transition: all 0.2s;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text-primary);
}

#languageSelect:hover,
#fileName:hover,
#lineNumber:hover {
  border-color: var(--secondary-color);
}

#languageSelect:focus,
#fileName:focus,
#lineNumber:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: var(--focus-ring);
}

/* Buttons */
.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  white-space: nowrap;
}

.btn i {
  font-size: 13px;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-sm);
}

.btn-primary:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

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

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

.btn-secondary:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-danger {
  background: var(--input-bg);
  color: var(--danger-color);
  border: 1px solid var(--border-color);
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.1);
  border-color: var(--danger-color);
}

.btn-success {
  background: var(--success-color);
  color: white;
  border-color: var(--success-color);
}

.btn-success:hover {
  background: #15803d;
  border-color: #15803d;
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--primary-color);
  color: white;
  border: none;
}

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

.btn-icon i {
  font-size: 14px;
  margin: 0;
}

/* Toolbar */
.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--editor-toolbar-bg);
  border: 1px solid var(--editor-border);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  gap: 12px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-toolbar {
  padding: 6px 12px;
  background: transparent;
  color: var(--editor-text);
  border: 1px solid var(--editor-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-toolbar:hover {
  background: var(--editor-border);
  color: white;
  border-color: var(--editor-line-number);
}

.btn-toolbar:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.btn-toolbar i {
  font-size: 13px;
}

.btn-toolbar-danger {
  color: #fca5a5;
  border-color: #7f1d1d;
}

.btn-toolbar-danger:hover {
  background: #7f1d1d;
  color: white;
  border-color: #991b1b;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--editor-border);
  margin: 0 4px;
}

/* Editor */
.editor-wrapper {
  margin-bottom: 20px;
}

#codeEditor {
  width: 100%;
  min-height: 320px;
  padding: 16px;
  border: 1px solid var(--editor-border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-family: "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro",
    monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  transition: all 0.2s;
  background: var(--editor-bg);
  color: var(--editor-text);
}

#codeEditor:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: var(--focus-ring);
}

#codeEditor::placeholder {
  color: var(--editor-line-number);
}

/* Preview Section */
.preview-section {
  padding: 24px 32px;
  background: var(--bg-light);
  border-top: 1px solid var(--border-color);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 16px;
  flex-wrap: wrap;
}

.preview-actions {
  display: flex;
  gap: 8px;
}

.code-stats {
  display: flex;
  gap: 16px;
  padding: 8px 12px;
  background: var(--editor-toolbar-bg);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: 12px;
  color: var(--editor-text);
  border: 1px solid var(--editor-border);
  border-bottom: none;
}

.code-stats span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.code-stats i {
  font-size: 11px;
  color: var(--editor-line-number);
}

.preview-header h3 {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-meta {
  flex: 1;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.preview-meta i {
  font-size: 12px;
}

pre {
  margin: 0;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--editor-border);
}

#codePreview {
  display: block;
  padding: 16px !important;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  overflow-x: auto;
  min-height: 120px;
  font-size: 13px;
  line-height: 1.6;
  background: var(--editor-bg) !important;
  color: var(--editor-text);
  counter-reset: line calc(var(--start-line, 1) - 1);
}

/* Line numbers */
pre.line-numbers {
  position: relative;
}

pre.line-numbers::before {
  content: "";
  position: absolute;
  left: 64px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--editor-gutter);
  z-index: 1;
}

pre.line-numbers #codePreview {
  padding-left: 76px !important;
  display: block;
}

.line-number {
  display: inline;
}

.line-number::before {
  content: attr(data-line);
  display: inline-block;
  width: 48px;
  margin-left: -68px;
  margin-right: 20px;
  text-align: right;
  color: var(--editor-line-number);
  font-size: 12px;
  user-select: none;
  pointer-events: none;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s;
  backdrop-filter: blur(4px);
}

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

.modal-content {
  background-color: var(--container-bg);
  margin: 80px auto;
  padding: 32px;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s;
  position: relative;
  border: 1px solid var(--border-color);
}

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

.close {
  position: absolute;
  right: 16px;
  top: 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.close:hover {
  background: var(--bg-light);
  color: var(--text-primary);
}

.modal-content h2 {
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-description {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.url-container {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

#shareUrl {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  font-family: "Monaco", "Menlo", "Consolas", monospace;
  font-size: 13px;
  background: var(--input-bg);
  color: var(--text-primary);
}

.info-box {
  background: var(--primary-light);
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.info-box i {
  color: var(--primary-color);
  margin-top: 2px;
  flex-shrink: 0;
}

.info-box p {
  color: var(--text-primary);
  font-size: 13px;
  margin: 0;
  line-height: 1.5;
}

/* URL Type Toggle */
.url-type-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-light);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: var(--focus-ring);
}

.toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

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

/* Password Protection */
.password-protection {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-light);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.password-protection .toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.password-protection .toggle-label i {
  color: var(--text-secondary);
}

.password-input-container {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  position: relative;
}

.password-input-container input {
  flex: 1;
  padding: 10px 12px;
  padding-right: 44px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--input-bg);
  color: var(--text-primary);
  transition: all 0.2s;
}

.password-input-container input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: var(--focus-ring);
}

.btn-show-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.btn-show-password:hover {
  color: var(--text-primary);
  background: var(--bg-light);
}

.password-modal-content {
  max-width: 400px;
}

/* Password Strength Indicator */
.password-strength {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  margin-top: -8px;
}

.strength-bar {
  flex: 1;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: width 0.3s, background-color 0.3s;
}

.strength-fill.weak {
  width: 25%;
  background: #ef4444;
}

.strength-fill.fair {
  width: 50%;
  background: #f59e0b;
}

.strength-fill.good {
  width: 75%;
  background: #22c55e;
}

.strength-fill.strong {
  width: 100%;
  background: #16a34a;
}

.strength-text {
  font-size: 11px;
  font-weight: 500;
  min-width: 50px;
}

.strength-text.weak {
  color: #ef4444;
}

.strength-text.fair {
  color: #f59e0b;
}

.strength-text.good {
  color: #22c55e;
}

.strength-text.strong {
  color: #16a34a;
}

.password-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid var(--danger-color);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  color: var(--danger-color);
  font-size: 13px;
}

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

/* Confirmation Modal */
.confirm-modal-content {
  max-width: 420px;
  text-align: center;
}

.confirm-modal-content h2 {
  margin-top: 0;
}

.confirm-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
}

.confirm-icon.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.confirm-icon.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.confirm-icon.info {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.confirm-icon.question {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
}

.password-tips {
  text-align: left;
  margin: 16px 0;
  padding-left: 24px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
}

.password-tips li {
  margin-bottom: 4px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.confirm-actions .btn {
  flex: 1;
  justify-content: center;
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: none;
}

.btn-warning:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  transform: translateY(-1px);
}

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

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

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
}

/* URL Loading */
.url-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  color: #92400e;
  font-size: 13px;
}

.url-loading i {
  font-size: 14px;
}

/* Notification */
.notification {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--container-bg);
  color: var(--text-primary);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  animation: slideInRight 0.3s ease-out;
  border-left: 4px solid var(--success-color);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--success-color);
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
}

.notification i {
  font-size: 18px;
}

.notification-success {
  border-left-color: var(--success-color);
}

.notification-success i {
  color: var(--success-color);
}

.notification-error {
  border-left-color: var(--danger-color);
}

.notification-error i {
  color: var(--danger-color);
}

.notification-info {
  border-left-color: var(--primary-color);
}

.notification-info i {
  color: var(--primary-color);
}

/* Keyboard Help */
.keyboard-help {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
}

.keyboard-help-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all 0.2s;
  font-size: 18px;
}

.keyboard-help-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.keyboard-help-tooltip {
  position: absolute;
  bottom: 60px;
  right: 0;
  background: var(--container-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  min-width: 280px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s;
  border: 1px solid var(--border-color);
}

.keyboard-help:hover .keyboard-help-tooltip,
.keyboard-help-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tooltip-header {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shortcut-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.shortcut-keys {
  display: flex;
  align-items: center;
  gap: 4px;
}

.shortcut-keys kbd {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text-primary);
  box-shadow: 0 1px 0 var(--border-color);
}

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

/* Hero Image */
.hero-image {
  width: 100%;
  max-width: 500px;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}

.hero-image:hover {
  transform: scale(1.02);
  opacity: 0.9;
}

@media (max-width: 768px) {
  .hero-image {
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .hero-image {
    max-width: 150px;
  }
}

.tooltip-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-secondary);
}

.tooltip-footer kbd {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1px 4px;
  font-size: 10px;
  font-family: inherit;
  color: var(--text-primary);
}

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

.notification.fadeOut {
  animation: fadeOut 0.3s;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Theme Switcher */
.theme-switcher {
  position: relative;
}

.theme-btn {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.theme-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

.theme-btn i {
  font-size: 14px;
}

.theme-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #1e293b;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  border: 1px solid #334155;
  min-width: 220px;
  max-height: 400px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 200;
}

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

.theme-dropdown-header {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #334155;
  background: #0f172a;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-size: 14px;
  color: #e2e8f0;
}

.theme-option:hover {
  background: #334155;
}

.theme-option.active {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
}

.theme-option.active .theme-preview {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

.theme-preview {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 2px solid #475569;
  flex-shrink: 0;
}

.theme-option-name {
  flex: 1;
  font-weight: 500;
}

.theme-option i {
  color: #60a5fa;
  opacity: 0;
  font-size: 12px;
}

.theme-option.active i {
  opacity: 1;
}

/* Theme preview colors */
.theme-preview-light { background: linear-gradient(135deg, #ffffff 50%, #f6f8fa 50%); }
.theme-preview-dark { background: linear-gradient(135deg, #1f2937 50%, #374151 50%); }
.theme-preview-dracula { background: linear-gradient(135deg, #282a36 50%, #44475a 50%); }
.theme-preview-monokai { background: linear-gradient(135deg, #272822 50%, #49483e 50%); }
.theme-preview-nord { background: linear-gradient(135deg, #2e3440 50%, #3b4252 50%); }
.theme-preview-solarized-dark { background: linear-gradient(135deg, #002b36 50%, #073642 50%); }
.theme-preview-solarized-light { background: linear-gradient(135deg, #fdf6e3 50%, #eee8d5 50%); }
.theme-preview-one-dark { background: linear-gradient(135deg, #282c34 50%, #3e4451 50%); }
.theme-preview-vscode-dark { background: linear-gradient(135deg, #1e1e1e 50%, #252526 50%); }
.theme-preview-vim { background: linear-gradient(135deg, #282828 50%, #3c3836 50%); }
.theme-preview-tokyo-night { background: linear-gradient(135deg, #1a1b26 50%, #292e42 50%); }
.theme-preview-catppuccin { background: linear-gradient(135deg, #1e1e2e 50%, #313244 50%); }

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

  .container {
    border-radius: 0;
  }

  header {
    padding: 16px 20px;
  }

  header::before,
  header::after {
    display: none;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .hero-features {
    width: 100%;
    justify-content: flex-start;
  }

  .sticky-nav {
    padding: 10px 16px;
  }

  .nav-logo {
    height: 26px;
  }

  .btn-share-nav {
    padding: 8px 14px;
    font-size: 13px;
  }

  .btn-share-nav span {
    display: none;
  }

  .btn-share-nav i {
    margin: 0;
  }

  .theme-btn span {
    display: none;
  }

  .theme-btn {
    padding: 8px 12px;
  }

  .theme-dropdown {
    right: -60px;
    min-width: 180px;
  }

  .logo h1 {
    font-size: 22px;
  }

  .logo i {
    font-size: 22px;
  }

  .hero-tagline {
    font-size: 14px;
  }

  .hero-description {
    font-size: 11px;
  }

  .hero-feature {
    font-size: 10px;
    padding: 4px 8px;
  }

  .editor-section,
  .preview-section {
    padding: 20px;
  }

  .file-tabs {
    flex-direction: row;
    align-items: center;
  }

  .tabs-container {
    flex: 1;
  }

  .file-tab {
    min-width: auto;
    padding: 6px 10px;
    font-size: 12px;
  }

  .controls-grid {
    grid-template-columns: 1fr 1fr;
  }

  .controls-grid .control-group:first-child {
    grid-column: 1 / -1;
  }

  .editor-toolbar {
    padding: 8px 10px;
  }

  .btn-toolbar .btn-text {
    display: none;
  }

  .btn-toolbar {
    padding: 8px 10px;
  }

  .url-container {
    flex-direction: column;
  }

  #copyUrlBtn {
    width: 100%;
  }

  .preview-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .preview-meta {
    width: 100%;
    justify-content: flex-start;
    margin: 8px 0;
  }

  .modal-content {
    margin: 20px;
    padding: 24px;
    width: auto;
  }
}

@media (max-width: 480px) {
  header p {
    font-size: 13px;
  }

  .hero-features {
    gap: 6px;
  }

  .controls-grid {
    grid-template-columns: 1fr;
  }

  .controls-grid .control-group:first-child {
    grid-column: auto;
  }
}
