html,
body {
  color: #333;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 1em;
  line-height: 1.5em;
  background-color: #fff;
  overscroll-behavior-y: none;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
  font-size: 1em;
  margin: 0;
  padding: 0;
  font-weight: normal;
}

p {
  margin: 1em;
}

a:link,
a:visited,
a:hover a:active {
  color: #333;
  text-decoration: none;
}

img {
  border: none;
}

/* Modern Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  height: 48px;
  width: 100%;

  background: linear-gradient(135deg, #2d3436 0%, #3d4852 50%, #4a5568 100%);
  font-size: 13px;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
}

.header-logo {
  display: flex;
  align-items: center;
  padding: 8px 12px;
}

.header-logo img {
  height: 28px;
  width: auto;
  transition: opacity 0.2s ease;
}

.header-logo a:hover img {
  opacity: 0.85;
}

header a:link,
header a:hover,
header a:visited,
header a:active {
  color: #fff;
}

header a:hover {
  text-decoration: none;
}

/* Menu Items */
#menu-items {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.logo a {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
  padding: 8px 12px;
  background: linear-gradient(90deg, #e94560, #ff6b9d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo a:hover {
  opacity: 0.9;
}

.menu-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 12px;
}

.menu-btn a,
.menu-btn label {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-weight: 500;
  cursor: pointer;
}

.menu-btn:hover a,
.menu-btn:hover label {
  background: rgba(255, 255, 255, 0.1);
}

#sync-button {
  display: flex;
  align-items: center;
}

#sync-button input[type="checkbox"] {
  margin-right: 6px;
  cursor: pointer;
}

/* Dropdown styles */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #333;
  min-width: 140px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  z-index: 100;
  border-radius: 4px;
  top: 100%;
  left: 0;
  padding-top: 4px;
}

.dropdown-content a {
  color: #fff;
  padding: 10px 14px;
  text-decoration: none;
  display: block;
}

.dropdown-content a:first-child {
  border-radius: 4px 4px 0 0;
}

.dropdown-content a:last-child {
  border-radius: 0 0 4px 4px;
}

.dropdown-content a:hover {
  background-color: #555;
  text-decoration: none;
}

.dropdown:hover .dropdown-content {
  display: block;
}

#import-button {
  cursor: pointer;
}

#sync-button {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Print Styles */
@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  header,
  footer,
  #edit,
  #split-divider {
    display: none !important;
  }

  body {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    background: white !important;
  }

  #container {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    border: none !important;
  }

  #preview {
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  #preview-wrapper {
    padding: 20px !important;
  }

  #output {
    max-width: 100% !important;
  }

  .markdown-body {
    font-size: 12pt !important;
    line-height: 1.6 !important;
  }

  /* Code blocks styling for print */
  .markdown-body pre {
    background-color: #f6f8fa !important;
    border: 1px solid #e1e4e8 !important;
    border-radius: 6px !important;
    padding: 16px !important;
    overflow: visible !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    page-break-inside: avoid;
  }

  .markdown-body pre code {
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    font-size: 11pt !important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
  }

  .markdown-body code {
    background-color: rgba(175, 184, 193, 0.2) !important;
    border-radius: 4px !important;
    padding: 0.2em 0.4em !important;
    font-size: 11pt !important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
  }

  /* Table styling for print */
  .markdown-body table {
    border-collapse: collapse !important;
    width: 100% !important;
    page-break-inside: avoid;
  }

  .markdown-body table th,
  .markdown-body table td {
    border: 1px solid #d0d7de !important;
    padding: 8px 12px !important;
  }

  .markdown-body table th {
    background-color: #f6f8fa !important;
    font-weight: 600 !important;
  }

  .markdown-body table tr:nth-child(even) {
    background-color: #f6f8fa !important;
  }

  .markdown-body table tr:nth-child(odd) {
    background-color: #ffffff !important;
  }

  .markdown-body img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  .markdown-body h1,
  .markdown-body h2,
  .markdown-body h3,
  .markdown-body h4,
  .markdown-body h5,
  .markdown-body h6 {
    page-break-after: avoid;
  }

  /* Blockquote styling for print */
  .markdown-body blockquote {
    border-left: 4px solid #d0d7de !important;
    background-color: #f6f8fa !important;
    padding: 8px 16px !important;
    margin: 16px 0 !important;
    color: #57606a !important;
  }
}

header input[type="checkbox"] {
  vertical-align: middle;
  margin-right: 4px;
  margin-top: 0px;
  accent-color: #e94560;
}

#github {
  padding-right: 12px;
}

#github img {
  display: block;
  width: 20px;
  height: 20px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

#github a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

#github a:hover {
  background: rgba(255, 255, 255, 0.1);
}

#github a:hover img {
  opacity: 1;
}

/* Footer */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  background: linear-gradient(135deg, #2d3436 0%, #3d4852 50%, #4a5568 100%);
  color: #ffffff;
  font-size: 13px;
  height: 32px;
}

footer a,
footer a:link,
footer a:visited {
  color: #00d9ff;
  text-decoration: underline;
  font-weight: 600;
  transition: color 0.2s ease;
}

footer a:hover {
  color: #5eeeff;
  text-decoration: underline;
}

.footer-logo {
  height: 18px;
  width: auto;
  vertical-align: middle;
  margin-right: 4px;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  opacity: 0.9;
}

.status-divider {
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.3);
}

#container {
  flex-grow: 1;
  overflow: hidden;
  width: 100%;
  margin: 0 auto;

  background-color: #fff;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
}

#editor-wrapper {
  height: 100%;
}

#editor {
  height: 100%;
}

#preview-wrapper {
  padding: 8px 16px 16px 16px;
}

.column {
  width: 50%;
  padding: 0;
  margin: 0;
  white-space: nowrap;
  vertical-align: top;
}

#preview.column {
  overflow-y: scroll;
  white-space: normal;
}

.split-container {
  display: flex;
  height: 100%;
  width: 100%;
}

.editor-pane,
.preview-pane {
  height: 100%;
}

.split-divider {
  width: 5px;
  background: #ccc;
  cursor: col-resize;
  z-index: 1;
}

.split-divider.hover {
  background: #999;
}

.split-divider.active {
  background: #666;
}

/* Zen Mode */
.zen-mode header,
.zen-mode footer {
  display: none !important;
}

.zen-mode #container {
  height: 100vh !important;
  border: none !important;
}

.zen-mode #editor,
.zen-mode #preview {
  height: 100vh !important;
}