/* Shared working surfaces for the site's small tools. */
.tool-page { --tool-error: #b32632; }
:root[data-theme="dark"] .tool-page { --tool-error: #ff9ba5; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .tool-page { --tool-error: #ff9ba5; }
}
.tool-shell { padding-block: clamp(32px, 6vw, 72px) 80px; }
.tool-heading { max-width: 960px; margin-bottom: 32px; }
.tool-heading h1 { font-size: clamp(36px, 5.2vw, 62px); line-height: 1.08; overflow-wrap: anywhere; }
.tool-heading > p { margin-top: 20px; }
.tool-intro { color: var(--muted); font-size: clamp(17px, 2vw, 20px); max-width: 75ch; }
.tool-meta { color: var(--muted); font-size: 14px; }
.tool-workspace { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 24px; }
.tool-panel { min-width: 0; padding: clamp(20px, 3vw, 32px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.tool-panel h2 { font-size: 24px; letter-spacing: -.025em; text-wrap: initial; }
.tool-panel h3 { font-size: 19px; }
.tool-panel > h2 + *, .tool-panel > h3 + * { margin-top: 20px; }
.tool-panel > p { color: var(--muted); }
.tool-panel > .tool-actions { margin-block: 20px; }
.tool-panel li + li { margin-top: 10px; }
.tool-panel + .tool-panel { margin-top: 24px; }
.tool-workspace > .tool-panel + .tool-panel { margin-top: 0; }
.tool-form { display: grid; gap: 20px; }
.tool-form fieldset { min-width: 0; border: 0; padding: 0; margin: 0; display: grid; gap: 16px; }
.tool-form legend { font-size: 18px; font-weight: 700; margin-bottom: 16px; padding: 0; }
.field { display: grid; gap: 8px; min-width: 0; align-content: start; }
.field > label, .field > span:first-child { font-weight: 600; }
.field input:not([type="checkbox"]):not([type="radio"]), .field textarea, .field select,
.tool-form > input:not([type="checkbox"]):not([type="radio"]), .tool-form > textarea {
  width: 100%; min-width: 0; min-height: 48px; margin: 0;
  border: 1px solid var(--control-line); border-radius: 6px; padding: 11px 13px;
  background: var(--solid); color: var(--text); font: inherit;
}
.field textarea, .tool-form > textarea { resize: vertical; line-height: 1.6; }
.field input[type="color"] { padding: 5px; cursor: pointer; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 1; }
.field [aria-invalid="true"] { border-color: var(--tool-error) !important; }
.field small, .field-help { font-size: 14px; line-height: 1.55; color: var(--muted); font-weight: 400; }
.field-error { color: var(--tool-error); font-size: 14px; overflow-wrap: anywhere; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.check-field { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; }
.check-field input { flex: 0 0 auto; margin-top: .3em; width: 18px; height: 18px; accent-color: var(--accent); }
.tool-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.tool-page .button { white-space: normal; text-align: center; }
.tool-page button:disabled { opacity: .55; }
.tool-page a[aria-disabled="true"] { pointer-events: none; opacity: .55; }
.tool-status { color: var(--muted); margin-top: 16px; overflow-wrap: anywhere; }
.tool-status:empty { display: none; }
.tool-status[data-state="error"], .tool-status.error { color: var(--tool-error); }
.tool-status[data-state="success"], .tool-status.success { color: var(--accent-detail); }
.tool-status[data-state="loading"] { border-left: 3px solid var(--accent); padding-left: 12px; }
.tool-preview { position: relative; isolation: isolate; min-width: 0; min-height: 230px; border: 1px solid var(--line); border-radius: 8px; background: var(--page); overflow: hidden; }
.tool-preview iframe { display: block; width: 100%; border: 0; min-height: 260px; }
.tool-output { display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 220px; max-height: 480px; overflow: auto; resize: vertical; margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--solid); color: var(--text); font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; }
.tool-notes { margin-top: 48px; border-top: 1px solid var(--line); padding-top: 32px; max-width: 86ch; }
.tool-notes h2 { font-size: clamp(24px, 3vw, 30px); margin-bottom: 18px; }
.tool-notes h3 { margin: 28px 0 14px; }
.tool-notes p, .tool-notes li { color: var(--muted); }
.tool-notes ul, .tool-notes ol { margin-block: 16px; }
.tool-notes li + li { margin-top: 10px; }
.tool-notes code { overflow-wrap: anywhere; }
.tool-warning { padding: 16px 20px; margin-block: 20px; border-left: 3px solid var(--accent-detail); background: var(--tint); color: var(--muted); }
.tool-empty { padding: 20px; color: var(--muted); background: var(--tint); border: 1px dashed var(--line); border-radius: 6px; }
.tool-links { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 20px; }
.tool-page .site-footer { margin-top: 0; }
@media (max-width: 900px) {
  .tool-workspace { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .tool-page { --gutter: 16px; }
  .tool-heading h1 { font-size: 34px; letter-spacing: -.04em; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .tool-panel { padding: 20px 16px; }
  .tool-actions > .button { flex: 1 1 auto; }
  .tool-output { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .tool-page *, .tool-page *::before, .tool-page *::after { scroll-behavior: auto; animation: none !important; transition: none !important; }
}
