/* ---------- Dark theme (default) ---------- */
:root {
  color-scheme: dark;
  --bg: #0c1310;
  --panel: #131d18;
  --panel-2: #18261f;
  --border: #27453a;
  --text: #e6f5ec;
  --muted: #93b3a2;
  --accent: #34d399;
  --accent-2: #a3e635;
  --radius: 14px;
  --header-bg: rgba(12, 19, 16, 0.78);
  --footer-bg: rgba(12, 19, 16, 0.85);
  --glow-1: rgba(52, 211, 153, 0.25);
  --glow-2: rgba(163, 230, 53, 0.18);
  --focus-shadow: rgba(52, 211, 153, 0.18);
  --case-hover: rgba(52, 211, 153, 0.14);
}

/* ---------- Light theme ---------- */
[data-theme="light"] {
  color-scheme: light;
  --bg: #ecf7f0;
  --panel: #ffffff;
  --panel-2: #f1f9f4;
  --border: #cfe7da;
  --text: #12241b;
  --muted: #4c675a;
  --accent: #12945f;
  --accent-2: #4f9e1f;
  --header-bg: rgba(255, 255, 255, 0.82);
  --footer-bg: rgba(255, 255, 255, 0.9);
  --glow-1: rgba(18, 148, 95, 0.18);
  --glow-2: rgba(79, 158, 31, 0.14);
  --focus-shadow: rgba(18, 148, 95, 0.2);
  --case-hover: rgba(18, 148, 95, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 10% -10%, var(--glow-1), transparent 60%),
    radial-gradient(800px 500px at 110% 10%, var(--glow-2), transparent 60%),
    var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 32px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth theme switching */
.site-header,
.site-footer,
.editor,
.actions,
.about {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* ---------- Site header ---------- */
.site-header {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand__logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.brand__name {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.3px;
}

.brand__accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav {
  display: flex;
  gap: 20px;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 18px;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.25s ease, border-color 0.2s, background-color 0.3s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.08) rotate(15deg);
}

.nav a,
.footer-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  transition: color 0.2s;
}

.nav a:hover,
.footer-nav a:hover {
  color: var(--accent);
}

.app {
  width: 100%;
  max-width: 1000px;
  padding-top: 32px;
}

.app__header {
  text-align: center;
  margin-bottom: 26px;
}

.app__header h1 {
  margin: 0 0 6px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.app__header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

/* ---------- Editors ---------- */
.editors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.editor {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
}

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

.editor__bar label {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.editor__actions {
  display: flex;
  gap: 8px;
}

textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: "Consolas", "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-shadow);
}

textarea[readonly] {
  cursor: default;
}

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

/* ---------- Actions ---------- */
.actions {
  margin-top: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.actions h2 {
  margin: 0 0 14px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
}

.actions__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  cursor: pointer;
  border-radius: 9px;
  border: 1px solid var(--border);
  transition: transform 0.12s, background 0.2s, border-color 0.2s, color 0.2s;
}

.btn:active {
  transform: translateY(1px);
}

.btn--ghost {
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  font-size: 0.82rem;
}

.btn--ghost:hover {
  color: var(--text);
  border-color: var(--accent);
}

.btn--primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
}

.btn--primary:hover {
  filter: brightness(1.1);
}

.btn--case {
  background: var(--panel-2);
  color: var(--text);
  padding: 12px 10px;
  font-size: 0.9rem;
  font-weight: 500;
}

.btn--case:hover {
  border-color: var(--accent);
  background: var(--case-hover);
}

/* ---------- About ---------- */
.about {
  margin-top: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.about h2 {
  margin: 0 0 10px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
}

.about p {
  margin: 0;
  line-height: 1.65;
  color: var(--muted);
  font-size: 0.95rem;
}

.about h3 {
  margin: 20px 0 8px;
  font-size: 1rem;
  color: var(--text);
}

.about strong {
  color: var(--text);
}

.about__list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
  color: var(--muted);
  font-size: 0.95rem;
}

.about__list li {
  margin-bottom: 5px;
}

.about__list--cols {
  list-style: none;
  padding-left: 0;
  columns: 2;
  column-gap: 30px;
}

.about__list--cols li {
  break-inside: avoid;
}

@media (max-width: 640px) {
  .about__list--cols {
    columns: 1;
  }
}

.about code {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  font-family: "Consolas", ui-monospace, Menlo, monospace;
  font-size: 0.88em;
  color: var(--accent);
}

/* ---------- Site footer ---------- */
.site-footer {
  width: 100%;
  margin-top: 34px;
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
}

.site-footer__inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.site-footer__note {
  font-size: 0.8rem !important;
  opacity: 0.75;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 80px);
  background: var(--panel-2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (max-width: 520px) {
  body {
    padding: 20px 10px;
  }

  textarea {
    min-height: 160px;
  }
}
