/* Tre kolonner: innstillinger | platen | oversikt og trekkeguide. Stables på smale skjermer. */
:root {
  --ui-font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ui-text-xs: 12px;
  --ui-text-sm: 12px;
  --ui-text-md: 14px;
  --t-meta: 12px;
  --t-body: 14px;
  --t-head: 18px;
  --t-title: 24px;
  --stage: #e6e4df;
  --stage-ink: #5b5850;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  margin: 0;
  font: 400 var(--t-body)/1.45 var(--ui-font);
  color: var(--ui-text-color);
  background: var(--ui-page);
}
/* Ingen fet eller liten fet tekst i komponentene */
.ds-primary-button, .ds-secondary-button, .ds-neutral-button, .ds-destructive-button,
.ds-segment-button, .ds-chip, .ds-switch-row, .ds-stepper button, .ds-stepper output,
details.ds-accordion > summary { font-weight: 400 !important; }
.ds-segment-button { font-size: var(--t-body) !important; }
/* Ikon foran teksten i valgknappene */
.ds-segment-button:has(> .ds-icon) { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.ds-segment-button > .ds-icon { width: 20px; height: 20px; flex: 0 0 20px; }

h1, h2 { font-weight: 400; margin: 0; text-wrap: balance; }
h1 { font-size: var(--t-title); line-height: 1.2; }
h2 { font-size: var(--t-head); line-height: 1.3; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app {
  height: 100%;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 320px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top top top" "settings stage info" "foot foot foot";
}
/* Uten resultat er det ingen høyrekolonne */
.app.no-info { grid-template-columns: 340px minmax(0, 1fr); grid-template-areas: "top top" "settings stage" "foot foot"; }
.app.no-info .info-panel { display: none; }
/* Første besøk: bare bildevalget */
.app.empty .after-start { display: none !important; }
.app:not(.empty) .only-empty { display: none !important; }
.topbar {
  grid-area: top;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px;
  background: var(--ui-surface);
  border-bottom: 1px solid var(--ui-divider);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: 'Schibsted Grotesk', var(--ui-font); font-weight: 700; font-size: 24px; line-height: 1; letter-spacing: -0.035em; color: var(--ui-text-color); }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-link { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; border-radius: var(--ui-radius-control); }
/* Fresing, avanserte innstillinger og lysretning: bare for admin og lokalt */
.app:not(.advanced) .advanced-only { display: none !important; }
.plate-material, .nail-size { color: var(--ui-text-secondary); }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

/* relative: skjulte etiketter (.sr) langt nede i panelet skal ikke gjøre siden høyere enn vinduet */
.panel { position: relative; background: var(--ui-surface); overflow-y: auto; min-width: 0; }
.settings { grid-area: settings; border-right: 1px solid var(--ui-divider); display: flex; flex-direction: column; }
.info-panel { grid-area: info; border-left: 1px solid var(--ui-divider); }
.group { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-bottom: 1px solid var(--ui-divider); }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.settings > details.ds-accordion { margin: 20px; }
/* Innholdet skal rulle, ikke krympes: ellers klemmes trekkspillene flate */
.settings > * { flex-shrink: 0; }
.ds-accordion-body.advanced { display: flex; flex-direction: column; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { color: var(--ui-text-secondary); font-size: var(--t-meta); display: flex; justify-content: space-between; gap: 8px; }
.field output { color: var(--ui-text-color); font-variant-numeric: tabular-nums; }
.field > span:has(> .field-end) { align-items: center; }
.field-end { display: flex; align-items: center; gap: 4px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
/* Mønstervalg: fliser med en liten forhåndsvisning av hvert mønster */
.pattern-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pattern-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0;
  padding: 6px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-control);
  background: var(--ui-surface); color: var(--ui-text-color); font: 400 var(--t-meta)/1.25 var(--ui-font); text-align: center; cursor: pointer;
}
.pattern-tile:hover { background: var(--ui-surface-hover); }
.pattern-tile canvas { width: calc(100% - 4px); aspect-ratio: 1; display: block; }
.pattern-tile span { max-width: 100%; overflow-wrap: anywhere; }
.pattern-tile.active { border-color: var(--ui-primary); box-shadow: inset 0 0 0 1px var(--ui-primary); background: var(--ui-primary-soft); }
.field-row > .field { flex: 1 1 120px; }
.field-row.align-end { align-items: flex-end; }
.field-row > .field.wide { flex-basis: 100%; }
.field.grow { flex: 1 1 auto; }
input[type="number"], select {
  height: var(--ui-control-height);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-control);
  padding: 0 10px;
  font: 400 var(--t-body) var(--ui-font);
  color: var(--ui-text-color);
  background: var(--ui-surface);
  width: 100%;
  font-variant-numeric: tabular-nums;
}
/* Egen pil med luft til kanten, ellers ligger pila klistret mot rammen */
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%235b6079' d='M12 15.6 5.7 9.4a.5.5 0 0 1 0-.7l.8-.8a.5.5 0 0 1 .7 0L12 12.6l4.8-4.7a.5.5 0 0 1 .7 0l.8.8a.5.5 0 0 1 0 .7Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
  text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
}
input[type="color"] {
  height: var(--ui-control-height); width: 56px; padding: 3px;
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius-control); background: var(--ui-surface);
}
input[type="range"] { width: 100%; }
textarea {
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius-control); padding: 8px 10px;
  font: 400 var(--t-body)/1.45 var(--ui-font); color: var(--ui-text-color); background: var(--ui-surface); width: 100%; resize: vertical;
}
input[type="text"], input[type="email"] {
  height: var(--ui-control-height); border: 1px solid var(--ui-border); border-radius: var(--ui-radius-control);
  padding: 0 10px; font: 400 var(--t-body) var(--ui-font); color: var(--ui-text-color); background: var(--ui-surface); width: 100%;
}
/* Glider med hakk (ds-stepped-slider): ett merke per steg under sporet */
input.ds-stepped-slider {
  height: 34px;
  background:
    repeating-linear-gradient(to right, rgba(29,35,71,.28) 0 2px, transparent 2px calc((100% - 2px) / var(--ticks, 4))) 13px calc(100% - 1px) / calc(100% - 26px) 5px no-repeat;
}
.file-button.over { outline: 3px solid var(--ui-primary); outline-offset: 3px; }
.ds-switch-row { margin: 0; }

.file-button { cursor: pointer; }
.wide { width: 100%; }
.small-button { min-height: 32px !important; padding: 0 12px !important; font-size: var(--t-body) !important; }
.ds-primary-button, .ds-secondary-button, .ds-neutral-button { gap: 8px; }
.ds-primary-button .ds-icon, .ds-neutral-button .ds-icon, .ds-secondary-button .ds-icon { width: 18px; height: 18px; flex: 0 0 18px; }

.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 999px;
  background: transparent; color: var(--ui-text-muted); cursor: help;
}
.info:hover { background: var(--ui-surface-hover); color: var(--ui-text-color); }
.info .ds-icon { width: 18px; height: 18px; }
.info[aria-expanded="true"] { background: var(--ui-surface-hover); color: var(--ui-primary); }
.tip {
  position: fixed; z-index: 50; padding: 12px 14px; border-radius: var(--ui-radius-card);
  background: var(--ui-text-color); color: #fff; box-shadow: 0 10px 30px rgba(20, 18, 12, .22);
  font-size: var(--t-body); line-height: 1.45;
}

/* Grupper som kan lukkes: verdien står i overskriften */
details.fold { gap: 0; }
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 12px; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { flex: 0 0 auto; }
.fold-value { flex: 1; min-width: 0; text-align: right; color: var(--ui-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fold-chevron { width: 18px; height: 18px; flex: 0 0 18px; color: var(--ui-text-muted); transition: transform .15s; }
details.fold[open] .fold-chevron { transform: rotate(90deg); }
.fold-body { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; }
.group-head .grow { flex: 1; }

.thumb { width: 100%; border-radius: var(--ui-radius-control); background: var(--stage); }

.swatches { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.swatches li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) 32px; align-items: center; gap: 10px;
  padding: 4px 4px 4px 6px; border-radius: var(--ui-radius-control);
}
.swatches li:hover { background: var(--ui-surface-hover); }
.swatch-color { position: relative; width: 28px; height: 28px; border-radius: 999px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.swatch-color input { position: absolute; inset: -8px; width: 44px; height: 44px; border: 0; padding: 0; cursor: pointer; opacity: 0; }
.swatch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Eget garn: navnet er en knapp som åpner skjemaet, med tykkelse og meter under */
.swatch-edit { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; min-width: 0; }
.swatch-edit > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatch-meta { color: var(--ui-text-secondary); font-size: var(--t-meta); }
.yarn-form { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--ui-radius-control); background: var(--ui-surface-hover); }
.yarn-actions { gap: 8px; }
.swatch-remove {
  width: 32px; height: 32px; border: 0; border-radius: 999px; background: transparent;
  color: var(--ui-text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.swatch-remove:hover { background: var(--ui-danger-soft); color: var(--ui-danger); }
.swatch-remove .ds-icon { width: 14px; height: 14px; }

.run-bar { position: sticky; bottom: 0; margin-top: auto; padding: 16px 20px; background: var(--ui-surface); border-top: 1px solid var(--ui-divider); }
.run-bar .ds-primary-button { min-height: 48px; }

.stage { grid-area: stage; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--stage); }
.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.views { overflow-x: auto; max-width: 100%; }
/* Visning utenfor fanene (plate, spikre, lyd …): merkelapp med kryss tilbake til resultatet */
.view-chip { gap: 8px; border-color: var(--ui-primary); color: var(--ui-primary); padding: 0 12px 0 16px; }
.view-chip .ds-icon { width: 14px; height: 14px; flex: 0 0 14px; }
.stage-bar .zoom { margin-left: auto; }
.zoom { display: flex; align-items: center; gap: 4px; }
.toggles3d { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.lift { display: flex; align-items: center; gap: 8px; color: var(--stage-ink); font-variant-numeric: tabular-nums; }
.view3d { position: absolute; inset: 0; background: var(--stage); }
.view3d canvas { display: block; width: 100%; height: 100%; }
.view3d .note { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--stage-ink); }
.light3d { position: absolute; left: 16px; bottom: 16px; width: 280px; max-width: calc(100% - 32px); display: flex; flex-direction: column; gap: 12px; padding: 12px; border-radius: var(--ui-radius-control); background: var(--ui-surface); box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
.view3d .loading3d { flex-direction: column; gap: 12px; background: var(--stage); }
.viewport { position: relative; flex: 1; min-height: 320px; overflow: hidden; touch-action: none; cursor: grab; }
.viewport.dragging { cursor: grabbing; }
.viewport.picking, .viewport.painting { cursor: crosshair; }
.tool-row { display: flex; align-items: center; gap: 4px; }
.tool {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 999px;
  background: transparent; color: var(--ui-text-muted); cursor: pointer;
}
.tool:hover { background: var(--ui-surface-hover); color: var(--ui-text-color); }
.tool .ds-icon { width: 18px; height: 18px; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Lyd */
.sound { position: absolute; inset: 0; overflow-y: auto; padding: 8px 16px 24px; cursor: default; touch-action: auto; }
.sound-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; max-width: 1200px; margin: 0 auto; }
.card { display: flex; flex-direction: column; gap: 16px; padding: 20px; border-radius: var(--ui-radius-card); background: var(--ui-surface); }
.chart { position: relative; height: 240px; }
.drop { position: absolute; inset: 0; display: flex; overflow-y: auto; padding: 32px 24px; cursor: default; touch-action: auto; }
/* Første besøk: hva dette er, eksempler og et felt å slippe bildet i */
.intro { margin: auto; width: 100%; max-width: 880px; display: flex; flex-direction: column; gap: 24px; }
.intro-title { font-size: 32px; line-height: 1.2; }
.intro-text { margin: -8px 0 0; max-width: 640px; font-size: var(--t-head); line-height: 1.45; color: var(--stage-ink); text-wrap: pretty; }
.examples { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.example {
  position: relative; display: block; aspect-ratio: 4 / 5; padding: 0; border: 0; border-radius: var(--ui-radius-card); overflow: hidden;
  background: var(--ui-surface); cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.12); transition: transform .15s, box-shadow .15s;
}
.example:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.16); }
.example:focus-visible { outline: 2px solid var(--ui-primary); outline-offset: 2px; }
.example img { width: 100%; height: 100%; object-fit: cover; display: block; }
.example .example-photo {
  position: absolute; left: 12px; bottom: 12px; width: 34%; height: auto; aspect-ratio: 1; object-fit: cover;
  border: 3px solid #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.drop-target {
  display: flex; align-items: center; justify-content: center; gap: 12px; padding: 24px;
  border: 2px dashed #b9b5aa; border-radius: var(--ui-radius-panel); color: var(--stage-ink); cursor: pointer; font-size: var(--t-head);
}
.drop-target .ds-icon { width: 32px; height: 32px; flex: 0 0 32px; }
.drop-target:hover, .drop.over .drop-target { background: rgba(255,255,255,.4); border-color: var(--ui-primary); }
@media (prefers-reduced-motion: reduce) { .example { transition: none; } .example:hover { transform: none; } }
/* Med berøringsskjerm finnes det ikke noe å slippe: feltet er et trykk for å velge bilde */
.drop-touch { display: none; }
@media (pointer: coarse) { .drop-fine { display: none; } .drop-touch { display: inline; } }

.progress {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  width: min(440px, calc(100% - 32px));
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center;
  padding: 12px 16px; border-radius: var(--ui-radius-card); background: var(--ui-surface);
  box-shadow: 0 8px 28px rgba(20, 18, 12, .18);
}
.progress-text { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.progress-track { grid-column: 1; height: 6px; border-radius: 3px; background: var(--ui-surface-subtle); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--ui-primary); transition: width .2s ease; }
.progress .small-button { grid-column: 2; grid-row: 1 / span 2; }
/* Omregning uten kjent fremdrift: en bit som glir over linja, ingen prosent eller avbryt */
.progress.busy #progressPct, .progress.busy .small-button { display: none; }
.progress.busy .progress-fill { width: 35%; transition: none; animation: busy 1.1s ease-in-out infinite; }
@keyframes busy { from { transform: translateX(-100%); } to { transform: translateX(290%); } }

.figures { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; }
.figures div { display: flex; flex-direction: column; gap: 2px; }
.figures dt { color: var(--ui-text-secondary); font-size: var(--t-meta); }
.figures dd { margin: 0; font-size: var(--t-head); font-variant-numeric: tabular-nums; }
.figures .fig-row { display: flex; align-items: center; gap: 4px; }

.table-wrap { overflow-x: auto; }
.shop { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.shop th { text-align: left; font-weight: 400; color: var(--ui-text-secondary); font-size: var(--t-meta); padding: 0 6px 6px 0; }
.shop td { padding: 6px 6px 6px 0; border-top: 1px solid var(--ui-divider); }
.shop .num { text-align: right; }
.shop tr.total td { border-top: 1px solid var(--ui-border-strong); }
.color-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dot { display: inline-block; width: 14px; height: 14px; flex: 0 0 14px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }

.download-list { display: flex; flex-direction: column; gap: 8px; }
.download-list .ds-neutral-button { justify-content: flex-start; }

.guide-step { color: var(--ui-text-secondary); font-variant-numeric: tabular-nums; }
.guide-color { display: flex; align-items: center; gap: 10px; font-size: var(--t-head); }
.guide-color .dot { width: 22px; height: 22px; flex-basis: 22px; }
.guide-move { font-size: 40px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.guide-note { padding: 10px 12px; border-radius: var(--ui-radius-control); background: var(--ui-closed-soft); }
.guide-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.guide-body { display: flex; flex-direction: column; gap: 12px; }
.guide-lock { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px 0; color: var(--ui-text-muted); }
.guide-lock > .ds-icon { width: 40px; height: 40px; flex: 0 0 40px; }

/* Underseksjoner i Avansert */
.adv-section { display: flex; flex-direction: column; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--ui-divider); }
.adv-section:last-child { border-bottom: 0; padding-bottom: 0; }
.adv-section h3 { font-size: var(--t-head); font-weight: 400; line-height: 1.3; margin: 0; }

/* Lyd: klasse med ord */
.verdict { display: flex; align-items: center; gap: 16px; }
.grade {
  display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; flex: 0 0 56px;
  border-radius: 999px; font-size: var(--t-title); background: var(--ui-surface-subtle); color: var(--ui-text-color);
}
.grade[data-cls="A"], .grade[data-cls="B"] { background: #d9f0e1; color: #0f5b2e; }
.grade[data-cls="C"] { background: #fff1c7; color: #6b4e00; }
.grade[data-cls="D"], .grade[data-cls="E"] { background: #fde4d6; color: #7a2e0b; }
.verdict-text { display: flex; flex-direction: column; gap: 2px; font-size: var(--t-head); }
.verdict-sub { font-size: var(--t-body); color: var(--ui-text-secondary); }
.sound-more { grid-column: 1 / -1; }
.sound-more .fold-chevron { margin-left: auto; }
.field-row.three > .field { flex: 1 1 80px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

/* Pris og bestilling: tre valg med hver sin pris, så prisen på ferdig bilde ikke står alene */
.make-options { display: flex; flex-direction: column; gap: 4px; }
.make-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  padding: 12px 16px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-control);
  background: var(--ui-surface); color: var(--ui-text-color); text-align: left; cursor: pointer;
  font: 400 var(--t-body)/1.35 var(--ui-font);
}
.make-option:hover { background: var(--ui-surface-hover); }
.make-option[aria-checked="true"] { background: var(--ui-primary-soft); border-color: var(--ui-primary-border); }
.make-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.make-name { font-size: var(--t-head); }
.make-detail { color: var(--ui-text-secondary); }
.make-price { font-size: var(--t-head); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tools-list { margin: 0; padding: 0 0 0 20px; }
.tools-list li { padding: 2px 0; }
.price-block { display: flex; flex-direction: column; gap: 12px; }
.addons { display: flex; flex-direction: column; }
.addon { font-weight: 400; margin: 4px 0; }
.addon-name { flex: 1; }
.addon-price { color: var(--ui-text-secondary); font-variant-numeric: tabular-nums; }
.price-big { font-size: 32px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.price-col { display: flex; flex-direction: column; gap: 4px; }
.price-sub { color: var(--ui-text-secondary); }
.field-head { align-items: center; }
/* Rammen velges rett under bryteren */
.frame-pick { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 12px; }
.wood-dots { display: flex; flex-wrap: wrap; gap: 8px; }
.wood-dot {
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18);
}
.wood-dot[aria-checked="true"] { box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), 0 0 0 2px var(--ui-surface), 0 0 0 4px var(--ui-primary); }
/* Rammeprofilene som tverrsnitt, valgt som treslagene */
.profile-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; }
.profile-tile {
  display: flex; align-items: center; justify-content: center; height: 64px; padding: 8px;
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius-control); background: var(--ui-surface); cursor: pointer;
}
.profile-tile:hover { background: var(--ui-surface-hover); }
.profile-tile[aria-checked="true"] { background: var(--ui-primary-soft); border-color: var(--ui-primary-border); box-shadow: 0 0 0 1px var(--ui-primary); }
.profile-tile canvas { width: 60px; height: 46px; }
/* Klassen bildet får med lyddemping, og veien til lydvisningen */
.addon-link {
  display: flex; align-items: center; gap: 10px; margin: 0 0 4px; padding: 6px 12px 6px 6px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ui-text-color);
  font: 400 var(--t-body) var(--ui-font); cursor: pointer; align-self: flex-start;
}
.addon-link:hover { background: var(--ui-surface-hover); }
.addon-link .ds-icon { width: 14px; height: 14px; flex: 0 0 14px; color: var(--ui-text-muted); }
.grade.small { width: 28px; height: 28px; flex: 0 0 28px; font-size: var(--t-body); }
/* Delene i esken og i oppskriften */
.parts-head { color: var(--ui-text-secondary); font-size: var(--t-meta); padding-top: 8px; }
.parts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.part {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) 16px; align-items: center; gap: 12px; width: 100%;
  padding: 8px; border: 0; border-top: 1px solid var(--ui-divider); background: transparent; text-align: left;
  font: 400 var(--t-body)/1.35 var(--ui-font); color: var(--ui-text-color); cursor: pointer;
}
.parts li:first-child .part { border-top: 0; }
.part:hover { background: var(--ui-surface-hover); }
.part-pic {
  width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--ui-radius-control); background: var(--ui-surface-subtle); color: var(--ui-text-muted); overflow: hidden;
}
.part-pic canvas { display: block; }
.part-pic .ds-icon { width: 30px; height: 30px; flex: 0 0 30px; }
.part-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.part-detail { color: var(--ui-text-secondary); }
.part-dots { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 4px; }
.part-dots .dot { width: 12px; height: 12px; flex-basis: 12px; }
.part-go { width: 14px; height: 14px; color: var(--ui-text-muted); }
.info-panel details.ds-accordion { margin: 0; }
.order { width: min(480px, calc(100% - 32px)); }
.order-step { display: flex; flex-direction: column; gap: 16px; }
.order-thumb { width: 100%; max-height: 260px; object-fit: contain; border-radius: var(--ui-radius-control); background: var(--stage); }
.order-total { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--t-head); font-variant-numeric: tabular-nums; padding-top: 12px; border-top: 1px solid var(--ui-divider); }
.order-thanks { margin: 0; }
.pay-buttons.single { grid-template-columns: 1fr; }

/* Betaling */
.pay { border: 0; padding: 0; border-radius: var(--ui-radius-card); width: min(380px, calc(100% - 32px)); color: var(--ui-text-color); box-shadow: 0 16px 48px rgba(20, 18, 12, .24); }
.pay::backdrop { background: rgba(29, 35, 71, .35); }
.pay-body { display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.pay-price { font-size: var(--t-title); font-variant-numeric: tabular-nums; }
.pay-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pay-list li { display: flex; align-items: center; gap: 10px; }
.pay-list .ds-icon { width: 18px; height: 18px; flex: 0 0 18px; color: var(--ui-primary); }
.pay-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-code { display: flex; align-items: flex-end; gap: 8px; }
.pay-code input { text-transform: uppercase; letter-spacing: 1px; }
.pay-code-msg { color: var(--ui-text-secondary); }
.pay-consent { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.pay-consent input { width: 18px; height: 18px; margin: 3px 0 0; flex: 0 0 18px; accent-color: var(--ui-primary); }
.terms-link { color: var(--ui-primary); }

/* Firmaopplysninger nederst (krav fra Vipps og forbrukerloven) */
.foot { grid-area: foot; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding: 8px 20px; background: var(--ui-surface); border-top: 1px solid var(--ui-divider); color: var(--ui-text-secondary); font-size: var(--t-meta); }
.foot-links { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.faq-link { color: var(--ui-primary); }
.foot-button { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: var(--ui-primary); text-decoration: underline; cursor: pointer; }

@media (max-width: 1100px) {
  .app, .app.no-info { grid-template-columns: 300px minmax(0, 1fr); grid-template-areas: "top top" "settings stage" "info info" "foot foot"; grid-template-rows: auto minmax(560px, 1fr) auto auto; height: auto; }
  .info-panel { border-left: 0; border-top: 1px solid var(--ui-divider); display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}
@media (max-width: 760px) {
  .app, .app.no-info { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "stage" "settings" "info" "foot"; grid-template-rows: auto 70vh auto auto auto; }
  /* Smal skjerm: introen og eksemplene over «Velg bilde», uten slippfeltet */
  .app.empty { grid-template-areas: "top" "stage" "settings" "foot"; grid-template-rows: auto auto 1fr auto; min-height: 100dvh; }
  .app.empty .viewport { min-height: 0; }
  .app.empty .drop { position: static; padding: 24px 16px 8px; }
  .app.empty .drop-target { display: none; }
  .intro { gap: 16px; }
  .intro-title { font-size: var(--t-title); }
  .intro-text { font-size: var(--t-body); margin-top: -4px; }
  .examples { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .example { border-radius: 8px; }
  .example .example-photo { left: 4px; bottom: 4px; width: 40%; border-width: 2px; border-radius: 4px; }
  .sound-grid { grid-template-columns: minmax(0, 1fr); }
  /* Bryterne i 3D står to og to, så de ligger på linje */
  .toggles3d { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; width: 100%; order: 3; }
  .toggles3d .lift { margin: 0; }
  /* Trekkeguiden brukes ved plata, ikke på telefonen */
  #views [data-view="guide"] { display: none; }
  .part[data-view="guide"] { pointer-events: none; }
  .part[data-view="guide"] .part-go { visibility: hidden; }
  .settings { border-right: 0; }
  /* Bildet vises allerede øverst, og «Mer detalj» står i linja over det */
  .thumb { display: none; }
  .stage-bar { gap: 8px; }
  .stage-bar #focusHead { gap: 0; }
  .stage-bar #focusPaint { min-height: 40px; padding: 0 16px; }
  .topbar { padding: 12px 16px; }
  .group { padding: 16px; }
}
/* Med fingrene zoomes det ved å klype, så pluss og minus trengs ikke */
@media (max-width: 760px) and (pointer: coarse) { #zoomIn, #zoomOut { display: none; } }
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } .progress.busy .progress-fill { width: 100%; animation: none; } }
