:root{
  --paper-max-w: 720px;     /* desktop column width */
  --paper-bg: #f5f3f1;      /* paper color */
  --strip-w: 32px;          /* desktop strip width (mobile halves it) */
  --ink: #111;
}

html, body { height: 100%; }
*{ box-sizing: border-box; }

/* Slight fluid scale for medium/small laptops */
html{ font-size: clamp(18px, 0.9vw + 0.5vh, 21px); }
@media (min-width: 1200px){
  html{ font-size: clamp(18px, 0.9vw + 0.5vh, 21px); }
}

body{
  margin:0;
  background:#000;          /* desktop sides are black */
  color: var(--ink);
  font-family: "Instrument Serif", serif;
  font-size: 1rem;
  line-height: 1;
  overflow-x: hidden;
}

.q-riddle{
font-family: 'Playfair Display', serif;
font-size: 0.8rem;
line-height: 1.35;
margin: 1.7rem 3% 0 3%;
white-space: pre-line;     /* keep \n from JS */
}

/* ===============================
   Screens (fill the viewport)
   =============================== */
.screen{ display:none; min-height:100dvh; min-height:100svh; justify-content:center; align-items:stretch; }
.screen.active{ display:flex; }

/* ===============================
   Endless Paper Column (no top/bottom gaps)
   =============================== */
.paper{
  width: 100%;
  max-width: var(--paper-max-w);
  background: var(--paper-bg);
  position: relative;
  margin: 0 auto;           /* centered (black on sides desktop) */
  display: flex;
  flex-direction: column;
  min-height: 100%;         /* fills .screen vertically */
  overflow: hidden;

  /* reserve space so strips don't overlap content */
  padding-left: var(--strip-w);
  padding-right: var(--strip-w);
}

/* Left strip (own image) */
.paper::before{
  content:"";
  position:absolute;
  top:0; bottom:0; left:0;
  width: var(--strip-w);
  background: url("pinfeedholes1.png") left top / 100% auto repeat-y;
  opacity:.95;
  pointer-events:none;
}

/* Right strip (own image) */
.paper::after{
  content:"";
  position:absolute;
  top:0; bottom:0; right:0;
  width: var(--strip-w);
  background: url("pinfeedholes2.png") right top / 100% auto repeat-y;
  opacity:.95;
  pointer-events:none;
}

/* Inner content – fills available height */
.paper-content{
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(18px, 3vw, 36px);
  background: var(--paper-bg);
}

/* ===============================
   Start screen
   =============================== */

   #start.screen{ align-items: center; justify-content: center; }
#start .start-inner{
  width:min(100%, 1200px);
  height: 100dvh;                  /* full viewport height */
  display:flex; align-items:center; justify-content:center;
}

.start-inner{
  width:min(calc(100vw - 16px), 1200px);
  max-height: 92vh;
  display:flex; align-items:center; justify-content:center;
}
.start-inner img{
  width:100%; height:auto; max-height:92vh;
  object-fit:contain; cursor:pointer; display:block;
}
.tap-hint{ position:fixed; bottom:18px; left:50%; transform:translateX(-50%); color:#bbb; font-size:.9rem; }




/* ===============================
   Header: number + progress (stays inside paper)
   =============================== */
.question-meta{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  padding: 0 2.5%;
}
.q-number{ font-weight:600; color:#333; white-space:nowrap; }

.progressbar{
  display:flex;
  flex: 1 1 auto;
  min-width: 0;
  gap: 6px;
  overflow: hidden;
  max-width: 100%;
}
.progressbar span{
  flex: 1 1 0;
  height: 6px;
  border-radius: 3px;
  background: rgba(0,0,0,.15);
}
.progressbar span.done{ background:#000; }
.progressbar span.current{ background:rgba(0,0,0,.35); }

/* ===============================
   Question media + titles
   =============================== */
.q-image{
  margin: 0 3%;
  display:none;              /* shown when src is set */
  justify-content:center;
  overflow:hidden;
}
.q-image img{
  width:auto;
  max-width:100%;
  max-height:40vh;           /* desktop/tall screens */
  height:auto;
  object-fit:contain;
  display:block;
}

.q-title{
  color:#1a1a1a;
  font-size: 1.8rem;
  font-weight: 600;
  line-height:1.3;
  margin: 0.45rem 3% 0 3%;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* Riddle text (no internal scroll; flows) */
.q-riddle{
  font-size: 1.2rem;
  line-height: 1.35;
  margin: 0.7rem 3% 0 3%;
  white-space: pre-line;     /* keep \n from JS */
}

/* ===============================
   Answers grid (A–D / images or text)
   =============================== */
form.options{
  display: grid;
  grid-template-columns: repeat(2, max-content); /* two columns sized to content */
  justify-content: center;                       /* <— centered as a group */
  align-items: center;
  column-gap: 5rem;                            /* space between the two columns */
  row-gap: 1.0rem;
  margin: 0 auto;                               
  margin-bottom: 1.6rem;  
  font-weight: 600; 
    
}

.opt{
  display:flex;
  flex-direction: row;       /* radio left, label right */
  align-items: center;
  gap: .55rem;
  justify-content: flex-start;
}
.opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.opt label{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:.55rem 0.9rem;
  border:2px solid #111;
  border-radius:10px;
  text-align:center;
  line-height:1.1;
  white-space:nowrap;
  min-width:var(--ans-w,auto);
cursor:pointer;
  transition:background .15s ease, color .15s ease, border-color .15s ease;
}


.opt label:hover {
  background: rgba(0,0,0,0.03);
}



body:not(.is-matrix) .opt label{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:.40rem 1.6rem;            /* a bit more padding */
  border:2px solid #111;
  border-radius:8px;
  background:transparent;
  color:#111;
  text-align:center;
  line-height:1.1;
  white-space:nowrap;
  min-width:var(--ans-w,auto);
  cursor:pointer;
  transition:background .15s ease, color .15s ease, border-color .15s ease;
}

/* subtle hover tint */
body:not(.is-matrix) .opt label:hover{
  background: rgba(0,0,0,0.03);
}

/* selected = inverted */
body:not(.is-matrix) .opt input[type="radio"]:checked + label{
  background:#111;
  color:#f5f3f1;
  border-color:#111;
}



/* Default (desktop/tablet) */
body.is-matrix .opt label {
  display:flex;
  align-items:center;
  justify-content:center;
  width: 140px;                  
  height: 140px;
  border:2px solid #111;         
  border-radius:10px;
  background:transparent;
  cursor:pointer;
  transition: background .15s ease, border-color .15s ease, border-width .15s ease;
}

/* On mobile (≤560px), scale down */
@media (max-width: 560px){
  body.is-matrix .opt label {
    width: 90px;
    height: 90px;
  }
}
 body.is-matrix .q-image img {
    max-height: 65vh;   /* increase image space on phones */
    min-width: 150%
  }


/* subtle hover tint on the whole button */
body.is-matrix .opt label:hover{
  background: rgba(0,0,0,0.05);
}

/* selected = thicker border */
body.is-matrix .opt input[type="radio"]:checked + label{
  border-width:4px;
}

/* image inside the button */
body.is-matrix .opt label img.answer-img{
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  display:block;
}

/* selected = thicker border (no double outline) */
body.is-matrix .opt input[type="radio"]:checked + label img.answer-img{
  border-width:5px;
}



/* Matrix answer thumbnails (full image visible, never crop) */
.opt label img.answer-img{
  width: auto;
  height: auto;
  max-width: clamp(2.6rem, 9vw, 5.4rem);
  max-height: clamp(2.6rem, 9vw, 5.4rem);
  object-fit: contain;
  display:block;
  background: transparent;
  border: 0;
  padding: .08rem;
  border-radius: .18rem;
}

/* ===============================
   Nav (prev / timer / next)
   =============================== */
.nav{
  margin-top:auto;           /* push to bottom of paper */
  padding: 23px 5%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;

  position: sticky;          /* stays at bottom when content taller */
  bottom: 0;
  background: var(--paper-bg);
}

.btn{
  appearance:none;
  border:2px solid#000;
  border-radius:6px;
  padding: 4px 8px;         /* compact, consistent height */
  min-height: 36px;
  line-height: 1;
  font-family: inherit;
  font-size: 18px;           /* px so browser zoom doesn’t balloon */
  font-weight:600;
  background:transparent;
  color:#000;
  cursor:pointer;
  transition:background .15s ease;
}
.nav .btn{ min-width: 100px; text-align:center; }
.btn:disabled{ opacity:.35; cursor:not-allowed; }

.btn:hover:not(:disabled),
.btn:focus-visible:not(:disabled){
  background:rgba(0,0,0,0.03);
}

.timer{
  font-weight:700;
  color:#000;
  font-variant-numeric: tabular-nums;
  letter-spacing:.03em;
}

/* ===============================
   Matrix emphasis (desktop/tablet)
   =============================== */
@media (min-width: 561px){
  body.is-matrix .q-image img{
    max-height: 58vh;        /* bigger prompt image */
    width: auto;
  }
  body.is-matrix .q-title{
    margin: .3rem 3% .2rem;
  }
  body.is-matrix form.options{
    gap: 2rem 2rem;
    margin-top: .45rem;
    margin-bottom: 2rem;
  }
}




/* ===============================
   Results grid (2-up)
   =============================== */
   
   
  
#end #answersString {
  color: var(--paper-bg);   /* same color as background – invisible */
  font-weight: 500;
  user-select: text;
  margin: 0;                /* 🔥 removes default top/bottom space */
  padding: 0;               /* just in case */
}

#end .answers-help {
  margin-bottom: 0.1rem; /* smaller space under the paragraph */
  margin-top: 0.1rem;    /* smaller space above */
  line-height: 1.3;      /* optional: tighter look */
}
   
   /* Final page: single product card */
.compendium-offer{
  margin: 3px 5% 0;
  display: grid;
  grid-template-columns: 1fr;  /* image on top, text below */
  justify-items: center;
  row-gap: 10px;
  margin-bottom: 55px;   
}

.comp-link{
  display:block;
  width: min(460px, 92%);      /* fits inside the paper column */
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0,0,0,0.04);
  transition: transform .18s ease, box-shadow .18s ease;
}
.comp-link img{
  width: 100%;
  height: auto;
  display: block;
}
.comp-link:hover img{ transform: scale(1.02); }

.comp-caption{
  width: min(520px, 92%);
  color: #111;
  text-align: left;
}
.comp-title{
  font-size: 1.0rem;
  line-height: 1.2;
  margin-bottom: 4px;
  font-weight: 600;
}
.comp-desc{
  font-size: .9rem;
  line-height: 1.35;
  opacity: .9;
}

/* a little more breathing room above the bottom nav */
#end .nav{ margin-top: 14px; }
   
#end .q-title {
  text-align: center;
  width: 100%;
  font-size: 2rem;         /* slightly larger */
  letter-spacing: 0.5px;   /* subtle spacing */
  margin: 1rem auto 1rem auto;
}
   
   
   
   
   
   
   
.store-wrap{
  margin: 10px 5% 0;
}
.store-heading{
  font-size: 1rem;
  margin: 0 0 .5rem 0;
  color: #111;
}
.store-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 4%;
  row-gap: 20px;
}
.store-card{
  display: flex;
  flex-direction: column;
}
.store-imglink{
  display: block;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0,0,0,0.04);
  transition: transform .18s ease, box-shadow .18s ease;
}
.store-imglink:hover img,
.store-imglink:focus-visible img{ transform: scale(1.03); }
.store-imglink:focus-visible{ outline: 2px solid #111; outline-offset: 2px; }
.store-imglink img{
  width: 100%;
  height: auto;
  aspect-ratio: 525 / 497;
  object-fit: contain;
  display: block;
}
.store-caption{
  margin-top: 8px;
  color: #111;
  background: transparent;
}
.store-title{
  font-size: .95rem;
  line-height: 1.2;
  margin-bottom: .25rem;
}
.store-desc{
  font-size: .85rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}



.q-mid{
  flex: 1;                         /* take the free vertical space */
  display: flex;
  flex-direction: column;
  justify-content: center;         /* <— vertical centering */
  gap: 0.85rem;                    /* space between blocks */
  min-height: 0;                   /* allow shrinking when content is tall */
}

/* keep existing margins on your inner pieces */
.q-mid .q-image{ margin-left:4%; margin-right:6%; }
.q-mid .q-title{ margin: 0.5rem 4% 0 4%; }
.q-mid .q-riddle{ margin: 0.8rem 3% 1.4rem 3%; }
.q-mid form.options{ margin-top: 0; }   /* we center, no need to push down */


/* ===============================
   Compact desktops (short height/narrow)
   =============================== */
@media (min-width: 561px) and (max-width: 1100px),
       (min-width: 561px) and (max-height: 800px){
  .q-image img{ max-height: 44vh; }
  .q-riddle{ font-size: .98rem; }
  .btn{ font-size: 17px; padding: 7px 12px; }
  .nav .btn{ min-width: 110px; }
  .timer{ font-size:.95rem; }
}

/* ===============================
   Phones (≤ 560px): smaller margins & strips,
   full-width paper, bigger media room
   =============================== */
@media (max-width: 560px){
  :root{ --strip-w: 16px; }    /* 50% strip width on mobile */

  .paper{
    max-width: none;
    width: 100vw;              /* edge-to-edge; no side gaps */
    min-height: 100dvh;        /* fill screen height */
    min-height: 100svh;
  }

  .paper-content{
    gap: 35px;
    padding: 10px 10px;        /* tighter mobile padding = more space for content */
  }

  .question-meta{ padding: 0 2%; padding-top: 0.5rem;}
  .progressbar{ gap: 5px; }
  .progressbar span{ height: 4px; }
  

  .q-image{ margin: 0 2.5%; }
  .q-image img{ max-height: 38vh; } /* a bit taller media on phones */


  
  .q-title{ font-size: .98rem; }
  .q-riddle{
    font-size: .9rem;
    line-height: 1.3;
    margin: 0.6rem 2.5% 0 2.5%;
  }

  #end .q-title {
    font-size: 1.35rem;      /* smaller headline */
    margin-bottom: 0.3rem;   /* tighter spacing below */
  }

  /* Reduce gap between title and the paragraph */
  #end .answers-help {
    margin-top: 0.2rem;      /* less space above paragraph */
    line-height: 1.3;        /* slightly tighter text */
  }
  
  
  #end #answersString {
    margin: 0;                /* 🔥 removes default top/bottom space */
  padding: 0;               /* just in case */
}

  form.options{
    gap: .85rem 1rem;
    margin: .45rem 4% 2.5rem 4%;
    font-weight: 600;
  }
  .opt input{ width: 1.6em; height: 1.6em; }
  .opt label{ font-size: .96rem; white-space: normal; }
  .opt label img.answer-img{
    max-width: 18vw;
    max-height: 18vw;
  }

  body:not(.is-matrix) form.options{
  grid-template-columns: 1fr;      /* stack */
  justify-items: center;           /* center each item */
  width: 100%;
  column-gap: 0;
  row-gap: 0.9em;
  margin: .6rem 4% 1.2rem;         /* a bit of side breathing room */
}

body:not(.is-matrix) .opt{
  width: 90%;
  justify-content: center;
}

body:not(.is-matrix) .opt label{
  width: min(90%, 520px);         /* clamp max width so it doesn’t get too wide */
  display: inline-flex;
  justify-content: center;
  text-align: center;
  padding: .5rem 1rem;             /* comfy tap target */
}
 body.is-matrix .q-image img {
    max-height: 55vh;   /* increase image space on phones */
  }

/* MATRIX on mobile: keep your two-column layout */
body.is-matrix form.options{
  grid-template-columns: repeat(2, max-content);
  justify-content: center;
  column-gap: 1.5rem;
  row-gap: .9rem;
}

  .q-image img{
  width:auto;
  max-width:117%;

    --content-pad-x: 14px;   /* must match .paper-content padding left/right */
    --nav-side-gap: 8px;     /* tiny inset from the perforation strip */
  }



  /* Mobile nav: prev/next near edges; timer centered, stable width */
   .nav{
    position: sticky;
    bottom: 0;
    background: var(--paper-bg);
    height: 43px;
    margin-bottom: 15px;

    /* grid keeps timer centered and buttons at edges */
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;

    /* little inset from the content edge */
    padding: 10px var(--nav-side-gap);
  }
   #btnPrev, #btnNext{
    padding: 3px 10px;          /* ← adjust inner spacing here */
    min-width: 74px;            /* shrink/grow width here */
    font-size: 15px;
  }

  /* place buttons to the edges of the grid */
  #btnPrev{ justify-self: start; }
  #btnNext{ justify-self: end; }

  /* center timer, fix width so it never shifts */
  .timer{
    justify-self: center;
    width: 5.2ch;               /* fits “00:00” exactly */
    text-align: center;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
  }
  /* Store grid tighter */
  .store-wrap{ margin: 10px 4% 0; }
  .store-grid{ column-gap: 3%; row-gap: 16px; }
  .store-title{ font-size: .9rem; }
  .store-desc{ font-size: .82rem; }
}