:root {
  --bg: #f7f1e6;
  --card: #fffaf2;
  --ink: #2b2118;
  --muted: #6f6253;
  --line: #e4d7c4;
  --green: #2f6b4f;
  --green2: #e3efe7;
  --terra: #c2562b;
  --r: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); font-weight: 600; }
img { max-width: 100%; }
.screen { display: none; min-height: 100dvh; max-width: 520px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom); }
.screen.active { display: block; }
.wordmark {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.wordmark svg { flex-shrink: 0; }
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  border-radius: 14px;
  border: 0;
  font-size: 20px;
  font-weight: 700;
  padding: 12px 16px;
}
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 3px 0 #1f4c37; }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #1f4c37; }
.btn-primary:disabled { opacity: .4; box-shadow: none; transform: none; }
.btn-ghost { background: #fff; border: 2px solid var(--ink); }
.linkbtn {
  background: none;
  border: 0;
  color: var(--green);
  font-weight: 700;
  font-size: 17px;
  text-decoration: underline;
  padding: 10px 4px;
  min-height: 44px;
}
.muted-label { color: var(--muted); font-size: 15px; font-weight: 600; }

.home-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 4px; }
.home-top .wordmark { font-size: 32px; }
.iconbtn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card);
  font-size: 22px;
  display: grid;
  place-items: center;
}
.tagline { padding: 0 16px; color: var(--muted); font-size: 17px; margin: 0 0 12px; }
.today {
  margin: 0 16px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(60, 40, 10, .08);
}
.today .art { height: 190px; position: relative; background: #d9cbb8; }
.today .art img { width: 100%; height: 100%; object-fit: cover; object-position: center 35%; display: block; }
.today .art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, rgba(0, 0, 0, .45)); }
.today .badge {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 1;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.today .body { padding: 14px 16px 16px; }
.today .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 16px; font-weight: 600; }
.pill-hard { background: #fbe3d6; color: #9c3d16; border-radius: 99px; padding: 3px 10px; font-size: 15px; font-weight: 700; white-space: nowrap; }
.today h2 { margin: 6px 0 4px; font-size: 25px; font-family: Georgia, serif; }
.today p { margin: 0 0 14px; color: var(--muted); font-size: 16px; }
.streak { margin: 14px 16px 0; background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.streak .row { display: flex; align-items: center; justify-content: space-between; }
.streak strong { font-size: 19px; }
.days { display: flex; gap: 6px; margin-top: 10px; }
.day { flex: 1; text-align: center; font-size: 13px; color: var(--muted); font-weight: 600; }
.day i {
  display: grid;
  place-items: center;
  height: 34px;
  border-radius: 10px;
  background: #efe6d6;
  font-style: normal;
  font-size: 16px;
  margin-top: 3px;
  color: transparent;
}
.day.done i { background: var(--green); color: #fff; }
.day.today i { outline: 2.5px solid var(--green); outline-offset: -2.5px; background: #fff; color: var(--green); }
.day.today.done i { background: var(--green); color: #fff; }
.home-links { display: flex; justify-content: center; gap: 18px; margin-top: 6px; }
.foot { text-align: center; font-size: 14px; color: var(--muted); padding: 8px 16px 20px; }
.foot a { color: var(--muted); font-weight: 500; }
.home-pad { padding: 6px 16px 24px; }

#play.active { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.playbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 6px; }
.playbar .title { flex: 1; min-width: 0; }
.playbar .title b { display: block; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playbar .title > span { font-size: 14px; color: var(--muted); font-weight: 600; }
.hintbtn { min-height: 48px; padding: 0 16px; border-radius: 99px; border: 2px solid var(--ink); background: #fff; font-weight: 700; font-size: 17px; }
.hintbtn:disabled { opacity: .4; }
.statusbar { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 8px; font-size: 17px; }
.counter { font-weight: 800; font-size: 19px; }
.counter small { font-weight: 600; color: var(--muted); font-size: 16px; }
#timer { font-variant-numeric: tabular-nums; font-weight: 700; background: #efe6d6; border-radius: 8px; padding: 2px 8px; margin-left: 8px; font-size: 17px; }
body.relaxed #timer { display: none; }
.switch { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; min-height: 44px; cursor: pointer; }
.switch input {
  appearance: none;
  width: 50px;
  height: 30px;
  border-radius: 99px;
  background: #cdbda6;
  position: relative;
  margin: 0;
  transition: background .2s;
  flex-shrink: 0;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: left .2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
.switch input:checked { background: var(--green); }
.switch input:checked::after { left: 23px; }
.stagewrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #1d1712; }
#stage {
  position: relative;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  aspect-ratio: 3 / 4;
  width: 100%;
  max-height: 100%;
  max-width: calc((100dvh - 250px) * .75);
}
#layer { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
#scene { width: 100%; height: 100%; display: block; pointer-events: none; object-fit: fill; }
.shake { animation: shake .38s; }
@keyframes shake {
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.mark {
  position: absolute;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--green), 0 0 12px rgba(0, 0, 0, .5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: pop .35s ease-out;
  aspect-ratio: 1;
}
@keyframes pop { from { transform: translate(-50%, -50%) scale(.3); opacity: 0; } }
.miss {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  color: #ff3b30;
  font: 700 28px/28px sans-serif;
  text-shadow: 0 0 4px #000;
  animation: fade .7s forwards;
}
@keyframes fade { to { opacity: 0; transform: translate(-50%, -80%); } }
.hint {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  aspect-ratio: 1;
  border: 4px solid #ffd54a;
  background: rgba(255, 213, 74, .2);
  animation: pulse .8s ease-in-out 4;
  opacity: 0;
}
@keyframes pulse {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.75); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.15); }
}
.hintlabel {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, 16px);
  background: rgba(20, 16, 12, .9);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  padding: 8px 12px;
  border-radius: 12px;
  pointer-events: none;
  max-width: 70%;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.hintlabel.above { transform: translate(-50%, calc(-100% - 16px)); }
.zoomtip {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: 99px;
  pointer-events: none;
  transition: opacity .6s;
}
.tray { background: var(--card); border-top: 1.5px solid var(--line); padding: 8px 0 calc(10px + env(safe-area-inset-bottom)); }
.tray-head { display: flex; justify-content: space-between; padding: 0 14px 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
#items { list-style: none; margin: 0; padding: 0 10px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; }
#items::-webkit-scrollbar { display: none; }
#items li { flex: 0 0 auto; }
#items button {
  width: 84px;
  height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid var(--line);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  padding: 4px;
}
#items img { width: 48px; height: 48px; object-fit: contain; }
#items li.found button { background: var(--green2); border-color: #b9d6c4; }
#items li.found img { opacity: .35; filter: grayscale(1); }
#items li.found span { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }

.solved-top { padding: 20px 16px 4px; text-align: center; }
.solved-top .wordmark { justify-content: center; font-size: 24px; }
.solved-top h1 { font-family: Georgia, serif; font-size: 30px; margin: 8px 0 2px; }
.solved-top .result { font-size: 20px; font-weight: 700; margin: 0; }
.sharecard { margin: 14px 16px 10px; border-radius: 18px; overflow: hidden; background: var(--green); color: #fff; box-shadow: 0 4px 14px rgba(30, 60, 40, .25); }
.sharecard .img { height: 120px; position: relative; background: #1d1712; }
.sharecard .img img { width: 100%; height: 100%; object-fit: cover; object-position: center 35%; display: block; }
.sharecard .img > span {
  position: absolute;
  left: 12px;
  top: 10px;
  background: rgba(255, 250, 242, .95);
  color: var(--green);
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 18px;
  padding: 3px 10px;
  border-radius: 99px;
}
.sharecard .txt { padding: 12px 16px 14px; }
.sharecard .big { font-size: 22px; font-weight: 800; }
.sharecard .sub { font-size: 16px; opacity: .9; }
.sharerow { display: flex; gap: 10px; margin: 0 16px; }
.card { margin: 14px 16px 0; background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; padding: 16px; }
.card h3 { margin: 0 0 4px; font-size: 21px; }
.card p { margin: 0 0 12px; color: var(--muted); font-size: 16px; }
.card .skip { display: block; margin: 4px auto 0; }
.tipcard { border-color: #c9dccf; background: #f1f7f2; }
.steps { margin: 6px 0 4px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 10px; align-items: center; font-size: 17px; margin: 8px 0; }
.steps li::before {
  content: counter(s);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 16px;
}
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  border: 1.5px solid #9fb8a7;
  border-radius: 7px;
  background: #fff;
  padding: 0 6px;
  font-weight: 700;
}

.scrim { position: fixed; inset: 0; background: rgba(30, 20, 10, .5); display: none; align-items: flex-end; justify-content: center; z-index: 20; }
.scrim.show { display: flex; }
.sheet {
  background: var(--bg);
  width: 100%;
  max-width: 520px;
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 94dvh;
  overflow: auto;
  animation: up .3s ease-out;
}
@keyframes up { from { transform: translateY(30%); opacity: 0; } }
.grab { width: 44px; height: 5px; border-radius: 3px; background: #cdbda6; margin: 0 auto 10px; }
.sheet h2 { font-family: Georgia, serif; margin: 0 0 4px; font-size: 26px; }
.sheet .lead { margin: 0 0 14px; color: var(--muted); font-size: 17px; }
.field label { display: block; font-weight: 700; font-size: 17px; margin: 0 0 6px; }
.field input[type=email], .field select {
  width: 100%;
  font-size: 19px;
  padding: 13px 12px;
  border: 2px solid #cdbda6;
  border-radius: 12px;
  background: #fff;
  min-height: 54px;
}
.field input:focus, .field select:focus { outline: 3px solid #9cc6ae; border-color: var(--green); }
.under { font-size: 16px; margin: 7px 0 0; color: var(--ink); }
.under a { white-space: nowrap; }
.field + .field { margin-top: 14px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; margin: 16px 0 14px; cursor: pointer; }
.check input { width: 26px; height: 26px; margin: 0; flex-shrink: 0; accent-color: var(--green); }
.sheet .skip { display: block; margin: 6px auto 0; }
.note { font-size: 14px; color: var(--muted); margin-top: 10px; text-align: center; }
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  max-width: 92vw;
  border-radius: 14px;
  font-size: 16px;
  opacity: 0;
  transition: opacity .25s;
  z-index: 40;
  pointer-events: none;
  text-align: center;
}
.archive-list { padding: 0 16px 28px; display: flex; flex-direction: column; gap: 10px; }
.archive-item {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.archive-item img { width: 92px; height: 92px; object-fit: cover; object-position: center 35%; flex-shrink: 0; background: #d9cbb8; }
.archive-item div { padding: 8px 10px 8px 0; }
.archive-item b { display: block; font-size: 18px; }
.archive-item span { color: var(--muted); font-size: 15px; font-weight: 600; }
.empty { color: var(--muted); padding: 8px 0 20px; }
.legal { max-width: 640px; margin: 0 auto; padding: 28px 20px 64px; }
.legal .wordmark { font-size: 28px; margin-bottom: 12px; }
.legal h1 { font-family: Georgia, serif; font-size: 34px; margin: 8px 0 12px; }
.legal h2 { font-family: Georgia, serif; font-size: 24px; margin: 22px 0 6px; }
.legal p, .legal li { font-size: 18px; }
.legal pre { white-space: pre-wrap; font-family: inherit; background: #fff; padding: 12px; border-radius: 12px; border: 1px solid var(--line); }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .shake, .mark, .miss, .hint, .sheet { animation: none; }
}
