:root {
  color-scheme: light;
  --ink: #101828;
  --muted: #667085;
  --line: #e6ebf2;
  --paper: #ffffff;
  --page: #f6f8fc;
  --soft-page: #eff6ff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #dbeafe;
  --green: #15803d;
  --orange: #c2410c;
  --rose: #e11d48;
  --violet: #7047d9;
  --shadow: 0 22px 60px rgba(16, 24, 40, 0.11);
  --pill-radius: 999px;
  --site-header-height: 72px;
  --body-bg:
    linear-gradient(135deg, rgba(37, 99, 235, 0.09) 0%, rgba(21, 128, 61, 0) 36%),
    linear-gradient(180deg, #fbfdff 0%, var(--page) 48%, #ffffff 100%);
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --glass: rgba(255, 255, 255, 0.88);
  --glass-strong: rgba(255, 255, 255, 0.96);
  --card-bg: linear-gradient(145deg, #ffffff 0%, #f9fbff 100%);
  --panel-bg: rgba(255, 255, 255, 0.84);
  --input-bg: #ffffff;
  --footer-bg: #101828;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f8fafc;
  --muted: #a9b4c6;
  --line: rgba(148, 163, 184, 0.24);
  --paper: #111827;
  --page: #0b1020;
  --soft-page: rgba(96, 165, 250, 0.13);
  --primary: #7dd3fc;
  --primary-dark: #38bdf8;
  --primary-soft: rgba(125, 211, 252, 0.16);
  --green: #34d399;
  --orange: #fb923c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --body-bg:
    radial-gradient(circle at 14% 8%, rgba(125, 211, 252, 0.14), transparent 30%),
    radial-gradient(circle at 92% 4%, rgba(52, 211, 153, 0.12), transparent 26%),
    linear-gradient(180deg, #070b14 0%, #0b1020 48%, #090d18 100%);
  --surface: #111827;
  --surface-soft: #172033;
  --glass: rgba(13, 18, 32, 0.82);
  --glass-strong: rgba(17, 24, 39, 0.96);
  --card-bg: linear-gradient(145deg, rgba(20, 28, 46, 0.96) 0%, rgba(12, 18, 32, 0.98) 100%);
  --panel-bg: rgba(17, 24, 39, 0.82);
  --input-bg: #111827;
  --footer-bg: #050814;
}

* {
  box-sizing: border-box;
}

::selection {
  color: #ffffff;
  background: rgba(37, 99, 235, 0.86);
}

html[data-theme="dark"] ::selection {
  color: #050814;
  background: rgba(125, 211, 252, 0.92);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--site-header-height, 72px) + 16px);
}

body {
  margin: 0;
  padding-top: var(--site-header-height, 72px);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--body-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  transition: background 220ms ease, color 220ms ease;
}

main {
  flex: 1 0 auto;
}

img,
svg {
  display: block;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

textarea {
  resize: vertical;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  border-radius: var(--pill-radius);
  text-decoration: none;
}

.skip-link:focus {
  top: 16px;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--glass);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  transition: background 220ms ease, border-color 220ms ease;
}

.header-inner,
.footer-grid,
.footer-bottom,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.header-inner {
  min-height: 72px;
  justify-content: flex-start;
}

.header-main {
  display: flex;
  align-items: center;
  margin-left: 28px;
}

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

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.site-nav,
.site-footer nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.site-nav a,
.site-footer nav a {
  padding: 9px 14px;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--pill-radius);
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-footer nav a:hover,
.site-footer nav a:focus-visible {
  color: var(--ink);
  background: var(--soft-page);
  outline: none;
}

.theme-picker {
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
}

.nav-toggle {
  width: 44px;
  height: 44px;
  min-height: 44px;
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.08);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), 0 12px 28px rgba(16, 24, 40, 0.08);
  outline: none;
}

.nav-toggle-mark,
.nav-toggle-mark::before,
.nav-toggle-mark::after {
  width: 18px;
  height: 2px;
  display: block;
  background: currentColor;
  border-radius: var(--pill-radius);
  transition: background 160ms ease, transform 180ms ease;
}

.nav-toggle-mark {
  position: relative;
}

.nav-toggle-mark::before,
.nav-toggle-mark::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle-mark::before {
  transform: translateY(-6px);
}

.nav-toggle-mark::after {
  transform: translateY(6px);
}

.site-header.nav-open .nav-toggle-mark {
  background: transparent;
}

.site-header.nav-open .nav-toggle-mark::before {
  transform: rotate(45deg);
}

.site-header.nav-open .nav-toggle-mark::after {
  transform: rotate(-45deg);
}

.theme-trigger {
  width: 44px;
  height: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.08);
  cursor: pointer;
  font-weight: 900;
}

.theme-trigger:hover,
.theme-trigger:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), 0 12px 28px rgba(16, 24, 40, 0.08);
  outline: none;
}

.theme-icon {
  position: relative;
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid #d0d5dd;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.72);
  transform: rotate(var(--theme-turn, 0deg)) scale(1);
  transition:
    background 220ms ease,
    border-color 220ms ease,
    transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.theme-core {
  position: relative;
  width: 12px;
  height: 12px;
  display: block;
  background: #101828;
  border-radius: 50%;
  transform: scale(1);
  transition:
    width 220ms ease,
    height 220ms ease,
    background 220ms ease,
    border-radius 220ms ease,
    transform 220ms ease;
}

.theme-core::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -5px;
  width: 16px;
  height: 16px;
  background: #101828;
  border-radius: 50%;
  opacity: 0;
  transform: translateX(2px) scale(0.72);
  transition: opacity 180ms ease, transform 220ms ease, border-radius 220ms ease;
}

.theme-trigger.theme-system .theme-icon {
  background: linear-gradient(90deg, #ffffff 0 50%, #101828 50% 100%);
}

.theme-trigger.theme-system .theme-core {
  width: 4px;
  height: 18px;
  background: rgba(37, 99, 235, 0.92);
  border-radius: var(--pill-radius);
}

.theme-trigger.theme-system .theme-core::after,
.theme-trigger.theme-light .theme-core::after {
  opacity: 0;
}

.theme-trigger.theme-light .theme-icon {
  background: #fef9c3;
  border-color: #fde68a;
}

.theme-trigger.theme-light .theme-core {
  background: #f59e0b;
  box-shadow:
    0 -8px 0 -5px #f59e0b,
    0 8px 0 -5px #f59e0b,
    8px 0 0 -5px #f59e0b,
    -8px 0 0 -5px #f59e0b,
    6px 6px 0 -5px #f59e0b,
    -6px -6px 0 -5px #f59e0b,
    6px -6px 0 -5px #f59e0b,
    -6px 6px 0 -5px #f59e0b;
}

.theme-trigger.theme-dark .theme-icon {
  background: #101828;
  border-color: #344054;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.theme-trigger.theme-dark .theme-core {
  width: 16px;
  height: 16px;
  background: #e0f2fe;
  box-shadow: none;
  overflow: hidden;
  transform: translateX(-1px) scale(1);
}

.theme-trigger.theme-dark .theme-core::after {
  opacity: 1;
  border-radius: 50%;
  transform: translateX(0) scale(1);
}

.theme-trigger.theme-changing .theme-icon {
  transform: rotate(var(--theme-turn, 0deg)) scale(0.88);
}

html[data-theme-choice="system"] .theme-trigger .theme-icon {
  background: linear-gradient(90deg, #ffffff 0 50%, #101828 50% 100%);
}

html[data-theme-choice="system"] .theme-trigger .theme-core {
  width: 4px;
  height: 18px;
  background: rgba(37, 99, 235, 0.92);
  border-radius: var(--pill-radius);
  box-shadow: none;
  overflow: visible;
  transform: scale(1);
}

html[data-theme-choice="system"] .theme-trigger .theme-core::after,
html[data-theme-choice="light"] .theme-trigger .theme-core::after {
  opacity: 0;
}

html[data-theme-choice="light"] .theme-trigger .theme-icon {
  background: #fef9c3;
  border-color: #fde68a;
}

html[data-theme-choice="light"] .theme-trigger .theme-core {
  width: 12px;
  height: 12px;
  background: #f59e0b;
  border-radius: 50%;
  overflow: visible;
  transform: scale(1);
  box-shadow:
    0 -8px 0 -5px #f59e0b,
    0 8px 0 -5px #f59e0b,
    8px 0 0 -5px #f59e0b,
    -8px 0 0 -5px #f59e0b,
    6px 6px 0 -5px #f59e0b,
    -6px -6px 0 -5px #f59e0b,
    6px -6px 0 -5px #f59e0b,
    -6px 6px 0 -5px #f59e0b;
}

html[data-theme-choice="dark"] .theme-trigger .theme-icon {
  background: #101828;
  border-color: #344054;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.08);
}

html[data-theme-choice="dark"] .theme-trigger .theme-core {
  width: 16px;
  height: 16px;
  background: #e0f2fe;
  border-radius: 50%;
  box-shadow: none;
  overflow: hidden;
  transform: translateX(-1px) scale(1);
}

html[data-theme-choice="dark"] .theme-trigger .theme-core::after {
  opacity: 1;
  border-radius: 50%;
  transform: translateX(0) scale(1);
}

.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 180px;
  display: grid;
  gap: 6px;
  padding: 8px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 22px 54px rgba(16, 24, 40, 0.16);
  backdrop-filter: blur(16px);
}

.theme-option {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--pill-radius);
  cursor: pointer;
  font-weight: 900;
  text-align: left;
}

.theme-option::after {
  content: "";
  width: 8px;
  height: 8px;
  background: transparent;
  border-radius: 50%;
}

.theme-option:hover,
.theme-option:focus-visible {
  color: var(--ink);
  background: var(--soft-page);
  outline: none;
}

.theme-option.is-active {
  color: #07111f;
  background: var(--primary);
}

.theme-option.is-active::after {
  background: currentColor;
}

.hero-section {
  padding: 72px 0 38px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 44px;
  align-items: center;
}

.hero-copy {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  font-size: 4.05rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.14rem;
}

.hero-copy h1 {
  color: transparent;
  background: linear-gradient(90deg, #101828 0%, #1d4ed8 62%, #166534 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

html[data-theme="dark"] .hero-copy h1,
html[data-theme="dark"] .page-hero h1 {
  background: linear-gradient(90deg, #f8fafc 0%, #7dd3fc 58%, #86efac 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-text,
.section-heading p,
.tool-intro,
.page-content p,
.page-content li {
  color: var(--muted);
}

.hero-text {
  max-width: 650px;
  margin: 18px 0 0;
  font-size: 1.12rem;
}

.hero-panel {
  display: grid;
  gap: 13px;
  padding: 8px 0;
  color: var(--ink);
}

.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px 2px 34px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.panel-top strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.panel-list {
  display: grid;
  gap: 12px;
}

.panel-list a {
  min-height: 76px;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  color: var(--ink);
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  box-shadow: 0 18px 48px rgba(16, 24, 40, 0.11);
  text-decoration: none;
  backdrop-filter: blur(14px);
  transition: background 220ms ease, border-color 220ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.panel-list a:nth-child(odd) {
  transform: translateX(22px);
}

.panel-list a:nth-child(even) {
  transform: translateX(-4px);
}

.panel-list a:hover,
.panel-list a:focus-visible {
  border-color: #93c5fd;
  box-shadow: 0 22px 56px rgba(37, 99, 235, 0.16);
  outline: none;
}

.panel-list span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
  font-weight: 900;
}

html[data-theme="dark"] .panel-list span,
html[data-theme="dark"] .tool-icon,
html[data-theme="dark"] .button.primary,
html[data-theme="dark"] .recipe-chip.is-active,
html[data-theme="dark"] .strong-action {
  color: #07111f;
}

.panel-list a:nth-child(2) span {
  background: var(--green);
}

.panel-list a:nth-child(3) span {
  background: linear-gradient(135deg, var(--primary) 0 33%, var(--green) 33% 66%, var(--orange) 66% 100%);
}

.panel-list a:nth-child(4) span {
  background: var(--orange);
}

.hero-panel p {
  width: min(100%, 340px);
  margin: 0 0 0 34px;
  padding: 12px 14px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  box-shadow: 0 16px 42px rgba(16, 24, 40, 0.08);
  font-size: 0.9rem;
}

.quick-band {
  background: transparent;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 18px;
  background: linear-gradient(135deg, #101828, #17345d);
  border-radius: 8px;
  box-shadow: 0 24px 62px rgba(16, 24, 40, 0.16);
}

.quick-grid div {
  position: relative;
  padding: 8px 20px;
}

.quick-grid div + div {
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.quick-grid strong,
.quick-grid span {
  display: block;
}

.quick-grid strong {
  color: #fff;
  margin-bottom: 3px;
}

.quick-grid span {
  color: #cbd5e1;
  font-size: 0.94rem;
}

.section {
  padding: 64px 0;
}

.section-heading {
  align-items: flex-end;
  margin-bottom: 24px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}

.tool-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  align-items: start;
  align-content: start;
  grid-column: span 6;
  gap: 18px 16px;
  min-height: 254px;
  padding: 24px;
  color: var(--ink);
  background: var(--card-bg);
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 20px 58px rgba(16, 24, 40, 0.08);
  overflow: hidden;
  overflow-wrap: anywhere;
  transition: background 220ms ease, box-shadow 180ms ease, transform 160ms ease;
}

.tool-card:nth-child(1),
.tool-card:nth-child(4) {
  grid-column: span 7;
}

.tool-card:nth-child(2),
.tool-card:nth-child(3) {
  grid-column: span 5;
}

.tool-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0) 52%);
  pointer-events: none;
}

.tool-card::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--green), var(--orange));
  border-radius: 8px 8px 0 0;
}

.tool-card:nth-child(2)::before,
.tool-card:nth-child(5)::before {
  background: linear-gradient(135deg, rgba(21, 128, 61, 0.13), rgba(21, 128, 61, 0) 54%);
}

.tool-card:nth-child(3)::before,
.tool-card:nth-child(6)::before {
  background: linear-gradient(135deg, rgba(194, 65, 12, 0.12), rgba(194, 65, 12, 0) 54%);
}

.tool-card > * {
  position: relative;
  z-index: 1;
}

.tool-card:hover,
.tool-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 26px 70px rgba(16, 24, 40, 0.13);
  outline: none;
}

.tool-icon {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.13);
  font-weight: 900;
}

.tool-card:nth-child(2) .tool-icon {
  background: linear-gradient(135deg, var(--primary) 0 35%, var(--green) 35% 68%, var(--orange) 68% 100%);
}

.tool-card:nth-child(3) .tool-icon {
  background: var(--green);
}

.tool-card:nth-child(4) .tool-icon,
.tool-card:nth-child(6) .tool-icon {
  background: var(--orange);
}

.tool-card:nth-child(5) .tool-icon {
  background: var(--violet);
}

.tool-card h3 {
  grid-column: 1;
  grid-row: 1;
  margin-top: 8px;
}

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

.empty-state {
  padding: 24px;
  margin: 0;
  color: var(--muted);
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 20px 58px rgba(16, 24, 40, 0.08);
}

.mini-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
  padding: 0;
  margin: 0;
  color: var(--muted);
  list-style: none;
  font-size: 0.92rem;
}

.mini-list li {
  position: relative;
  padding: 6px 10px 6px 22px;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.mini-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  transform: translate(10px, -50%);
}

.content-panel {
  position: relative;
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 20px 58px rgba(16, 24, 40, 0.08);
  overflow: hidden;
  padding: 22px;
}

.content-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0) 48%);
  pointer-events: none;
}

.content-panel > * {
  position: relative;
  z-index: 1;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.button:hover,
.button:focus-visible {
  border-color: #93c5fd;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.1);
  outline: none;
}

.button.primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--primary-dark);
}

.page-hero {
  padding: 62px 0 34px;
}

.page-hero h1 {
  max-width: 780px;
  color: transparent;
  background: linear-gradient(90deg, #101828 0%, #1d4ed8 72%, #166534 100%);
  -webkit-background-clip: text;
  background-clip: text;
  font-size: 3rem;
}

.page-content {
  padding: 54px 0 72px;
}

.content-panel {
  max-width: 840px;
}

.content-panel h2 {
  margin-top: 28px;
  font-size: 1.4rem;
}

.content-panel h2:first-child {
  margin-top: 0;
}

.site-footer {
  padding: 34px 0 24px;
  color: #fff;
  background: var(--footer-bg);
}

.site-footer p {
  margin: 12px 0 0;
  color: #c7ccd1;
}

.footer-brand {
  color: #fff;
}

.site-footer nav a {
  color: #c7ccd1;
}

.site-footer nav a:hover,
.site-footer nav a:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.footer-bottom {
  margin-top: 28px;
  padding-top: 18px;
  color: #aeb6bd;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.92rem;
}

.tool-grid .tool-card:only-child {
  grid-column: span 8;
}

.tool-main {
  background: var(--body-bg);
}

.tool-section {
  padding: 26px 0 72px;
}

.cleaner-shell {
  display: grid;
  gap: 12px;
}

.tool-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tool-title-bar .eyebrow {
  margin-bottom: 4px;
}

.tool-title-bar h1 {
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1.05;
}

.recipe-strip {
  display: flex;
  align-items: center;
  grid-auto-flow: column;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}

.recipe-chip {
  min-height: 40px;
  flex: 0 0 auto;
  padding: 0 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  box-shadow: 0 10px 26px rgba(16, 24, 40, 0.06);
  cursor: pointer;
  font-weight: 900;
  white-space: nowrap;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.recipe-chip:hover,
.recipe-chip:focus-visible,
.recipe-chip.is-active {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.12);
  outline: none;
}

.recipe-chip.is-active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #15803d);
}

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

.editor-card {
  background: var(--glass);
  border: 1px solid var(--line);
  min-width: 0;
  border-radius: 26px;
  box-shadow: 0 20px 56px rgba(16, 24, 40, 0.08);
  backdrop-filter: blur(16px);
  overflow: hidden;
  transition: background 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.result-card {
  background:
    linear-gradient(145deg, var(--glass-strong), var(--panel-bg));
}

.editor-head {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.editor-label {
  display: block;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 950;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.icon-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  outline: none;
}

.icon-button:disabled {
  color: var(--muted);
  background: var(--surface-soft);
  border-color: var(--line);
  box-shadow: none;
  cursor: not-allowed;
}

.toggle-action {
  inline-size: 76px;
  flex: 0 0 76px;
}

.toggle-action.is-active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.stable-action {
  min-width: 0;
  inline-size: 112px;
  flex: 0 0 112px;
}

.strong-action {
  min-width: 124px;
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.strong-action:hover,
.strong-action:focus-visible {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.text-box {
  width: 100%;
  height: clamp(410px, 57vh, 620px);
  display: block;
  padding: 16px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
  resize: none;
  font-size: 1rem;
  line-height: 1.58;
}

.result-card.find-replace-open .text-box {
  height: clamp(310px, 43vh, 520px);
}

.text-box::placeholder {
  color: var(--muted);
}

.output-preview {
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.output-preview.is-empty::before {
  color: var(--muted);
  content: attr(data-placeholder);
}

.output-match {
  padding: 1px 2px;
  background: #fef08a;
  border-radius: 5px;
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.16);
}

html[data-theme="dark"] .output-match {
  color: #1f2937;
}

.output-match.is-current {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

html[data-theme="dark"] .output-match.is-current {
  color: #07111f;
}

.metric-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0;
}

.metric-row span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: var(--pill-radius);
  font-size: 0.86rem;
  font-weight: 800;
}

.metric-row strong {
  color: var(--ink);
}

.result-metrics {
  justify-content: center;
}

.segmented-control {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface-soft);
  border-radius: var(--pill-radius);
}

.segment {
  min-height: 36px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--pill-radius);
  cursor: pointer;
  font-weight: 950;
  white-space: nowrap;
}

.segment:hover,
.segment:focus-visible,
.segment.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.09);
  outline: none;
}

.option-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  box-shadow: 0 14px 38px rgba(16, 24, 40, 0.07);
}

.shape-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.shape-control > span {
  padding-left: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 950;
}

.switch-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.switch-card {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 7px 7px 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  cursor: pointer;
  font-weight: 900;
  text-align: left;
}

.switch-card span {
  white-space: nowrap;
}

.switch-card:hover,
.switch-card:focus-visible {
  border-color: rgba(37, 99, 235, 0.45);
  outline: none;
}

.switch-card i {
  position: relative;
  width: 42px;
  height: 26px;
  flex: 0 0 auto;
  background: var(--line);
  border-radius: var(--pill-radius);
  transition: background 160ms ease;
}

.switch-card i::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 5px 12px rgba(16, 24, 40, 0.24);
  transition: transform 160ms ease;
}

.switch-card.is-on i {
  background: linear-gradient(135deg, var(--primary), var(--green));
}

.switch-card.is-on i::before {
  transform: translateX(16px);
}

.advanced-toggle {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 8px 0 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  cursor: pointer;
  font-weight: 950;
  text-align: left;
  white-space: nowrap;
}

.advanced-toggle i {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  border-radius: 50%;
}

.advanced-toggle i::before {
  content: "+";
  color: var(--primary);
  font-weight: 950;
}

.advanced-toggle[aria-expanded="true"] i::before {
  content: "-";
}

.advanced-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 14px 38px rgba(16, 24, 40, 0.07);
}

.replace-panel {
  display: grid;
  gap: 12px;
  padding: 10px 12px 12px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--line);
}

.replace-row {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
}

.replace-row:first-child {
  grid-template-columns: 66px minmax(0, 1fr);
}

.replace-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 2;
  min-width: 0;
}

.match-controls {
  display: flex;
  grid-column: 2;
  grid-row: 2;
  gap: 6px;
  justify-self: start;
}

.compact-button {
  min-height: 40px;
  padding-inline: 12px;
}

.compact-input {
  min-width: 0;
  min-height: 40px;
}

.match-counter {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  font-size: 0.82rem;
  font-weight: 900;
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  white-space: nowrap;
}

.field-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.1;
}

.clean-input {
  width: 100%;
  min-height: 46px;
  padding: 0 15px;
  color: var(--ink);
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  outline: none;
}

.clean-input:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.compact-switch {
  margin-top: 0;
  min-width: 146px;
  min-height: 40px;
  flex: 0 0 auto;
  padding-left: 14px;
}

.compact-switch i {
  width: 38px;
  height: 24px;
}

.compact-switch i::before {
  width: 18px;
  height: 18px;
}

.compact-switch.is-on i::before {
  transform: translateX(14px);
}

.not-found-page {
  min-height: calc(100vh - var(--site-header-height, 72px));
}

.not-found-hero {
  min-height: calc(100vh - var(--site-header-height, 72px));
  display: grid;
  align-items: center;
  padding: 64px 0;
}

.not-found-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 42px;
  align-items: center;
}

.not-found-copy h1 {
  max-width: 760px;
  color: transparent;
  background: linear-gradient(90deg, #101828 0%, #1d4ed8 62%, #166534 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

html[data-theme="dark"] .not-found-copy h1 {
  background: linear-gradient(90deg, #f8fafc 0%, #7dd3fc 58%, #86efac 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.not-found-copy p:not(.eyebrow) {
  max-width: 660px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.12rem;
}

.not-found-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.not-found-card {
  position: relative;
  padding: 26px;
  color: var(--ink);
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 32px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.not-found-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(21, 128, 61, 0.08), transparent 62%);
  pointer-events: none;
}

.not-found-card > * {
  position: relative;
  z-index: 1;
}

.not-found-code {
  width: fit-content;
  margin-bottom: 18px;
  padding: 8px 14px;
  color: #07111f;
  background: linear-gradient(135deg, var(--primary), var(--green));
  border-radius: var(--pill-radius);
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.18);
  font-size: clamp(3.5rem, 8vw, 6rem);
  font-weight: 950;
  line-height: 0.95;
}

.not-found-card h2 {
  font-size: 1.4rem;
}

.not-found-links {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.not-found-links a {
  min-height: 62px;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  text-decoration: none;
  backdrop-filter: blur(14px);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.not-found-links a:hover,
.not-found-links a:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.14);
  transform: translateY(-2px);
  outline: none;
}

.not-found-links span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 900;
}

.not-found-links .tool-icon {
  grid-column: auto;
  grid-row: auto;
  justify-self: auto;
  background: var(--primary);
  box-shadow: none;
}

@media (max-width: 920px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    max-width: 640px;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-grid div:nth-child(odd) {
    border-left: 0;
  }

  .quick-grid div:nth-child(n + 3) {
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .tool-card,
  .tool-card:nth-child(1),
  .tool-card:nth-child(2),
  .tool-card:nth-child(3),
  .tool-card:nth-child(4),
  .tool-card:nth-child(5),
  .tool-card:nth-child(6) {
    grid-column: 1 / -1;
  }

  .not-found-shell {
    grid-template-columns: 1fr;
  }

  .not-found-card {
    max-width: 640px;
  }
}

@media (max-width: 680px) {
  :root {
    --site-header-height: 72px;
  }

  .section-heading,
  .footer-grid,
  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-inner {
    min-height: 64px;
    gap: 10px;
    padding: 10px 0;
  }

  .brand {
    min-width: 0;
  }

  .brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand small {
    display: none;
  }

  .header-main {
    margin-left: 0;
  }

  .site-header.nav-ready .header-main {
    position: absolute;
    top: calc(100% + 8px);
    left: 16px;
    right: 16px;
    z-index: 20;
    display: block;
    width: auto;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top right;
    transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 180ms;
  }

  .site-header.nav-ready.nav-open .header-main {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition-delay: 0s;
  }

  .site-header.nav-ready .site-nav {
    width: 100%;
    display: grid;
    gap: 4px;
    padding: 8px;
    background: var(--glass-strong);
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
  }

  .site-header.nav-ready .site-nav a {
    padding: 12px 14px;
    color: var(--ink);
  }

  .site-header.nav-ready .site-nav a:hover,
  .site-header.nav-ready .site-nav a:focus-visible {
    background: var(--soft-page);
  }

  .theme-picker {
    width: auto;
    margin-left: auto;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .theme-menu {
    left: auto;
    right: 0;
    width: min(78vw, 240px);
  }

  .hero-section {
    padding: 36px 0 30px;
  }

  h1 {
    font-size: 2.75rem;
  }

  h2 {
    font-size: 1.7rem;
  }

  .page-hero h1 {
    font-size: 2.35rem;
  }

  .panel-top {
    padding-inline: 0;
  }

  .panel-list a:nth-child(odd),
  .panel-list a:nth-child(even) {
    transform: none;
  }

  .hero-panel p {
    width: 100%;
    margin-left: 0;
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

  .quick-grid div {
    padding-inline: 4px;
  }

  .quick-grid div + div {
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-left: 0;
  }

  .tool-card {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) 52px;
  }

  .tool-icon {
    width: 52px;
    height: 52px;
  }

  .section {
    padding-block: 48px;
  }

  .not-found-hero {
    align-items: start;
    padding: 38px 0 54px;
  }

  .not-found-copy h1 {
    font-size: 2.7rem;
  }

  .not-found-card {
    border-radius: 26px;
    padding: 20px;
  }
}

@media (max-width: 420px) {
  .container {
    width: min(100% - 22px, 1120px);
  }

  .site-nav a {
    font-size: 0.93rem;
  }

  .panel-list a {
    grid-template-columns: 38px 1fr;
  }

  .panel-list span {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 1040px) {
  .tool-grid .tool-card:only-child {
    grid-column: 1 / -1;
  }

  .option-dock {
    flex-wrap: wrap;
    border-radius: 28px;
  }

  .result-metrics {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    padding-left: 6px;
  }

  .replace-row,
  .replace-row:first-child {
    grid-template-columns: 1fr;
  }

  .match-controls,
  .match-counter,
  .replace-actions {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .tool-section {
    padding-top: 18px;
  }

  .editor-zone {
    grid-template-columns: 1fr;
  }

  .tool-title-bar,
  .editor-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .tool-title-bar h1 {
    font-size: 1.35rem;
  }

  .tool-title-bar .editor-actions,
  .editor-actions {
    justify-content: flex-start;
  }

  .text-box {
    height: 330px;
  }

  .recipe-strip {
    margin-inline: -2px;
  }

  .option-dock,
  .shape-control {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented-control {
    overflow-x: auto;
    justify-content: flex-start;
    max-width: 100%;
  }

  .advanced-toggle {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .editor-card {
    border-radius: 22px;
  }

  .tool-title-bar .editor-actions {
    width: 100%;
  }

  .tool-title-bar .icon-button {
    flex: 1 1 auto;
  }

  .editor-head .metric-row {
    width: 100%;
  }

  .segment {
    flex: 0 0 auto;
  }

  .switch-list {
    display: grid;
    grid-template-columns: 1fr;
  }
}

.calculator-tool-section {
  padding: 34px 0 72px;
}

.calculator-tool-shell {
  display: grid;
  gap: 18px;
}

.calculator-title-bar {
  max-width: 560px;
  margin-inline: auto;
}

.calculator-workspace {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: stretch;
  margin-inline: auto;
}

.calculator-card,
.history-panel {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 34px;
  box-shadow: var(--shadow);
}

.calculator-card {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.calculator-display {
  min-height: 166px;
  display: grid;
  align-content: end;
  gap: 8px;
  padding: 22px;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(37, 99, 235, 0.1), rgba(20, 184, 166, 0.08)),
    var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 28px;
}

html[data-theme="dark"] .calculator-display {
  background:
    linear-gradient(145deg, rgba(125, 211, 252, 0.12), rgba(52, 211, 153, 0.08)),
    var(--surface-soft);
}

.display-formula,
.display-preview {
  min-height: 22px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calculator-keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.calc-key {
  min-width: 0;
  min-height: 66px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--pill-radius);
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.08);
  cursor: pointer;
  font-size: 1.18rem;
  font-weight: 950;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.calc-key:hover,
.calc-key:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), 0 12px 28px rgba(16, 24, 40, 0.08);
  outline: none;
  transform: translateY(-1px);
}

.calc-key:active {
  transform: translateY(1px) scale(0.98);
}

.key-function {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.key-operator {
  color: #ffffff;
  background: linear-gradient(145deg, #2563eb, #0f9f8f);
  border-color: transparent;
}

.key-equals {
  color: #ffffff;
  background: linear-gradient(145deg, #101828, #2563eb);
  border-color: transparent;
}

html[data-theme="dark"] .key-equals {
  color: #050814;
  background: linear-gradient(145deg, #7dd3fc, #34d399);
}

.history-panel {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 18px;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-head span {
  display: block;
  color: var(--ink);
  font-weight: 950;
}

.history-head small {
  color: var(--muted);
  font-weight: 800;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.history-list {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: 470px;
  overflow: auto;
  padding-right: 4px;
}

.history-list.is-empty {
  align-content: center;
}

.history-list.is-empty p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.history-item {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  cursor: pointer;
  text-align: right;
}

.history-item:hover,
.history-item:focus-visible {
  border-color: var(--primary);
  outline: none;
}

.history-item span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item strong {
  font-size: 1.12rem;
  font-weight: 950;
}

#historyOpenButton,
#copyResultButton {
  min-width: 92px;
}

@media (max-width: 860px) {
  .calculator-tool-section {
    padding-top: 22px;
  }

  .history-panel {
    min-height: auto;
    box-shadow: 0 14px 36px rgba(16, 24, 40, 0.08);
  }
}

@media (max-width: 520px) {
  .calculator-card,
  .history-panel {
    border-radius: 24px;
  }

  .calculator-card {
    padding: 12px;
  }

  .calculator-display {
    min-height: 136px;
    padding: 18px;
    border-radius: 22px;
  }

  .calculator-keypad {
    gap: 8px;
  }

  .calc-key {
    min-height: 58px;
    font-size: 1.05rem;
  }
}

body.history-open {
  overflow: hidden;
}

.calculator-display {
  position: relative;
}

.display-input {
  width: 100%;
  min-height: 62px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
  font-size: clamp(2.1rem, 7vw, 3.8rem);
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1.05;
  text-align: right;
  text-overflow: ellipsis;
}

.display-input::selection {
  color: #ffffff;
  background: var(--primary);
}

html[data-theme="dark"] .display-input::selection {
  color: #050814;
  background: var(--primary);
}

.display-input::placeholder {
  color: var(--muted);
}

.display-preview {
  min-height: 28px;
  justify-self: end;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 900;
  text-align: right;
}

.display-preview:hover,
.display-preview:focus-visible {
  color: var(--primary-dark);
  outline: none;
}

.display-preview:disabled {
  cursor: default;
}

.display-preview:disabled:hover {
  color: var(--muted);
}

.calculator-display.is-animating-result .display-formula,
.calculator-display.is-animating-result .display-input,
.calculator-display.is-animating-result .display-preview {
  color: transparent;
  caret-color: transparent;
}

.calculator-motion-ghost {
  position: fixed;
  z-index: 180;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
  pointer-events: none;
  text-align: right;
  white-space: nowrap;
  transition:
    left 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
    top 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
    width 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
    height 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
    color 240ms ease,
    font-size 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
    line-height 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  .calculator-motion-ghost {
    transition: none;
  }
}

.history-overlay {
  position: fixed;
  inset: 0;
  z-index: 155;
  background: rgba(15, 23, 42, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

html[data-theme="dark"] .history-overlay {
  background: rgba(0, 0, 0, 0.48);
}

.history-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.history-panel {
  position: fixed;
  top: calc(var(--site-header-height, 72px) + 16px);
  right: 16px;
  bottom: 16px;
  z-index: 160;
  width: min(380px, calc(100% - 32px));
  min-height: auto;
  transform: translateX(calc(100% + 28px));
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.history-panel.is-open {
  transform: translateX(0);
}

.history-list {
  max-height: none;
  min-height: 0;
}

@media (max-width: 760px) {
  .history-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(76svh, 620px);
    border-radius: 28px 28px 0 0;
    transform: translateY(calc(100% + 28px));
  }

  .history-panel.is-open {
    transform: translateY(0);
  }
}
