/* cct_layout.css — the page layout every CCT app's style.css shared word for
 * word (cct_common/static, 0.29.0; served as static/cct/cct_layout.css):
 * Timing Pulley Generator's layout as Sprocket Designer copied it, then Gear,
 * Worm, Bevel, Planetary and Gear-Belt-Chain. Made by tools/css_common.py from
 * the rules all of Pulley, Sprocket, Gear and Worm had on 2026-10-29 (every one
 * of those apps, and Bevel, Planetary and Gear-Belt-Chain, has each of them);
 * rules cct_theme.css already holds are left to it.
 *
 * Load it between the theme and the app's own CSS:
 *   <link rel="stylesheet" href="static/cct/cct_theme.css">
 *   <link rel="stylesheet" href="static/cct/cct_layout.css">
 *   <link rel="stylesheet" href="static/style.css">       (the app's own rules)
 * An app adopting it deletes these rules from its style.css (phase 3):
 *   python tools/css_common.py --report cct_common/static/cct_layout.css <app>/static/style.css
 */
.no-spin::-webkit-inner-spin-button, .no-spin::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Segoe UI, Arial, sans-serif; font-size: 14px; color: #1a1a1a; background: #f0f2f5; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
header { background: #0078d4; color: #fff; padding: 10px 24px; flex-shrink: 0; }
.header-inner { display: flex; align-items: center; gap: 16px; }
.logo { height: 48px; width: auto; display: block; margin: -10px 0; }
.header-title-block { display: flex; flex-direction: column; gap: 1px; }
.header-title { font-size: 14px; opacity: 0.88; }
.header-version { font-size: 10px; opacity: 0.60; letter-spacing: 0.3px; }
main { display: flex; flex: 1; gap: 0; overflow: hidden; min-height: 0; }
.controls-panel { width: 280px; min-width: 240px; background: #fff; border-right: 1px solid #dde3ea; overflow-y: auto; padding: 12px; flex-shrink: 0; }
.card { background: #f7f9fc; border: 1px solid #dde3ea; border-radius: 6px; padding: 12px 14px; margin-bottom: 10px; }
.card h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: #0078d4; margin-bottom: 10px; }
label { display: block; font-size: 12px; font-weight: 500; color: #444; margin-top: 8px; margin-bottom: 3px; }
select, input[type="number"] { width: 100%; padding: 6px 8px; border: 1px solid #c8d0db; border-radius: 4px; font-size: 13px; background: #fff; color: #1a1a1a; appearance: none; }
select:focus, input[type="number"]:focus { outline: none; border-color: #0078d4; box-shadow: 0 0 0 2px rgba(0,120,212,0.15); }
.info-row { font-size: 11px; color: #666; margin-top: 6px; }
.preset-info { font-size: 11px; color: #888; margin-top: 2px; height: 14px; }
.toggle-row { margin-top: 10px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.toggle-row input { width: auto; }
.hidden { display: none !important; }
.download-card { text-align: center; }
.btn-download { width: 100%; padding: 9px; background: #0078d4; color: #fff; border: none; border-radius: 5px; font-size: 13px; font-weight: 600; cursor: pointer; letter-spacing: 0.3px; transition: background 0.15s; }
.btn-download:hover { background: #005fa3; }
.dl-wrap { position: relative; margin-bottom: 6px; }
.dl-wrap:last-child { margin-bottom: 0; }
.dl-menu { position: absolute; bottom: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid #c8d0db; border-radius: 5px; box-shadow: 0 4px 14px rgba(0,0,0,0.13); z-index: 200; overflow: hidden; }
.dl-item { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 9px 14px; font-size: 13px; font-weight: 500; background: none; border: none; border-bottom: 1px solid #f0f2f5; cursor: pointer; color: #1a1a1a; text-align: left; }
.dl-item:last-child { border-bottom: none; }
.dl-item:hover:not(.dl-item-soon) { background: #eef3f9; color: #0078d4; }
.dl-item-soon { color: #aaa; cursor: default; }
.dl-soon-tag { font-size: 10px; background: #f3f4f6; color: #9ca3af; padding: 1px 6px; border-radius: 8px; border: 1px solid #e5e7eb; font-weight: 400; }
.preview-panel { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #fff; overflow: hidden; }
.preview-header { display: flex; align-items: center; padding: 8px 16px; gap: 8px; border-bottom: 1px solid #dde3ea; background: #f7f9fc; font-size: 13px; font-weight: 600; color: #333; flex-shrink: 0; }
.preview-tab { padding: 3px 10px; font-size: 12px; font-weight: 600; border: 1px solid #c8d0db; border-radius: 4px; background: #f0f2f5; color: #555; cursor: pointer; }
.preview-tab.active { background: #0078d4; color: #fff; border-color: #0078d4; }
.preview-tab:hover:not(.active) { background: #e2e8f0; }
.preview-box { flex: 1; min-height: 0; display: flex; align-items: stretch; justify-content: stretch; overflow: hidden; padding: 12px; background: #fafbfc; position: relative; }
#preview-img { width: 100%; height: 100%; min-height: 0; object-fit: contain; display: block; }
.preview-box-3d { padding: 0 !important; }
#three-canvas { flex: 1 1 auto; min-width: 0; min-height: 0; align-self: stretch; display: block; touch-action: none; }
.preview-box svg { max-width: 100%; max-height: 100%; }
.preview-placeholder { color: #bbb; font-size: 14px; }
.preview-footer { padding: 6px 16px; font-size: 11px; color: #888; border-top: 1px solid #eee; background: #f7f9fc; flex-shrink: 0; height: 28px; }
.drive-bar { display: flex; align-items: center; gap: 20px; padding: 6px 16px; background: #eef3f9; border-bottom: 1px solid #d0dae6; flex-shrink: 0; flex-wrap: wrap; }
.drive-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #1a1a1a; cursor: pointer; }
.drive-toggle input[type="checkbox"] { width: auto; margin: 0; cursor: pointer; accent-color: #0078d4; }
.mode3d { position: relative; display: flex; align-items: center; gap: 8px; height: 30px; margin: 0; padding: 0 8px 0 6px; border: 1.5px solid #2f63c8; border-radius: 7px; background-color: #123a8a; background-image: linear-gradient(rgba(160, 220, 255, 0.18) 1px, transparent 1px), linear-gradient(90deg, rgba(160, 220, 255, 0.18) 1px, transparent 1px); background-size: 8px 8px; cursor: pointer; user-select: none; flex-shrink: 0; }
.mode3d input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.mode3d-pulley { display: block; height: 26px; width: auto; filter: grayscale(1) contrast(0.8); opacity: 0.75; transition: filter 0.3s, opacity 0.3s; pointer-events: none; }
.mode3d-text { font-family: Orbitron, "Segoe UI", Arial, sans-serif; font-weight: 900; font-size: 14px; line-height: 1; letter-spacing: 1.5px; color: #a9e6ff; white-space: nowrap; transition: color 0.3s; pointer-events: none; }
.mode3d-switch { position: relative; flex: none; width: 30px; height: 16px; border-radius: 8px; background: #27488f; transition: background 0.25s; pointer-events: none; }
.mode3d-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); transition: left 0.25s; }
.mode3d input:checked ~ .mode3d-pulley { filter: none; opacity: 1; }
.mode3d input:checked ~ .mode3d-text { color: #fff; }
.mode3d input:checked ~ .mode3d-switch { background: #5ee0ff; }
.mode3d input:checked ~ .mode3d-switch::after { left: 16px; }
.mode3d input:focus-visible ~ .mode3d-switch { outline: 2px solid #fff; outline-offset: 2px; }
.drive-spacing { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #444; }
.drive-spacing label { margin: 0; font-size: 12px; font-weight: 500; color: #444; white-space: nowrap; }
.drive-spacing input[type="number"] { width: 90px; padding: 4px 6px; font-size: 12px; }
#gear_ratio { width: 75px; }
.belt-group { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #b0bec5; border-radius: 6px; padding: 4px 10px; }
.ratio-arrows { display: flex; flex-direction: column; gap: 1px; }
.ratio-btn { display: flex; align-items: center; justify-content: center; width: 20px; height: 16px; padding: 0; font-size: 9px; line-height: 1; background: #e8edf3; border: 1px solid #c8d0db; border-radius: 3px; cursor: pointer; color: #444; }
.ratio-btn:hover { background: #d0daea; border-color: #0078d4; color: #0078d4; }
.lock-ratio-label { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #475569; cursor: pointer; user-select: none; white-space: nowrap; }
.min-dist-btn { padding: 3px 10px; font-size: 12px; font-weight: 600; background: #f1f3f5; border: 1px solid #c8d0db; border-radius: 4px; cursor: pointer; color: #555; white-space: nowrap; transition: background 0.15s, border-color 0.15s, color 0.15s; }
.min-dist-btn:hover { background: #e2e8f0; border-color: #0078d4; color: #0078d4; }
.min-dist-btn.min-dist-warn { background: #fee2e2; border-color: #f87171; color: #b91c1c; }
.min-dist-btn.min-dist-warn:hover { background: #fecaca; }
.import-btn { padding: 3px 10px; font-size: 12px; background: #eff6ff; border: 1px solid #93c5fd; border-radius: 4px; cursor: pointer; color: #1d4ed8; white-space: nowrap; }
.import-btn:hover { background: #dbeafe; border-color: #3b82f6; }
.drive-info-btn { padding: 3px 10px; font-size: 12px; background: #eef5fc; border: 1px solid #90b8db; border-radius: 4px; cursor: pointer; color: #0078d4; white-space: nowrap; }
.drive-info-btn:hover { background: #0078d4; border-color: #0078d4; color: #fff; }
.drive-bar-right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.drive-note { font-size: 11px; color: #888; white-space: nowrap; }
.panel-title { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; color: #0078d4; text-transform: uppercase; letter-spacing: 0.5px; padding: 4px 2px 10px; border-bottom: 2px solid #0078d4; margin-bottom: 10px; }
.belt-lock-info { font-size: 12px; color: #333; padding: 8px 12px; background: #eef3f9; border-color: #c2d4e8; }
main.dual { display: grid; grid-template-columns: 280px 1fr 280px; }
main.dual .controls-panel { border-right: 1px solid #dde3ea; }
main.dual #panel2 { border-left: 1px solid #dde3ea; border-right: none; }
.panel-title-p2 { color: #761516 !important; border-bottom-color: #761516 !important; }
.view-snap-bar { flex: 1; display: flex; justify-content: center; align-items: center; gap: 4px; }
.view-snap-btn { padding: 3px 8px; font-size: 11px; font-weight: 600; background: rgba(255,255,255,0.82); border: 1px solid #bbb; border-radius: 4px; cursor: pointer; color: #333; white-space: nowrap; backdrop-filter: blur(2px); transition: background 0.12s; }
.view-snap-btn:hover { background: rgba(0,120,212,0.15); border-color: #0078d4; color: #0078d4; }
.help-btn-row { position: sticky; bottom: 0; display: flex; justify-content: flex-end; padding: 6px 2px 2px; background: linear-gradient(to bottom, transparent, #fff 40%); }
.drive-help { display: flex; align-items: center; }
@media (max-width: 600px) {
  main { flex-direction: column; height: auto; }
  main.dual { grid-template-columns: 1fr; }
  .controls-panel { width: 100%; border-right: none; border-bottom: 1px solid #dde3ea; }
  .preview-panel { min-height: 360px; }
  .drive-bar { gap: 10px; }
}
body.feature-build .fb-2d { display: none !important; }
body:not(.feature-build) .fb-3d { display: none !important; }
.hub-header { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: #0078d4; margin-bottom: 0; }
.hub-header:hover { color: #005fa3; }
.hub-arrow { font-size: 10px; transition: transform 0.2s; color: #0078d4; }
.hub-arrow.open { transform: rotate(180deg); }
.hub-body { display: none; margin-top: 10px; }
.hub-body.open { display: block; }
.hub-info { font-size: 11px; color: #888; margin-top: 4px; }
.hub-warn { font-size: 11px; color: #b91c1c; background: #fee2e2; border-radius: 4px; padding: 4px 8px; margin-top: 6px; }
@keyframes cct-spoke-flash { 0% { opacity: 0; background: #fecaca; } 30% { opacity: 1; background: #fca5a5; } 60% { opacity: 0.7; background: #fecaca; } 100% { opacity: 1; background: #fee2e2; } }
.spoke-overlap-warn { font-size: 11px; color: #b91c1c; background: #fee2e2; border: 1px solid #fca5a5; border-radius: 4px; padding: 5px 8px; margin-top: 4px; }
.spoke-overlap-warn.flash { animation: cct-spoke-flash 0.45s ease-out forwards; }
.spoke-overlap-warn .spoke-fit-head { font-weight: 600; }
.spoke-overlap-warn ul { margin: 4px 0 6px; padding-left: 16px; }
.spoke-overlap-warn li { margin: 1px 0; }
.spoke-fit-btn { width: auto; padding: 3px 12px; font-size: 12px; font-weight: 600; color: #fff; background: #b91c1c; border: none; border-radius: 4px; cursor: pointer; }
.spoke-fit-btn:hover { background: #991b1b; }
.size-row { display: flex; gap: 8px; }
.size-row > div { flex: 1; min-width: 0; }
.size-row label { margin-top: 0; }
.approx-note { font-size: 11px; color: #666; margin-top: 6px; }
.dims { border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.dims td, .dims th { padding: 2px 10px 2px 0; border-bottom: 1px solid #f0f2f5; text-align: left; }
.dims th { color: #888; font-weight: 600; }
.dims td.num { text-align: right; font-variant-numeric: tabular-nums; }
.warn-row { display: flex; align-items: flex-start; gap: 10px; }
label.has-picture { cursor: help; text-decoration: underline dotted #94a3b8; text-underline-offset: 3px; }
.feature-pic { position: fixed; z-index: 2000; width: auto; max-width: min(1000px, calc(100vw - 24px)); padding: 6px; background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; box-shadow: 0 8px 28px rgba(15, 23, 42, 0.28); pointer-events: none; opacity: 0; visibility: hidden; transition: opacity 0.12s ease; }
.feature-pic.open { opacity: 1; visibility: visible; }
.drive-units select { width: auto; padding: 3px 6px; font-size: 12px; }
#bug-report-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1100; align-items: center; justify-content: center; }
#bug-report-box { background: #fff; border-radius: 8px; width: min(520px, 96vw); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 8px 40px rgba(0,0,0,0.35); overflow: hidden; }
.bug-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 12px; border-bottom: 1px solid #dde3ea; background: #fffbeb; flex-shrink: 0; }
.bug-title { font-size: 18px; font-weight: 700; color: #92400e; }
.bug-feature-toggle { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: #555; cursor: pointer; margin-left: auto; margin-right: 10px; user-select: none; }
.bug-feature-toggle input[type="checkbox"] { cursor: pointer; accent-color: #2563eb; width: 14px; height: 14px; }
.bug-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #555; line-height: 1; padding: 0 4px; }
.bug-close:hover { color: #000; }
.bug-body { overflow-y: auto; padding: 18px 20px 10px; display: flex; flex-direction: column; gap: 10px; }
.bug-label { font-size: 13px; font-weight: 600; color: #1a1a1a; display: block; }
.bug-optional { font-weight: 400; color: #888; font-size: 12px; }
.bug-textarea { width: 100%; border: 1px solid #c8d6e2; border-radius: 4px; padding: 7px 9px; font-size: 13px; resize: vertical; font-family: inherit; box-sizing: border-box; color: #1a1a1a; }
.bug-textarea:focus { outline: none; border-color: #0078d4; }
.bug-input { width: 100%; border: 1px solid #c8d6e2; border-radius: 4px; padding: 7px 9px; font-size: 13px; font-family: inherit; box-sizing: border-box; color: #1a1a1a; }
.bug-input:focus { outline: none; border-color: #0078d4; }
.bug-status { font-size: 12px; min-height: 18px; color: #555; }
.bug-status-ok { color: #16a34a; font-weight: 600; }
.bug-status-error { color: #dc2626; font-weight: 600; }
.bug-status-warn { color: #b45309; font-weight: 600; white-space: pre-line; }
.bug-philosophy { font-size: 12px; color: #666; background: #f8fafc; border-top: 1px solid #dde3ea; padding: 10px 20px; line-height: 1.5; }
.bug-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 16px; border-top: 1px solid #dde3ea; flex-shrink: 0; }
.bug-btn { padding: 6px 20px; font-size: 13px; border-radius: 4px; cursor: pointer; border: 1.5px solid transparent; font-weight: 600; }
.bug-btn-cancel { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
.bug-btn-cancel:hover { background: #e2e8f0; }
.bug-btn-submit { background: #0078d4; border-color: #0078d4; color: #fff; }
.bug-btn-submit:hover:not(:disabled) { background: #005fa3; border-color: #005fa3; }
.bug-btn-submit:disabled { opacity: 0.55; cursor: default; }
.bug-info-btn { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #c8d0db; background: #f0f4f9; color: #0078d4; font-size: 14px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background 0.15s, border-color 0.15s, color 0.15s; flex-shrink: 0; margin-left: auto; margin-right: 6px; }
.bug-info-btn:hover { background: #0078d4; border-color: #0078d4; color: #fff; }
.bug-info-panel { background: #eef5fc; border-left: 3px solid #0078d4; border-radius: 0 4px 4px 0; padding: 10px 14px; margin: 0 0 12px; font-size: 13px; color: #1a3a5c; line-height: 1.5; }
.bug-info-panel ul { margin: 6px 0 4px 18px; }
.bug-info-panel li { margin-bottom: 3px; }
.bug-info-panel p { margin-top: 6px; font-style: italic; color: #4a6080; }
