:root {
  --bg: #f7f8f4;
  --panel: #ffffff;
  --ink: #1d2a32;
  --ink-soft: #4e5f6c;
  --accent: #0e8f7f;
  --accent-strong: #0a6e62;
  --warning: #af2f2f;
  --line: #d8dfd9;
  --glow-1: rgba(14, 143, 127, 0.2);
  --glow-2: rgba(198, 130, 33, 0.18);
  --shadow: 0 12px 36px rgba(29, 42, 50, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(circle at 8% 10%, #fefaf2 0%, var(--bg) 45%, #eff3ee 100%);
  color: var(--ink);
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  line-height: 1.5;
  position: relative;
}

.bg-orb {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  filter: blur(6px);
}

.bg-orb--left {
  width: 260px;
  height: 260px;
  background: var(--glow-1);
  border-radius: 50%;
  top: -70px;
  left: -80px;
}

.bg-orb--right {
  width: 320px;
  height: 320px;
  background: var(--glow-2);
  border-radius: 50%;
  right: -90px;
  top: 25%;
}

.container {
  width: min(1024px, calc(100vw - 32px));
  margin: 0 auto;
}

.site-header {
  padding: 20px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.site-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  padding: 6px 10px;
  border-radius: 8px;
}

.site-nav a[aria-current="page"],
.site-nav a:hover {
  background: #e8f5f2;
  color: var(--accent-strong);
}

.home-main,
.tool-main {
  padding-bottom: 38px;
  display: grid;
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.hero h1,
.tool-main h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 2.8vw, 2.1rem);
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.tool-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.tool-card h2 {
  margin-top: 0;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  background: var(--accent-strong);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #c8d2ce;
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  color: var(--ink);
  background: #fbfdfc;
}

textarea,
.mono,
.output-panel {
  font-family: "SF Mono", "Menlo", "Monaco", monospace;
}

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

.output-panel {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid #dce4df;
  border-radius: 12px;
  background: #f7fbfa;
  padding: 12px;
  min-height: 90px;
}

.error-text {
  margin: 0 0 10px;
  color: var(--warning);
  font-weight: 700;
  min-height: 24px;
}

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

.stats-row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stats-row h2,
.converter-grid h2,
.ad-panel h2 {
  margin: 0 0 8px;
}

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

.ad-slot {
  border: 1px dashed #b8c5bf;
  border-radius: 10px;
  background: #f6f8f7;
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #61766d;
  padding: 8px;
}

.ad-slot--sidebar {
  min-height: 280px;
}

.ad-slot[data-state="disabled"] {
  opacity: 0.8;
}

.ad-slot[data-state="active"] {
  border-style: solid;
}

.ad-rail {
  position: fixed;
  right: max(18px, calc((100vw - 1024px) / 2 - 188px));
  top: 120px;
  width: 170px;
  display: none;
}

.site-footer {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 0 0 24px;
}

.site-footer a {
  text-decoration: none;
  color: var(--ink-soft);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffffa6;
}

.site-footer a[aria-current='page'],
.site-footer a:hover {
  color: var(--accent-strong);
  border-color: #bcd4cb;
  background: #e8f5f2;
}

@media (min-width: 1320px) {
  .ad-rail {
    display: block;
  }
}

@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .container {
    width: calc(100vw - 24px);
  }
}
