/* TinyTools — tools.css
   Tool-page structure and the interface of each individual tool. */

.tool-page { padding-block: 22px 8px; }
.tool-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.tool-head-main { display: flex; align-items: flex-start; gap: 14px; }
.tool-head h1 { font-size: clamp(1.6rem, 5.5vw, 2.3rem); margin: 0 0 6px; }
.tool-head .tool-icon { width: 52px; height: 52px; margin-top: 2px; }
.tool-head p { margin: 0; color: var(--text-2); max-width: 62ch; }
.tool-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fav-toggle .icon-star-on { display: none; }
.fav-toggle[aria-pressed="true"] { border-color: var(--accent-2); color: var(--text); background: var(--violet-soft); }
.fav-toggle[aria-pressed="true"] .icon-star-on { display: inline-block; color: var(--accent-2); }
.fav-toggle[aria-pressed="true"] .icon-star-off { display: none; }

/* The working interface is the visual focus */
.panel {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.panel::before { content: ""; position: absolute; left: 20px; right: 20px; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--accent-line), transparent); }
.panel-title { font-size: 0.8rem; font-family: var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); margin: 0 0 12px; font-weight: 500; }
.tool-ui { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.two-col { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.rt-layout { grid-template-areas: "results" "editor" "settings"; }
.rt-editor { grid-area: editor; } .rt-results-panel { grid-area: results; } .rt-settings { grid-area: settings; }
.stats.is-stack { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats.is-stack + .hint { margin-top: 10px; }
.search-open .search-label { display: none; }
.tool-error { padding: 16px; border: 1px solid var(--error); border-radius: var(--radius); background: var(--error-soft); }
.noscript-box { padding: 16px; border: 1px solid var(--accent-line); border-radius: var(--radius); background: var(--accent-soft); margin-bottom: 16px; }

.tool-below { display: grid; gap: 28px; margin-top: 36px; }
.tool-below h2 { font-size: 1.3rem; }
.instructions { color: var(--text-2); }
.instructions h2 { color: var(--text); }
.tool-head-actions { flex: none; }
.instructions ol, .instructions ul { padding-left: 1.3em; }
.instructions li { margin-bottom: 0.45em; }
.instructions strong { color: var(--text); }
.notes { font-size: 0.92rem; color: var(--text-2); }
.notes li { margin-bottom: 0.4em; }
.related-title { margin-bottom: 14px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; text-decoration: none; margin-top: 24px; }
.back-link:hover { text-decoration: underline; }

.editor-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.editor-head > label, .editor-head .field-label { font-weight: 600; font-size: 0.92rem; }
.editor .textarea { min-height: 240px; }
.editor-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.editor-tools .btn { flex: 1 1 140px; }
.empty-hint { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 0; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--text-2); font-size: 0.92rem; }
.empty-hint .icon { color: var(--accent-text); margin-top: 2px; }

/* ----- Stat tiles (Word Counter, Reading Time) ----- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.stat { padding: 12px 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); text-align: center; min-width: 0; }
.stat dt { font-size: 0.72rem; color: var(--text-2); line-height: 1.25; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin: 0 0 4px; }
.stat dd { margin: 0; font-family: var(--mono); font-size: clamp(1.1rem, 5vw, 1.6rem); font-weight: 600; color: var(--text); line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat dd.is-text { font-size: clamp(0.95rem, 4vw, 1.15rem); }
.stat.is-accent { border-color: var(--accent-line); background: var(--accent-soft); }
.stat.is-accent dd { color: var(--accent-text); }
.stat small { display: block; margin-top: 4px; font-family: var(--font); font-size: 0.75rem; color: var(--text-2); font-weight: 400; }

/* ----- Case converter ----- */
.mode-panel .seg-group { gap: 8px; }
.output-box { position: relative; }
.output-box .textarea { min-height: 200px; background: var(--bg-2); }
.output-placeholder { color: var(--text-2); }

/* ----- QR ----- */
.qr-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.qr-canvas-wrap { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; max-width: 340px; width: 100%; margin-inline: auto; background: #ffffff; border: 1px solid var(--border-strong); border-radius: 16px; padding: 12px; overflow: hidden; }
.qr-canvas-wrap canvas { width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.qr-placeholder { text-align: center; color: #4b5b78; padding: 16px; font-size: 0.92rem; }
.qr-placeholder .icon { width: 44px; height: 44px; color: #8091ad; display: block; margin: 0 auto 8px; }
.qr-meta { text-align: center; color: var(--text-2); font-size: 0.85rem; margin: 10px 0 0; min-height: 1.4em; }
.qr-lib-error { padding: 14px; border: 1px solid var(--error); background: var(--error-soft); border-radius: 12px; margin-bottom: 14px; }
.qr-lib-error p { margin: 0 0 10px; }

/* ----- Password ----- */
.pw-display {
  display: flex; align-items: center; justify-content: center;
  min-height: 96px; padding: 18px 14px;
  background: var(--bg-2);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  box-shadow: inset 0 0 30px -18px var(--accent);
  font-family: var(--mono);
  font-size: clamp(1.15rem, 5.4vw, 1.75rem);
  line-height: 1.5;
  letter-spacing: 0.03em;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-all;
  user-select: all; -webkit-user-select: all;
}
.pw-display output { display: block; width: 100%; }
.pw-display .pw-placeholder { color: var(--text-2); font-family: var(--font); font-size: 1rem; letter-spacing: 0; }
.pw-d { color: var(--accent-text); }
.pw-s { color: var(--accent-2); }
.strength { margin: 14px 0 0; }
.strength-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 0.9rem; margin-bottom: 8px; flex-wrap: wrap; }
.strength-label { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.strength-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.strength-bars span { height: 8px; border-radius: 99px; background: var(--border); transition: background-color 0.25s; }
.strength[data-level="1"] .strength-bars span:nth-child(-n+1) { background: var(--error); }
.strength[data-level="2"] .strength-bars span:nth-child(-n+2) { background: #ffb86b; }
.strength[data-level="3"] .strength-bars span:nth-child(-n+3) { background: var(--accent); }
.strength[data-level="4"] .strength-bars span:nth-child(-n+4) { background: var(--success); }
.strength-note { color: var(--text-2); font-size: 0.82rem; margin: 8px 0 0; }
.len-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 12px; align-items: center; }
.len-row .input { text-align: center; font-family: var(--mono); }
.opt-list { display: grid; gap: 2px; }

/* ----- Reading time ----- */
.speed-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.custom-speed { margin-top: 8px; }
.result-big { font-family: var(--mono); font-size: clamp(1.15rem, 5vw, 1.5rem); font-weight: 600; color: var(--accent-text); }
.rt-results { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); margin: 0; }
.rt-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); }
.rt-card dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); font-weight: 600; margin-bottom: 4px; }
.rt-card dd { margin: 0; }
.rt-card .sub { color: var(--text-2); font-size: 0.85rem; margin-top: 2px; }
.rt-card .result-big.is-muted { color: var(--text-2); }

/* ----- Lorem ----- */
.qty-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; gap: 8px; align-items: center; }
.qty-row .input { text-align: center; font-family: var(--mono); }
.qty-row .btn { padding: 0; min-width: 48px; font-size: 1.3rem; }
.lorem-output { min-height: 200px; max-height: 480px; overflow: auto; padding: 14px 16px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; line-height: 1.7; }
.lorem-output p { margin: 0 0 1em; }
.lorem-output p:last-child { margin-bottom: 0; }
.lorem-output:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.lorem-output .output-placeholder { margin: 0; }
.output-meta { color: var(--text-2); font-size: 0.85rem; font-family: var(--mono); margin: 8px 0 0; min-height: 1.4em; }
.qr-canvas-wrap.is-stale canvas { opacity: 0.25; }
.stat dd .is-muted { color: var(--text-2); }
.strength + .btn-row, .pw-display + .btn-row, .qr-meta + .btn-row { margin-top: 16px; }
