:root{
  --bg:#ffffff;
  --ink:#111;
  --muted:#555;
  --card:#fff;
  --shadow: rgba(0,0,0,0.10);
  --accent:#ff6a00;
  --postA:#ffe45c;
  --postB:#a7f3d0;
  --tape:#ffd27a;
  --soft:#f4f4f4;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.wrap{
  width:min(980px, 92vw);
  margin:26px auto 46px;
  display:grid;
  gap:14px;
  position: relative;
}

.header{ position: relative; padding: 6px 4px 2px; }
.badge{
  display:inline-block;
  padding:6px 10px;
  border:2px solid var(--ink);
  border-radius: 10px;
  font-weight:950;
  letter-spacing:1px;
  background:#fff;
}

.postits{
  position:absolute;
  right: 0;
  top: 0;
  display:flex;
  gap:10px;
}

.postit{
  width: 180px;
  padding: 12px 12px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 4px 0 var(--shadow);
  font-weight: 950;
  background:#fff;
}
.postit.a{ background: var(--postA); transform: rotate(-2deg); }
.postit.b{ background: var(--postB); transform: rotate(2deg); }

.header h1{
  margin: 12px 0 6px;
  font-size: 30px;
  letter-spacing:-0.3px;
}
.sub{
  margin:0;
  color: var(--muted);
  line-height: 1.35;
}

.card{
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 3px 4px 0 var(--shadow);
  position: relative;
}

.tape::before,
.tape::after{
  content:"";
  position:absolute;
  width: 118px;
  height: 26px;
  background: var(--tape);
  border: 2px solid rgba(0,0,0,0.20);
  top: -12px;
  pointer-events:none;
}
.tape::before{ left: 22px; transform: rotate(-4deg); }
.tape::after{ right: 22px; transform: rotate(3deg); }

.cardHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}

h2{
  margin:0 0 12px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field{ display:grid; gap:6px; }
.field span{
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}

.field input{
  width:100%;
  padding: 10px 10px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background:#fff;
  outline:none;
  font-size:14px;
}

.field input:focus{ box-shadow: 0 0 0 3px rgba(255,106,0,0.25); }

.row{ display:flex; gap:10px; margin-top: 14px; flex-wrap: wrap; }

.btn{
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  background:#fff;
  cursor:pointer;
  font-weight: 950;
}
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0px); }

.btn.primary{ background: #fff3ea; }
.btn.toggle{ padding: 8px 10px; }
.btn.wide{ width: 100%; text-align:center; }

.pill{
  display:inline-block;
  margin-left: 8px;
  min-width: 44px;
  text-align:center;
  padding: 3px 8px;
  border:2px solid var(--ink);
  border-radius: 999px;
  background:#fff;
  font-size: 12px;
}
.pill.on{ background:#fff3ea; }

.hint{
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px dashed rgba(0,0,0,0.25);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.result{
  padding: 12px;
  border-radius: 12px;
  border: 2px dashed var(--ink);
  background:#fff;
  line-height:1.45;
}

.big{ font-size: 18px; font-weight: 950; margin-bottom: 8px; }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }

.split{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.miniBox{
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 10px;
  background:#fff;
}
.miniTitle{
  font-weight: 950;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 6px;
}
.tierList{ display:grid; gap: 8px; }
.tierRow{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--soft);
  border: 1px solid rgba(0,0,0,0.10);
}

.warmCard .warmHead{ 
  text-align: center;
  justify-items: center;
  position: relative;
  z-index: 5;
}

.warmCard .warmHead h2{
  margin: 0;
}

.warmupArea{
  max-height: 0;
  overflow: hidden;
  transition: max-height 280ms ease, padding-top 280ms ease;
  border-top: 1px dashed rgba(0,0,0,0.25);
  margin-top: 12px;
  padding-top: 0;
}
.warmupArea.open{
  max-height: 1400px;
  padding-top: 12px;
}

.warmupTop{
  display:flex;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom: 10px;
}

.scrapTag{
  display:inline-block;
  padding: 6px 10px;
  border:2px solid var(--ink);
  border-radius: 999px;
  font-weight: 950;
  background:#fff;
}

.warmupNote{
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.warmStats{
  margin-top: 12px;
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat{
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 8px 10px;
  background:#fff;
  display:flex;
  justify-content:space-between;
  gap:10px;
}
.stat .k{
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-size: 11px;
}
.stat .v{ font-weight: 950; }

.case{
  margin-top: 12px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 12px;
  background:#fff;
}

.caseWindow{
  position: relative;
  height: 86px;
  width: 744px;
  max-width: 92vw;
  margin: 0 auto;
  border: 2px solid var(--ink);
  border-radius: 12px;
  overflow: hidden;
  background: #fafafa;
  isolation: isolate;
}

.casePointer{
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  transform: translateX(-50%);
  z-index: 999;
  pointer-events: none;
}

.casePointer::before{
  content:"";
  position:absolute;
  top:0;
  left:-10px;
  width:20px;
  height: 10px;
  background: var(--accent);
  border:2px solid var(--ink);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
}

.casePointer::after{
  content:"";
  position:absolute;
  bottom:0;
  left:-10px;
  width:20px;
  height: 10px;
  background: var(--accent);
  border:2px solid var(--ink);
  border-top: none;
  border-radius: 0 0 10px 10px;
}

.caseStrip{
  position: relative;
  z-index: 1;
  display:flex;
  height: 100%;
  align-items:center;
  gap: 10px;
  padding: 0 12px;
  transform: translateX(0px);
  will-change: transform;
}

.caseNum{
  width: 64px;
  height: 54px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 950;
  box-shadow: 2px 2px 0 var(--shadow);
  flex: 0 0 auto;
}

.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 18px;
  z-index: 999;
}
.modalCard{
  width: min(560px, 94vw);
  background:#fff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 6px 8px 0 var(--shadow);
  padding: 14px;
}
.modalTitle{ font-weight: 950; font-size: 18px; margin-bottom: 8px; }
.modalBody{ color: var(--muted); font-weight: 700; line-height: 1.35; }
.modalBtns{ display:flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.gate, .nuh{
  position: fixed;
  inset: 0;
  display:none;
  align-items:center;
  justify-content:center;
  background:#fff;
  z-index: 2000;
}
.gate.show{ display:flex; }
.gateCard{
  width: min(560px, 94vw);
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 6px 8px 0 var(--shadow);
  padding: 16px;
  background:#fff;
  position: relative;
  padding-bottom: 60px;
}
.stamp{
  display:inline-block;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 1px;
  transform: rotate(-2deg);
  background: var(--postA);
}
.gateTitle{ margin: 12px 0 8px; font-size: 26px; }
.gateText{ margin: 0; color: var(--muted); font-weight: 700; line-height: 1.35; }
.gateBtns{ display:flex; gap:10px; margin-top: 14px; flex-wrap: wrap; }
.tiny{ margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.nuh.show{ display:flex; }

.nuhInner{
  display:grid;
  gap: 12px;
  place-items: center;
  padding: 20px;
}

.nuhGif{
  max-width: min(520px, 92vw);
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 6px 8px 0 var(--shadow);
}

.nuhText{
  font-weight: 950;
  font-size: 18px;
}

.footer{
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  padding: 0 4px;
}

.nuhLinks{
  margin-top: 12px;
  display:grid;
  gap: 10px;
  text-align: center;
}

.repoLink{
  display: inline-block;
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  font-weight: 950;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
}

.repoLink:hover{
  transform: translateY(-1px);
}

.resetHint{
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.4;
}

.resetHint code {
  display: inline-block;
  margin-top: 4px;
  padding: 4px 6px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #f4f4f4;
  font-family: ui-monospace, monospace;
  font-size: 11px;
}

.cornerNote{
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  max-width: 280px;
}

.cornerNote a {
  color: var(--ink);
  font-weight: 900;
  text-decoration: underline;
}

.calcLayout{
  display:grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  align-items: start;
}

.chartCard{
  display:grid;
  gap: 10px;
}

.chartEmpty{
  border: 2px dashed var(--ink);
  border-radius: 12px;
  padding: 16px;
  background:#fff;
  color: var(--muted);
  font-weight: 800;
  text-align:center;
  line-height: 1.3;
}

.chartWrap{
  border: 2px dashed var(--ink);
  border-radius: 12px;
  padding: 10px;
  background:#fff;
  height: 260px;
}

.hidden{ display:none !important; }

@media (max-width: 900px){
  .postits{ position: static; margin-top: 10px; }
  .split{ grid-template-columns: 1fr; }
}

@media (max-width: 740px){
  .grid{ grid-template-columns: 1fr; }
  .cardHead{ flex-direction: column; align-items:flex-start; }
  .warmStats{ grid-template-columns: 1fr; }
  .calcLayout{ grid-template-columns: 1fr; }
}