/* BLOCK 도구 개편(2026-11-25) — 표현 층.
   시안: Claude Design "BLOCK 도구 개편안". 모든 /tools 페이지가 util CSS 뒤에 마지막으로 불러온다.
   BLOCK의 horizon-v2.css 사본에 없는 Horizon 토큰(*-text, *-surface, --hz-motion-*)을 여기서 정의한다.
   규칙: 선택·현재 위치는 중립 채움 + 굵게(밑줄·색 테두리 금지), 전환 속성은 색·투명도·4px 이하 transform만. */

.util-page-body {
  --tools-primary-text: color-mix(in srgb, var(--primary) 86%, #000);
  --tools-success-text: #217a39;
  --tools-warning-text: #a65c00;
  --tools-destructive-text: #c73737;
  --tools-info-surface: #edf4fb;
  --tools-success-surface: #edf4ef;
  --tools-warning-surface: #f8f2eb;
  --tools-destructive-surface: #fbefef;
  --tools-glass: color-mix(in srgb, var(--background) 78%, transparent);
  --tools-issue: #e0218a;
  --hz-motion-feedback: 140ms;
  --hz-motion-state: 150ms;
  --hz-motion-overlay: 160ms;
  --hz-motion-exit: 120ms;
  --hz-motion-reveal: 200ms;
  --hz-motion-content: 200ms;
  --hz-motion-busy-delay: 300ms;
  --hz-motion-slow: 300ms;
  --hz-motion-easing: cubic-bezier(0.2, 0, 0, 1);
  --hz-motion-easing-exit: cubic-bezier(0.3, 0, 1, 1);
  word-break: keep-all;
  overflow-wrap: break-word;
}
:root:is([data-theme="dark"], [data-theme="hc-dark"]) .util-page-body {
  --tools-primary-text: #8ebcf7;
  --tools-success-text: #83c496;
  --tools-warning-text: #f0b44e;
  --tools-destructive-text: #e2a6a8;
  --tools-info-surface: #1e2634;
  --tools-success-surface: #1d2826;
  --tools-warning-surface: #2c2720;
  --tools-destructive-surface: #2b2428;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .util-page-body {
    --tools-primary-text: #8ebcf7;
    --tools-success-text: #83c496;
    --tools-warning-text: #f0b44e;
    --tools-destructive-text: #e2a6a8;
    --tools-info-surface: #1e2634;
    --tools-success-surface: #1d2826;
    --tools-warning-surface: #2c2720;
    --tools-destructive-surface: #2b2428;
  }
}
:root[data-theme="hc-light"] .util-page-body {
  --tools-primary-text: #0b4a80;
  --tools-success-text: #11542a;
  --tools-warning-text: #6b3b00;
  --tools-destructive-text: #8f1d1d;
}
:root[data-theme="hc-dark"] .util-page-body {
  --tools-primary-text: #bcd8ff;
  --tools-success-text: #b5e6c2;
  --tools-warning-text: #ffd48a;
  --tools-destructive-text: #ffc9cb;
}
:root[data-theme="colorblind"] .util-page-body {
  --tools-success-text: #0f6e78;
  --tools-destructive-text: #b4461a;
}

/* ── 페이지 틀 ─────────────────────────────────────────── */
.tools-page .content { max-width: 1240px; }
.tools-page .content-wrapper { padding: 28px 40px 64px; }
.tools-stack { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.tools-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.tools-head-copy { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tools-crumb { display: flex; align-items: center; gap: 4px; font-size: 13.5px; color: var(--muted-foreground); }
.tools-crumb a { color: inherit; text-decoration: none; }
.tools-crumb a:hover { color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; }
.tools-crumb .hz-icon { font-size: 16px; }
.tools-title { margin: 0; font-size: 32px; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; }
.tools-lead { margin: 0; font-size: 16px; line-height: 1.55; color: var(--muted-foreground); }
.tools-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tools-head-actions .btn { gap: 6px; }

/* ── 버튼 보정: 같은 그룹은 한 크기, 주요 동작은 하나 ── */
.tools-page .btn { transition: background-color var(--hz-motion-state) var(--hz-motion-easing), color var(--hz-motion-state) var(--hz-motion-easing), opacity var(--hz-motion-state) var(--hz-motion-easing); }
.tools-page .btn:active:not(:disabled) { transform: translateY(1px); transition-duration: var(--hz-motion-feedback); }
.tools-btn-m { min-height: 40px; padding-inline: 16px; font-size: 15px; }
.tools-btn-block { width: 100%; justify-content: center; }

/* ── 패널: 작업 하나를 묶을 때만 ── */
.tools-page :is(.glass-card, .card) {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.tools-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); min-width: 0; }
.tools-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.tools-panel-head h2, .tools-panel-title { margin: 0; font-size: 16px; line-height: 1.35; font-weight: 600; }
.tools-panel-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

/* ── 로그인 안내: 노란 경고 상자 대신 한 줄 안내 ── */
.tools-page .schematic-access-notice.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--tools-info-surface);
  color: var(--foreground);
}
.tools-page .schematic-access-notice[hidden] { display: none; }
.tools-page .schematic-access-notice .alert-icon { color: var(--tools-primary-text); flex: none; }
.tools-page .schematic-access-notice .alert-content { display: flex; align-items: center; gap: 4px 12px; flex: 1; flex-wrap: wrap; min-width: 0; }
.tools-page .schematic-access-notice .alert-title { font-size: 14px; font-weight: 600; }
.tools-page .schematic-access-notice .alert-description { font-size: 14px; color: var(--muted-foreground); flex: 1 1 280px; }
.tools-page .schematic-access-notice .alert-actions { margin: 0 0 0 auto; }

/* ── 진행 단계 ── */
.tools-steps { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 14px; }
.tools-steps li { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 6px; border-radius: 999px; color: var(--muted-foreground); transition: background-color var(--hz-motion-state) var(--hz-motion-easing), color var(--hz-motion-state) var(--hz-motion-easing); }
.tools-steps .tools-step-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 12px; font-weight: 700; }
.tools-steps .tools-step-no .hz-icon { font-size: 14px; }
.tools-steps li[data-state="current"] { background: var(--muted); color: var(--foreground); font-weight: 600; }
.tools-steps li[data-state="current"] .tools-step-no { background: var(--foreground); border-color: var(--foreground); color: var(--background); }
.tools-steps li[data-state="done"] { color: var(--foreground); }
.tools-steps li[data-state="done"] .tools-step-no { border-color: transparent; background: var(--tools-success-surface); color: var(--tools-success-text); }
.tools-steps .tools-step-bar { width: 20px; height: 1px; background: var(--border-strong); padding: 0; }

/* ── 작업대 ── */
.tools-bench { display: grid; grid-template-columns: minmax(0, 1fr) 344px; gap: 24px; align-items: start; }
.tools-bench-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tools-bench-main { display: flex; flex-direction: column; min-width: 0; }

/* 드롭 영역(기존 schematic-dropzone을 작업대 크기로) */
.tools-page .tools-bench .schematic-upload-area { margin: 0; }
.tools-page .tools-drop .schematic-dropzone {
  min-height: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--background-subtle);
  box-shadow: none;
  text-align: center;
  transition: background-color var(--hz-motion-state) var(--hz-motion-easing);
}
.tools-page .tools-drop .schematic-dropzone:hover,
.tools-page .tools-drop .schematic-dropzone.is-dragover,
.tools-page .tools-drop .schematic-dropzone.dragover { background: var(--tools-info-surface); transform: none; }
.tools-page .tools-drop .schematic-dropzone > .hz-icon { font-size: 40px; color: var(--tools-primary-text); }
.tools-page .tools-drop .dropzone-title { font-size: 16px; font-weight: 600; }
.tools-page .tools-drop[data-has-preview="1"] .schematic-dropzone { min-height: 0; padding: 12px; flex-direction: row; gap: 10px; border-style: solid; }
.tools-page .tools-drop[data-has-preview="1"] .schematic-dropzone > .hz-icon { font-size: 24px; }
.tools-page .tools-drop[data-has-preview="1"] .dropzone-meta:not([data-template-file-name]):not([data-terrain-file-name]) { display: none; }

/* 미리보기 */
.tools-preview[hidden] { display: none; }
.tools-preview { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--card); }
.tools-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--border); }
.tools-preview-file { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; }
.tools-preview-file b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tools-preview-file small { color: var(--muted-foreground); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tools-preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 24px;
  background-color: var(--background-subtle);
  background-image:
    linear-gradient(45deg, color-mix(in srgb, var(--foreground) 6%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--foreground) 6%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--foreground) 6%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--foreground) 6%, transparent) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  transition: opacity var(--hz-motion-content) var(--hz-motion-easing);
}
.tools-preview-stage[aria-busy="true"] { opacity: 0.55; }
.tools-preview-stage canvas { display: block; max-width: 100%; image-rendering: pixelated; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), var(--shadow-md); cursor: crosshair; }
.tools-preview-readout { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.tools-preview-readout .hz-icon { font-size: 16px; }
.tools-preview-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--border); }

/* 세그먼트: 선택 = 중립 채움 + 굵게 */
.tools-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-md); background: var(--muted); }
.tools-seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--muted-foreground); cursor: pointer; white-space: nowrap; transition: background-color var(--hz-motion-state) var(--hz-motion-easing), color var(--hz-motion-state) var(--hz-motion-easing); }
.tools-seg button[aria-pressed="true"] { background: var(--card); color: var(--foreground); font-weight: 600; box-shadow: var(--shadow-sm); }
.tools-seg button:disabled { opacity: 0.5; cursor: not-allowed; }

/* 파일 칩 */
.tools-file-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: none; font: inherit; font-size: 12.5px; color: var(--muted-foreground); cursor: pointer; }
.tools-file-chip[aria-pressed="true"] { background: var(--muted); border-color: var(--muted); color: var(--foreground); font-weight: 600; }
.tools-file-chip .hz-icon { font-size: 14px; }

/* 검사 목록 */
.tools-checks { margin: 0; padding: 0; list-style: none; }
.tools-checks li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; }
.tools-checks li:first-child { border-top: 0; }
.tools-checks li > .hz-icon { flex: none; margin-top: 1px; }
.tools-checks .tools-check-copy { flex: 1; min-width: 0; }
.tools-checks .tools-check-copy small { display: block; font-size: 13px; color: var(--muted-foreground); }
.tools-checks [data-tone="ok"] > .hz-icon { color: var(--tools-success-text); }
.tools-checks [data-tone="warn"] > .hz-icon { color: var(--tools-warning-text); }
.tools-checks [data-tone="error"] > .hz-icon { color: var(--tools-destructive-text); }
.tools-checks [data-tone="wait"] > .hz-icon { color: var(--muted-foreground); }
.tools-link-btn { height: 28px; padding: 0 8px; border: 0; border-radius: var(--radius); background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--tools-primary-text); cursor: pointer; white-space: nowrap; }
.tools-link-btn:hover { background: var(--hover-overlay); }

/* 배지 */
.tools-badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--muted); color: var(--muted-foreground); transition: background-color var(--hz-motion-state) var(--hz-motion-easing), color var(--hz-motion-state) var(--hz-motion-easing); }
.tools-badge .hz-icon { font-size: 14px; }
.tools-badge[data-tone="ok"] { background: var(--tools-success-surface); color: var(--tools-success-text); }
.tools-badge[data-tone="warn"] { background: var(--tools-warning-surface); color: var(--tools-warning-text); }
.tools-badge[data-tone="error"] { background: var(--tools-destructive-surface); color: var(--tools-destructive-text); }
.tools-badge[data-tone="info"] { background: var(--tools-info-surface); color: var(--tools-primary-text); }

/* 변환 단추와 막힌 이유 */
.tools-convert { display: flex; flex-direction: column; gap: 6px; }
.tools-convert-why { margin: 0; font-size: 13px; color: var(--muted-foreground); min-height: 19px; }
.tools-convert .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* 설정 폼 정리 */
.tools-page .tools-bench-side .schematic-upload-form { display: flex; flex-direction: column; gap: 14px; }
.tools-page .tools-bench-side .input-group { margin: 0; }
.tools-page .tools-bench-side .infra-slope-panel { border: 0; padding: 0; background: none; }
.tools-page .input:focus { border-color: var(--input); box-shadow: none; }

/* 진행 표시 */
.tools-page .util-progress-fill { transition: transform var(--hz-motion-slow) var(--hz-motion-easing), width var(--hz-motion-slow) var(--hz-motion-easing); }
.tools-page .util-progress-step[data-status="active"] { background: var(--muted); border-color: transparent; color: var(--foreground); font-weight: 600; }

/* 기록 표: 새 행은 4px 올라오며 나타난다 */
.tools-page .schematic-table-wrap tbody tr { animation: tools-reveal var(--hz-motion-reveal) var(--hz-motion-easing) both; }
@keyframes tools-reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.tools-reveal { animation: tools-reveal var(--hz-motion-reveal) var(--hz-motion-easing) both; }

/* ── 규칙과 색상표 시트 ── */
.tools-sheet {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(440px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateX(4px);
  transition: opacity var(--hz-motion-exit) var(--hz-motion-easing-exit), transform var(--hz-motion-exit) var(--hz-motion-easing-exit), overlay var(--hz-motion-exit) allow-discrete, display var(--hz-motion-exit) allow-discrete;
}
.tools-sheet[open] { display: flex; flex-direction: column; opacity: 1; transform: none; transition: opacity var(--hz-motion-overlay) var(--hz-motion-easing), transform var(--hz-motion-overlay) var(--hz-motion-easing), overlay var(--hz-motion-overlay) allow-discrete, display var(--hz-motion-overlay) allow-discrete; }
@starting-style { .tools-sheet[open] { opacity: 0; transform: translateX(4px); } }
.tools-sheet::backdrop { background: rgba(10, 11, 14, 0.32); opacity: 0; transition: opacity var(--hz-motion-exit) var(--hz-motion-easing-exit), overlay var(--hz-motion-exit) allow-discrete, display var(--hz-motion-exit) allow-discrete; }
.tools-sheet[open]::backdrop { opacity: 1; transition-duration: var(--hz-motion-overlay); }
@starting-style { .tools-sheet[open]::backdrop { opacity: 0; } }
.tools-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--border); }
.tools-sheet-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.tools-sheet-body { flex: 1; overflow-y: auto; padding: 16px 20px 28px; display: flex; flex-direction: column; gap: 20px; }
.tools-sheet-body :is(.glass-card, .card) { border: 0; border-radius: 0; background: none; }
.tools-sheet-body :is(.card-header, .card-content) { padding: 0; }
.tools-sheet-body .card-header { padding-bottom: 8px; border: 0; }
.tools-sheet-body .card-title { font-size: 15px; font-weight: 600; }
.tools-sheet-body > section + section { padding-top: 20px; border-top: 1px solid var(--border); }
.tools-sheet-body .mapping-table tbody tr { cursor: copy; }
.tools-sheet-body .mapping-table tbody tr:hover { background: var(--hover-overlay); }
.tools-sheet-body .grid { display: flex; flex-direction: column; gap: 20px; }

/* ── 토스트 ── */
.tools-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: var(--z-toast, 60);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--foreground);
  color: var(--background);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity var(--hz-motion-exit) var(--hz-motion-easing-exit), transform var(--hz-motion-exit) var(--hz-motion-easing-exit);
}
.tools-toast[data-show="1"] { opacity: 1; transform: translate(-50%, 0); transition: opacity var(--hz-motion-overlay) var(--hz-motion-easing), transform var(--hz-motion-overlay) var(--hz-motion-easing); }

/* ── 기록 섹션 머리 ── */
.tools-page #myTemplatesSection, .tools-page #myTerrainsSection, .tools-page #myTexturesSection, .tools-page #myUploadsSection { border-radius: var(--radius-lg); }

/* ── 모바일 ── */
@media (max-width: 1024px) {
  .tools-bench { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .tools-page .content-wrapper { padding: 20px 16px 120px; }
  .tools-title { font-size: 26px; }
  .tools-lead { font-size: 15px; }
  .tools-head { align-items: stretch; }
  .tools-head-actions { width: 100%; }
  .tools-head-actions .btn { flex: 1; min-height: 44px; }
  .tools-steps { flex-wrap: nowrap; gap: 4px; font-size: 12.5px; }
  .tools-steps li { flex: 1; flex-direction: column; align-items: stretch; gap: 6px; height: auto; padding: 0; background: none !important; }
  .tools-steps li::before { content: ""; height: 3px; border-radius: 999px; background: var(--border-strong); }
  .tools-steps li[data-state="done"]::before { background: var(--tools-success-text); }
  .tools-steps li[data-state="current"]::before { background: var(--foreground); }
  .tools-steps .tools-step-no, .tools-steps .tools-step-bar { display: none; }
  .tools-page .tools-drop .schematic-dropzone { min-height: 200px; }
  .tools-preview-stage { min-height: 0; padding: 12px; }
  .tools-convert-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--tools-glass);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    backdrop-filter: blur(32px) saturate(180%);
    border-top: 1px solid var(--border);
  }
  .tools-convert-bar .btn { min-height: 48px; }
  .tools-sheet { width: 100vw; inset: auto 0 0 0; height: min(86dvh, 720px); border-left: 0; border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; transform: translateY(4px); }
  @starting-style { .tools-sheet[open] { transform: translateY(4px); } }
  .tools-page .input, .tools-page select, .tools-page textarea { font-size: 16px; }
  .tools-seg button { height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .tools-page *, .tools-page *::before, .tools-page *::after, .tools-sheet, .tools-sheet::backdrop, .tools-toast { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

.tools-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border: 1px solid var(--border); border-radius: var(--radius-md); }
.tools-stats[hidden] { display: none; }
.tools-stats > div { padding: 10px 12px; min-width: 0; }
.tools-stats > div + div { border-left: 1px solid var(--border); }
.tools-stats dt { order: 2; font-size: 12px; color: var(--muted-foreground); }
.tools-stats dd { margin: 0; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tools-stats > div { display: flex; flex-direction: column-reverse; }

/* ── 인프라 틀: 모드 세그먼트, 단면 미리보기 패널 ── */
.tools-mode { display: flex; flex-direction: column; gap: 8px; }
.tools-page .infra-mode-switch { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-radius: var(--radius-md); background: var(--muted); align-self: flex-start; }
.tools-page .infra-mode-switch .btn { height: 32px; min-height: 32px; padding: 0 14px; border: 0; border-radius: 6px; background: none; color: var(--muted-foreground); font-weight: 500; box-shadow: none; }
.tools-page .infra-mode-switch .btn:hover { background: var(--hover-overlay); color: var(--foreground); }
.tools-page .infra-mode-switch .btn.is-active,
.tools-page .infra-mode-switch .btn[aria-selected="true"] { background: var(--card); color: var(--foreground); font-weight: 600; box-shadow: var(--shadow-sm); }
.tools-mode #infraModeDescription { margin: 0; font-size: 14px; color: var(--muted-foreground); }
.tools-page .tools-cross :is(.card-header, .card-content) { padding: 14px 20px; }
.tools-page .tools-cross .card-header { border-bottom: 1px solid var(--border); }
.tools-page .tools-cross .card-title { font-size: 16px; font-weight: 600; }

/* ── 선택 표시 일괄 정리: 색 테두리 대신 중립 채움 + 굵게 ── */
.tools-page :is(.scape-group-row, .scape-strip-item, .scape-chip-btn) { transition: background-color var(--hz-motion-state) var(--hz-motion-easing), color var(--hz-motion-state) var(--hz-motion-easing); }
.tools-page .scape-group-row { border-color: transparent; background: none; }
.tools-page .scape-group-row:hover { border-color: transparent; background: var(--hover-overlay); }
.tools-page .scape-group-row.is-active { border-color: transparent; background: var(--muted); }
.tools-page .scape-group-row.is-active :is(strong, b, .scape-group-id) { font-weight: 700; }
.tools-page .scape-strip-item.is-active,
.tools-page .scape-chip-btn.is-active { border-color: var(--muted); background: var(--muted); color: var(--foreground); font-weight: 600; }
.tools-page .scape-strip-item:hover,
.tools-page .scape-chip-btn:hover { border-color: var(--border); }
.tools-page .scape-viewer-canvas { animation: tools-reveal var(--hz-motion-reveal) var(--hz-motion-easing) both; }
.tools-page .scape-command-row .btn { gap: 6px; }

/* ── 텍스처 디자이너·스키매틱 업로드: 패널 정리 ── */
.tools-page .schematic-overview { border: 0; padding: 0; background: none; gap: 4px 16px; }
.tools-page .schematic-overview-item { border: 0; padding: 0; background: none; }
.tools-page .texture-preview-frame, .tools-page .texture-canvas-frame { border-radius: var(--radius-lg); }

/* ── 도구 홈 ─────────────────────────────────────────── */
.tools-hub { max-width: 1240px; }
.tools-finder { display: flex; flex-direction: column; gap: 14px; }
.tools-search { position: relative; }
.tools-search > .hz-icon { position: absolute; left: 14px; top: 13px; font-size: 22px; color: var(--muted-foreground); pointer-events: none; }
.tools-search .input { width: 100%; height: 48px; padding: 0 48px 0 46px; border: 1px solid var(--input); border-radius: var(--radius-md); background: var(--muted); font-size: 16px; }
.tools-kbd { position: absolute; right: 14px; top: 15px; display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--card); font: 500 11px/1 var(--font-mono); color: var(--muted-foreground); }
.tools-search .input:focus + .tools-kbd, .tools-search .input:not(:placeholder-shown) ~ .tools-kbd { opacity: 0; }
.tools-finder-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tools-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tools-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: none; font: inherit; font-size: 14px; font-weight: 500; color: var(--muted-foreground); cursor: pointer; white-space: nowrap; transition: background-color var(--hz-motion-state) var(--hz-motion-easing), color var(--hz-motion-state) var(--hz-motion-easing); }
.tools-chip:hover { background: var(--hover-overlay); color: var(--foreground); }
.tools-chip[aria-pressed="true"] { background: var(--foreground); border-color: var(--foreground); color: var(--background); font-weight: 600; }
.tools-chip[hidden] { display: none; }
.tools-chip-count { font-size: 12px; opacity: 0.7; font-variant-numeric: tabular-nums; }
.tools-count { font-size: 13px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

.tools-flow-wrap { display: flex; flex-direction: column; gap: 12px; }
.tools-flow-wrap[hidden] { display: none; }
.tools-flow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.tools-flow > li { display: flex; flex-direction: column; gap: 6px; padding: 16px 20px; min-width: 0; }
.tools-flow > li + li { border-left: 1px solid var(--border); }
.tools-flow-step { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.tools-flow-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; background: var(--muted); font-size: 12px; font-weight: 700; }
.tools-flow p { margin: 0; font-size: 14px; color: var(--muted-foreground); }
.tools-flow a { display: inline-flex; align-items: center; gap: 2px; margin-top: auto; font-size: 13.5px; font-weight: 600; color: var(--tools-primary-text); text-decoration: none; }
.tools-flow a:hover { text-decoration: underline; text-underline-offset: 3px; }
.tools-flow a .hz-icon { font-size: 16px; }
.tools-flow code { margin-top: auto; font: 500 13px/1.4 var(--font-mono); color: var(--foreground); }

.tools-hub-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start; }
.tools-groups { display: flex; flex-direction: column; gap: 32px; min-width: 0; }
.tools-group[hidden] { display: none; }
.tools-group-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding-bottom: 8px; }
.tools-group-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.tools-group-head span { font-size: 13px; color: var(--muted-foreground); }
.tools-rows { margin: 0; padding: 0; list-style: none; }
.tools-rows > li { border-top: 1px solid var(--border); }
.tools-rows > li:last-of-type { border-bottom: 1px solid var(--border); }
.tools-rows > li[hidden] { display: none; }
.tools-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto 24px; align-items: center; gap: 16px; padding: 14px 12px; margin: 0 -12px; border-radius: var(--radius-lg); color: inherit; text-decoration: none; transition: background-color var(--hz-motion-state) var(--hz-motion-easing); }
.tools-row:hover { background: var(--hover-overlay); text-decoration: none; }
.tools-row-copy { min-width: 0; }
.tools-row h3 { margin: 0; font-size: 16px; line-height: 1.35; font-weight: 600; }
.tools-row p { margin: 2px 0 0; font-size: 14px; color: var(--muted-foreground); }
.tools-row-meta { display: block; margin-top: 6px; font: 400 12.5px/1.4 var(--font-mono); color: var(--muted-foreground); }
.tools-row-go { color: var(--muted-foreground); transition: transform var(--hz-motion-state) var(--hz-motion-easing), color var(--hz-motion-state) var(--hz-motion-easing); }
.tools-row:hover .tools-row-go { color: var(--foreground); transform: translateX(2px); }
.tools-thumb { display: grid; width: 88px; height: 60px; border-radius: var(--radius-md); overflow: hidden; background: var(--muted); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) 8%, transparent); image-rendering: pixelated; }
.tools-thumb > i { display: block; }
.tools-thumb > img { width: 100%; height: 100%; object-fit: cover; }
.tools-thumb-icon { place-items: center; color: var(--muted-foreground); }
.tools-thumb-icon .hz-icon { font-size: 28px; }
.tools-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 0; text-align: center; color: var(--muted-foreground); }
.tools-empty[hidden] { display: none; }
.tools-empty p { margin: 0; }
.tools-empty-title { font-size: 16px; font-weight: 600; color: var(--foreground); }
[data-hz-content] { transition: opacity var(--hz-motion-content) var(--hz-motion-easing), transform var(--hz-motion-content) var(--hz-motion-easing); }
[data-hz-content][data-entering="true"] { opacity: 0; transform: translateY(4px); transition: none; }

.tools-rail { position: sticky; top: calc(var(--header-height, 56px) + 24px); display: flex; flex-direction: column; gap: 24px; }
.tools-recent { padding-top: 6px; padding-bottom: 10px; gap: 12px; }
.tools-recent[data-state="loading"] { min-height: 96px; }
.tools-recent-note { margin: 0; font-size: 14px; color: var(--muted-foreground); }
.tools-recent .btn[data-recent-login] { align-self: flex-start; }
.tools-recent :is(p, a, ul)[hidden] { display: none; }
.tools-recent-list { margin: 0; padding: 0; list-style: none; }
.tools-recent-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); animation: tools-reveal var(--hz-motion-reveal) var(--hz-motion-easing) both; }
.tools-recent-list li:first-child { border-top: 0; }
.tools-recent-name { min-width: 0; color: inherit; text-decoration: none; }
.tools-recent-name:hover b { text-decoration: underline; text-underline-offset: 3px; }
.tools-recent-name b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tools-recent-name small { font-size: 12.5px; color: var(--muted-foreground); }
.tools-recent-list .btn { gap: 4px; }
.tools-learn { display: flex; flex-direction: column; gap: 4px; }
.tools-learn h2 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--muted-foreground); }
.tools-learn a { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; margin: 0 -10px; border-radius: var(--radius-md); font-size: 14px; font-weight: 500; color: inherit; text-decoration: none; }
.tools-learn a:hover { background: var(--hover-overlay); }
.tools-learn a .hz-icon { color: var(--muted-foreground); }

@media (max-width: 1024px) {
  .tools-hub-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .tools-rail { position: static; }
}
@media (max-width: 640px) {
  .tools-search .input { height: 44px; }
  .tools-search > .hz-icon { top: 11px; }
  .tools-kbd { display: none; }
  .tools-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
  .tools-chips::-webkit-scrollbar { display: none; }
  .tools-chip { height: 36px; }
  .tools-count { display: none; }
  .tools-flow { grid-template-columns: minmax(0, 1fr); }
  .tools-flow > li + li { border-left: 0; border-top: 1px solid var(--border); }
  .tools-flow > li { padding: 12px 14px; }
  .tools-row { grid-template-columns: 64px minmax(0, 1fr) 20px; gap: 12px; padding: 12px 0; margin: 0; border-radius: 0; }
  .tools-row .tools-badge { grid-column: 2; grid-row: 2; justify-self: start; margin-top: -6px; }
  .tools-row-go { grid-column: 3; grid-row: 1 / span 2; }
  .tools-thumb { width: 64px; height: 48px; }
  .tools-row h3 { font-size: 15px; }
  .tools-row p { font-size: 13px; }
}
@media (max-width: 640px) {
  .tools-row .tools-thumb { grid-row: 1 / span 2; }
}

/* 앱이 입력을 막아도(로그인 전·설정 미완료) 드롭 영역은 검사용으로 눌린다. */
.tools-page .tools-drop .schematic-dropzone.is-disabled { pointer-events: auto; opacity: 1; cursor: pointer; }
@media (max-width: 640px) {
  .tools-preview-head { flex-wrap: wrap; padding: 8px 8px 8px 12px; }
  .tools-preview-file { flex: 1 1 100%; flex-wrap: wrap; row-gap: 0; }
}

/* 만료 임박 배지: Horizon 글자·면 짝(대비 4.5:1 이상) */
.tools-page .schematic-remaining.is-danger { color: var(--tools-destructive-text); background: var(--tools-destructive-surface); border-color: color-mix(in srgb, var(--tools-destructive-text) 24%, transparent); }
