/* Tools hub and shared tool-page layout. Uses the site tokens from styles.css. */

.tool-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Tools hub ---------- */
.tools-hub-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--ink); border: 1px solid var(--ink); }
.tools-hub-card { display: flex; flex-direction: column; gap: 16px; min-width: 0; min-height: 320px; padding: 28px; background: var(--paper); color: var(--ink); text-decoration: none; font-family: var(--ui-font); }
.tools-hub-card:hover { background: var(--lime); }
.tools-hub-card:focus-visible { outline: 3px solid var(--acid); outline-offset: 3px; }
.tools-hub-card h2 { margin: 0; font-size: clamp(26px, 3vw, 36px); line-height: 1.25; letter-spacing: -.02em; word-break: keep-all; }
.tools-hub-card p { margin: 0; line-height: 1.6; }
.tools-hub-card dl { display: grid; gap: 10px; margin: 0; padding-top: 14px; border-top: 1px solid var(--line-strong); font-size: 14px; line-height: 1.55; }
.tools-hub-card dt { font-weight: 700; }
.tools-hub-card dd { margin: 2px 0 0; }
.tools-hub-open { margin-top: auto; font-weight: 700; }
.tools-hub-guides { max-width: 740px; margin: 80px auto 0; padding-top: 24px; border-top: 1px solid var(--ink); font-family: var(--ui-font); }
.tools-hub-guides h2 { margin: 0 0 18px; font-size: 24px; }
.tools-hub-guides ul { list-style: none; margin: 0; padding: 0; }
.tools-hub-guides li { display: grid; gap: 4px; margin: 0 0 18px; line-height: 1.6; }
.tools-hub-guides a { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Tool page frame ---------- */
.tool-page .tool-panel { margin-top: 56px; border: 1px solid var(--ink); background: var(--soft); font-family: var(--ui-font); }
.tool-panel [hidden] { display: none !important; }
.tool-panel-section { padding: 30px; }
.tool-panel-section + .tool-panel-section { border-top: 1px solid var(--ink); }
.tool-panel h2 { margin: 0 0 10px; font-size: clamp(24px, 3vw, 34px); line-height: 1.3; letter-spacing: -.02em; }
.tool-panel-lead { max-width: 680px; margin: 0 0 22px; line-height: 1.65; }
.tool-label { display: block; margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.tool-hint { max-width: 680px; margin: 14px 0 0; font-size: 14px; line-height: 1.6; opacity: .78; }
.tool-textarea, .tool-input {
  width: 100%;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui-font);
}
.tool-textarea { min-height: 190px; padding: 16px; font-size: 18px; line-height: 1.7; resize: vertical; }
.tool-input { min-height: 46px; padding: 0 12px; font-size: 17px; }
.tool-textarea:focus-visible, .tool-input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Tool notes ---------- */
.tool-notes { max-width: 740px; margin: 84px auto 0; font-size: 17px; line-height: 1.8; overflow-wrap: anywhere; }
.tool-notes h2 { margin: 60px 0 18px; padding-top: 18px; border-top: 1px solid var(--line-strong); font-size: clamp(26px, 3.4vw, 38px); line-height: 1.3; letter-spacing: -.02em; word-break: keep-all; }
.tool-notes h2:first-child { margin-top: 0; }
.tool-notes p { margin: 0 0 20px; }
.tool-notes ul, .tool-notes ol { margin: 0 0 24px; padding-left: 1.35em; }
.tool-notes li { margin: 0 0 10px; padding-left: .2em; }
.tool-notes a { text-decoration: underline; text-underline-offset: 3px; }
.tool-notes code, .un-css { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .9em; }
.tool-credit { margin-top: 8px; padding: 18px 20px; border: 1px solid var(--line-strong); font-size: 14px; line-height: 1.7; }
.tool-faq { margin: 0 0 24px; }
.tool-faq dt { margin: 22px 0 6px; font-weight: 700; }
.tool-faq dt:first-child { margin-top: 0; }
.tool-faq dd { margin: 0; }

/* ---------- Units ---------- */
.un-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: end; }
.un-field { display: block; min-width: 0; }
.un-table { width: 100%; max-width: 680px; margin-top: 26px; border-collapse: collapse; font-size: 17px; }
.un-table th, .un-table td { padding: 12px 14px; border: 1px solid var(--line-strong); text-align: left; }
.un-table thead th { background: var(--paper-deep); font-size: 14px; }
.un-table tbody th { width: 80px; }
.un-table output { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.un-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 26px 0 0; background: var(--ink); border: 1px solid var(--ink); }
.un-results div { padding: 18px; background: var(--paper); }
.un-results dt { font-size: 14px; }
.un-results dd { margin: 8px 0 0; font-size: 18px; }
.un-results output { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Coming-soon card (odd tool counts) ---------- */
.tools-hub-card-soon { color: var(--muted, var(--ink)); }
.tools-hub-card-soon:hover { background: var(--paper); }

/* ---------- Korean placeholder text ---------- */
.lk-settings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lk-fieldset { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line-strong); background: var(--paper); }
.lk-fieldset legend { padding: 0 4px; font-size: 14px; font-weight: 700; }
.lk-choices { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.lk-choices--stack { display: grid; gap: 6px; }
.lk-choice { display: inline-flex; align-items: flex-start; gap: 8px; min-height: 32px; padding-top: 4px; line-height: 1.4; cursor: pointer; }
.lk-choice input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--ink); }
.lk-choice small { display: block; font-size: 13px; opacity: .72; }
.lk-amount { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.lk-amount .tool-input { max-width: 140px; }
.lk-seed { display: block; margin-top: 14px; }
.lk-seed-row { display: flex; gap: 8px; }
.lk-seed-row .tool-input { min-width: 0; }
.lk-seed-row .button { flex: none; }
.lk-output-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.lk-output-head h2 { margin: 0; }
.lk-view { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.lk-view label { display: block; min-width: 180px; }
.lk-view input[type="range"] { width: 100%; min-height: 46px; accent-color: var(--ink); }
.lk-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 20px 0 0; background: var(--ink); border: 1px solid var(--ink); }
.lk-stats div { min-width: 0; padding: 12px 16px; background: var(--paper); }
.lk-stats dt { font-size: 13px; }
.lk-stats dd { margin: 4px 0 0; font-size: 14px; }
.lk-stats output { margin-right: 2px; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lk-output { min-height: 200px; max-height: 70vh; margin-top: 16px; padding: 20px; overflow: auto; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); font-size: 20px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; word-break: keep-all; }
.lk-output:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.lk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 16px; }
.lk-status { margin: 0; font-size: 14px; }

/* ---------- Symbols ---------- */
.sy-controls { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.sy-controls label { display: block; min-width: 0; }
.sy-controls .tool-input { width: 100%; }
.sy-recent { position: relative; margin-top: 20px; }
.sy-recent h3, .sy-group h3 { margin: 0 0 10px; font-size: 16px; }
.sy-group h3 small { margin-left: 4px; font-size: 13px; font-weight: 400; opacity: .72; }
.sy-recent-clear { position: absolute; top: -4px; right: 0; padding: 4px 8px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.sy-detail { display: flex; align-items: center; gap: 20px; margin-top: 20px; padding: 16px; border: 1px solid var(--line-strong); background: var(--paper); }
.sy-detail-glyph { flex: none; display: grid; place-items: center; width: 88px; height: 88px; border: 1px solid var(--ink); font-size: 52px; line-height: 1; user-select: all; }
.sy-detail dl { display: grid; grid-template-columns: repeat(4, minmax(0, auto)); gap: 8px 24px; margin: 0; }
.sy-detail dt { font-size: 13px; opacity: .72; }
.sy-detail dd { margin: 2px 0 0; font-size: 15px; overflow-wrap: anywhere; }
.sy-group + .sy-group { margin-top: 28px; }
.sy-group[hidden] { display: none; }
.sy-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.sy-item { min-width: 0; }
.sy-item[hidden] { display: none; }
.sy-cell { position: relative; display: grid; place-items: center; width: 100%; min-width: 0; height: 56px; padding: 0; border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); font: inherit; font-size: 26px; line-height: 1; cursor: pointer; }
.sy-cell:hover { background: var(--lime); }
.sy-cell:focus-visible { outline: 3px solid var(--blue); outline-offset: 1px; z-index: 1; }
.sy-cell.is-missing { border-style: dashed; color: var(--muted, var(--ink)); }
.sy-cell.is-missing .sy-glyph { opacity: .55; }
/* The family maps these to an unusable outline; draw them in an OS font instead. */
.sy-cell.is-broken .sy-glyph, .sy-detail-glyph.is-broken { font-family: "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
.sy-cell.is-missing::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); opacity: .45; }
.sy-empty { margin: 0; font-size: 15px; }
.sy-toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; max-width: calc(100vw - 32px); margin: 0; padding: 10px 16px; transform: translateX(-50%); border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .15s; }
.sy-toast-symbol { font-family: "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
.sy-toast.is-visible { opacity: 1; }
.sy-coverage { width: 100%; margin: 0 0 20px; border-collapse: collapse; font-size: 15px; }
.sy-coverage caption { margin-bottom: 8px; font-weight: 700; text-align: left; }
.sy-coverage th, .sy-coverage td { padding: 8px 10px; border-bottom: 1px solid var(--line-strong); text-align: left; }
.sy-coverage td { font-variant-numeric: tabular-nums; }

/* ---------- Contrast ---------- */
.ct { word-break: keep-all; }
.ct-colors { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: start; }
.ct-color { min-width: 0; }
.ct-color-row { display: flex; gap: 8px; }
.ct-color-row .tool-input { min-width: 0; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.ct-picker { flex: none; width: 56px; height: 46px; padding: 2px; border: 1px solid var(--ink); border-radius: 0; background: var(--paper); cursor: pointer; }
.ct-picker:focus-visible, .ct-swap:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.ct-swap { align-self: start; margin-top: 30px; white-space: nowrap; }
.ct-error { min-height: 1.4em; margin: 6px 0 0; font-size: 14px; line-height: 1.5; font-weight: 700; color: var(--ink); }
.ct-error:empty { min-height: 0; margin: 0; }
.tool-input[aria-invalid="true"] { border-width: 2px; border-style: dashed; }
.ct-type { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.ct-type label { display: block; min-width: 0; }
.ct-result { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 28px; }
.ct-ratio output { display: block; font-size: clamp(40px, 6vw, 64px); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ct-summary { flex: 1 1 320px; max-width: 560px; margin: 0; line-height: 1.6; }
.ct-table { width: 100%; max-width: 680px; margin-top: 22px; border-collapse: collapse; font-size: 16px; }
.ct-table th, .ct-table td { padding: 10px 14px; border: 1px solid var(--line-strong); text-align: left; }
.ct-table thead th { background: var(--paper-deep); font-size: 14px; }
.ct-table td { white-space: nowrap; }
.ct-table tbody th { font-weight: 400; }
.ct-table tr.is-current th, .ct-table tr.is-current td { font-weight: 700; background: var(--paper); }
.ct-table tr.is-current th::after { content: " · 지금 크기"; font-size: 13px; }
.ct-table td.is-pass::before { content: "✓ "; }
.ct-table td.is-fail::before { content: "✕ "; }
.ct-preview { margin-top: 22px; padding: 24px; border: 1px solid var(--ink); overflow-wrap: anywhere; word-break: keep-all; line-height: 1.5; }
.ct-preview p { margin: 0; }
.ct-preview .ct-preview-meta { margin-top: 14px; font-family: var(--ui-font); font-size: 13px; font-weight: 400; line-height: 1.4; }
.ct-suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ct-suggest-item { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px 14px; align-items: center; padding: 16px; border: 1px solid var(--line-strong); background: var(--paper); }
.ct-suggest-item h3 { grid-column: 1 / -1; margin: 0; font-size: 16px; }
.ct-swatch { width: 48px; height: 48px; border: 1px solid var(--ink); background: var(--paper); }
.ct-suggest-item p { margin: 0; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.ct-suggest-item .button { grid-column: 1 / -1; justify-self: start; }
.ct-suggest-item .button:disabled { opacity: .45; cursor: not-allowed; }
.ct-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 20px; }
.ct-status { margin: 0; font-size: 14px; }

@media (max-width: 760px) {
  .tools-hub-list { grid-template-columns: minmax(0, 1fr); }
  .tools-hub-card { min-height: 0; padding: 22px; }
  .tool-page .tool-panel { margin-top: 36px; }
  .tool-panel-section { padding: 20px 16px; }
  .tool-notes { margin-top: 56px; font-size: 16px; }
  .tool-notes h2 { margin-top: 44px; }
  .un-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .un-results { grid-template-columns: minmax(0, 1fr); }
  .tools-hub-card-soon { display: none; }
  .lk-settings { grid-template-columns: minmax(0, 1fr); }
  .lk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lk-view, .lk-view label { width: 100%; }
  .lk-output { padding: 16px; }
  .sy-controls { grid-template-columns: minmax(0, 1fr); }
  .sy-detail { align-items: flex-start; gap: 14px; }
  .sy-detail-glyph { width: 64px; height: 64px; font-size: 38px; }
  .sy-detail dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sy-row { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  .sy-cell { height: 48px; font-size: 22px; }
  .ct-colors { grid-template-columns: minmax(0, 1fr); }
  .ct-swap { margin-top: 0; justify-self: start; white-space: normal; }
  .ct-type { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ct-type label:last-child { grid-column: 1 / -1; }
  .ct-suggest { grid-template-columns: minmax(0, 1fr); }
  .ct-preview { padding: 16px; }
  .ct-table th, .ct-table td { padding: 8px 10px; }
}

/* ---------- Text cleaner ---------- */
.tc-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.tc-options fieldset { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line-strong); background: var(--paper); }
.tc-fieldset-hint { margin: 0 0 12px; }
.tc-options legend { padding: 0 5px; font-size: 15px; font-weight: 700; }
.tc-options label:not(.tool-label) { display: flex; align-items: flex-start; gap: 9px; margin: 0 0 10px; line-height: 1.45; cursor: pointer; }
.tc-options label.tc-sub { margin-left: 24px; font-size: 14px; }
.tc-options input[type="checkbox"] { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ink); }
.tc-options .tool-label { margin: 16px 0 6px; }
.tc-options .tool-input { max-width: 340px; }
.tc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.tc-actions .button:disabled { opacity: .45; cursor: not-allowed; }
.tc-status { min-height: 1.5em; margin: 12px 0 0; font-size: 14px; }
.tc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 20px 0 0; border: 1px solid var(--ink); background: var(--ink); }
.tc-stats div { min-width: 0; padding: 12px; background: var(--paper); }
.tc-stats dt { font-size: 13px; }
.tc-stats dd { margin: 6px 0 0; font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .tc-options { grid-template-columns: minmax(0, 1fr); }
  .tc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
