:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --line: #ddd9d0;
  --line-soft: #e8e5de;
  --text: #1a1a1a;
  --muted: #55524a;
  --dim: #7a7669;
  --accent: #0f6b4c;
  --accent-soft: #e3f2ea;
  --danger: #9f1239;
  --amber: #92600a;
  --blue: #1d4ed8;
  --radius: 16px;
  --tap: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 19px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { min-height: 100dvh; }

button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(18px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

.screen { display: none; flex: 1; flex-direction: column; }
.screen.on { display: flex; }

h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin: 10px 0 6px; text-align: center; }
h2 { font-size: 23px; font-weight: 750; letter-spacing: -0.015em; margin: 4px 0 8px; }
.sub { color: var(--muted); font-size: 17px; margin: 0 0 14px; line-height: 1.45; }
.section-label {
  font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--dim); margin: 22px 0 10px;
}

/* ---------- topbar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 2px 0 14px; }
.back { font-size: 18px; font-weight: 600; color: var(--accent); min-height: var(--tap); display: flex; align-items: center; padding: 0 4px 0 0; }
.step-indicator { font-size: 14px; color: var(--dim); font-weight: 600; }
.pill {
  font-size: 15px; font-weight: 700; letter-spacing: .05em;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; color: var(--muted); background: var(--surface);
}

/* ---------- start ---------- */
.wheel-hero { width: 96px; height: 96px; margin: 12px auto 4px; }
.wheel-hero.small { width: 56px; height: 56px; font-size: 40px; display: flex; align-items: center; justify-content: center; margin: 4px auto 8px; }
.foot-actions { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 14px; margin: 8px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.field-label { font-size: 15px; font-weight: 600; color: var(--muted); margin: 4px 0 2px; display: block; }
.code-open-row { display: flex; flex-direction: column; gap: 10px; }
.code-open-row .field { text-transform: uppercase; }
.error-text { color: var(--danger); font-size: 15px; margin: 4px 0 0; font-weight: 600; }

.resume-card {
  margin-top: 20px; width: 100%; text-align: left;
  background: var(--accent-soft); border: 1px solid #bfe0cd; border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
  transition: transform .1s, background .14s;
}
.resume-card[hidden] { display: none; }
.resume-card:active { transform: scale(.98); }
.resume-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.resume-title { font-size: 18px; font-weight: 700; }
.resume-code { font-size: 14px; color: var(--dim); font-variant-numeric: tabular-nums; letter-spacing: .05em; }

/* ---------- fields ---------- */
.field {
  width: 100%; min-height: var(--tap);
  background: var(--surface); border: 2px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
  font-size: 19px; outline: none;
}
.field:focus { border-color: var(--accent); }
.field.textarea { min-height: 140px; resize: vertical; line-height: 1.5; }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 68px; width: 100%;
  border-radius: var(--radius);
  font-size: 19px; font-weight: 700; letter-spacing: -0.005em;
  transition: transform .1s, opacity .14s, background .14s;
}
.btn .ic { font-size: 22px; }
.btn:active { transform: scale(.97); opacity: .9; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:disabled { opacity: .4; }
.btn-secondary { background: var(--text); color: #fff; }
.btn-ghost { background: var(--surface); border: 2px solid var(--line); color: var(--text); }
.btn-ghost:active { background: var(--surface-2); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.foot-btn { margin-top: auto; }

/* ---------- nolan wizard ---------- */
.wizard-step { display: none; flex-direction: column; gap: 6px; flex: 1; }
.wizard-step.on { display: flex; }
.ideer-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.idee-row { display: flex; gap: 8px; align-items: center; }
.idee-row .field { flex: 1; }
.idee-remove {
  min-width: var(--tap); min-height: var(--tap); font-size: 24px; color: var(--danger);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ---------- kod ---------- */
.code-display {
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 44px; font-weight: 800; letter-spacing: .08em;
  text-align: center; background: var(--surface); border: 2px dashed var(--line);
  border-radius: var(--radius); padding: 22px 10px; margin: 10px 0 16px;
  color: var(--accent);
}
.warn-banner {
  background: #fdf3e3; border: 1px solid #f0d9a8; color: var(--amber);
  border-radius: 12px; padding: 12px 14px; font-size: 15.5px; line-height: 1.4; margin: 16px 0 0;
  font-weight: 600;
}

/* ---------- oversikt ---------- */
.nolan-summary {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; font-size: 17px; font-weight: 650; margin-bottom: 4px;
}
.chev { transition: transform .18s; color: var(--dim); }
.nolan-summary[aria-expanded="true"] .chev { transform: rotate(180deg); }
.nolan-summary-body {
  background: var(--surface-2); border-radius: 0 0 12px 12px; padding: 4px 16px 14px;
  margin-top: -8px; font-size: 16px; color: var(--muted); line-height: 1.5;
}
.nolan-summary-body dt { font-weight: 700; color: var(--text); margin-top: 10px; }
.nolan-summary-body dd { margin: 2px 0 0; }
.nolan-summary-body ul, .nolan-summary-body ol { margin: 2px 0 0; padding-left: 20px; }
.nolan-summary-body ol li { margin-bottom: 8px; }
.nolan-summary-body p { margin: 0 0 4px; }

.timeline { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.varv-card {
  width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px;
  transition: transform .1s, border-color .14s;
}
.varv-card:active { transform: scale(.98); }
.varv-card-top { display: flex; align-items: center; justify-content: space-between; }
.varv-name { font-size: 19px; font-weight: 750; }
.badge {
  font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  letter-spacing: .02em;
}
.badge-adopt { background: #dcf5e6; color: var(--accent); }
.badge-adapt { background: #fdf3e3; color: var(--amber); }
.badge-abandon { background: #f1efe9; color: var(--dim); }
.badge-nytt_varv { background: #dbe6fd; color: var(--blue); }
.badge-igang { background: var(--surface-2); color: var(--muted); }

.quad-row { display: flex; gap: 8px; }
.quad {
  flex: 1; text-align: center; padding: 8px 4px; border-radius: 8px;
  font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--dim);
  border: 2px solid transparent;
}
.quad.done { background: var(--accent-soft); color: var(--accent); }
.quad.current { border-color: var(--accent); color: var(--accent); }

/* ---------- fas ---------- */
.fas-wheel-row { display: flex; justify-content: center; margin-bottom: 8px; }
.reference-banner {
  background: var(--accent-soft); border: 1px solid #bfe0cd; border-radius: 12px;
  padding: 12px 14px; font-size: 15.5px; line-height: 1.45; margin-bottom: 14px; color: #0a4732;
}
.reference-banner b { display: block; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; color: var(--accent); }
.fas-form { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.form-field label { display: block; font-size: 16.5px; font-weight: 650; margin-bottom: 6px; }
.form-field .optional-tag { font-weight: 500; color: var(--dim); font-size: 14px; }

.decision-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.decision-card {
  border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 16px 10px; text-align: center; font-size: 16.5px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 84px; justify-content: center;
  transition: transform .1s, border-color .14s, background .14s;
}
.decision-card .ic { font-size: 26px; }
.decision-card:active { transform: scale(.96); }
.decision-card[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: var(--text); color: #fff; font-weight: 700; font-size: 16px;
  padding: 12px 20px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- wheel spin ---------- */
.spin-wheel { animation: spin-once .7s cubic-bezier(.34,1.56,.64,1); }
@keyframes spin-once { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
