:root {
  --font: 'Inter', sans-serif;
  --radius: 0.5rem;
  --bg: #0d1117;
  --container-bg: #161b22;
  --text: #c9d1d9;
  --border: #30363d;
  --primary: #58a6ff;
  --primary-hover: #3b82f6;
  --danger: #f85149;
  --danger-hover: #a50e14;
  --success: #2ea44f;
  --success-hover: #2c974b;
  --disabled-bg: #444c56;
  --scrollbar-thumb: #484f58;
  --scrollbar-track: #161b22;
  --label-inactive: #8b949e;
  --label-active: var(--primary);
  --tooltip-bg: var(--success);
  --tooltip-text: var(--bg);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body,
html {
  margin: 0;
  padding: 0;
  height: 100vh;
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 80rem;
  margin: 2rem auto 3rem;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 4rem);
  user-select: none;
}

.title {
  font-size: 2.25rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.5rem;
  user-select: text;
}

.split-container {
  flex: 1 1 auto;
  display: flex;
  gap: 1.5rem;
  height: 100%;
  border-radius: var(--radius);
  overflow: hidden;
}

.panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.section-heading {
  margin-bottom: 0.75rem;
  user-select: none;
  font-size: 1.25rem;
  font-weight: 600;
  align-self: center;
}

.faq-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-box {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1rem;
  background: var(--container-bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 2);
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.section-box::-webkit-scrollbar {
  width: 0.5rem;
}

.section-box::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 0.625rem;
}

.section-box::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.faq-pair {
  position: relative;
  margin-bottom: 1.5rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  user-select: text;
}

.faq-question-wrapper,
.faq-answer-wrapper {
  position: relative;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
}

.faq-question-wrapper {
  border-bottom: none;
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.faq-answer-wrapper {
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  margin-bottom: -0.25rem;
}

.faq-question-wrapper input,
.faq-answer-wrapper textarea {
  width: 100%;
  padding: 2rem 0.75rem 1rem;
  font-family: var(--font);
  font-size: 1rem;
  border: none;
  background: transparent;
  color: var(--text);
  resize: vertical;
  min-height: 3.25rem;
  box-sizing: border-box;
  border-radius: 0;
  line-height: 1.4;
}

.faq-answer-wrapper textarea {
  min-height: 4rem;
}

.faq-question-wrapper input::placeholder,
.faq-answer-wrapper textarea::placeholder {
  color: transparent;
}

.faq-question-wrapper label,
.faq-answer-wrapper label {
  position: absolute;
  top: 1rem;
  left: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--label-inactive);
  pointer-events: none;
  padding: 0 0.25rem;
  transition: all 0.2s ease;
  user-select: none;
  background: var(--bg);
}

input.faq-question:focus,
textarea.faq-answer:focus {
  outline: none;
  background: var(--container-bg);
  color: var(--text);
}

.delete-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--danger);
  color: var(--bg);
  font-weight: 700;
  font-size: 1.2rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-align: center;
  padding: 0;
  z-index: 10;
  transition: background-color 0.2s ease;
  line-height: 1;
}

.delete-btn:hover {
  background-color: var(--danger-hover);
}

.controls {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.btn {
  --shadow: 0 0 0 0 var(--primary);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  background: linear-gradient(145deg, var(--primary), var(--primary-hover));
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.3s ease;
  isolation: isolate;
  user-select: none;
}

.btn:hover:not(:disabled) {
  transform: translateY(-0.125rem);
  box-shadow: 0 0.25rem 0.625rem rgba(88, 166, 255, 0.3);
  background: linear-gradient(145deg, var(--primary-hover), var(--primary));
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
  box-shadow: 0 0.125rem 0.375rem rgba(88, 166, 255, 0.2);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  background: var(--disabled-bg);
}

.btn.secondary {
  background: linear-gradient(145deg, var(--success), var(--success-hover));
  color: var(--text);
}

.btn.secondary:hover:not(:disabled) {
  box-shadow: 0 0.25rem 0.625rem rgba(46, 164, 79, 0.25);
  background: linear-gradient(145deg, var(--success-hover), var(--success));
}

.tooltip-wrapper {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
  align-self: center;
}

#copyMessage {
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.4);
}

#copyMessage.show {
  opacity: 1;
  visibility: visible;
}

.faq-question-wrapper input:focus + label,
.faq-question-wrapper input:not(:placeholder-shown) + label,
.faq-answer-wrapper textarea:focus + label,
.faq-answer-wrapper textarea:not(:placeholder-shown) + label {
  top: 0.75rem;
  left: 0.5rem;
  font-size: 0.625rem;
  color: var(--label-active);
  background: var(--container-bg);
  padding: 0 0.25rem;
}

.code-preview pre {
  margin: 0;
  font-family: 'Fira Code', monospace, monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  user-select: text;
}
@media (max-width: 768px) {
  body,
  html {
    height: auto;
  }

  .container {
    height: auto;
    padding: 0 0.75rem;
    margin-top: 1rem;
    margin-bottom: 2rem;
  }
  .title {
    font-size: 1.75rem;
    margin-bottom: 1rem;
  }

  .split-container {
    flex-direction: column;
    gap: 1rem;
    height: auto;
  }

  .section-box {
    padding: 0.75rem;
    border-radius: var(--radius);
  }

  .section-heading {
    font-size: 1.125rem;
  }

  .faq-question-wrapper input,
  .faq-answer-wrapper textarea {
    padding: 1.5rem 0.75rem 0.75rem;
    font-size: 0.95rem;
  }

  .faq-question-wrapper label,
  .faq-answer-wrapper label {
    font-size: 0.75rem;
    top: 0.75rem;
  }

  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.95rem;
  }

  .controls {
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
  }

  .tooltip-wrapper {
    margin-top: 0.75rem;
  }

  .delete-btn {
    width: 1.125rem;
    height: 1.125rem;
    font-size: 1rem;
    top: 0.375rem;
    right: 0.375rem;
  }

  .code-preview pre {
    font-size: 0.8125rem;
  }
}

@media (max-width: 480px) {
  .title {
    font-size: 1.5rem;
  }

  .section-heading {
    font-size: 1rem;
  }

  .btn {
    font-size: 0.875rem;
  }

  .faq-question-wrapper input,
  .faq-answer-wrapper textarea {
    font-size: 0.875rem;
  }

  .faq-question-wrapper label,
  .faq-answer-wrapper label {
    font-size: 0.7rem;
  }

  .delete-btn {
    font-size: 0.95rem;
  }
}
