@font-face { font-family: 'Fredoka'; src: url('../vendor/fonts/fredoka-600.woff') format('woff'); font-weight: 600; font-display: swap; }

:root {
  --bg: #f6f3ee;
  --paper: #fffdf9;
  --ink: #1f2328;
  --muted: #6b665e;
  --line: #e3ddd3;
  --accent: #e2591b;
  --accent-ink: #fff;
  --accent-soft: #fbe6da;
  --radius: 14px;
  --head: 'Fredoka', ui-rounded, system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body); }
a { color: inherit; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 14px clamp(16px, 4vw, 40px); border-bottom: 1px solid var(--line); background: var(--paper); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--head); font-size: 22px; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  background-image: repeating-linear-gradient(0deg, transparent 0 4px, rgba(255,255,255,.35) 4px 5px); }
.top nav a { text-decoration: none; color: var(--muted); font-weight: 500; }
.top nav a:hover { color: var(--ink); }

/* ---------- Home ---------- */
.hero { max-width: 1100px; margin: 0 auto; padding: clamp(40px, 7vw, 88px) clamp(16px, 4vw, 40px) 28px; }
.hero h1 { font-size: clamp(38px, 6vw, 68px); letter-spacing: -.01em; }
.hero p { font-size: 19px; color: var(--muted); max-width: 38em; }
.cards { max-width: 1100px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card { display: flex; flex-direction: column; text-decoration: none; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; transition: transform .15s, box-shadow .15s, border-color .15s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(60, 40, 20, .09); border-color: #d6cdbf; }
.card svg { width: 56px; height: 56px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; margin-bottom: 14px; }
.card h2 { font-size: 22px; }
.card p { color: var(--muted); margin: 0 0 16px; flex: 1; }
.card .go { font-weight: 600; color: var(--accent); }
.how { max-width: 1100px; margin: 56px auto; padding: 0 clamp(16px, 4vw, 40px); display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; }
.how span { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-family: var(--head); margin-bottom: 8px; }
.how p { color: var(--muted); margin: 0; }
.foot { text-align: center; color: var(--muted); padding: 30px; border-top: 1px solid var(--line); font-size: 14px; }

/* ---------- Toolpagina ---------- */
.toolpage { height: 100vh; display: flex; flex-direction: column; }
.tool { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 400px; }
.stage { position: relative; background: radial-gradient(ellipse at 50% 40%, #fffdf9 0%, #ece6dc 100%); min-height: 360px; }
model-viewer { width: 100%; height: 100%; --poster-color: transparent; --progress-bar-color: var(--accent); --progress-bar-height: 2px; }
.stage-info { position: absolute; left: 18px; bottom: 16px; display: flex; gap: 12px; align-items: center; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stage-info #dims { background: rgba(255,255,255,.8); padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); }
.busy { color: var(--accent); font-weight: 600; }
.busy::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; margin-right: 6px; vertical-align: -1px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stage .error { position: absolute; top: 16px; left: 16px; right: 16px; }
.error { background: #fdecea; color: #8a1c12; border: 1px solid #f3c2bc; padding: 10px 14px; border-radius: 10px; margin: 0; }

.panel { background: var(--paper); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.panel-head { padding: 22px 22px 6px; }
.panel-head h1 { font-size: 28px; }
.intro { color: var(--muted); margin: 0; }
.params, .params-extra { padding: 0 22px; margin: 0; border: 0; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 14px 0 0; padding: 10px 0 0; min-width: 0; }
.params fieldset:first-child legend { margin-top: 6px; }
.params fieldset:first-child { border-top: 0; }
legend { font-family: var(--head); font-size: 15px; color: var(--muted); padding: 0; margin-bottom: 4px; letter-spacing: .02em; }
.field { margin: 10px 0; }
.field > label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.unit { font-weight: 400; color: var(--muted); }
.rangewrap { display: flex; gap: 10px; align-items: center; }
input[type=range] { flex: 1; accent-color: var(--accent); }
input.num { width: 76px; }
input, select, textarea { font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; width: 100%; }
input.num, input[type=range] { width: auto; }
input.num { width: 76px; padding: 6px 8px; font-variant-numeric: tabular-nums; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; }
.check label, label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input, label.check input { width: auto; accent-color: var(--accent); }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.link { background: none; border: 0; color: var(--accent); padding: 4px 0; cursor: pointer; font: inherit; font-size: 14px; }
canvas.draw { display: block; max-width: 100%; height: auto !important; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: #fff; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches button.on { box-shadow: 0 0 0 2px var(--ink); }

.buybox { position: sticky; bottom: 0; margin-top: auto; background: var(--paper); border-top: 1px solid var(--line); padding: 16px 22px 20px; display: grid; grid-template-columns: auto 1fr; gap: 12px 16px; align-items: end; }
.qty label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.qty input { width: 76px; }
.pricewrap { text-align: right; }
.price { font-family: var(--head); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.price-sub { font-size: 13px; color: var(--muted); }
.actions { grid-column: 1 / -1; display: flex; gap: 10px; }
.btn { flex: 1; border: 1px solid var(--ink); background: #fff; color: var(--ink); border-radius: 11px; padding: 11px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: #f3efe8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

dialog.order { border: 0; border-radius: 18px; padding: 26px; width: min(620px, 94vw); background: var(--paper); color: var(--ink); box-shadow: 0 24px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(30, 25, 20, .45); }
dialog .x { position: absolute; right: 14px; top: 10px; border: 0; background: none; font-size: 28px; cursor: pointer; color: var(--muted); }
.summary { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.grid2 label { font-size: 14px; font-weight: 600; display: flex; flex-direction: column; gap: 4px; }
.grid2 .wide { grid-column: 1 / -1; }
.orderform > label.check { margin: 14px 0; }
.hp { position: absolute; left: -9999px; }

@media (max-width: 860px) {
  .toolpage { height: auto; }
  .tool { grid-template-columns: 1fr; }
  .stage { height: 52vh; }
  .panel { border-left: 0; overflow: visible; }
  .grid2 { grid-template-columns: 1fr; }
}
