@font-face { font-family: "Alfa Slab One"; src: url("fonts/AlfaSlabOne-Regular.ttf") format("truetype"); font-display: swap; }

:root {
  --pine: #15332a; --pine-2: #1d4437; --pine-3: #2a5a49; --moss: #9fc7a5;
  --birch: #f3dfb8; --birch-2: #e3c48d; --bark: #6b4526; --bark-2: #4a2f19; --ink: #3a2412;
  --red: #e2533a; --red-2: #b93c27; --cream: #fbf3df; --safe: #7bd389;
  --tile: 52px; --gap: 6px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--pine);
  background-image: radial-gradient(120% 70% at 50% 0%, #24503f 0%, var(--pine) 60%), repeating-linear-gradient(115deg, rgba(255,255,255,.018) 0 2px, transparent 2px 9px);
  color: var(--cream); font: 16px/1.4 ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
#app { max-width: 540px; min-height: 100%; min-height: 100dvh; margin: 0 auto; padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible { outline: 3px solid var(--cream); outline-offset: 2px; }

header { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 6px; }
.brand { display: flex; align-items: baseline; gap: 8px; position: relative; }
.brand h1 { font: 30px/1 "Alfa Slab One", Georgia, serif; margin: 0; letter-spacing: .5px; color: var(--birch); text-shadow: 0 2px 0 var(--bark-2); }
.knife { width: 46px; height: 18px; align-self: center; transform: rotate(-14deg); }
.dayno { font-size: 13px; color: var(--moss); font-weight: 700; }
nav { display: flex; gap: 4px; }
.icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--moss); }
.icon:hover { background: rgba(255,255,255,.07); }
.icon svg { width: 22px; height: 22px; }
.icon .slash { display: none; }
.icon[aria-pressed="false"] .waves { display: none; }
.icon[aria-pressed="false"] .slash { display: block; }

main { flex: 1; display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.goal { margin: 2px 0 10px; color: var(--moss); font-size: 15px; }
.goal b { color: var(--cream); }

/* the pile: earlier words, each one shorter, stacking into a point */
.pile { display: flex; flex-direction: column; align-items: center; gap: 5px; min-height: 8px; margin-bottom: 14px; }
.prow { display: flex; gap: 3px; animation: drop .32s cubic-bezier(.2,.9,.3,1.2) both; }
.prow i, .funnel i, .demo i {
  font: 15px/26px "Alfa Slab One", Georgia, serif; font-style: normal; width: 24px; height: 26px; text-align: center; text-transform: uppercase;
  color: var(--ink); background: var(--birch-2); border-radius: 5px; box-shadow: inset 0 -2px 0 rgba(74,47,25,.28);
}
.prow i.cut, .funnel i.cut, .demo i.cut { background: transparent; color: rgba(243,223,184,.42); box-shadow: inset 0 0 0 1.5px rgba(243,223,184,.3); text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
@keyframes drop { from { opacity: 0; transform: translateY(26px) scale(1.25); } to { opacity: 1; transform: none; } }

.bench { position: relative; width: 100%; display: flex; justify-content: center; padding: 18px 0 16px; }
.bench::before { content: ""; position: absolute; left: -6px; right: -6px; bottom: 0; height: 12px; border-radius: 6px; background: linear-gradient(#7d5330, var(--bark-2)); box-shadow: 0 6px 0 rgba(0,0,0,.18); }
.row { display: flex; gap: var(--gap); position: relative; z-index: 1; }
.tile {
  width: var(--tile); height: calc(var(--tile) * 1.18); border-radius: calc(var(--tile) * .17); position: relative;
  font: calc(var(--tile) * .62)/calc(var(--tile) * 1.1) "Alfa Slab One", Georgia, serif; text-transform: uppercase; color: var(--ink); text-align: center; padding: 0;
  background-color: var(--birch);
  background-image: linear-gradient(90deg, rgba(255,255,255,.35), transparent 22%, transparent 78%, rgba(107,69,38,.18)),
    repeating-linear-gradient(92deg, transparent 0 7px, rgba(107,69,38,.09) 7px 8px, transparent 8px 13px, rgba(107,69,38,.05) 13px 14px);
  box-shadow: inset 0 calc(var(--tile) * -.1) 0 var(--birch-2), 0 calc(var(--tile) * .08) 0 var(--bark), 0 calc(var(--tile) * .16) 10px rgba(0,0,0,.3);
  transition: transform .14s cubic-bezier(.3,1.6,.5,1), box-shadow .14s, background-color .2s;
  will-change: transform;
}
.tile:hover { transform: translateY(-3px); }
.tile.sel { transform: translateY(calc(var(--tile) * -.42)) rotate(-4deg); background-color: #fff3d4; box-shadow: inset 0 calc(var(--tile) * -.1) 0 var(--birch-2), 0 calc(var(--tile) * .08) 0 var(--red), 0 calc(var(--tile) * .5) 14px rgba(0,0,0,.35); }
.tile.safe::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: calc(var(--tile) * -.36); height: 5px; border-radius: 3px; background: var(--safe); box-shadow: 0 0 8px var(--safe); }
.tile.done { cursor: default; }
.tile.done:hover { transform: none; }
.row.shake { animation: shake .38s; }
@keyframes shake { 15% { transform: translateX(-9px) rotate(-1deg); } 35% { transform: translateX(8px) rotate(1deg); } 55% { transform: translateX(-6px); } 75% { transform: translateX(4px); } }
.row.win .tile { animation: hop .6s cubic-bezier(.3,1.6,.5,1) both; background-color: #ffe9a8; }
.row.win .tile:nth-child(2) { animation-delay: .08s; } .row.win .tile:nth-child(3) { animation-delay: .16s; }
@keyframes hop { 40% { transform: translateY(-22px) rotate(-5deg); } }

.fx { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: visible; }
.fly { position: absolute; margin: 0; }
.curl { position: absolute; width: 16px; height: 9px; border: 3px solid var(--birch); border-bottom-color: transparent; border-left-color: transparent; border-radius: 50%; }
.curl.b { border-color: var(--birch-2); border-bottom-color: transparent; border-right-color: transparent; width: 11px; height: 11px; }

.msg { min-height: 24px; margin: 12px 0 4px; text-align: center; font-weight: 600; color: var(--cream); }
.msg.bad { color: #ffb3a3; }
.msg.good { color: var(--safe); }
.msg .pv { font-family: "Alfa Slab One", Georgia, serif; letter-spacing: 2px; color: var(--birch); text-transform: uppercase; }

.controls { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 8px; padding-bottom: 14px; }
.controls[hidden] { display: none; }
.carve {
  width: min(100%, 340px); padding: 15px 18px; border-radius: 16px; font: 19px/1 "Alfa Slab One", Georgia, serif; letter-spacing: .5px;
  color: #fff6ea; background: var(--red); box-shadow: 0 5px 0 var(--red-2), 0 10px 18px rgba(0,0,0,.25); transition: transform .08s, box-shadow .08s, background .15s;
}
.carve:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--red-2); }
.carve:disabled { background: var(--pine-3); color: var(--moss); box-shadow: 0 5px 0 #1b3d31; cursor: default; }
.kit { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: min(100%, 340px); }
.tool { flex: 1; padding: 9px 6px; border-radius: 13px; background: var(--pine-2); box-shadow: inset 0 0 0 1.5px var(--pine-3); display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.tool .tname { font-weight: 800; font-size: 15px; }
.tool .tcost { font-size: 11.5px; color: var(--moss); }
.tool:disabled { opacity: .4; cursor: default; }
.tool:active:not(:disabled) { transform: translateY(2px); }
.bandages { display: flex; gap: 5px; padding: 0 4px; }
.band { width: 30px; height: 13px; border-radius: 7px; background: #f0b48f; position: relative; transform: rotate(-24deg); box-shadow: 0 2px 0 rgba(0,0,0,.25); transition: transform .3s, opacity .3s; }
.band::after { content: ""; position: absolute; left: 10px; top: 1.5px; width: 10px; height: 10px; border-radius: 2px; background: #fbe3cf; }
.band.used { opacity: .18; transform: rotate(-24deg) scale(.8); }
.band.pop { animation: pop .5s; }
@keyframes pop { 30% { transform: rotate(10deg) scale(1.5); opacity: 1; } }
.link { color: var(--moss); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; padding: 6px 10px; }
footer { text-align: center; font-size: 12.5px; color: rgba(159,199,165,.75); padding: 10px 0 14px; }
footer .by { white-space: nowrap; }
footer .by::before { content: "· "; }

/* the clock */
.goal[hidden], .clock[hidden], .count[hidden] { display: none; }
.clock { position: relative; display: flex; flex-direction: column; align-items: center; margin: 0 0 10px; }
.clock-t { font: 44px/1 "Alfa Slab One", Georgia, serif; color: var(--birch); text-shadow: 0 3px 0 var(--bark-2); font-variant-numeric: tabular-nums; letter-spacing: 1px; min-width: 5.2ch; text-align: center; }
.clock-p { min-height: 16px; margin-top: 4px; font-size: 12.5px; font-weight: 700; color: #ffb3a3; }
.clock.idle .clock-t { opacity: .3; }
.clock.stopped .clock-t { color: var(--safe); }
.clock.hit .clock-t { animation: hit .45s; }
@keyframes hit { 25% { color: #ff8f7a; transform: scale(1.12) rotate(-2deg); } }
.pen { position: absolute; left: 50%; top: -6px; font: 22px/1 "Alfa Slab One", Georgia, serif; color: #ff8f7a; text-shadow: 0 2px 0 rgba(0,0,0,.35); pointer-events: none; transform: translate(-50%, 0); opacity: 0; }
.tile.blank { cursor: default; background-color: var(--birch-2); }
.tile.blank::after { content: ""; position: absolute; left: 50%; top: 46%; width: 26%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; box-shadow: inset 0 0 0 calc(var(--tile) * .045) rgba(107,69,38,.35), inset 0 0 0 calc(var(--tile) * .1) transparent; background: radial-gradient(circle, rgba(107,69,38,.28) 0 22%, transparent 24%); }
.tile.blank:hover { transform: none; }
.count { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; font: 92px/1 "Alfa Slab One", Georgia, serif; color: var(--cream); text-shadow: 0 5px 0 var(--red-2), 0 10px 24px rgba(0,0,0,.5); pointer-events: none; }
.count.beat { animation: beat .58s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes beat { from { transform: scale(2.2); opacity: 0; } 35% { transform: scale(1); opacity: 1; } 85% { opacity: 1; } to { transform: scale(.8); opacity: 0; } }
.endtag { margin: 2px 0 0; font-weight: 800; font-size: 14px; color: #4f8a59; min-height: 0; }
.endtag:empty, .pbline:empty { display: none; }
.card h2.time { font-size: 54px; margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.pbline { margin: 4px 0 2px; font-weight: 700; color: #6a4a2c; font-size: 14px; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 10; background: rgba(9,24,19,.72); display: flex; align-items: flex-end; justify-content: center; padding: 12px; overflow-y: auto; animation: fade .2s; }
.sheet[hidden] { display: none; }
@media (min-height: 760px), (min-width: 600px) { .sheet { align-items: center; } }
.card { position: relative; width: min(100%, 420px); background: var(--cream); color: var(--ink); border-radius: 22px; padding: 22px 20px 20px; text-align: center; box-shadow: 0 8px 0 var(--birch-2), 0 24px 50px rgba(0,0,0,.45); animation: rise .34s cubic-bezier(.2,.9,.3,1.15); margin: auto 0; }
@keyframes fade { from { opacity: 0; } } @keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.card h2 { font: 26px/1.1 "Alfa Slab One", Georgia, serif; margin: 4px 0 8px; color: var(--bark-2); }
.card .x { position: absolute; right: 10px; top: 8px; width: 40px; height: 40px; font-size: 28px; line-height: 1; color: var(--bark); border-radius: 12px; }
.card .carve { margin-top: 14px; }
.card .link { color: var(--bark); }
.how { text-align: left; padding-left: 22px; margin: 8px 0 12px; }
.how li { margin: 7px 0; }
.demo { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 12px 0; }
.demo div, .funnel div { display: flex; gap: 3px; }
.demo i.cut, .funnel i.cut { color: rgba(74,47,25,.4); box-shadow: inset 0 0 0 1.5px rgba(74,47,25,.25); }
.fine { font-size: 14px; color: #6a4a2c; margin: 8px 0 0; }
.badge { height: 54px; display: grid; place-items: center; }
.badge svg { height: 46px; max-width: 100%; }
.endline { margin: 0 0 12px; color: #6a4a2c; }
.funnel { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 6px 0 12px; }
.funnel div:last-child i:not(.cut) { background: var(--red); color: #fff6ea; }
.funnel.perfect div:last-child i { background: #4f9a5d; }
.pathreveal { margin-top: 8px; padding-top: 10px; border-top: 2px dashed var(--birch-2); }
.pathreveal[hidden] { display: none; }
.best { margin: 6px 0 2px; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0 0; }
.stats div { background: #f3e4c3; border-radius: 12px; padding: 8px 2px 7px; }
.stats b { display: block; font: 19px/1.25 "Alfa Slab One", Georgia, serif; color: var(--bark-2); }
.stats span { font-size: 11.5px; color: #7a5a3a; }
.next { font-size: 13.5px; color: #7a5a3a; margin: 12px 0 0; }

@media (max-height: 640px) { .goal { display: none; } .clock-t { font-size: 34px; } .clock { margin-bottom: 6px; } .pile { margin-bottom: 8px; } .prow i { height: 22px; line-height: 22px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (min-width: 700px) and (min-height: 700px) { main { padding-top: 5vh; } .prow i { width: 28px; height: 30px; font-size: 17px; line-height: 30px; } }
