.htp-app { --htp-blue: #2e78ff; --htp-ink: #1f2a44; max-width: 880px; margin-inline: auto; }
.htp-app [hidden], .htp-loading[hidden] { display: none !important; }
.htp-head { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.htp-head h1 { margin: 2px 0 7px; }
.htp-head .label { margin: 0; }
.htp-hero { width: 88px; height: 88px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--rule); border-radius: 22px; background: linear-gradient(145deg, var(--accent-soft), var(--card)); }
.htp-hero-icon { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.htp-icon-fallback { display: grid; place-items: center; color: var(--accent); font-weight: 750; letter-spacing: -.04em; }
.htp-hero-icon.htp-icon-fallback { font-size: 18px; }
.htp-backend { margin: 16px 0; padding: 12px 15px; border-left: 3px solid var(--rule-2); background: var(--surface); color: var(--muted); font-size: 14px; }
.htp-backend.ready { border-color: var(--accent); }
.htp-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 6px; margin: 18px 0; border: 1px solid var(--rule); border-radius: 999px; background: var(--card); }
.htp-tab { min-height: 46px; border-radius: 999px; color: var(--muted); font-weight: 700; }
.htp-tab.active { color: white; background: var(--accent); }
.htp-card { margin: 18px 0; padding: clamp(18px, 4vw, 28px); border: 1px solid var(--rule); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.htp-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.htp-card-title h2 { margin: 0 0 6px; font-size: 24px; }
.htp-mini-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.htp-mini { min-height: 36px; padding: 7px 13px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 700; }
.htp-mini.danger, .zm-button.danger { color: #c4372c; background: #fff3f1; border-color: #f0c9c5; }
.htp-uploader { width: 100%; min-height: 230px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; margin-top: 18px; border: 2px dashed var(--rule-2); border-radius: 16px; background: linear-gradient(180deg, var(--accent-soft), var(--card)); }
.htp-uploader:hover { border-color: var(--accent); }
.htp-uploader span:last-child { color: var(--muted); font-size: 14px; }
.htp-uploader-plus { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--card); color: var(--accent); font-size: 34px; }
.htp-preview img { display: block; width: 100%; max-height: 560px; margin-top: 18px; object-fit: contain; border-radius: 14px; background: white; }
.htp-preview p { text-align: center; }
.htp-primary { width: 100%; margin: 18px 0 0; justify-content: center; }
.htp-error:empty { display: none; }
.htp-draw-wrap { position: relative; margin-top: 18px; overflow: hidden; border: 1px solid var(--rule-2); border-radius: 16px; background: white; }
.htp-canvas { display: block; width: 100%; background: white; touch-action: none; cursor: crosshair; }
.htp-draw-badge, .htp-tools-toggle, .htp-landscape { position: absolute; z-index: 3; border-radius: 999px; background: rgba(20, 28, 45, .72); color: white; font-size: 12px; backdrop-filter: blur(8px); }
.htp-draw-badge { left: 12px; bottom: 12px; padding: 7px 11px; pointer-events: none; }
.htp-tools-toggle { left: 12px; top: 12px; padding: 8px 12px; }
.htp-landscape { right: 12px; bottom: 12px; padding: 8px 12px; }
.htp-toolbar { margin-top: 15px; padding: 15px; border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); }
.tools-collapsed .htp-toolbar { display: none; }
.htp-tool-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.htp-tool-label { width: 48px; flex: 0 0 auto; font-size: 14px; }
.htp-colors { display: flex; flex-wrap: wrap; gap: 10px; }
.htp-color { width: 30px; height: 30px; border: 2px solid var(--rule-2); border-radius: 999px; }
.htp-color.on { outline: 3px solid var(--accent-soft); border-color: var(--accent); transform: scale(1.08); }
.htp-tool-row input[type="range"] { flex: 1; min-width: 100px; accent-color: var(--accent); }
.htp-size, .htp-pill { padding: 5px 10px; border: 1px solid var(--rule); border-radius: 999px; color: var(--muted); font-size: 13px; }
.htp-tool-actions, .htp-result-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.htp-tool-actions > *, .htp-result-actions > * { flex: 1; justify-content: center; }
.htp-info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.htp-info { padding: 16px; border: 1px solid var(--rule); border-radius: 13px; background: var(--surface); }
.htp-info p { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.htp-info-top { display: flex; align-items: center; gap: 9px; }
.htp-info-icon, .htp-part-icon { width: 30px; height: 30px; object-fit: contain; flex: 0 0 auto; }
.htp-info-icon.htp-icon-fallback, .htp-part-icon.htp-icon-fallback { border-radius: 9px; background: var(--accent-soft); }
.htp-guide h2 { margin: 20px 0 12px; font-size: 22px; }
.htp-guide h2:first-child { margin-top: 0; }
.htp-guide-list { padding-left: 23px; line-height: 1.8; color: var(--muted); }
.htp-guide-list li::marker { color: var(--accent); }
.htp-guide-foot { padding: 12px; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); color: var(--muted); text-align: center; font-size: 14px; }
.htp-part { margin-top: 12px; border: 1px solid var(--rule); border-radius: 13px; overflow: hidden; background: var(--surface); }
.htp-part.running { border-color: color-mix(in srgb, var(--accent) 30%, var(--rule)); }
.htp-part.error, .htp-part.failed { border-color: #f0c9c5; }
.htp-part summary { display: flex; align-items: center; gap: 10px; padding: 13px; cursor: pointer; }
.htp-part summary strong { flex: 1; }
.htp-part-status { color: var(--muted); font-size: 12px; }
.htp-part-text { margin: 0 13px 13px; padding: 13px; border-radius: 10px; background: var(--card); white-space: pre-line; line-height: 1.8; }
.htp-result-actions { margin-top: 17px; }
.htp-loading { position: fixed; z-index: 1000; inset: 0; display: grid; place-content: center; padding: 30px; background: rgba(12, 16, 28, .42); }
.htp-loading > * { width: min(560px, calc(100vw - 60px)); box-sizing: border-box; margin: 0; padding: 10px 22px; background: var(--card); }
.htp-loading strong { padding-top: 24px; border-radius: 18px 18px 0 0; font-size: 18px; }
.htp-loading p:last-child { padding-bottom: 24px; border-radius: 0 0 18px 18px; }
body.htp-focus-mode { overflow: hidden; }
.htp-focus-card { position: fixed; z-index: 999; inset: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: #0b1020; }
.htp-focus-card .htp-card-title { display: none; }
.htp-focus-card .htp-draw-wrap { margin: 0; border: 0; border-radius: 0; }
.htp-focus-card .htp-toolbar { position: absolute; z-index: 5; left: 12px; right: 12px; bottom: 12px; max-height: 45vh; margin: 0; overflow: auto; background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); }
.htp-focus-card.tools-collapsed .htp-toolbar { display: none; }
.htp-focus-card .htp-landscape { top: 12px; bottom: auto; }
.htp-focus-card .htp-draw-badge { top: 14px; bottom: auto; left: 82px; }
@media (max-width: 600px) {
  .htp-head { align-items: flex-start; } .htp-hero { width: 64px; height: 64px; border-radius: 17px; }
  .htp-card-title { flex-direction: column; } .htp-mini-actions { width: 100%; justify-content: flex-start; }
  .htp-info-grid { grid-template-columns: 1fr; } .htp-tool-row { align-items: flex-start; } .htp-tool-actions > * { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .htp-app * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
