:root{
  --wall:#FFC23D;
  --paper:#FFF8EA;
  --paper2:#F3EAD6;
  --paper3:#E9DDC4;
  --red:#E0312B;
  --ink:#2A2220;
  --green:#2E9E4F;
  --binder:#9E1F1A;
  --metal:#C9C2B8;
  --pad:20px;
  --sheet-w:520px;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
html{ -webkit-text-size-adjust:100%; }

body{
  min-height:100vh;
  min-height:100dvh;
  font-family:'Rubik',system-ui,sans-serif;
  color:var(--ink);
  background-color:var(--wall);
  background-image:url('assets/wall.jpg');
  background-size:cover;
  background-position:center;
  background-attachment:fixed;
  display:flex;
  justify-content:center;
  align-items:flex-start;
  padding:32px 16px 56px;
  overflow-x:hidden;
}

/* ============ scene & calendar ============ */
.scene{
  width:100%;
  max-width:var(--sheet-w);
  display:flex;
  flex-direction:column;
  align-items:center;
}

.calendar{
  position:relative;
  width:100%;
  z-index:1;
}

.nail{
  width:12px;height:12px;border-radius:50%;
  margin:0 auto -1px;
  background:radial-gradient(circle at 35% 30%, #6b625c, #241f1d 70%);
  box-shadow:0 2px 3px rgba(40,20,0,.45), 0 0 0 1px rgba(0,0,0,.15) inset;
  position:relative;
  z-index:4;
}

/* ============ binder bar ============ */
.binder{
  position:relative;
  background:linear-gradient(#a8241e, var(--binder) 55%, #821712);
  border-radius:8px 8px 3px 3px;
  padding:10px 18px 12px;
  box-shadow:0 2px 0 #6f120e, 0 8px 16px rgba(80,40,0,.25);
  z-index:5;
}
.staples{
  display:flex;
  justify-content:space-between;
  padding:0 22px;
  margin-bottom:6px;
}
.staple{
  width:64px;height:9px;border-radius:5px;
  background:linear-gradient(#e7e2da, var(--metal) 45%, #9c9690);
  box-shadow:0 1px 1px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.6);
}
.binder-counters{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  color:#fff;
  font-weight:700;
  letter-spacing:.06em;
  text-transform:uppercase;
  font-size:clamp(15px,4.4vw,19px);
}
.counter{white-space:nowrap;}
.counter-label{opacity:.85;}
.counter-value{font-weight:700;}

/* ============ stack of sheets behind ============ */
.stack{
  position:absolute;
  left:0;right:0;top:100%;
  z-index:2;
  pointer-events:none;
}
.stack-edge{
  position:absolute;
  left:0;right:0;
  height:16px;
  margin:0 auto;
  border-radius:0 0 10px 10px;
}
.edge-1{top:-14px;width:99.2%;background:var(--paper2);box-shadow:0 4px 6px rgba(80,40,0,.12);}
.edge-2{top:-9px;width:98.2%;background:var(--paper3);}
.edge-3{top:-4px;width:97%;background:var(--paper2);}

/* ============ the sheet ============ */
.sheet{
  position:relative;
  background-color:var(--paper);
  background-image:url('assets/paper.jpg');
  background-size:cover;
  background-position:center;
  padding:var(--pad) var(--pad) calc(var(--pad) + 10px);
  margin-top:-2px;
  border-radius:2px 2px 0 0;
  box-shadow:0 2px 0 var(--paper3), 0 10px 24px rgba(80,40,0,.18);
  z-index:3;
  transform-origin:60% 0%;
}
/* perforated tear edge */
.sheet::after{
  content:"";
  position:absolute;
  left:0;right:0;bottom:-9px;
  height:10px;
  background-color:var(--paper);
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='10' viewBox='0 0 18 10'%3E%3Cpath d='M0 0 H18 V2 L9 10 L0 2 Z' fill='%23000'/%3E%3C/svg%3E") repeat-x bottom/18px 10px;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='10' viewBox='0 0 18 10'%3E%3Cpath d='M0 0 H18 V2 L9 10 L0 2 Z' fill='%23000'/%3E%3C/svg%3E") repeat-x bottom/18px 10px;
}

/* tear-off animation */
.sheet.tearing{
  transition:transform .45s cubic-bezier(.4,0,.7,1), opacity .45s ease-in;
  transform:translate(70px,-30px) rotate(7deg);
  opacity:0;
}
.sheet.dropping{
  transition:none;
  transform:translateY(-10px) rotate(-1.2deg);
  opacity:0;
}
.sheet.dropped{
  transition:transform .32s ease-out, opacity .32s ease-out;
  transform:none;
  opacity:1;
}

/* ============ question layout ============ */
.q-grid{display:block;}
.q-left,.q-right{min-width:0;}

/* ============ sheet header ============ */
.kicker{
  text-align:center;
  color:var(--red);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.14em;
  font-size:12px;
  margin:2px 0 2px;
}
.sheet-number{
  font-family:'Oswald',sans-serif;
  font-weight:700;
  color:var(--red);
  text-align:center;
  line-height:.92;
  font-size:96px;
  margin:0;
  letter-spacing:.01em;
}
.sheet-rule{
  border:0;
  border-top:2px solid var(--red);
  width:84%;
  margin:10px auto 20px;
  opacity:.9;
}

/* ============ aphorism ============ */
.aphorism{
  font-family:'PT Serif',serif;
  font-style:italic;
  font-size:clamp(22px,5.6vw,28px);
  line-height:1.4;
  text-align:center;
  color:var(--ink);
  margin:0 auto 10px;
  max-width:44ch;
}
.ask{
  text-align:center;
  font-family:'Rubik',sans-serif;
  font-size:14px;
  letter-spacing:.03em;
  color:rgba(42,34,32,.6);
  margin:0 0 20px;
}

/* ============ answers ============ */
.answers{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
}
.answer{
  display:flex;
  align-items:center;
  gap:14px;
  width:100%;
  min-height:56px;
  padding:10px 14px;
  text-align:left;
  font-family:'Rubik',sans-serif;
  font-size:clamp(16px,4.4vw,18px);
  font-weight:500;
  color:var(--ink);
  background-color:var(--paper);
  border:2px solid var(--ink);
  border-radius:6px;
  cursor:pointer;
  transition:background-color .12s ease, transform .12s ease, opacity .2s ease, border-color .2s ease;
  -webkit-tap-highlight-color:transparent;
}
.answer .badge{
  flex:0 0 auto;
  width:30px;height:30px;border-radius:50%;
  background:var(--red);
  color:#fff;
  font-weight:700;
  display:flex;align-items:center;justify-content:center;
  font-size:15px;
  line-height:1;
}
.answer .name{flex:1 1 auto;}
@media (hover:hover){
  .answer:not(:disabled):hover{background-color:var(--paper2);transform:translateY(1.5px);}
}
.answer:not(:disabled):active{background-color:var(--paper2);transform:translateY(2px);}
.answer:focus-visible{outline:3px solid rgba(224,49,43,.5);outline-offset:2px;}

.answers.locked .answer{cursor:default;}
.answer.correct{
  background-color:var(--green);
  border-color:var(--green);
  color:#fff;
}
.answer.correct .badge{background:#fff;color:var(--green);}
.answer.wrong{
  background-color:var(--red);
  border-color:var(--red);
  color:#fff;
}
.answer.wrong .badge{background:#fff;color:var(--red);}
.answer.dim{opacity:.4;}

/* ============ stamp ============ */
.stamp{
  position:absolute;
  top:7%;right:5%;
  transform:rotate(-8deg) scale(1.3);
  opacity:0;
  padding:6px 14px;
  border:4px double currentColor;
  border-radius:8px;
  font-family:'Rubik',sans-serif;
  font-weight:700;
  letter-spacing:.12em;
  text-transform:uppercase;
  font-size:22px;
  line-height:1;
  pointer-events:none;
  z-index:6;
  background:rgba(255,248,234,.35);
}
.stamp.show{
  animation:stampIn .2s ease-out forwards;
  opacity:.85;
}
.stamp.ok{color:var(--green);}
.stamp.no{color:var(--red);}
@keyframes stampIn{
  0%{transform:rotate(-8deg) scale(1.3);opacity:0;}
  70%{transform:rotate(-8deg) scale(.96);opacity:.9;}
  100%{transform:rotate(-8deg) scale(1);opacity:.85;}
}

/* ============ reveal footer ============ */
.reveal{
  overflow:hidden;
  max-height:0;
  opacity:0;
  transition:max-height .4s ease, opacity .3s ease, margin .3s ease;
  margin-top:0;
}
.reveal.open{
  max-height:600px;
  opacity:1;
  margin-top:22px;
}
.reveal-inner{
  border-top:1px dashed rgba(42,34,32,.3);
  padding-top:14px;
  text-align:center;
}
.said-line{
  font-size:14px;
  color:rgba(42,34,32,.6);
  letter-spacing:.03em;
}
.said-name{
  display:block;
  font-size:clamp(20px,5.5vw,26px);
  font-weight:700;
  color:var(--ink);
  margin-top:2px;
}
.said-note{
  font-size:13px;
  color:rgba(42,34,32,.6);
  margin-top:6px;
}

/* ============ buttons ============ */
.btn{
  display:block;
  width:100%;
  margin-top:18px;
  padding:16px 18px;
  font-family:'Rubik',sans-serif;
  font-weight:700;
  font-size:17px;
  letter-spacing:.02em;
  text-align:center;
  color:#fff;
  background:var(--red);
  border:0;
  border-radius:8px;
  cursor:pointer;
  box-shadow:0 3px 0 #a8221d, 0 6px 14px rgba(80,40,0,.22);
  transition:transform .1s ease, box-shadow .1s ease, background-color .15s ease;
}
.btn:hover{background:#cf2a25;}
.btn:active{transform:translateY(2px);box-shadow:0 1px 0 #a8221d;}
.btn:focus-visible{outline:3px solid rgba(42,34,32,.4);outline-offset:2px;}

/* ============ start screen ============ */
.cover-title{
  font-family:'Oswald',sans-serif;
  font-weight:700;
  color:var(--red);
  text-align:center;
  text-transform:uppercase;
  font-size:clamp(52px,15vw,84px);
  line-height:.96;
  margin:14px 0 6px;
  letter-spacing:.01em;
}
.cover-sub{
  font-family:'PT Serif',serif;
  font-style:italic;
  text-align:center;
  font-size:clamp(18px,4.8vw,22px);
  color:var(--ink);
  margin:0 0 22px;
}
.rules{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.rules li{
  display:flex;
  gap:12px;
  align-items:flex-start;
  font-size:16px;
  line-height:1.35;
  color:var(--ink);
}
.rules .rn{
  flex:0 0 auto;
  font-family:'Oswald',sans-serif;
  font-weight:700;
  color:var(--red);
  font-size:22px;
  line-height:1.15;
  min-width:20px;
}

/* ============ final screen ============ */
.final-num{
  font-family:'Oswald',sans-serif;
  font-weight:700;
  color:var(--red);
  text-align:center;
  font-size:clamp(64px,18vw,110px);
  line-height:1;
  margin:16px 0 4px;
}
.final-score{
  text-align:center;
  font-weight:700;
  font-size:18px;
  color:var(--ink);
  margin:0 0 10px;
}
.final-phrase{
  font-family:'PT Serif',serif;
  font-style:italic;
  text-align:center;
  font-size:clamp(19px,5vw,23px);
  line-height:1.4;
  color:var(--ink);
  margin:0 auto 6px;
  max-width:32ch;
}

/* ============ min restart ============ */
.restart-min{
  margin-top:26px;
  background:transparent;
  border:0;
  color:var(--ink);
  font-family:'Rubik',sans-serif;
  font-weight:500;
  font-size:16px;
  letter-spacing:.02em;
  cursor:pointer;
  padding:8px 12px;
  border-radius:8px;
  opacity:.9;
}
.restart-min:hover{background:rgba(42,34,32,.1);}
.restart-min .confirm{font-weight:700;color:var(--red);}

/* ============ responsive ============ */
@media (min-width:640px){
  :root{--pad:32px;}
  .sheet-number{font-size:140px;}
  .answers{grid-template-columns:1fr 1fr;}
  .answer{padding:12px 16px;}
  body{padding-top:40px;}
  .stamp{font-size:28px;top:6%;right:5%;}
}
@media (min-width:900px){
  body{align-items:flex-start;}
}

@media (max-width:359px){
  .sheet-number{font-size:78px;}
  .binder-counters{font-size:14px;letter-spacing:.03em;}
}

/* ============================================================
   Short landscape (phones held sideways): everything must fit
   the height without scrolling, so the sheet splits into two
   columns and the type steps down with the viewport height.
   ============================================================ */
@media (orientation:landscape) and (max-height:560px){
  body{padding:8px 12px 10px;}
  .calendar{max-width:820px;margin:0 auto;}
  .nail{width:10px;height:10px;}

  .binder{padding:6px 14px 8px;}
  .staples{padding:0 14px;margin-bottom:4px;}
  .staple{width:48px;height:8px;}
  .binder-counters{font-size:clamp(13px,2.6vh,16px);}

  .sheet{padding:12px 18px calc(12px + 6px);}
  .q-grid{display:grid;grid-template-columns:38% 1fr;gap:18px;align-items:start;}

  .kicker{font-size:11px;margin-top:0;}
  .sheet-number{font-size:clamp(40px,9.5vh,68px);}
  .sheet-rule{margin:5px auto 9px;width:70%;}
  .aphorism{font-size:clamp(13px,2.6vh,18px);line-height:1.3;margin-bottom:5px;}
  .ask{font-size:12px;margin-bottom:0;}

  .answers{grid-template-columns:1fr 1fr;gap:8px;}
  .answer{min-height:42px;padding:6px 10px;font-size:14px;gap:9px;}
  .answer .badge{width:24px;height:24px;font-size:12px;}

  .reveal.open{max-height:340px;margin-top:8px;}
  .reveal-inner{padding-top:8px;}
  .said-line{font-size:12px;}
  .said-name{font-size:clamp(16px,3vh,21px);}
  .said-note{font-size:12px;margin-top:3px;}
  .btn{margin-top:8px;padding:10px 14px;font-size:15px;}

  .stamp{font-size:clamp(16px,3.4vh,22px);top:4%;right:3%;padding:5px 11px;}

  .restart-min{margin-top:8px;font-size:14px;padding:6px 10px;}

  /* cover and final are a single column, tightened to the height */
  .cover-title{font-size:clamp(32px,10.5vh,56px);margin:2px 0 2px;}
  .cover-sub{font-size:clamp(13px,2.6vh,17px);margin-bottom:10px;}
  .rules{gap:5px;}
  .rules li{font-size:13px;line-height:1.22;}
  .rules .rn{font-size:16px;min-width:15px;}
  .final-num{font-size:clamp(34px,12vh,66px);margin:2px 0 2px;}
  .final-score{font-size:15px;margin-bottom:4px;}
  .final-phrase{font-size:clamp(13px,2.6vh,18px);}
}

/* Narrow-and-short landscape (older / small phones): shrink once more. */
@media (orientation:landscape) and (max-height:400px){
  .q-grid{grid-template-columns:36% 1fr;gap:12px;}
  .sheet{padding:10px 14px calc(10px + 6px);}
  .aphorism{font-size:clamp(11px,3.3vh,14px);line-height:1.25;}
  .answer{min-height:38px;font-size:12.5px;padding:5px 9px;}
  .sheet-number{font-size:clamp(30px,9vh,48px);}
  .btn{margin-top:6px;padding:8px 12px;font-size:14px;}
  .reveal.open{margin-top:6px;}
  .reveal-inner{padding-top:6px;}
  .said-name{font-size:clamp(15px,4vh,19px);}
  .said-note{display:none;}
  .binder{padding:5px 12px 6px;}
}

/* ============================================================
   Portrait phones: tighten the tall layout so the whole sheet
   fits one screen, with the restart sitting under the calendar
   on the wall as in the reference.
   ============================================================ */
@media (max-width:639px){
  body{padding:20px 16px 24px;align-items:flex-start;}
  .restart-min{margin-top:18px;}
  .sheet-number{font-size:76px;}
  .sheet-rule{margin:6px auto 14px;}
  .aphorism{margin-bottom:8px;}
  .answers{gap:10px;}
  .answer{min-height:50px;}
  .reveal.open{margin-top:12px;}
  .reveal-inner{padding-top:10px;}
}

@media (orientation:portrait) and (max-width:639px) and (max-height:720px){
  .sheet-number{font-size:60px;}
  .cover-title{font-size:clamp(40px,13vw,56px);}
  .aphorism{font-size:18px;}
  .ask{margin-bottom:12px;}
  .answer{min-height:44px;font-size:15px;}
  .rules{gap:9px;}
  .btn{margin-top:12px;padding:12px 16px;}
  .reveal.open{margin-top:10px;}
  .reveal-inner{padding-top:8px;}
  .said-name{font-size:20px;}
  .said-note{margin-top:4px;}
}

@media (prefers-reduced-motion:reduce){
  .sheet.tearing{transition:opacity .3s ease-out;transform:none;}
  .sheet.dropped{transition:opacity .25s ease-out;transform:none;}
  .stamp.show{animation:none;opacity:.85;}
  .btn,.answer{transition:none;}
}

/* ============ language choice ============ */
.lang-pick{margin:0 0 12px;text-align:center;}
.lang-label{
  margin:0 0 6px;
  font-size:12px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;
  color:rgba(42,34,32,.6);
}
.lang-row{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;}
.lang-chip{
  min-height:40px;padding:6px 4px;
  font-family:'Rubik',system-ui,sans-serif;font-weight:500;font-size:15px;
  color:var(--ink);background:var(--paper);
  border:2px solid var(--ink);border-radius:6px;cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  transition:background-color .12s ease;
}
.lang-chip:hover{background:var(--paper2);}
.lang-chip.on{background:var(--ink);color:#fff;}
.lang-chip:focus-visible{outline:3px solid rgba(224,49,43,.5);outline-offset:2px;}
.link-btn{
  display:block;margin:12px auto 0;padding:8px 12px;
  background:transparent;border:0;border-radius:8px;cursor:pointer;
  font-family:'Rubik',system-ui,sans-serif;font-size:15px;font-weight:500;
  color:var(--ink);text-decoration:underline;text-underline-offset:3px;
}
.link-btn:hover{background:rgba(42,34,32,.08);}
@media (min-width:640px){ .lang-row{grid-template-columns:repeat(6,1fr);} .lang-chip{font-size:14px;} }
@media (orientation:landscape) and (max-height:560px){
  .lang-pick{margin-bottom:4px;}
  .lang-label{display:none;}
  .lang-row{grid-template-columns:repeat(6,1fr);gap:5px;}
  .lang-chip{min-height:30px;padding:3px 4px;font-size:13px;}
  .link-btn{margin-top:4px;padding:4px 10px;font-size:13px;}
}

/* Chinese: system CJK faces, no faked italics, no uppercase spacing */
html:lang(zh-CN) body, html:lang(zh-CN) .cover-title, html:lang(zh-CN) .aphorism,
html:lang(zh-CN) .cover-sub, html:lang(zh-CN) .final-phrase, html:lang(zh-CN) .answer,
html:lang(zh-CN) .btn, html:lang(zh-CN) .rules li{
  font-family:'Rubik',"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans CJK SC","Noto Sans SC",sans-serif;
}
html:lang(zh-CN) .aphorism, html:lang(zh-CN) .cover-sub, html:lang(zh-CN) .final-phrase{font-style:normal;}
html:lang(zh-CN) .cover-title{letter-spacing:.04em;}

/* ============ short landscape: centre the calendar, use the height ============ */
@media (orientation:landscape) and (max-height:560px){
  body{align-items:center;padding-top:6px;padding-bottom:6px;}
  .sheet{padding-top:16px;}
  .aphorism{font-size:clamp(14px,4.4vh,21px);}
  .ask{font-size:clamp(12px,3.2vh,14px);}
  .sheet-number{font-size:clamp(40px,13vh,72px);}
  .answer{min-height:clamp(42px,12vh,54px);font-size:clamp(13px,3.8vh,16px);}
  /* the stamp sits in the free space of the left column, never over a name */
  .q-left{position:relative;}
  .sheet-number{transition:transform .25s ease-out;}
  .sheet.stamped .sheet-number{transform:translateX(-28%);}
  .q-left .stamp{top:clamp(14px,6vh,26px);right:-4px;left:auto;bottom:auto;font-size:clamp(14px,4vh,19px);padding:4px 9px;border-width:3px;}
}
@media (orientation:landscape) and (max-height:400px){
  .aphorism{font-size:clamp(12px,4vh,16px);}
  .answer{font-size:clamp(12px,3.6vh,14px);}
}
.sheet.dropping{transform:translateY(-4px) rotate(-1deg);}
@media (orientation:landscape) and (max-height:340px){
  body{padding-top:2px;padding-bottom:0;}
  .restart-min{margin-top:4px;padding:4px 10px;}
}
