/* The three free tools (card g-2). Loaded by each tool page after the landing page's own
   styles, so it uses the same tokens and follows the same light and dark themes. */
:root { --bad: #a3262a; --bad-bg: rgba(163, 38, 42, 0.08); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bad: #ff9b9b; --bad-bg: rgba(255, 155, 155, 0.1); }
}
:root[data-theme="dark"] { --bad: #ff9b9b; --bad-bg: rgba(255, 155, 155, 0.1); }

.tool { max-width: 860px; margin: 0 auto; padding: 0 var(--gutter) var(--s9); text-align: left; position: relative; z-index: 1; }
.tool-card { background: var(--tile); border-radius: var(--r-l); padding: var(--s6); }
.tool-card + .tool-card { margin-top: var(--s4); }
.tool-card h2 { font-size: clamp(20px, 2vw, 26px); line-height: 1.15; letter-spacing: -0.03em; font-weight: 600; margin: 0; max-width: none; text-align: left; text-wrap: balance; }
.tool-card .hint { margin-top: var(--s1); color: var(--ink-3); font-size: 14px; }
.tool .needs-js { margin-bottom: var(--s4); padding: var(--s4) var(--s5); border-radius: var(--r-m); background: var(--bg-alt); color: var(--ink); box-shadow: inset 0 0 0 1px var(--field-line); font-weight: 500; }
.tool.live .needs-js { display: none; }
.tool:not(.live) .js-only { display: none; }

.tool > .hint { margin-top: var(--s4); color: var(--ink-3); font-size: 14px; }
.field { display: block; margin-top: var(--s4); }
.field > span, .field > legend { display: block; font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: var(--s1); }
.field .opt { color: var(--ink-3); font-weight: 400; }
.tool input[type="text"], .tool select, .tool textarea {
  width: 100%; min-height: 44px; font: inherit; font-size: 16px; color: var(--ink); background: var(--bg);
  border: 0; border-radius: var(--r-s); padding: var(--s2) var(--s3); box-shadow: inset 0 0 0 1px var(--field-line);
}
.tool textarea { resize: vertical; min-height: 88px; line-height: 1.45; }
.tool input:focus-visible, .tool select:focus-visible, .tool textarea:focus-visible { outline: 2px solid var(--violet); outline-offset: 1px; }
.tool input::placeholder, .tool textarea::placeholder { color: var(--ink-3); opacity: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s4); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 var(--s4); }

.lines { list-style: none; margin: var(--s3) 0 0; padding: 0; display: grid; gap: var(--s2); }
.line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 160px) auto; gap: var(--s2); align-items: center; }
button.x { appearance: none; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; width: 44px; height: 44px; border-radius: var(--r-s); font: inherit; font-size: 22px; line-height: 1; }
.x:hover { background: var(--bg-alt); color: var(--ink); }
.tool-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s4); }
.tool .btn { min-height: 44px; }

.tool-result { margin-top: var(--s4); border-radius: var(--r-l); padding: var(--s6); background: var(--night-tile); color: var(--night-ink); }
.tool-result:empty { display: none; }
.tool-result .kicker { font-size: 14px; color: var(--night-ink-3); font-weight: 500; }
.tool-result .answer { margin-top: var(--s1); font-size: clamp(30px, 4.4vw, 52px); line-height: 1.05; letter-spacing: -0.04em; font-weight: 600; text-wrap: balance; }
.tool-result .detail { margin-top: var(--s3); color: var(--night-ink-3); max-width: 52ch; }
.tool-result .detail a, .tool-result a { color: var(--night-link); }
.tool-result ul { margin: var(--s4) 0 0; padding: 0; list-style: none; display: grid; gap: var(--s3); }
.tool-result li { padding-top: var(--s3); border-top: 1px solid rgba(255, 255, 255, 0.14); color: var(--night-ink-3); }
.tool-result li strong { display: block; color: var(--night-ink); font-weight: 500; }
.tool-result .note { position: static; transform: none; width: auto; max-width: none; background: transparent; box-shadow: none; padding: 0; margin-top: var(--s4); color: var(--night-ink-3); font-size: 14px; }
.tool-result.is-learn .answer, .tool-result.is-worth .answer { color: var(--night-ink); }
.sums { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); margin: var(--s4) 0 0; }
.sums div { padding-top: var(--s3); border-top: 1px solid rgba(255, 255, 255, 0.14); }
.sums dt { font-size: 14px; color: var(--night-ink-3); }
.sums dd { margin: var(--s1) 0 0; font-size: clamp(22px, 2.6vw, 30px); font-weight: 600; letter-spacing: -0.03em; color: var(--night-ink); }

.tool-error { margin-top: var(--s4); padding: var(--s4) var(--s5); border-radius: var(--r-m); background: var(--bad-bg); box-shadow: inset 0 0 0 1px var(--bad); color: var(--ink); }
.tool-error:empty { display: none; }
.tool-error ul { margin: 0; padding-left: var(--s5); }
.tool-error p { font-weight: 500; margin-bottom: var(--s1); color: var(--bad); }

.chart { display: block; width: 100%; height: auto; margin-top: var(--s5); }
.chart-line { fill: none; stroke: #b6a9ff; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: rgba(182, 169, 255, 0.16); stroke: none; }
.chart-base { stroke: rgba(255, 255, 255, 0.28); stroke-width: 1; }
.chart-text { fill: var(--night-ink-3); font-size: 13px; font-family: var(--font); }

.questions { display: grid; gap: var(--s3); margin: var(--s4) 0 0; padding: 0; }
.q { border: 0; margin: 0; padding: var(--s4) var(--s5); background: var(--bg); border-radius: var(--r-m); min-width: 0; }
.q legend { padding: 0; font-weight: 500; font-size: 17px; letter-spacing: -0.01em; float: left; width: 100%; margin-bottom: var(--s3); }
.q .must { font-size: 12px; font-weight: 500; color: var(--link); margin-left: var(--s2); white-space: nowrap; }
.choices { display: flex; flex-wrap: wrap; gap: var(--s2); clear: both; }
.choices label { position: relative; }
.choices input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choices span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s5); border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px var(--field-line); color: var(--ink); font-size: 15px; font-weight: 500; }
.choices input:checked + span { background: var(--violet); color: var(--on-violet); box-shadow: none; }
.choices input:focus-visible + span { outline: 2px solid var(--link); outline-offset: 3px; }
.progress { margin-top: var(--s4); font-size: 14px; color: var(--ink-3); }

.table-wrap { margin-top: var(--s3); }
.sheet-table { width: 100%; border-collapse: collapse; }
.sheet-table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--ink-3); padding: 0 var(--s2) var(--s1) 0; }
.sheet-table td { padding: var(--s1) var(--s2) var(--s1) 0; vertical-align: middle; }
.sheet-table td:last-child, .sheet-table th:last-child { padding-right: 0; width: 52px; }
.sheet-table td:nth-child(2), .sheet-table th:nth-child(2) { width: 34%; }

.how, .tool-faq { max-width: 680px; margin: 0 auto; padding: 0 var(--gutter) var(--s8); text-align: left; position: relative; z-index: 1; }
.how h2, .tool-faq h2 { font-size: clamp(24px, 2.4vw, 32px); line-height: 1.15; letter-spacing: -0.03em; font-weight: 600; margin: 0 0 var(--s3); max-width: none; text-align: left; }
.how ol, .how p { margin: 0 0 var(--s4); color: var(--ink-2); }
.how ol { padding-left: var(--s5); }
.how li + li { margin-top: var(--s2); }
.how a { text-decoration: underline; text-underline-offset: 3px; }
.stay { font-weight: 500; color: var(--ink); }
.tool-faq .faq { margin-top: var(--s3); }

@media (max-width: 899px) {
  .tool-card { padding: var(--s5) var(--s4); }
  .tool-result { padding: var(--s5) var(--s4); }
  .sums { grid-template-columns: 1fr; gap: var(--s3); }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
  .line { grid-template-columns: minmax(0, 1fr) 44px; }
  .line input:nth-child(2) { grid-column: 1; grid-row: 2; }
  .line .x { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .sheet-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .sheet-table, .sheet-table tbody, .sheet-table tr, .sheet-table td { display: block; }
  .sheet-table tr { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: var(--s2); margin-bottom: var(--s3); align-items: center; }
  .sheet-table td { padding: 0; width: auto !important; }
  .sheet-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .sheet-table td:nth-child(2) { grid-column: 1; grid-row: 2; }
  .sheet-table td:nth-child(3) { grid-column: 2; grid-row: 1 / span 2; }
}
