:root {
  --tool-ink: #101014;
  --tool-paper: #f4f1e9;
  --tool-card: #fffdf7;
  --tool-line: rgba(16, 16, 20, .16);
  --tool-accent: #ee5f3f;
  --tool-green: #267455;
}

.tools-page { background: var(--tool-paper); color: var(--tool-ink); }
.tools-shell { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }
.tools-hero { padding: 140px 0 72px; border-bottom: 1px solid var(--tool-line); }
.tools-kicker { display: inline-block; margin-bottom: 20px; color: var(--tool-accent); font-size: .76rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.tools-hero h1 { max-width: 900px; margin: 0; font-family: "Instrument Serif", Georgia, serif; font-size: clamp(3.2rem, 8vw, 7rem); font-weight: 400; letter-spacing: -.04em; line-height: .92; }
.tools-hero p { max-width: 700px; margin: 28px 0 0; color: rgba(16, 16, 20, .68); font-size: clamp(1rem, 2vw, 1.25rem); line-height: 1.6; }
.tools-section { padding: 72px 0; }
.tools-heading { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 40px; margin-bottom: 32px; }
.tools-heading h2 { margin: 0; font-family: "Instrument Serif", Georgia, serif; font-size: clamp(2.2rem, 5vw, 4.5rem); font-weight: 400; line-height: 1; }
.tools-heading p { max-width: 620px; margin: 6px 0 0; color: rgba(16, 16, 20, .68); line-height: 1.65; }
.tools-cluster-nav { display: flex; gap: 10px; margin: 0 0 56px; flex-wrap: wrap; }
.tools-cluster-nav a { padding: 10px 15px; border: 1px solid var(--tool-line); border-radius: 999px; color: inherit; font-size: .82rem; font-weight: 700; text-decoration: none; }
.tools-cluster-nav a:hover { border-color: var(--tool-ink); }
.tools-cluster { padding: 48px 0 16px; scroll-margin-top: 88px; border-top: 1px solid var(--tool-line); }
.tools-cluster + .tools-cluster { margin-top: 48px; }
.tools-cluster-heading { display: grid; grid-template-columns: minmax(150px, .55fr) minmax(280px, 1fr) minmax(280px, .85fr); gap: 28px; margin-bottom: 28px; align-items: start; }
.tools-cluster-heading > span { color: var(--tool-accent); font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.tools-cluster-heading h2 { margin: 0; font-family: "Instrument Serif", Georgia, serif; font-size: clamp(2rem, 4vw, 3.4rem); font-weight: 400; line-height: 1; }
.tools-cluster-heading p { margin: 2px 0 0; color: rgba(16, 16, 20, .68); line-height: 1.6; }
.tools-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tool-card { display: flex; min-height: 280px; padding: 26px; flex-direction: column; border: 1px solid var(--tool-line); border-radius: 20px; background: var(--tool-card); color: inherit; text-decoration: none; transition: transform .2s ease, border-color .2s ease; }
.tool-card:hover { border-color: var(--tool-ink); transform: translateY(-4px); }
.tool-card .tool-number { color: var(--tool-accent); font-size: .75rem; font-weight: 700; letter-spacing: .12em; }
.tool-card h3 { margin: auto 0 12px; font-family: "Instrument Serif", Georgia, serif; font-size: 2rem; font-weight: 400; line-height: 1; }
.tool-card p { margin: 0; color: rgba(16, 16, 20, .65); line-height: 1.5; }
.tool-card b { margin-top: 22px; font-size: .82rem; }
.tool-workspace { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 18px; align-items: start; }
.tool-panel { padding: 28px; border: 1px solid var(--tool-line); border-radius: 20px; background: var(--tool-card); }
.tool-panel h2, .tool-panel h3 { margin-top: 0; }
.tool-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.tool-field.full { grid-column: 1 / -1; }
.tool-field label { display: block; margin-bottom: 8px; font-size: .8rem; font-weight: 700; }
.tool-field small { display: block; margin-top: 6px; color: rgba(16, 16, 20, .58); line-height: 1.4; }
.tool-field input, .tool-field select, .tool-field textarea { box-sizing: border-box; width: 100%; padding: 13px 14px; border: 1px solid var(--tool-line); border-radius: 10px; background: #fff; color: var(--tool-ink); font: inherit; }
.tool-field textarea { min-height: 270px; resize: vertical; line-height: 1.55; }
.tool-field input:focus, .tool-field select:focus, .tool-field textarea:focus { border-color: var(--tool-accent); outline: 3px solid rgba(238, 95, 63, .14); }
.tool-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.tool-button { padding: 12px 17px; border: 1px solid var(--tool-ink); border-radius: 999px; background: var(--tool-ink); color: #fff; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 700; }
.tool-button.secondary { background: transparent; color: var(--tool-ink); }
.tool-button:disabled { cursor: not-allowed; opacity: .45; }
.tool-output { min-height: 120px; padding: 16px; overflow-wrap: anywhere; border: 1px dashed var(--tool-line); border-radius: 12px; background: rgba(16, 16, 20, .035); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88rem; line-height: 1.6; }
.tool-status { min-height: 22px; margin: 10px 0 0; color: var(--tool-green); font-size: .84rem; font-weight: 700; }
.counter-ring { display: grid; width: 180px; height: 180px; margin: 8px auto 24px; place-items: center; border: 12px solid rgba(38, 116, 85, .16); border-radius: 50%; text-align: center; }
.counter-ring.over { border-color: rgba(238, 95, 63, .3); }
.counter-ring strong { display: block; font-family: "Instrument Serif", Georgia, serif; font-size: 3rem; font-weight: 400; line-height: 1; }
.counter-ring span { color: rgba(16, 16, 20, .58); font-size: .78rem; }
.limit-table { width: 100%; border-collapse: collapse; }
.limit-table th, .limit-table td { padding: 14px 12px; border-bottom: 1px solid var(--tool-line); text-align: left; }
.limit-table th { font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; }
.prose-block { max-width: 760px; }
.prose-block h2 { font-family: "Instrument Serif", Georgia, serif; font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 400; line-height: 1; }
.prose-block h3 { margin-top: 34px; }
.prose-block p, .prose-block li { color: rgba(16, 16, 20, .72); line-height: 1.7; }
.source-note { margin-top: 20px; font-size: .82rem; }

@media (max-width: 820px) {
  .tools-grid, .tool-workspace, .tools-heading, .tools-cluster-heading { grid-template-columns: 1fr; }
  .tools-hero { padding-top: 112px; }
}

@media (max-width: 560px) {
  .tools-shell { width: min(100% - 24px, 1120px); }
  .tool-fields { grid-template-columns: 1fr; }
  .tool-field.full { grid-column: auto; }
  .tool-panel { padding: 20px; overflow-x: auto; }
}

@media (prefers-color-scheme: dark) {
  :root { --tool-ink: #f4f1e9; --tool-paper: #08080c; --tool-card: #111117; --tool-line: rgba(244, 241, 233, .17); }
  .tools-hero p, .tools-heading p, .tools-cluster-heading p, .tool-card p, .tool-field small, .counter-ring span, .prose-block p, .prose-block li { color: rgba(244, 241, 233, .68); }
  .tool-field input, .tool-field select, .tool-field textarea { background: #08080c; color: var(--tool-ink); }
}
