*{box-sizing:border-box}
:root{
  --desktop:#777;
  --window:#d8d8d8;
  --paper:#f7f7f7;
  --ink:#111;
  --dim:#555;
  --line:#777;
  --hilite:#fff;
  --shadow:#555;
  --focus:#000;
  --soft:#ececec;
  --danger:#7a1717;
}
html{min-height:100%;background:var(--desktop)}
body{
  margin:0;
  min-height:100vh;
  color:var(--ink);
  background:
    repeating-linear-gradient(90deg,rgba(255,255,255,.035) 0 1px,transparent 1px 4px),
    var(--desktop);
  font-family:"Chicago","Geneva","Charcoal","Helvetica Neue",Arial,sans-serif;
  font-size:16px;
  -webkit-font-smoothing:none;
}
button,input{font:inherit}
button,a{-webkit-tap-highlight-color:transparent}
button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid var(--focus);outline-offset:2px}
.hidden{display:none!important}

.update-banner{
  position:sticky;top:0;z-index:50;
  display:flex;gap:12px;align-items:center;justify-content:center;flex-wrap:wrap;
  padding:8px 12px;background:#fff4b8;border-bottom:2px solid #000;
  font-weight:700;
}

.desktop-shell{width:min(1120px,100%);margin:0 auto;padding:18px}
.mac-window{
  background:var(--window);
  border:2px solid #000;
  box-shadow:4px 4px 0 rgba(0,0,0,.45);
}
.titlebar{
  min-height:28px;padding:3px 6px;
  display:grid;grid-template-columns:1fr auto 1fr;gap:8px;align-items:center;
  background:#eee;border-bottom:2px solid #000;
}
.titlebar-lines{
  height:16px;
  background:repeating-linear-gradient(to bottom,#777 0 1px,transparent 1px 3px);
}
.titlebar-title{font-weight:800;font-size:14px;white-space:nowrap}

.app-header{display:flex;align-items:center;gap:16px;padding:20px 22px 14px}
.app-header h1{font-size:2rem;line-height:1;margin:0 0 4px}
.version-line{margin:0;font-size:.82rem;font-weight:700}
.tagline{margin:7px 0 0;color:#333}
.app-mark{
  width:68px;height:68px;position:relative;flex:0 0 auto;
  border:3px solid #000;background:#f7f7f7;border-radius:10px;
  box-shadow:inset -3px -3px 0 #999,inset 3px 3px 0 #fff;
}
.face-eye{position:absolute;top:20px;width:7px;height:9px;background:#000;border-radius:50%}
.face-eye:nth-child(1){left:17px}.face-eye:nth-child(2){right:17px}
.face-mouth{position:absolute;left:18px;right:18px;bottom:16px;height:10px;border-bottom:3px solid #000;border-radius:0 0 30px 30px}

.toolbar{
  display:flex;gap:7px;flex-wrap:wrap;
  border-top:1px solid #777;border-bottom:2px solid #777;
  padding:8px 12px;background:#c5c5c5;
}
.mac-button{
  appearance:none;border:2px solid #000;border-radius:4px;
  background:#eee;color:#000;padding:9px 14px;min-height:42px;
  font-weight:750;cursor:pointer;
  box-shadow:inset 2px 2px 0 #fff,inset -2px -2px 0 #888;
}
.mac-button:hover{background:#fff}
.mac-button:active{box-shadow:inset 2px 2px 0 #888,inset -2px -2px 0 #fff;transform:translate(1px,1px)}
.mac-button.primary{border-width:3px}
.mac-button.compact{padding:6px 10px;min-height:34px;font-size:.88rem}
.mac-button.danger{color:#fff;background:var(--danger);box-shadow:inset 2px 2px 0 #b55,inset -2px -2px 0 #330707}
.link-button{text-decoration:none;display:inline-flex;align-items:center;justify-content:center}

.privacy-strip{
  margin:12px 18px 0;padding:10px 12px;border:1px solid #555;background:#efefef;
  font-size:.9rem;
}
.status-pill{display:inline-block;margin-left:8px;padding:2px 7px;border:1px solid #555;border-radius:999px;font-size:.75rem;background:#fff}

.view{padding:18px}
.inset-panel{
  background:var(--paper);border:2px solid #777;
  box-shadow:inset 2px 2px 0 #888,inset -2px -2px 0 #fff;
  padding:22px;
}
.intro-panel h2,.view h2{margin-top:0}
.choice-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:20px 0}
.test-card{
  min-height:126px;text-align:left;padding:18px;border:2px solid #111;background:#eee;cursor:pointer;
  box-shadow:inset 3px 3px 0 #fff,inset -3px -3px 0 #888;
}
.test-card strong{font-size:1.1rem;display:block;margin-bottom:8px}
.test-card span{color:#333;line-height:1.35}
.test-card:hover{background:#fff}
.test-card:active{box-shadow:inset 3px 3px 0 #888,inset -3px -3px 0 #fff}
.between-note{
  display:flex;gap:12px;align-items:flex-start;margin-top:16px;padding:12px;border:1px dashed #555;background:#eee;
}
.between-note p{margin:4px 0 0}.tiny-icon{font-size:1.5rem;font-weight:bold}

.form-topline,.results-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:14px}
.muted{color:var(--dim);margin:.25rem 0}
.questionnaire-section{
  margin:0 0 18px;background:var(--paper);border:2px solid #777;
  box-shadow:inset 2px 2px 0 #888,inset -2px -2px 0 #fff;
}
.section-heading{padding:14px 16px;border-bottom:2px solid #888;background:#e9e9e9}
.section-heading h3{margin:0 0 5px}
.section-heading p{margin:0;color:#444;font-size:.9rem}
.question-row{padding:16px;border-bottom:1px solid #aaa}
.question-row:last-child{border-bottom:0}
.question-text{display:flex;gap:10px;font-weight:750;line-height:1.4;margin-bottom:12px}
.q-number{
  display:inline-grid;place-items:center;flex:0 0 28px;height:28px;border:1px solid #555;background:#eee;
}
.answer-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:7px}
.answer-option{
  min-height:54px;padding:8px 9px;border:2px solid #555;background:#e8e8e8;cursor:pointer;
  box-shadow:inset 2px 2px 0 #fff,inset -2px -2px 0 #aaa;
  text-align:center;line-height:1.15;font-size:.92rem;
}
.answer-option .points{display:block;margin-top:3px;font-size:.72rem;color:#555}
.answer-option.selected{
  background:#111;color:#fff;border-color:#000;
  box-shadow:inset 0 0 0 2px #fff;
}
.answer-option.selected .points{color:#ddd}
.answer-option:disabled{opacity:.45;cursor:not-allowed}
.question-hint{margin:8px 0 0;font-size:.8rem;color:#555}
.question-error{margin:8px 0 0;padding:6px 8px;background:#fff4b8;border:1px solid #555;font-size:.82rem}

.difficulty-row{padding:16px;background:#eee;border-top:2px solid #888}
.difficulty-row .answer-grid{grid-template-columns:repeat(4,1fr)}
.form-actions{display:flex;justify-content:flex-end;padding:4px 0 8px}

.result-card{
  padding:18px;margin-bottom:14px;background:var(--paper);border:2px solid #777;
  box-shadow:inset 2px 2px 0 #888,inset -2px -2px 0 #fff;
}
.result-card h3{margin:0 0 8px}
.score-big{font-size:2.1rem;font-weight:900;letter-spacing:-.03em}
.severity-line{font-weight:800;margin:2px 0 8px}
.result-note{font-size:.9rem;color:#444;line-height:1.45}
.range-badge{display:inline-block;border:1px solid #555;background:#eee;padding:3px 7px;font-size:.75rem;margin-left:6px;vertical-align:middle}
.safety-box{
  margin-top:14px;padding:14px;border:3px double #000;background:#fff4b8;line-height:1.45;
}
.safety-box h4{margin:0 0 6px}
.local-save-confirm{padding:10px 12px;border:1px dashed #555;background:#eee;font-weight:700}

.history-list{display:grid;gap:10px}
.history-entry{
  padding:14px;background:var(--paper);border:2px solid #777;
  box-shadow:inset 1px 1px 0 #fff,inset -1px -1px 0 #999;
}
.history-entry-head{display:flex;justify-content:space-between;gap:12px;margin-bottom:8px}
.history-entry time{font-weight:800}
.history-scores{display:flex;flex-wrap:wrap;gap:8px}
.history-score{padding:5px 8px;border:1px solid #666;background:#eee;font-size:.85rem}
.history-empty{padding:30px;text-align:center;background:#eee;border:2px dashed #777}
.history-actions{margin-top:14px;display:flex;justify-content:flex-end}

.app-footer{
  padding:14px 18px 18px;border-top:2px solid #999;
  display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;font-size:.8rem;color:#333;
}
.footer-links{display:flex;gap:12px}.footer-links a{color:#000}

.mac-dialog{
  width:min(560px,calc(100vw - 28px));padding:0;border:2px solid #000;background:#d8d8d8;
  box-shadow:5px 5px 0 rgba(0,0,0,.5);
}
.mac-dialog::backdrop{background:rgba(0,0,0,.5)}
.dialog-titlebar{padding:5px 9px;border-bottom:2px solid #000;background:#eee;text-align:center;font-weight:800}
.dialog-body{padding:18px}.dialog-body h2{margin-top:0}
.check-row{display:flex;gap:10px;align-items:flex-start;padding:10px 0}
.check-row input{width:22px;height:22px;accent-color:#000;flex:0 0 auto}
.check-row small{display:block;color:#555;margin-top:3px}
.notice-box{margin:14px 0;padding:12px;border:1px solid #666;background:#eee;line-height:1.4}
.notice-box p{margin:6px 0}
.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}
.compact-dialog{max-width:430px}
.about-mark{width:74px;height:74px;margin:0 auto 12px;display:grid;place-items:center;border:3px solid #000;background:#fff;font-size:1.6rem;font-weight:900;border-radius:12px}
.about-version{font-size:.7em;color:#555}.smallprint{font-size:.8rem;line-height:1.45;color:#444}
.about-links{display:flex;gap:8px;flex-wrap:wrap}

@media (max-width:760px){
  .desktop-shell{padding:8px}
  .app-window{box-shadow:2px 2px 0 rgba(0,0,0,.45)}
  .app-header{padding:16px 14px 10px;align-items:flex-start}
  .app-mark{width:56px;height:56px}
  .face-eye{top:16px}.face-mouth{bottom:12px}
  .app-header h1{font-size:1.65rem}
  .tagline{font-size:.88rem}
  .toolbar{display:grid;grid-template-columns:repeat(2,1fr)}
  .toolbar .mac-button{width:100%}
  .privacy-strip{margin:10px 10px 0;line-height:1.4}
  .view{padding:10px}
  .inset-panel{padding:14px}
  .choice-cards{grid-template-columns:1fr}
  .test-card{min-height:90px}
  .answer-grid,.difficulty-row .answer-grid{grid-template-columns:repeat(2,1fr)}
  .answer-option{min-height:64px}
  .form-topline,.results-header{align-items:center}
  .app-footer{padding:12px 10px 16px;display:block;line-height:1.6}
  .footer-links{margin-top:5px}
}
@media (max-width:430px){
  body{font-size:15px}
  .app-header{gap:10px}
  .app-mark{width:48px;height:48px}
  .face-eye{top:13px;width:6px;height:7px}.face-eye:nth-child(1){left:12px}.face-eye:nth-child(2){right:12px}
  .face-mouth{left:13px;right:13px;bottom:10px}
  .toolbar{gap:5px;padding:7px}
  .mac-button{padding:8px 9px}
  .question-row{padding:13px 10px}
  .answer-grid{gap:5px}
  .answer-option{padding:7px 5px;font-size:.83rem}
}
@media (prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
