* {
  box-sizing: border-box;
}

:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  font-weight: 500;
  color: #3b82f6;
  text-decoration: none;
}

a:hover {
  color: #2563eb;
  text-decoration: underline;
}

#app {
  height: 100vh;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.5em 0;
  font-weight: 600;
}

p {
  margin: 0 0 0.5em 0;
}

button {
  font-family: inherit;
  font-size: inherit;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 8px 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }

  body {
    background-color: #0f172a;
    color: #f8fafc;
  }
}


.milkdown {
  /* background-color: green; */
  flex: 1;
  width: 100% !important;
  height: 100% !important;
  display: flex;
  padding: 5px;
  /* border: 1px solid green; */

}
.milkdown > div {
  /* background-color: yellow; */
  outline: none;
  /* border: 1px solid green; */
  flex: 1;
  width: 100%;
  height: 100%;
}

  .editor-wrapper > div {
    flex: 1;
    /* border: 1px solid red; */
  }
  .settings-overlay.svelte-182y78p {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
  }

  .settings-modal.svelte-182y78p {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  }

  .settings-header.svelte-182y78p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }

  .settings-header.svelte-182y78p h2:where(.svelte-182y78p) {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
  }

  .close-button.svelte-182y78p {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
  }

  .close-button.svelte-182y78p:hover {
    background: #f3f4f6;
  }

  .setting-group.svelte-182y78p {
    margin-bottom: 20px;
  }

  .setting-group.svelte-182y78p label:where(.svelte-182y78p) {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
  }

  .api-key-input.svelte-182y78p {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: monospace;
  }

  .api-key-input.svelte-182y78p:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  }

  .api-key-help.svelte-182y78p {
    margin-top: 6px;
    font-size: 12px;
    color: #6b7280;
  }

  .api-key-help.svelte-182y78p a:where(.svelte-182y78p) {
    color: #3b82f6;
    text-decoration: none;
  }

  .api-key-help.svelte-182y78p a:where(.svelte-182y78p):hover {
    text-decoration: underline;
  }

  .setting-actions.svelte-182y78p {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .save-button.svelte-182y78p {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
  }

  .save-button.svelte-182y78p:hover:not(:disabled) {
    background: #2563eb;
  }

  .save-button.svelte-182y78p:disabled {
    background: #9ca3af;
    cursor: not-allowed;
  }

  .clear-button.svelte-182y78p {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
  }

  .clear-button.svelte-182y78p:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
  }

  .success-message.svelte-182y78p {
    color: #059669;
    font-size: 14px;
    font-weight: 500;
  }

  main.svelte-1n46o8q {
    height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: system-ui, sans-serif;
    margin: 0;
    padding: 0;
  }

  .bar.svelte-1n46o8q {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    align-items: center;
    flex-shrink: 0;
  }

  .bar.svelte-1n46o8q button:where(.svelte-1n46o8q) {
    padding: 8px 12px;
    cursor: pointer;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .bar.svelte-1n46o8q button:where(.svelte-1n46o8q):hover {
    background: #f3f4f6;
    border-color: #9ca3af;
  }

  .bar.svelte-1n46o8q button:where(.svelte-1n46o8q):active {
    background: #e5e7eb;
  }

  .status.svelte-1n46o8q {
    font-size: 13px;
    color: #6b7280;
    margin-left: auto;
    padding: 4px 8px;
    background: #f3f4f6;
    border-radius: 4px;
    min-width: 100px;
    text-align: center;
  }

  .editor-wrapper.svelte-1n46o8q {
    flex: 1;
    padding: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    overflow-y: scroll;
  }


  /* Dark mode support */
  @media (prefers-color-scheme: dark) {
    main.svelte-1n46o8q {
      background: #111827;
    }

    .bar.svelte-1n46o8q {
      background: #1f2937;
      border-bottom-color: #374151;
    }

    .bar.svelte-1n46o8q button:where(.svelte-1n46o8q) {
      background: #374151;
      border-color: #4b5563;
      color: #f9fafb;
    }

    .bar.svelte-1n46o8q button:where(.svelte-1n46o8q):hover {
      background: #4b5563;
      border-color: #6b7280;
    }

    .status.svelte-1n46o8q {
      background: #374151;
      color: #d1d5db;
    }
  }
