:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #161920;
  --panel-strong: #1d212b;
  --text: #e6e8ef;
  --muted: #a6adbb;
  --accent: #4cb4ff;
  --accent-strong: #7ed0ff;
  --border: #2a3040;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f6f7fb;
    --panel: #ffffff;
    --panel-strong: #eef0f7;
    --text: #121520;
    --muted: #525a6d;
    --accent: #1f7ddc;
    --accent-strong: #0e63b6;
    --border: #d9dce6;
    --shadow: 0 10px 30px rgba(15, 18, 34, 0.12);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, var(--bg), #0c0e13 55%, var(--panel));
  color: var(--text);
}

.wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 17, 21, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

header a {
  color: var(--text);
  text-decoration: none;
}

.site-title {
  font-weight: 700;
  letter-spacing: 0.4px;
}

.nav {
  display: flex;
  gap: 14px;
  font-size: 0.95rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--text);
  background: rgba(76, 180, 255, 0.08);
  outline: none;
}

main {
  padding-top: 16px;
}

.hero {
  background: linear-gradient(180deg, rgba(76, 180, 255, 0.12), rgba(76, 180, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 2rem;
}

.hero p {
  margin: 6px 0 0;
  color: var(--muted);
}

.page-header {
  margin: 10px 0 24px 0;
}

.section-heading {
  margin: 0 0 12px;
  font-size: 1.15rem;
  letter-spacing: 0.2px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.tool-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.tool-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
}

.tool-meta {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card p {
  color: var(--muted);
  margin: 0 0 8px;
}

footer {
  padding: 20px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  text-align: center;
  color: var(--muted);
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover,
footer a:focus-visible {
  color: var(--accent-strong);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.two-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

textarea {
  width: 100%;
  min-height: 180px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--panel-strong);
  color: var(--text);
  padding: 12px;
  resize: vertical;
  font-family: inherit;
}

a.inline {
  color: var(--accent);
  text-decoration: none;
}

a.inline:hover,
a.inline:focus-visible {
  color: var(--accent-strong);
}

.tool-card.clickable:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.3);
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

main dl {
  margin: 0;
}

main dt {
  font-weight: 700;
  margin-top: 12px;
}

main dd {
  margin: 6px 0 12px 0;
  color: var(--muted);
}

.skeleton-note {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 8px;
}

/* AI Text Sanitizer page */
.ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 10px 0;
}

.ai-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-btns-output {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ai-copy-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ai-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.button-primary {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(76, 180, 255, 0.2), rgba(76, 180, 255, 0.05));
  box-shadow: 0 10px 30px rgba(76, 180, 255, 0.22);
}

.button-secondary {
  border-color: var(--border);
  background: var(--panel-strong);
}

.button-ghost {
  border-color: var(--border);
  background: transparent;
}

.pill {
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  background: var(--panel-strong);
  display: inline-flex;
  gap: 6px;
}

.pill.info {
  color: var(--accent);
  border-color: rgba(76, 180, 255, 0.35);
}

.pill.good {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.45);
}

.pill.warn {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.45);
}

.pill.bad {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.45);
}

.pill b {
  color: var(--text);
  font-weight: 700;
}

.pill.good b {
  color: #22c55e;
}

.pill.warn b {
  color: #f59e0b;
}

.pill.bad b {
  color: #ef4444;
}

.pill.info b {
  color: var(--accent);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.ai-output {
  width: 100%;
  min-height: 180px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  line-height: 1.55;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

mark {
  padding: 0 2px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
}

mark.inv {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.35);
}

mark.punc {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.35);
}

mark.space {
  background: rgba(76, 180, 255, 0.14);
  border-color: rgba(76, 180, 255, 0.3);
}

mark.ctrl {
  background: rgba(168, 85, 247, 0.16);
  border-color: rgba(168, 85, 247, 0.34);
}

.ai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ai-table th,
.ai-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}

.ai-table th {
  color: var(--muted);
  font-weight: 600;
}

.empty {
  color: var(--muted);
  font-size: 0.95rem;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 8px;
}

/* Capitalize My Title */
.case-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.case-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.case-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.95rem;
}

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

.case-field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.case-line {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  padding: 12px 14px;
  font-size: 1rem;
  min-height: 0;
  height: 48px;
}

.case-line::placeholder {
  color: var(--muted);
}

.case-icons {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

.case-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.case-meta {
  color: var(--muted);
  font-size: 0.95rem;
  display: flex;
  gap: 12px;
  align-items: center;
}

.case-toast {
  position: fixed;
  inset: auto 18px 18px auto;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  font-size: 0.9rem;
}

.case-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* JSON Formatter */
.json-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.json-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.json-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.json-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.json-grid {
  align-items: start;
  gap: 14px;
}

.json-output {
  min-height: 220px;
}

.json-lint {
  margin-top: 10px;
}

.json-preview {
  margin-top: 10px;
}

.json-error-block {
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.json-error {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--text);
}

.json-error-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
}
