/* ================= LoomSharp design system ================= */
:root {
  --bg: #0e1116;
  --bg-soft: #151a21;
  --bg-card: #1a2029;
  --border: #2a3340;
  --text: #e8ecf1;
  --text-dim: #9aa7b5;
  --accent: #e8b44a;       /* warm gold — thread color */
  --accent-soft: rgba(232, 180, 74, 0.12);
  --teal: #3ecfb2;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.6; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
code { font-family: var(--mono); }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 780px; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); letter-spacing: -0.01em; margin-bottom: 12px; }
h3 { font-size: 1.05rem; }
.accent { color: var(--accent); }
.good { color: var(--ok); }
.bad { color: var(--bad); }
section { padding: 72px 0; }
.section-sub { color: var(--text-dim); max-width: 620px; margin: 0 0 32px; }

/* buttons */
.btn { display: inline-block; padding: 12px 22px; border-radius: 10px; font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent; cursor: pointer; transition: all .15s ease; text-align: center; }
.btn-primary { background: var(--accent); color: #1a1408; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-outline { border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ============ header ============ */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(14,17,22,0.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 28px; height: 62px; }
.logo { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; display: inline-flex; align-items: center; gap: 8px; }
.logo-mark { color: var(--accent); font-size: 1.3rem; }
.site-nav { display: flex; gap: 22px; margin-left: auto; font-size: 0.9rem; color: var(--text-dim); }
.site-nav a:hover { color: var(--text); }
@media (max-width: 760px) { .site-nav { display: none; } .header-inner { justify-content: space-between; } }

/* ============ hero ============ */
.hero { padding: 88px 0 64px; text-align: center;
  background: radial-gradient(ellipse 70% 55% at 50% 0%, rgba(232,180,74,0.08), transparent),
              repeating-linear-gradient(90deg, transparent 0 39px, rgba(255,255,255,0.015) 39px 40px); }
.hero-kicker { color: var(--teal); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 16px; }
.hero .arrow { color: var(--accent); }
.hero-sub { color: var(--text-dim); font-size: 1.15rem; max-width: 640px; margin: 20px auto 40px; }
.hero-sub strong { color: var(--text); }

.hero-upload { max-width: 780px; margin: 0 auto; }
.upload-zone { display: block; border: 2px dashed var(--border); border-radius: var(--radius); padding: 40px 24px;
  background: var(--bg-soft); transition: all .2s; }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.upload-icon { font-size: 2rem; color: var(--accent); }
.upload-title { font-weight: 700; font-size: 1.15rem; margin-top: 8px; }
.upload-hint { color: var(--text-dim); font-size: 0.85rem; margin-top: 4px; }

.hero-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
@media (max-width: 680px) { .hero-modes { grid-template-columns: 1fr; } }
.mode-btn { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 16px;
  text-align: left; display: flex; flex-direction: column; gap: 2px; transition: all .15s; }
.mode-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.mode-icon { color: var(--accent); font-size: 1.3rem; }
.mode-name { font-weight: 700; }
.mode-desc { color: var(--text-dim); font-size: 0.82rem; }

/* ============ flow ============ */
.flow { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg-soft); padding: 48px 0; }
.flow-steps { display: flex; align-items: stretch; gap: 10px; justify-content: space-between; }
.flow-step { flex: 1; text-align: center; padding: 10px; }
.flow-num { display: inline-flex; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-weight: 700; align-items: center; justify-content: center; margin-bottom: 10px; }
.flow-step h3 { margin-bottom: 4px; }
.flow-step p { color: var(--text-dim); font-size: 0.85rem; }
.flow-arrow { align-self: center; color: var(--accent); font-size: 1.4rem; }
@media (max-width: 760px) { .flow-steps { flex-direction: column; } .flow-arrow { transform: rotate(90deg); } }

/* ============ problem ============ */
.problem { text-align: center; }
.problem p { color: var(--text-dim); margin: 18px auto; max-width: 640px; }
.problem p strong { font-family: var(--mono); }
.ppi-demo { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 460px; margin: 28px auto; padding: 22px 26px; text-align: left; }
.ppi-demo-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.ppi-demo-row span { color: var(--text-dim); }
.ppi-demo-fix { text-align: center; padding-top: 18px; }
.problem-note em { color: var(--text); font-style: normal; font-weight: 600; }

/* ============ features ============ */
.features { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.features h2 { text-align: center; margin-bottom: 40px; }
.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 760px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.feature-icon { font-size: 1.6rem; margin-bottom: 10px; }
.feature-card h3 { font-size: 1.2rem; margin-bottom: 8px; }
.feature-card p { color: var(--text-dim); font-size: 0.92rem; }
.check-list { list-style: none; margin-top: 14px; font-family: var(--mono); font-size: 0.85rem; }
.check-list li { padding: 3px 0; }
.check-list li.ok::before { content: "✅ "; }
.check-list li.warn::before { content: "⚠️ "; }
.placement-demo { margin-top: 16px; }
.placement-fabric { position: relative; height: 150px; border: 1px solid var(--accent); border-radius: 6px;
  background: repeating-linear-gradient(0deg, transparent 0 19px, rgba(232,180,74,0.06) 19px 20px); }
.placement-art { position: absolute; top: 18px; right: 32px; font-size: 2.4rem; }
.placement-w { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); color: var(--text-dim); font-size: 0.75rem; font-family: var(--mono); }
.placement-h { position: absolute; top: 50%; left: 6px; transform: translateY(-50%); color: var(--text-dim); font-size: 0.75rem; font-family: var(--mono); }
.repeat-demo { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.repeat-demo span { border: 1px solid var(--border); border-radius: 20px; padding: 5px 14px; font-size: 0.82rem; color: var(--text-dim); }

/* ============ presets ============ */
.presets h2 { text-align: center; }
.presets .section-sub { text-align: center; margin: 0 auto 36px; }
.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 860px) { .preset-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .preset-grid { grid-template-columns: 1fr; } }
.preset-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; text-align: center; transition: border-color .15s; }
.preset-card:hover { border-color: var(--accent); }
.preset-card h3 { color: var(--accent); margin-bottom: 6px; }
.preset-card p { color: var(--text-dim); font-size: 0.85rem; }

/* ============ audience ============ */
.audience { text-align: center; background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.audience-tags { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 24px; }
.audience-tags span { border: 1px solid var(--border); background: var(--bg-card); border-radius: 20px; padding: 7px 16px; font-size: 0.88rem; color: var(--text-dim); }

/* ============ pricing ============ */
.pricing h2 { text-align: center; }
.pricing .section-sub { text-align: center; margin: 0 auto 36px; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .pricing-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .pricing-grid { grid-template-columns: 1fr; } }
.price-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; display: flex; flex-direction: column; position: relative; }
.price-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.price-card .badge { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #1a1408; font-size: 0.72rem; font-weight: 700; padding: 3px 12px; border-radius: 12px; }
.price-card h3 { margin-bottom: 8px; }
.price { font-size: 1.8rem; font-weight: 800; margin-bottom: 14px; }
.price span { font-size: 0.85rem; color: var(--text-dim); font-weight: 400; }
.price-card ul { list-style: none; color: var(--text-dim); font-size: 0.88rem; flex: 1; margin-bottom: 18px; }
.price-card li { padding: 4px 0 4px 20px; position: relative; }
.price-card li::before { content: "✓"; position: absolute; left: 0; color: var(--teal); }
.beta-note { text-align: center; margin-top: 28px; color: var(--text-dim); background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 20px; }
.beta-note strong { color: var(--accent); }

/* ============ faq ============ */
.faq details { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-right: 28px; }
.faq summary::after { content: "+"; position: absolute; right: 4px; color: var(--accent); font-size: 1.2rem; }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--text-dim); margin-top: 10px; font-size: 0.94rem; }

/* ============ footer ============ */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0 24px; background: var(--bg-soft); }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-inner p { color: var(--text-dim); font-size: 0.85rem; margin-top: 8px; }
.footer-inner nav { display: flex; gap: 20px; font-size: 0.9rem; color: var(--text-dim); }
.footer-inner nav a:hover { color: var(--text); }
.footer-legal { margin-top: 28px; color: var(--text-dim); font-size: 0.8rem; }

/* ================================================================
   APP STYLES
   ================================================================ */
.app-body { display: flex; flex-direction: column; min-height: 100vh; }
.app-main { flex: 1; display: grid; grid-template-columns: 320px 1fr; gap: 0; align-items: start; }
@media (max-width: 900px) { .app-main { grid-template-columns: 1fr; } }

/* sidebar */
.app-side { border-right: 1px solid var(--border); background: var(--bg-soft); padding: 20px; min-height: calc(100vh - 62px);
  position: sticky; top: 62px; overflow-y: auto; max-height: calc(100vh - 62px); }
@media (max-width: 900px) { .app-side { position: static; min-height: 0; max-height: none; border-right: 0; border-bottom: 1px solid var(--border); } }
.side-section { margin-bottom: 22px; }
.side-section h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 10px; }

.drop-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 26px 14px; text-align: center; cursor: pointer; transition: all .2s; background: var(--bg-card); }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone .upload-icon { font-size: 1.5rem; }
.drop-zone p { font-size: 0.85rem; color: var(--text-dim); margin-top: 6px; }
.drop-zone strong { color: var(--text); }

.img-info { font-family: var(--mono); font-size: 0.82rem; }
.img-info .row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--border); }
.img-info .row span:first-child { color: var(--text-dim); font-family: var(--font); }
.thumb-wrap { margin-bottom: 10px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background:
  repeating-conic-gradient(#252c36 0% 25%, #1a2029 0% 50%) 0 0 / 16px 16px; text-align: center; }
.thumb-wrap img { display: block; margin: 0 auto; max-height: 160px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 4px; }
.field input[type="number"], .field select, .field input[type="text"] {
  width: 100%; background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font-size: 0.92rem; font-family: var(--mono); }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.field .hint { font-size: 0.75rem; color: var(--text-dim); margin-top: 3px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 12px; cursor: pointer; }

/* verdict */
.verdict { border-radius: var(--radius); padding: 14px 16px; font-size: 0.9rem; margin-top: 12px; border: 1px solid var(--border); background: var(--bg-card); }
.verdict .verdict-ppi { font-size: 1.5rem; font-weight: 800; font-family: var(--mono); }
.verdict.v-ok { border-color: rgba(74,222,128,.4); } .verdict.v-ok .verdict-ppi { color: var(--ok); }
.verdict.v-warn { border-color: rgba(251,191,36,.4); } .verdict.v-warn .verdict-ppi { color: var(--warn); }
.verdict.v-bad { border-color: rgba(248,113,113,.4); } .verdict.v-bad .verdict-ppi { color: var(--bad); }
.verdict .verdict-detail { color: var(--text-dim); font-size: 0.8rem; margin-top: 6px; font-family: var(--mono); }

/* tabs + panels */
.app-content { padding: 24px 28px 60px; min-width: 0; }
.app-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 24px; flex-wrap: wrap; }
.app-tab { background: none; border: none; color: var(--text-dim); font-size: 0.95rem; font-weight: 600; padding: 12px 18px;
  cursor: pointer; border-bottom: 2px solid transparent; font-family: var(--font); }
.app-tab:hover { color: var(--text); }
.app-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel { display: none; }
.panel.active { display: block; }
.panel h2 { font-size: 1.3rem; margin-bottom: 6px; }
.panel .panel-sub { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 20px; }

.panel-grid { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .panel-grid { grid-template-columns: 1fr; } }
.panel-controls { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.panel-stage { min-width: 0; }

.canvas-frame { border: 1px solid var(--border); border-radius: var(--radius); background:
  repeating-conic-gradient(#252c36 0% 25%, #1a2029 0% 50%) 0 0 / 18px 18px; overflow: auto; text-align: center; position: relative; }
.canvas-frame canvas { display: block; margin: 0 auto; max-width: 100%; }
.canvas-caption { color: var(--text-dim); font-size: 0.8rem; margin-top: 8px; font-family: var(--mono); }

.progress-wrap { margin-top: 14px; display: none; }
.progress-wrap.active { display: block; }
.progress-bar { height: 8px; background: var(--bg-card); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .2s; }
.progress-label { font-size: 0.8rem; color: var(--text-dim); margin-top: 6px; font-family: var(--mono); }

.result-block { margin-top: 18px; display: none; }
.result-block.active { display: block; }
.export-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.notice { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 0.85rem; color: var(--text-dim); margin-top: 12px; }
.notice.warn { border-color: rgba(251,191,36,.45); color: var(--warn); }
.notice.bad { border-color: rgba(248,113,113,.45); color: var(--bad); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-state .big { font-size: 2rem; margin-bottom: 10px; }

/* segmented buttons (repeat types) */
.seg { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.seg button { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px;
  color: var(--text-dim); cursor: pointer; font-size: 0.85rem; font-family: var(--font); }
.seg button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* checker report */
.report { font-size: 0.92rem; }
.report-item { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); align-items: baseline; }
.report-item .r-icon { flex: 0 0 auto; }
.report-item .r-label { font-weight: 600; }
.report-item .r-detail { color: var(--text-dim); font-size: 0.85rem; font-family: var(--mono); }
.report-summary { margin-top: 16px; padding: 14px 18px; border-radius: var(--radius); font-weight: 700; border: 1px solid var(--border); }
.report-summary.ok { color: var(--ok); border-color: rgba(74,222,128,.4); background: rgba(74,222,128,.06); }
.report-summary.warn { color: var(--warn); border-color: rgba(251,191,36,.4); background: rgba(251,191,36,.06); }
.report-summary.bad { color: var(--bad); border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.06); }

/* placement canvas cursor */
#placement-canvas { cursor: grab; touch-action: none; }
#placement-canvas.dragging { cursor: grabbing; }

.app-footer { border-top: 1px solid var(--border); padding: 14px 24px; color: var(--text-dim); font-size: 0.8rem; text-align: center; }
