/* Bundled OFL fonts (library/fonts): a stylized display face for titles/buttons, a rounded UI face for the rest. */
@font-face { font-family: 'Display'; src: url('assets/fonts/lilita-one-latin-400-normal.woff2') format('woff2'); font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Display'; src: url('assets/fonts/lilita-one-latin-ext-400-normal.woff2') format('woff2'); font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'UI'; font-weight: 700 900; src: url('assets/fonts/nunito-latin-800-normal.woff2') format('woff2'); font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'UI'; font-weight: 700 900; src: url('assets/fonts/nunito-latin-ext-800-normal.woff2') format('woff2'); font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --cream: #fff8ea; --cream2: #f6ead2; --brown: #6b4423; --brown2: #8a5a33; --ink: #4a3121; --sky: #9fd8f5;
  --green: #5cbf4a; --green-d: #3a8a2c; --gold: #ffc93c; --gold-d: #c98a12; --red: #e8574a; --clover: #3fae4a;
  --u: clamp(11px, 2.1vmin, 20px); /* base UI unit: legible from 800x450 to 1920x1080 */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; width: 100vw; height: 100vh; overflow: hidden; background: var(--sky); color: var(--ink);
  font: 800 var(--u)/1.3 "UI", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  touch-action: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
  user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none;
}
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button {
  font: inherit; cursor: pointer; border: 0; border-radius: 1em; padding: .55em 1.3em; color: var(--ink);
  background: var(--cream); box-shadow: 0 .25em 0 #d9c39b; transition: transform .06s;
}
button:hover { filter: brightness(1.05); }
button:active { transform: translateY(.15em); box-shadow: 0 .1em 0 #d9c39b; }
button.big {
  font-family: 'Display', 'UI', sans-serif; font-weight: 400; letter-spacing: .03em; font-size: calc(var(--u) * 1.9);
  background: var(--green); color: #fff; padding: .35em 1.6em; box-shadow: 0 .2em 0 var(--green-d); text-shadow: 0 .08em 0 rgba(0, 0, 0, .25);
  min-width: 7em;
}
button.big small { font-family: 'UI'; font-size: .5em; opacity: .9; vertical-align: middle; }
button.big:active { box-shadow: 0 .06em 0 var(--green-d); }
button.soft { display: inline-flex; align-items: center; gap: .4em; }
button.reward { background: var(--gold); color: #5a3a00; box-shadow: 0 .25em 0 var(--gold-d); }
button.icon { width: 2.6em; height: 2.6em; padding: 0; font-size: calc(var(--u) * 1.15); display: grid; place-items: center; }
.row { display: flex; gap: .8em; justify-content: center; flex-wrap: wrap; }
.dim { opacity: .65; }

/* icons (inline SVG data URIs, so the flat CrazyGames build needs no extra files) */
.ico { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -.25em; background: center / contain no-repeat; flex: none; }
.ico-sheep { background-image: url('assets/ui/tw_sheep.svg'); }
.ico-sheep.off { opacity: .45; filter: grayscale(1) brightness(.85); }
.ico-clover { background-image: url('assets/ui/tw_clover.svg'); }
.ico-clock { background-image: url('assets/ui/tw_clock.svg'); }
.ico-star { background-image: url('assets/ui/tw_star.svg'); }
.ico-wool { background-image: url('assets/ui/tw_wool.svg'); }
.ico-map { background-image: url('assets/ui/tw_map.svg'); }
.ico-lock { background-image: url('assets/ui/tw_lock.svg'); }

/* HUD */
#hud { position: fixed; top: .8em; left: .8em; right: .8em; display: flex; gap: .55em; align-items: center; z-index: 10; pointer-events: none; flex-wrap: wrap; }
#hud > * { pointer-events: auto; }
#hud .pill {
  display: flex; align-items: center; gap: .35em; padding: .3em .8em; border-radius: 999px; background: rgba(255, 248, 234, .92);
  box-shadow: 0 .2em 0 rgba(107, 68, 35, .25); font-size: calc(var(--u) * 1.1); transition: transform .15s;
}
#hud .pill.pulse { transform: scale(1.18); }
#hud .lvl b { font-family: 'Display'; font-weight: 400; color: var(--brown2); }
#hud .lvl span { opacity: .8; font-size: .85em; }
#hudSheep { gap: .15em; }
#hudSheep .ico { width: 1.6em; height: 1.6em; transition: transform .2s; }
#hudTime small { opacity: .6; font-size: .8em; margin-left: .15em; }
#hudTime.late b { color: var(--red); }
#hud .right { margin-left: auto; display: flex; gap: .5em; }
#btnPause .bars { width: .8em; height: .9em; border-left: .28em solid var(--ink); border-right: .28em solid var(--ink); }

#banner {
  position: fixed; z-index: 12; left: 50%; top: 22%; transform: translateX(-50%); text-align: center; pointer-events: none;
  animation: bannerIn 2.2s ease forwards; white-space: nowrap;
}
#banner small { display: block; font-size: calc(var(--u) * 1.1); color: #fff; text-shadow: 0 .12em 0 rgba(0, 0, 0, .3); }
#banner b { display: block; font: 400 calc(var(--u) * 3.2) 'Display'; color: #fff; text-shadow: 0 .1em 0 var(--brown), 0 0 .6em rgba(0, 0, 0, .25); }
@keyframes bannerIn { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -20%); } }

/* onboarding */
#tip {
  position: fixed; z-index: 14; left: 50%; bottom: 4%; transform: translateX(-50%); display: flex; align-items: center; gap: 1em;
  background: rgba(255, 248, 234, .95); border-radius: 1.2em; padding: .7em 1em .7em 1.2em; box-shadow: 0 .3em 0 rgba(107, 68, 35, .3);
  max-width: min(92vw, 44em); animation: tipIn .3s ease;
}
@keyframes tipIn { from { opacity: 0; transform: translate(-50%, 1em); } }
#tip p { margin: 0; font-size: calc(var(--u) * 1.25); flex: 1; }
#tipIcon { display: flex; align-items: center; gap: .8em; flex: none; }
#btnSkipTips { font-size: calc(var(--u) * .8); padding: .35em .8em; opacity: .75; background: var(--cream2); box-shadow: none; }
.keys { display: grid; grid-template-columns: repeat(3, 1.9em); grid-template-rows: 1.9em 1.9em; gap: .2em; }
.keys kbd {
  display: grid; place-items: center; font: 800 calc(var(--u) * .95) 'UI'; color: var(--ink); background: #fff; border-radius: .35em;
  box-shadow: 0 .18em 0 #c8b28e, inset 0 0 0 .1em #e3d3b6; animation: keyPress 1.6s infinite;
}
.keys kbd:nth-child(1) { grid-column: 2; grid-row: 1; }
.keys kbd:nth-child(2) { grid-column: 1; grid-row: 2; } .keys kbd:nth-child(3) { grid-column: 2; grid-row: 2; } .keys kbd:nth-child(4) { grid-column: 3; grid-row: 2; }
.keys kbd:nth-child(2) { animation-delay: .4s; } .keys kbd:nth-child(3) { animation-delay: .8s; } .keys kbd:nth-child(4) { animation-delay: 1.2s; }
@keyframes keyPress { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(.12em); background: #ffe9a8; } }
.or { opacity: .6; font-size: .9em; }
.mouse { width: 2.4em; height: 3.2em; position: relative; }
.mouse::before { content: ''; position: absolute; inset: 0 .3em .2em; border: .2em solid var(--ink); border-radius: 1em 1em 1.1em 1.1em; background: #fff; }
.mouse::after { content: ''; position: absolute; left: .55em; top: .2em; width: .65em; height: 1.1em; border-radius: .8em 0 0 0; background: var(--green); }
.mouse { animation: drag 1.8s ease-in-out infinite; }
@keyframes drag { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(.8em, 0); } 50% { transform: translate(0, .6em); } 75% { transform: translate(-.8em, 0); } }
.hand {
  width: 3em; height: 3em; animation: drag 1.8s ease-in-out infinite;
  background: center / contain no-repeat url('assets/ui/tw_hand.svg');
}
.tip-pic { width: 2.4em; height: 2.4em; border-radius: .6em; display: grid; place-items: center; font-size: 1.6em; background: var(--cream2); }
#arrow {
  position: fixed; z-index: 13; width: 3em; height: 3em; margin: -3.6em 0 0 -1.5em; pointer-events: none; animation: bob .8s ease-in-out infinite alternate;
  background: center / contain no-repeat url('assets/ui/tw_arrow.svg');
}
@keyframes bob { to { transform: translateY(-.6em); } }

/* screens */
.screen { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 1em; }
.screen:not(.menu) { background: rgba(255, 244, 226, .18); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.panel {
  background: var(--cream); border-radius: 1.6em; padding: 1.2em 1.8em 1.4em; box-shadow: 0 .45em 0 #d9c39b, 0 1em 3em rgba(60, 40, 20, .25);
  display: flex; flex-direction: column; align-items: center; gap: .8em; text-align: center; max-height: 94vh; max-width: 94vw; overflow: auto;
}
.panel.wide { width: min(92vw, 52em); }
.panel h2 { margin: 0; font: 400 calc(var(--u) * 2.4) 'Display'; color: var(--brown2); letter-spacing: .02em; }

.menu { justify-content: flex-start; padding-left: max(4vw, 1em); pointer-events: none; }
.menu-col { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 1em; width: min(42vw, 30em); text-align: center; }
.logo {
  margin: 0; font: 400 calc(var(--u) * 5.6)/1 'Display'; color: #fff; letter-spacing: .02em;
  text-shadow: 0 .07em 0 var(--brown), 0 .14em 0 rgba(107, 68, 35, .45), 0 0 .5em rgba(255, 255, 255, .5); transform: rotate(-3deg);
}
.logo span { color: var(--gold); }
.logo.small { font-size: calc(var(--u) * 3.4); margin-bottom: .6em; }
.tag { margin: -.2em 0 .2em; font-size: calc(var(--u) * 1.3); color: #fff; text-shadow: 0 .1em 0 rgba(107, 68, 35, .6); }
.stars-total { margin: 0; display: flex; align-items: center; gap: .3em; font-size: calc(var(--u) * 1.2); background: rgba(255, 248, 234, .9); padding: .3em 1em; border-radius: 999px; }
.stars-total .ico-wool { margin-left: .8em; }

.tabs { display: flex; gap: .4em; flex-wrap: wrap; justify-content: center; }
.tabs button { padding: .4em .9em; background: var(--cream2); box-shadow: none; }
.tabs button.on { background: var(--brown2); color: #fff; }
.tabs button.locked { opacity: .5; }
.level-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .7em; width: 100%; }
.level-grid button {
  aspect-ratio: 1 / 1.05; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15em; padding: .3em;
  background: #fff; font: 400 calc(var(--u) * 1.9) 'Display'; color: var(--brown2);
}
.level-grid button small { font: 800 calc(var(--u) * .72) 'UI'; color: var(--ink); opacity: .75; line-height: 1.1; }
.level-grid button .st { display: flex; gap: .05em; }
.level-grid button .st i { width: .95em; height: .95em; }
.level-grid button .st i.off { opacity: .22; filter: grayscale(1); }
.level-grid button.locked { background: var(--cream2); color: #b9a58a; cursor: default; }
.level-grid button.current { outline: .2em solid var(--green); }
.wallet { margin: 0; font-size: calc(var(--u) * 1.3); }
.coat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .7em; width: 100%; }
.coat-grid button { display: flex; flex-direction: column; align-items: center; gap: .25em; padding: .6em .3em; background: #fff; }
.coat-grid button.on { outline: .22em solid var(--green); }
.coat-grid button.locked .swatch { filter: saturate(.4) brightness(.9); }
.coat-grid .swatch { width: 3.2em; height: 3.2em; border-radius: 50%; position: relative; box-shadow: inset 0 -.35em 0 rgba(0, 0, 0, .12), 0 0 0 .15em rgba(107, 68, 35, .25); }
.coat-grid .swatch::after { content: ''; position: absolute; left: 30%; top: 38%; width: 40%; height: 46%; border-radius: 45%; background: #4a3a44; }
.coat-grid small { font-size: calc(var(--u) * .85); }
.coat-grid .price { display: flex; align-items: center; gap: .2em; font-size: calc(var(--u) * .9); color: var(--brown2); }

.res-stars { display: flex; gap: 1.2em; justify-content: center; }
.star { display: flex; flex-direction: column; align-items: center; gap: .3em; width: 7.5em; font-size: calc(var(--u) * .95); }
.star i { width: 3.6em; height: 3.6em; background: center / contain no-repeat; background-image: inherit; opacity: .2; filter: grayscale(1); transition: transform .3s cubic-bezier(.3, 1.8, .5, 1); transform: scale(.7); }
.star i { background-image: url('assets/ui/tw_star.svg'); }
.star.on i { opacity: 1; filter: none; transform: scale(1); }
.star span { opacity: .8; }
.star.on span { opacity: 1; }
.res-wool { margin: 0; font-size: calc(var(--u) * 1.4); display: flex; align-items: center; gap: .25em; }
.res-wool .new { margin-left: .5em; font-size: .75em; color: var(--green-d); }

#joystick { position: fixed; z-index: 15; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(255, 255, 255, .18); border: 3px solid rgba(255, 255, 255, .5); pointer-events: none; }
#joystick .knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 248, 234, .9); box-shadow: 0 3px 0 rgba(107, 68, 35, .3); }

#loading { position: fixed; inset: 0; z-index: 30; display: grid; place-content: center; justify-items: center; background: linear-gradient(#8fd0f2, #d9f1ff); }
#loading .bar { width: min(60vw, 360px); height: 12px; border-radius: 10px; background: rgba(255, 255, 255, .6); overflow: hidden; }
#loading i { display: block; height: 100%; width: 0; background: var(--green); transition: width .15s; }
#toast { position: fixed; z-index: 40; left: 50%; bottom: 14%; transform: translateX(-50%); padding: .6em 1.2em; border-radius: 1em; background: var(--cream); box-shadow: 0 .25em 0 #d9c39b; }

/* narrow / portrait: the menu column sits on top, the island below it */
@media (max-aspect-ratio: 1/1) {
  .menu { justify-content: center; align-items: flex-start; padding: 6vh 1em 0; }
  .menu-col { width: min(92vw, 30em); }
  .level-grid { grid-template-columns: repeat(3, 1fr); }
  .coat-grid { grid-template-columns: repeat(3, 1fr); }
  .res-stars { gap: .4em; }
}
@media (max-height: 520px) {
  .panel { padding: .8em 1.2em 1em; gap: .5em; }
  .star i { width: 2.8em; height: 2.8em; }
}
