/* Global styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  border: none;
  box-shadow: none;
}

:root {
  color-scheme: dark;
  --bg: #0e1116;
  --bg-2: #141a1f;
  --card: #151b24;
  --card-2: #11161d;
  --text: #e6ebf2;
  --muted: #9aa6b6;
  --accent: #5de4a7;
  --accent-2: #4aa6ff;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 16px 40px rgba(4, 8, 16, 0.45);
  --radius: 12px;
  --content: 860px;
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

body {
  background:
    radial-gradient(700px 380px at 10% 10%, rgba(93, 228, 167, 0.12), transparent 60%),
    radial-gradient(640px 360px at 90% 10%, rgba(74, 166, 255, 0.12), transparent 55%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  margin: 0;
  padding: 36px 24px 60px;
}

body.page-b, body.page-c, body.page-d {
  padding: 36px 24px 60px;
}

h1 {
  font-size: 2.1em;
  letter-spacing: 0.2px;
  margin-bottom: 20px;
}

h2 {
  margin-top: 26px;
  margin-bottom: 12px;
  font-size: 1.2em;
}

a {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px;
  margin-bottom: 18px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

a:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

a.home-link {
  margin-bottom: 10px;
}


a.index-link {
  display: block;
  width: min(520px, 100%);
  text-align: center;
  padding: 12px 18px;
  margin-bottom: 14px;
}

/* Common form elements */
input[type="text"] {
  width: 100%;
  max-width: var(--content);
  background: rgba(15, 20, 28, 0.9);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 0.98em;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus {
  outline: none;
  border-color: rgba(93, 228, 167, 0.6);
  box-shadow: 0 0 0 3px rgba(93, 228, 167, 0.15);
}

input[type="text"]::placeholder {
  color: #7f8a9a;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.controls input[type="checkbox"] {
    transform: translateY(4px); /* Increase this value to lower it more */
}

/* Buttons */
button {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #0b0f14;
  border: none;
  padding: 10px 16px;
  margin: 0;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.96em;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 12px 22px rgba(15, 188, 139, 0.2);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(15, 188, 139, 0.3);
}

button.success {
  background: #2d5016;
  color: #e6f5dc;
  box-shadow: 0 10px 20px rgba(45, 80, 22, 0.35);
}

button:disabled {
  background: #2a2f39;
  color: #7b8493;
  cursor: not-allowed;
  opacity: 0.5;
}

/* Textarea and pre */
textarea, pre {
  width: 100%;
  max-width: var(--content);
  background: rgba(15, 20, 28, 0.9);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 0.96em;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  height: 170px;
  resize: vertical;
  padding-right: 45px;
}

textarea:focus,
input[type="text"]:focus,
pre:focus {
  border-color: rgba(74, 166, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(74, 166, 255, 0.15);
}

pre {
  min-height: 200px;
  max-height: 440px;
  overflow: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

pre::-webkit-scrollbar {
  width: 10px;
}

pre::-webkit-scrollbar-track {
  background: #141922;
  border-radius: 5px;
}

pre::-webkit-scrollbar-thumb {
  background: #2d3442;
  border-radius: 5px;
}

pre::-webkit-scrollbar-thumb:hover {
  background: #3a4252;
}

/* Layout elements */
.textarea-wrapper {
  position: relative;
  width: 100%;
  max-width: var(--content);
}

.section {
  margin-bottom: 18px;
  width: 100%;
  max-width: var(--content);
  background: linear-gradient(160deg, rgba(21, 27, 36, 0.95), rgba(16, 22, 30, 0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.controls {
  margin-top: 10px;
  margin-bottom: 10px;
}

.hidden {
  display: none;
}

.label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9em;
}

label {
  margin-right: 15px;
  font-size: 0.9em;
  cursor: pointer;
  margin: 0;
  color: var(--muted);
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.checkbox-label {
  font-size: 0.9em;
  cursor: pointer;
  margin: 0;
  color: var(--muted);
}

.button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.file-upload-wrapper {
  display: flex;
  align-items: center;
  gap: 15px;
}

.file-upload-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.file-upload-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.file-info {
  font-size: 0.9em;
  color: var(--muted);
}

#fileInput {
  display: none;
}

.icon {
  width: 18px;
  height: 18px;
}

.paste-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  transition: all 0.2s;
}

.paste-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}

.paste-btn svg {
  width: 18px;
  height: 18px;
  fill: var(--text);
}

.preview-section {
  margin-top: 30px;
  width: 100%;
  max-width: var(--content);
  display: none;
}

.preview-section.show {
  display: block;
}

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

.preview-header h2 {
  font-size: 1.3em;
  margin: 0;
}

.match-count {
  font-size: 0.9em;
  color: var(--muted);
}

@media (min-width: 1100px) {
  :root {
    --content: 980px;
  }

  h1 {
    font-size: 2.5em;
  }
}

@media (max-width: 520px) {
  body {
    padding: 28px 18px 50px;
  }

  h1 {
    font-size: 1.7em;
  }

  a.index-link {
    padding: 10px 14px;
    font-size: 0.95em;
  }
}
