:root {
  --bg: #F5F2EE;
  --surface: #FFFFFF;
  --surface2: #EDE9E3;
  --border: #D6D0C7;
  --text: #1A1714;
  --text2: #6B6560;
  --accent: #C84B2F;
  --accent2: #E8693A;
  --accent-light: #FFF0EC;
  --btn-active-bg: #1A1714;
  --btn-active-text: #F5F2EE;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
}
[data-theme="dark"] {
  --bg: #111010;
  --surface: #1C1B1A;
  --surface2: #252422;
  --border: #333230;
  --text: #F0EDE8;
  --text2: #8A8580;
  --accent: #E8693A;
  --accent2: #F07B4A;
  --accent-light: #2A1A13;
  --btn-active-bg: #F0EDE8;
  --btn-active-text: #111010;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
}

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

body {
  font-family: 'Nunito Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* ─── HEADER ─── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: white;
  letter-spacing: -1px;
}
.logo-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.logo-text span { color: var(--accent); }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* nav tabs */
nav {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  padding: 4px;
  border-radius: 10px;
}
nav a {
  text-decoration: none;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 7px;
  transition: all 0.2s;
}
nav a:hover, nav a.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.theme-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.theme-btn:hover { background: var(--border); }

/* ─── HERO ─── */
.hero {
  text-align: center;
  padding: 56px 32px 40px;
  max-width: 800px;
  margin: 0 auto;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 14px;
}
.hero h1 .highlight {
  color: var(--accent);
  position: relative;
  display: inline-block;
}
.hero h1 .highlight::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.3;
}
.hero p {
  color: var(--text2);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
}

/* ─── MAIN TOOL ─── */
.tool-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* Case buttons */
.case-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 20px 20px 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
}
.case-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  font-family: 'Syne', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s;
  letter-spacing: 0.2px;
}
.case-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}
.case-btn.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-text);
  border-color: var(--btn-active-bg);
}

/* Textarea */
.textarea-wrap {
  position: relative;
}
textarea {
  width: 100%;
  min-height: 240px;
  padding: 24px;
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  line-height: 1.7;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  color: var(--text);
  transition: color 0.2s;
}
textarea::placeholder { color: var(--text2); opacity: 0.6; }

/* Stats bar */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat {
  flex: 1;
  min-width: 100px;
  padding: 10px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--border);
}
.stat:last-child { border-right: none; }
.stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text2);
}
.stat-value {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: -0.5px;
}

/* Action buttons */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 20px;
  align-items: center;
}
.action-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 9px;
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  border: 1px solid transparent;
}
.action-btn.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.action-btn.primary:hover { background: var(--accent2); border-color: var(--accent2); }
.action-btn.secondary {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}
.action-btn.secondary:hover { border-color: var(--accent); color: var(--accent); }
.action-btn.danger {
  background: transparent;
  color: var(--text2);
  border-color: var(--border);
}
.action-btn.danger:hover { color: #cc3333; border-color: #cc3333; background: #fff0f0; }
[data-theme="dark"] .action-btn.danger:hover { background: #2a1010; }

.copy-feedback {
  display: none;
  font-size: 12px;
  color: #2a9d4e;
  font-weight: 700;
  padding: 4px 10px;
  background: #e8f5ee;
  border-radius: 6px;
  animation: fadeIn 0.2s ease;
}
[data-theme="dark"] .copy-feedback { background: #0f2a1c; color: #4caf7a; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ─── TOOLS GRID ─── */
.section {
  max-width: 900px;
  margin: 0 auto 48px;
  padding: 0 24px;
}
.section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text2);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.tool-item {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.tool-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(200,75,47,0.12);
}
.tool-item.active {
  border-color: var(--accent);
  background: var(--accent-light);
}
.tool-item-icon { font-size: 20px; margin-bottom: 8px; }
.tool-item-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.tool-item-desc {
  font-size: 11px;
  color: var(--text2);
  margin-top: 3px;
  line-height: 1.4;
}

/* ─── ABOUT ─── */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}
.about-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}
.about-card p {
  font-size: 13.5px;
  color: var(--text2);
  line-height: 1.6;
  font-weight: 400;
}

/* ─── FOOTER ─── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px;
  text-align: center;
  color: var(--text2);
  font-size: 13px;
}
footer a { color: var(--accent); text-decoration: none; }

/* ─── TOAST ─── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 24px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 1000;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── MOBILE ─── */
@media (max-width: 600px) {
  header { padding: 14px 16px; }
  nav { display: none; }
  .hero { padding: 36px 16px 28px; }
  .tool-container { padding: 0 12px 48px; }
  .stat { min-width: 80px; padding: 8px 12px; }
  .stat-value { font-size: 18px; }
  .section { padding: 0 12px; }
}
