:root {
  --bg: #f5f9fd;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --text: #1f2937;
  --muted: #607089;
  --line: #dbe7f3;
  --line-strong: #bfd8ef;
  --blue: #0876c9;
  --blue-dark: #075d9d;
  --orange: #f47b20;
  --green: #228b66;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(28, 80, 130, 0.11);
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(232, 244, 255, 0.82), rgba(255, 255, 255, 0) 340px),
    var(--bg);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 1.5fr) minmax(150px, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 104px;
  padding: 20px clamp(20px, 6vw, 120px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(22, 77, 125, 0.06);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-logo-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-right: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 22px rgba(23, 84, 139, 0.12);
  overflow: visible;
}

.brand-logo {
  position: relative;
  z-index: 2;
  display: block;
  width: 46px;
  height: auto;
  max-width: 46px;
  max-height: 42px;
  object-fit: contain;
}

.brand-logo-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-weight: 800;
  font-size: 1.35rem;
}

.brand-logo[src$="logo.png"] + .brand-logo-fallback {
  z-index: 1;
}

.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-wordmark span:first-child {
  color: #008bd2;
}

.brand-wordmark span:nth-child(2) {
  color: var(--orange);
}

.brand-wordmark span:last-child {
  color: #202a38;
}

.header-title {
  text-align: center;
  min-width: 0;
}

.header-tool-name {
  margin: 0;
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.7rem);
  font-weight: 800;
  line-height: 1.2;
}

.header-slogan {
  margin: 8px 0 0;
  color: #65758e;
  font-size: 0.96rem;
  line-height: 1.45;
}

.tools-menu {
  position: relative;
  justify-self: end;
}

.tools-button,
.primary-button,
.secondary-button,
.ghost-button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.tools-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  color: #0f3356;
  background: #fff;
  border: 1px solid #b9d8f4;
  box-shadow: 0 12px 28px rgba(32, 104, 168, 0.1);
}

.grid-icon {
  width: 15px;
  height: 15px;
  background:
    radial-gradient(circle, currentColor 2px, transparent 2.5px) 0 0 / 7px 7px;
}

.chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.tools-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  display: none;
  width: 238px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.tools-dropdown a {
  display: block;
  padding: 11px 12px;
  color: #183a5a;
  text-decoration: none;
  border-radius: 10px;
}

.tools-dropdown a:hover,
.tools-dropdown a:focus {
  background: #eef7ff;
  outline: none;
}

.tools-menu.open .tools-dropdown {
  display: block;
}

.page-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 36px auto;
}

.hero {
  margin-bottom: 22px;
  padding: clamp(24px, 4vw, 42px);
  background: linear-gradient(135deg, #ffffff, #f2f9ff);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 12px;
  color: var(--blue-dark);
  background: #eaf5ff;
  border: 1px solid #cce6fb;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 800;
}

.badge-free {
  color: #167251;
  background: #eaf8f2;
  border-color: #c8ebdd;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 1.58rem + 1.8vw, 3.35rem);
  line-height: 1.06;
  letter-spacing: 0;
}

.hero p {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.68;
}

.formatter-card,
.info-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.formatter-card {
  padding: clamp(18px, 3vw, 28px);
}

.card-heading {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-heading h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.options-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.check-option,
.select-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #30465c;
  font-size: 0.93rem;
  font-weight: 800;
}

.check-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

select {
  min-height: 38px;
  padding: 7px 12px;
  color: #172635;
  background: #fff;
  border: 1px solid #cbddea;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.editor-panel {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: #30465c;
  font-size: 0.93rem;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  padding: 16px;
  color: #172635;
  background: var(--panel-soft);
  border: 1px solid #cbddea;
  border-radius: 14px;
  font: 0.95rem/1.55 Consolas, "SFMono-Regular", "Liberation Mono", monospace;
  outline: none;
  tab-size: 4;
}

textarea:focus,
select:focus,
button:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(8, 118, 201, 0.13);
}

textarea[readonly] {
  background: #fbfdff;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.primary-button,
.secondary-button,
.ghost-button {
  padding: 0 18px;
}

.primary-button {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 10px 20px rgba(8, 118, 201, 0.2);
}

.secondary-button {
  color: #0f5f98;
  background: #e9f5ff;
  border: 1px solid #c8e2f7;
}

.ghost-button {
  color: #52667a;
  background: #fff;
  border: 1px solid var(--line);
}

button:hover {
  transform: translateY(-1px);
}

.message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--green);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 22px;
}

.info-grid article {
  padding: 22px;
}

.info-grid h2 {
  margin: 0 0 10px;
  font-size: 1.12rem;
}

.info-grid p,
.info-grid ul {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.info-grid ul {
  padding-left: 20px;
}

.site-footer {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto 34px;
  padding: 18px 20px;
  color: #4f6277;
  text-align: center;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(22, 77, 125, 0.06);
}

.site-footer p {
  margin: 0;
  line-height: 1.55;
}

.site-footer strong {
  color: #1f2937;
}

@media (max-width: 900px) {
  .editor-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 280px;
  }
}

@media (max-width: 820px) {
  .site-header {
    grid-template-columns: 1fr auto;
    gap: 16px;
    min-height: auto;
    padding: 16px 20px;
  }

  .header-title {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: left;
  }

  .tools-menu {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 480px) {
  .page-shell {
    width: min(100% - 24px, 1180px);
    margin-top: 20px;
  }

  .brand-wordmark {
    font-size: 1rem;
  }

  .brand-logo-wrap {
    width: 48px;
    height: 48px;
  }

  .brand-logo {
    width: 40px;
    max-width: 40px;
    max-height: 36px;
  }

  .tools-button {
    padding: 0 13px;
  }

  .hero,
  .formatter-card {
    border-radius: 16px;
  }

  .actions {
    display: grid;
  }
}
