@font-face { font-family: 'Future'; src: url(../fonts/kenney-future.ttf); font-display: swap; }
@font-face { font-family: 'Mini'; src: url(../fonts/kenney-mini-square.ttf); font-display: swap; }
/* one pair: vermilion field, jade buttons */
:root { --field: #d8402a; --deep: #8e2112; --deeper: #4f0f07; --jade: #0f9d76; --jade2: #07624a; --paper: #fff1dc; --ink: #2a0904; --hl: #ffd9a0; --top: 64px; --pad: 76px; }
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; background: var(--field); color: var(--paper); font-family: 'Mini', ui-monospace, monospace; overflow: hidden; }
#app { position: fixed; inset: 0; }
.screen { position: absolute; inset: 0; }
[hidden] { display: none !important; }
h1, h2, .btn, #lvname, #card-num { font-family: 'Future', 'Mini', sans-serif; font-weight: 400; letter-spacing: .02em; }
blockquote { font-family: Georgia, 'Times New Roman', serif; font-style: italic; }

.btn { appearance: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px; color: var(--paper); background: var(--jade); box-shadow: 0 5px 0 var(--jade2), 0 5px 0 3px var(--deeper); border: 3px solid var(--deeper); font-size: 16px; line-height: 1; min-height: 44px; white-space: nowrap; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--jade2), 0 1px 0 3px var(--deeper); }
.btn.big { font-size: 22px; padding: 14px 22px; }
.btn.ghost { background: var(--deep); box-shadow: 0 5px 0 var(--deeper); }
.btn:focus-visible { outline: 4px solid var(--hl); outline-offset: 3px; }
kbd { font-family: 'Mini', monospace; font-size: .62em; background: var(--paper); color: var(--ink); padding: 4px 6px; border-bottom: 3px solid #d9bf96; line-height: 1; }
body.touch kbd { display: none; }

/* home */
#homecv { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.home-ui { position: absolute; inset: 0; display: grid; grid-template-rows: 1fr auto auto; row-gap: 3vh; justify-items: center; padding: max(3vh, env(safe-area-inset-top)) 4vw max(5vh, env(safe-area-inset-bottom)); pointer-events: none; }
.home-ui > * { pointer-events: auto; }
#logo { align-self: start; margin-top: 2vh; font-size: min(13vw, 21vh); line-height: .9; text-align: center; color: var(--paper); text-shadow: .05em .05em 0 var(--deep), .1em .1em 0 var(--deeper); display: flex; gap: .18em; flex-wrap: wrap; justify-content: center; align-items: baseline; }
#logo small { font-size: .42em; }
#logo span { display: inline-block; animation: creep 2.4s infinite ease-in-out; transform-origin: 50% 100%; }
#logo span:nth-of-type(2) { animation-delay: 1.2s; }
@keyframes creep { 0%, 100% { transform: translateY(0) scale(1, 1); } 40% { transform: translateY(-3%) scale(1.03, .95); } 55% { transform: translateY(1%) scale(.98, 1.04); } }
.home-btns { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; align-items: center; }

/* bars */
.bar { display: flex; align-items: center; gap: 18px; padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left)); background: var(--deep); border-bottom: 4px solid var(--deeper); }
.bar h2 { font-size: 26px; }
.why { margin-left: auto; font-size: 15px; color: var(--hl); min-height: 1.2em; text-align: right; }

/* chapters */
#chapters { display: grid; grid-template-rows: auto 1fr; }
#chapter-grid { overflow-y: auto; -webkit-overflow-scrolling: touch; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); align-content: start; padding-bottom: env(safe-area-inset-bottom); }
.ch { appearance: none; text-align: left; border: 0; border-right: 4px solid var(--deeper); border-bottom: 4px solid var(--deeper); background: var(--field); color: var(--paper); padding: 14px 16px; min-height: 108px; cursor: pointer; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto 1fr; column-gap: 12px; row-gap: 4px; font-family: 'Mini'; }
.ch:nth-child(even) { background: #c9361f; }
.ch b { grid-row: 1 / 4; font-family: 'Future'; font-weight: 400; font-size: 38px; line-height: 1; color: var(--hl); }
.ch strong { font-family: 'Future'; font-weight: 400; font-size: 17px; }
.ch em { font-style: normal; font-size: 14px; opacity: .92; }
.ch .chops { display: flex; gap: 4px; align-self: end; }
.ch .chop { width: 18px; height: 18px; border: 2px solid var(--deeper); background: transparent; }
.ch .chop.on { background: var(--paper); box-shadow: inset 0 0 0 3px var(--field); }
.ch[aria-disabled="true"] { opacity: .5; }
.ch:focus-visible { outline: 4px solid var(--hl); outline-offset: -6px; }

/* chapter card */
#card { display: grid; place-items: center; background: radial-gradient(ellipse at 50% 30%, #e85638, var(--field) 60%, var(--deep)); }
#card .scroll { width: min(92vw, 860px); display: grid; gap: 2.4vh; justify-items: center; text-align: center; padding: 3vh 4vw; }
#card-num { font-size: min(5vw, 3.4vh); color: var(--hl); }
#card-title { font-size: min(10vw, 8vh); line-height: 1; text-shadow: .05em .05em 0 var(--deeper); }
#card-quote { font-size: min(5vw, 3.4vh); line-height: 1.35; }
#card-rule { font-size: min(4.4vw, 2.8vh); background: var(--deeper); padding: 12px 16px; line-height: 1.35; }

/* forecast */
#forecast { display: grid; grid-template-rows: auto 1fr auto; }
#days { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; }
.day { appearance: none; border: 0; border-right: 4px solid var(--deeper); background: var(--field); color: var(--paper); cursor: pointer; display: grid; grid-template-rows: auto 1fr auto auto auto; align-items: center; justify-items: center; padding: 2vh 10px; gap: 1vh; font-family: 'Mini'; }
.day:nth-child(even) { background: #c9361f; }
.day:last-child { border-right: 0; }
.day h3 { font-family: 'Future'; font-weight: 400; font-size: min(7vw, 5vh); }
.day canvas { width: min(26vw, 30vh); height: min(26vw, 30vh); image-rendering: pixelated; }
.day p { font-size: min(4vw, 2.6vh); }
.day .crowmark { font-family: 'Future'; color: var(--hl); min-height: 1.2em; }
.day:focus-visible, .day:hover { background: #e9563b; outline: 0; }
#crow-row { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 10px 14px max(12px, env(safe-area-inset-bottom)); background: var(--deep); min-height: 68px; }
#crow-says { font-size: 16px; color: var(--hl); }

/* play: board area fixed between a top bar and a pad that is always reserved */
#play { display: grid; grid-template-rows: var(--top) 1fr var(--pad); }
#top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 6px max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left)); background: var(--deep); border-bottom: 4px solid var(--deeper); min-width: 0; }
#lvname { font-size: 17px; white-space: nowrap; }
#clock, #energy { height: 100%; min-width: 0; position: relative; }
#clockcv, #energycv { position: absolute; inset: 0; width: 100%; height: 100%; }
#energy { width: 170px; }
#stage { position: relative; min-height: 0; overflow: hidden; background: var(--deeper); }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }
#toast { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: var(--paper); color: var(--ink); font-size: 16px; padding: 8px 14px; border: 3px solid var(--deeper); opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 92%; text-align: center; }
#toast.on { opacity: 1; }
#pad { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 6px max(12px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: var(--deep); border-top: 4px solid var(--deeper); min-width: 0; }
#keys-hint { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; font-size: 15px; }
#keys-hint span { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
#touch-btns { display: none; gap: 10px; }
body.touch #touch-btns { display: flex; width: 100%; max-width: 560px; }
#touch-btns .btn { flex: 1 0 auto; min-width: 0; padding: 10px 2px; font-size: min(15px, 3.4vw); letter-spacing: 0; gap: 0; }
#touch-btns #b-wait { flex: 2 0 auto; }
body.touch #keys-hint { display: none; }

/* panels */
.panel { position: absolute; inset: 0; background: rgba(79, 15, 7, .82); display: grid; place-items: center; overflow-y: auto; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.sheet { background: var(--field); border: 4px solid var(--deeper); box-shadow: 0 8px 0 var(--deeper); width: min(94vw, 720px); padding: 18px 20px 22px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.sheet h2 { font-size: 30px; }
.sheet .row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
#resultcv { width: min(60vw, 300px); height: min(30vw, 150px); image-rendering: pixelated; }
#result-quote { font-size: 18px; line-height: 1.35; }
#seals { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.seal { width: 98px; display: grid; justify-items: center; gap: 6px; font-size: 13px; }
.seal i { width: 62px; height: 62px; display: grid; place-items: center; font-style: normal; font-family: 'Future'; font-size: 26px; border: 3px solid var(--deeper); color: var(--deeper); background: transparent; }
.seal.on i { background: var(--paper); color: var(--field); box-shadow: inset 0 0 0 4px var(--field), inset 0 0 0 6px var(--paper); transform: rotate(-4deg); animation: stamp .35s cubic-bezier(.2, 1.8, .4, 1) backwards; }
@keyframes stamp { from { transform: scale(1.8) rotate(-12deg); opacity: 0; } }
#credits-body { text-align: left; font-size: 14px; line-height: 1.45; display: grid; gap: 10px; width: 100%; }
#credits-body h3 { font-family: 'Future'; font-weight: 400; font-size: 16px; color: var(--hl); }
#tweaks-body { display: grid; gap: 12px; width: 100%; text-align: left; }
#tweaks-body label { display: flex; gap: 10px; align-items: center; font-size: 15px; }

@media (max-height: 460px) { :root { --top: 52px; --pad: 62px; } #lvname { font-size: 14px; } .btn.big { font-size: 18px; padding: 10px 16px; } .sheet h2 { font-size: 22px; } }
@media (max-width: 640px) { #top { grid-template-columns: 1fr auto; grid-template-rows: 30px 1fr; row-gap: 4px; } #clock { grid-column: 1 / 3; grid-row: 2; } :root { --top: 104px; } #energy { width: 110px; } #lvname { font-size: 14px; } }

/* portrait phones: the days stack, picture on the left */
@media (max-aspect-ratio: 4/5) {
  #days { grid-auto-flow: row; grid-auto-rows: 1fr; grid-auto-columns: auto; }
  .day { border-right: 0; border-bottom: 4px solid var(--deeper); grid-template-columns: auto 1fr; grid-template-rows: auto auto auto auto; justify-items: start; text-align: left; column-gap: 14px; padding: 1.4vh 16px; }
  .day canvas { grid-column: 1; grid-row: 1 / 5; width: min(28vw, 15vh); height: min(28vw, 15vh); }
  .day h3 { font-size: min(7vw, 4vh); }
  .day p { font-size: min(4vw, 2.2vh); }
  .day:last-child { border-bottom: 0; }
}
#pitch { font-family: 'Future', 'Mini', sans-serif; font-size: min(5.4vw, 4.4vh); line-height: 1.25; text-align: center; color: var(--paper); background: var(--deeper); padding: .5em .9em; border: 4px solid var(--paper); box-shadow: .18em .18em 0 var(--deep); }
#card-goal { font-family: 'Future', 'Mini', sans-serif; font-size: min(5vw, 3.4vh); line-height: 1.25; color: var(--paper); }
