@font-face {
  font-family: Nunito;
  src: url('./assets/Nunito-Variable.ttf') format('truetype');
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #fff1cc;
  --muted: #e8ba98;
  --night: #261c50;
  --ground: #28130e;
  --gold: #ffcf79;
  --rim: #cf7439;
  --navigation-extra-height: 16px;
  --app-viewport-height: var(--choco-expanded-height, 100dvh);
  --app-safe-top: calc(max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px));
  --app-safe-bottom: calc(max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px)) + var(--tg-content-safe-area-inset-bottom, 0px));
  --dock-height: calc(79px + var(--app-safe-bottom));
  --chocolate: radial-gradient(ellipse at 47% -75%, #db773a 7%, transparent 78%),
    linear-gradient(#9e4624, #72301b 44%, #622616 74%, #79361c);
  --bevel: inset 0 2px 1px #ffc780a6, inset 0 -3px 1px #3a140eaa, 0 3px 0 #34130e, 0 5px 10px #140a0780;
  --candy: linear-gradient(145deg, #ffe4a0 4%, #ffbd50 46%, #dc7e24 100%);
  --body-font: Nunito, ui-rounded, system-ui, sans-serif;
  font: 16px/1.3 var(--body-font);
  font-synthesis: none;
  -webkit-tap-highlight-color: transparent;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, .subpage, dialog { touch-action: pan-x pan-y; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body {
  margin: 0;
  min-height: var(--app-viewport-height);
  color: var(--ink);
  background: radial-gradient(ellipse at 50% 10%, #352751, #181121 72%);
}
button { margin: 0; font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid #fff3c7; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 1000; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.95; stroke-linecap: round; stroke-linejoin: round; }

.launch-screen {
  position: fixed;
  z-index: 10;
  inset-block: 0;
  inset-inline: 0;
  width: min(100%, 464px);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  isolation: isolate;
  overflow: clip;
  padding: calc(clamp(16px, 5dvh, 45px) + var(--app-safe-top)) 20px calc(clamp(22px, 8dvh, 74px) + var(--app-safe-bottom));
  background: #221326;
}
.launch-art {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.launch-screen::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: '';
  background: linear-gradient(#1b102dcc, transparent 28% 68%, #210d16ed);
}
.launch-logo { width: min(85%, 325px); height: auto; filter: drop-shadow(0 6px 6px #16080eaa); }
.launch-status { width: min(80%, 300px); text-align: center; color: var(--ink); font-weight: 900; }
.launch-status p { margin-top: 9px; text-shadow: 0 2px 3px #211018; }
.launch-status #launch-error p { font-size: 14px; line-height: 1.3; }
.launch-status #launch-retry { width: 100%; margin-top: 12px; min-height: 48px; }
.launch-status progress {
  appearance: none;
  display: block;
  width: 100%;
  height: 14px;
  overflow: hidden;
  border: 1px solid #ce9055;
  border-radius: 999px;
  color: #fec65f;
  background: #311613;
}
.launch-status progress::-webkit-progress-bar { background: #311613; }
.launch-status progress::-webkit-progress-value { background: linear-gradient(#ffe093, #d9802d); transition: width .2s ease-out; }
.launch-status progress::-moz-progress-bar { background: linear-gradient(#ffe093, #d9802d); }
@media (prefers-reduced-motion: reduce) {
  .launch-status progress::-webkit-progress-value { transition: none; }
}

.app-shell {
  --game-width: min(100vw, 464px);
  --shell-height: var(--app-viewport-height);
  --scene-width: clamp(0px, calc(var(--shell-height) - 200px), var(--game-width));
  --scene-image-height: calc(var(--scene-width) * 1.5);
  --frame-height: calc(var(--scene-width) * var(--choco-scene-aspect, 1.5));
  /* The platform ends at 70% of the artwork. Account for the vertical crop on short screens. */
  --factory-platform-bottom: calc(var(--scene-image-height) * .7 - (var(--scene-image-height) - var(--frame-height)) * .38);
  position: relative;
  display: block;
  width: var(--game-width);
  height: var(--shell-height);
  min-height: var(--shell-height);
  margin-inline: auto;
  background: linear-gradient(var(--night), #35224a 48%, var(--ground) 85%);
  box-shadow: 0 0 55px #0c081399;
}
.app-main {
  position: relative;
  height: max(0px, calc(var(--shell-height) - var(--dock-height)));
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  flex: none;
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: calc(7px + var(--app-safe-top)) 10px 0 3px;
}
.brand {
  display: block;
  width: clamp(165px, 51vw, 228px);
  max-width: 68%;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  filter: drop-shadow(0 3px 3px #210c16b0);
}
.brand img { display: block; width: 100%; height: auto; }

.close-button {
  border: 1px solid var(--rim);
  background: var(--chocolate);
  box-shadow: var(--bevel);
  color: var(--ink);
  text-shadow: 0 2px 1px #48170d;
}
.balance {
  isolation: isolate;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: none;
  width: clamp(118px, 43vw, 165px);
  min-width: 118px;
  max-width: 47%;
  min-height: 51px;
  padding: 4px 12px 7px 6px;
  border-radius: 18px;
  color: #fff0cf;
  text-shadow: 0 2px 1px #431607;
}
.balance::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  border: 1px solid transparent;
  border-image: url('./assets/ui/chocolate-glaze.webp') 64 70 68 fill / 17px 20px 18px stretch;
  filter: drop-shadow(0 3px 4px #210e178c);
}
.coin-icon { display: block; flex: none; filter: drop-shadow(0 1px 2px #31100895); }
.balance .coin-icon { filter: drop-shadow(0 0 5px #ffb34a77) drop-shadow(0 2px 2px #311008ab); }
.balance > span { flex: 1; min-width: 0; }
.balance small { display: block; color: #ffd19b; font-size: .64rem; font-weight: 900; line-height: 1; white-space: nowrap; }
.balance output { display: block; margin-top: 3px; font-size: clamp(.93rem, 4.5vw, 1.24rem); line-height: 1.05; font-weight: 1000; font-variant-numeric: tabular-nums; white-space: nowrap; }

.content { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 0 10px 12px; }
html {
  overflow: hidden;
  overscroll-behavior: none;
}
.app-shell[data-page='factory'] .content {
  padding: 0;
}
.app-dock {
  position: fixed;
  inset-inline: 0;
  top: max(0px, calc(var(--app-viewport-height) - var(--dock-height)));
  bottom: auto;
  width: min(100%, 464px);
  height: auto;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  overflow: visible;
  background: transparent;
  color: var(--ink);
  z-index: 4;
}
.app-dock::backdrop { background: transparent; pointer-events: none; }
.machine-scene { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.scene-media {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  width: var(--scene-width);
  height: min(100%, calc(var(--factory-platform-bottom) + 2px));
  margin-inline: auto;
}
.scene-media::after {
  position: absolute;
  inset: 0 0 auto;
  height: 3%;
  content: '';
  background: linear-gradient(var(--night), transparent);
}
.machine-art, .machine-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Keep the platform at the lower edge as the video box changes height. */
  object-position: center calc(100% + var(--scene-image-height) * .3 - 2px);
}
.machine-video { opacity: 0; }
.machine-video.has-playing-frame { opacity: 1; }

#factory-actions {
  display: grid;
  gap: 7px;
  padding: 7px 10px 12px;
  background: linear-gradient(#3c2217, var(--ground) 60%);
}
#factory-actions .factory-buy {
  --button-light: 1;
  min-height: 60px;
  padding: 7px 16px 10px;
  gap: 10px;
  font-size: clamp(1.05rem, 5vw, 1.35rem);
}
.factory-buy img { object-fit: contain; filter: drop-shadow(0 3px 2px #6d30168f); }
.factory-metrics {
  border: 1px solid transparent;
  border-image: url('./assets/factory-metrics/frame.webp') 74 fill / 20px stretch;
  color: #572408;
  filter: drop-shadow(0 3px 3px #210d0990);
}
.factory-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 10px 12px 12px;
}
.factory-metric { padding-inline: 5px; text-align: center; }
.factory-metric + .factory-metric { border-left: 1px solid #a967395e; }
.factory-metric small {
  display: block;
  color: #572408;
  font-size: clamp(.66rem, 3.2vw, .84rem);
  font-weight: 900;
  line-height: 1.15;
}
.factory-metric-value {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  margin-top: 4px;
  font-size: clamp(.95rem, 4.55vw, 1.2rem);
  font-weight: 1000;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
#factory-income-unit { font-size: .67em; }
#factory-next-income {
  width: fit-content;
  min-width: min(9ch, 100%);
  max-width: 100%;
  margin-inline: auto;
  padding: 5px 10px 6px;
  background: url('./assets/factory-metrics/next.webp') center / 100% 100% no-repeat;
  color: #572408;
  font-size: clamp(.82rem, 4.2vw, 1.12rem);
  white-space: nowrap;
}

.navigation {
  --nav-icon-size: clamp(31px, 10vw, 39px);
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  padding: 6px 7px calc(9px + var(--app-safe-bottom));
  border-top: 1px solid #c37a49;
  border-radius: 19px 19px 0 0;
  background: radial-gradient(ellipse at 50% -85%, #b06c43 0%, transparent 79%),
    linear-gradient(#65341f, #442115 36%, #2c140e);
  box-shadow: inset 0 2px 1px #efae7780, inset 0 -4px #1e0c08, 0 -4px 13px #1c0b0880;
}
.navigation button {
  min-width: 0;
  min-height: calc(47px + var(--navigation-extra-height));
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  padding: 2px 1px;
  border: 1px solid #9e5b3938;
  border-radius: 13px 14px 12px 13px;
  background: linear-gradient(#82492b24, #26110a30);
  box-shadow: inset 0 1px #fbb27424;
  color: #f2d2ac;
  font: 900 clamp(.64rem, 3.3vw, .81rem)/1.05 var(--body-font);
  text-shadow: 0 1px 2px #261008;
  white-space: nowrap;
}
.navigation button img {
  display: block;
  width: var(--nav-icon-size);
  height: var(--nav-icon-size);
  object-fit: contain;
  filter: drop-shadow(0 2px 2px #240d08b3);
}
.navigation button[aria-current='page'] {
  position: relative;
  top: -3px;
  border-color: #edaa60;
  background: radial-gradient(ellipse at 52% 1%, #eaa050, #a3532b 62%, #713018);
  box-shadow: inset 0 2px 1px #ffe4ad9e, inset 0 -3px 1px #52210e90,
    0 3px #35140c, 0 0 10px #ee93344d;
  color: #fff4d2;
  font-weight: 1000;
}

.subpage { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #b27745 transparent; padding: 13px 3px 12px; }
.eyebrow { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; color: var(--gold); font-size: .62rem; font-weight: 900; letter-spacing: .1em; }
.eyebrow span { width: 6px; height: 6px; transform: rotate(45deg); border-radius: 1px; background: var(--gold); }
h1 { font-size: 1.9rem; }
.bonus-dialog {
  border: 1px solid #bf6b37;
  border-radius: 18px;
  background: linear-gradient(#56291c, #351910);
  box-shadow: inset 0 2px #f8a1605e, 0 8px 24px #1a0b10aa;
}
.bonus-dialog { width: min(calc(100% - 25px), 365px); padding: 18px; color: var(--ink); }
.bonus-dialog::backdrop { background: #110b19b8; }
.bonus-dialog h2 { margin: 6px 28px 8px 0; font-size: 1.24rem; }
.bonus-dialog p:not(.eyebrow) { color: var(--muted); font-size: .86rem; }
.close-button { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; }
.toast { position: fixed; z-index: 5; left: 50%; bottom: calc(var(--dock-height) + 12px); transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); padding: 7px 11px; border: 1px solid #d48948; border-radius: 12px; background: #4c2318; color: #ffe2ac; font-size: .79rem; text-align: center; pointer-events: none; }
.toast:empty { display: none; }

.app-shell:not([data-page='factory']) {
  background: radial-gradient(ellipse at 92% 8%, #78523b54, transparent 44%),
    radial-gradient(ellipse at 4% 17%, #583c5b 0%, transparent 39%),
    linear-gradient(#302047, #3b221d 43%, #24130e);
}
.app-shell:not([data-page='factory']) .content { padding-bottom: 9px; }
.subpage .eyebrow { font-size: .53rem; letter-spacing: .08em; }
.subpage h1 { font-size: 1.93rem; line-height: 1.04; text-shadow: 0 2px 1px #210f1d; }
.subpage h2, .subpage h3 { margin: 0; }
.app-shell:is([data-page='shop'], [data-page='tasks'], [data-page='friends']) {
  background: radial-gradient(ellipse at 50% 85%, #92502542, transparent 66%),
    radial-gradient(ellipse at 50% 0%, #70444c61, transparent 60%),
    linear-gradient(#36202e, #3e1e1d 65%, #301711);
}
#shop, #tasks, #friends, #wallet { padding: 3px 1px 18px; scrollbar-width: none; overscroll-behavior-y: contain; scroll-padding: 8px; }
:is(#shop, #tasks, #friends, #wallet)::-webkit-scrollbar { display: none; }
.shop-heading { position: relative; padding: 1px 30px 11px; text-align: center; }
.subpage .shop-heading h1 { position: relative; color: #fff0c8; font-size: clamp(1.95rem, 9.1vw, 2.4rem); line-height: 1.08; text-shadow: 0 2px #9c542b, 0 4px 6px #1b0c1399; -webkit-text-stroke: .25px currentColor; }
.leaf-title { display: flex; align-items: center; justify-content: center; gap: clamp(8px, 2.5vw, 13px); }
.leaf-title::before, .leaf-title::after {
  content: '';
  flex: none;
  width: clamp(20px, 6.4vw, 30px);
  height: clamp(20px, 6.4vw, 30px);
  background: url('./assets/ui/cocoa-leaf.webp') center / contain no-repeat;
  filter: drop-shadow(0 2px 1px #24100d99);
  transform: translateY(1px);
}
.leaf-title::after { transform: translateY(1px) scaleX(-1); }
.shop-heading > p { margin-top: 3px; color: #e5b98b; font-size: clamp(.82rem, 3.5vw, 1rem); font-weight: 850; line-height: 1.2; }
.chocolate-tile { position: absolute; top: 20px; left: 5px; width: 22px; height: 29px; border: 3px solid #4c241d; border-radius: 4px; transform: rotate(27deg); opacity: .6; background: repeating-linear-gradient(0deg, transparent 0 9px, #3b1b1766 9px 12px), repeating-linear-gradient(90deg, #69372b 0 7px, #3b1b1766 7px 10px); box-shadow: inset 2px 2px 2px #b4774538, 2px 4px 4px #1d0c143d; }
.chocolate-tile:last-child { left: auto; right: 5px; transform: rotate(-26deg); }
.parts-list { display: grid; gap: 10px; }
.part-card {
  --stud: radial-gradient(circle at 35% 28%, #fff9ce 0%, #ffd578 28%, #ed9c32 47%, #9a4d1c 60%, transparent 72%);
  position: relative;
  display: grid;
  grid-template-columns: 38% minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 5px;
  min-height: 136px;
  padding: 12px 16px 13px 10px;
  border: 1px solid transparent;
  border-image: url('./assets/adsgram-frame.webp') 42 118 48 120 fill / 16px 24px 17px stretch;
  color: #542409;
  filter: drop-shadow(0 3px 3px #1d09084d);
}
.part-card::before { content: ''; position: absolute; inset: 8px 9px; pointer-events: none; background-image: var(--stud), var(--stud), var(--stud), var(--stud); background-position: left top, right top, left bottom, right bottom; background-size: 9px 9px; background-repeat: no-repeat; }
#parts-list .part-card { padding-block: 22px 23px; }
.part-image { grid-column: 1; grid-row: 1 / 3; display: block; justify-self: center; width: 100%; height: 114px; object-fit: contain; filter: drop-shadow(0 4px 3px #8b4b343d); }
.part-description { grid-column: 2; align-self: end; min-width: 0; }
.part-description h2 { color: #582507; font-size: clamp(1rem, 4.9vw, 1.32rem); line-height: 1.16; text-shadow: 0 1px #fff1c6; }
.part-card[data-part='heater'] h2, .part-card[data-part='mixer'] h2 { max-width: 7.8em; }
.part-income { display: inline-flex; align-items: center; gap: 3px; margin-top: 7px; padding: 3px 7px 3px 4px; border: 1px solid #b9b96a7d; border-radius: 20px; color: #414018; background: linear-gradient(100deg, #efe8a8, #dce19b); box-shadow: inset 0 1px #fff7c6, 0 1px #b9ac5d52; font-size: clamp(.75rem, 3.45vw, .95rem); line-height: 1; font-weight: 1000; white-space: nowrap; }
.part-income img, .part-price img { flex: none; object-fit: contain; }
.part-purchase { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; align-self: start; padding-bottom: 1px; }
.part-price { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 30px; flex: 1; padding: 4px 6px; border: 1px solid #b2652f; border-radius: 10px; color: #fff0c5; background: radial-gradient(ellipse at 50% -10%, #bd6c39, transparent 90%), linear-gradient(#8c4022, #682a18); box-shadow: inset 0 1px #efb777a6, inset 0 -2px #4c1a1280; font-size: clamp(.83rem, 3.65vw, 1rem); line-height: 1; font-weight: 1000; font-variant-numeric: tabular-nums; text-shadow: 0 1px #63331b; white-space: nowrap; }
.part-card .part-buy { flex: 1.1; min-width: 0; min-height: 42px; padding-inline: 8px; font-size: clamp(.86rem, 3.8vw, 1.04rem); }
.part-shortfall { flex-basis: 100%; color: #83512d; font-size: .58rem; font-weight: 850; text-align: right; line-height: 1.15; }
.part-installed { display: inline-flex; align-items: center; gap: 3px; padding: 4px 7px; border: 1px solid #a3b16a; border-radius: 9px; color: #495322; background: #dce8b1; box-shadow: inset 0 1px #f9ffda; font-size: .7rem; font-weight: 1000; }
.part-installed .icon { width: 14px; height: 14px; stroke-width: 3; }
.part-countdown { display: flex; flex-basis: 100%; align-items: center; justify-content: space-between; gap: 4px; color: #89603b; font-size: .53rem; font-weight: 850; }
.part-countdown time { color: #633411; font-size: .83rem; font-weight: 1000; font-variant-numeric: tabular-nums; white-space: nowrap; }
.part-card.owned .part-image { filter: drop-shadow(0 3px 4px #7e793b40); }
.storage-notice { margin-top: 14px; padding: 12px; border: 1px solid #c78550; border-radius: 12px; color: #ffe0b7; background: #5a2e1d; font-size: .75rem; }
.text-button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 36px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: #7b3b1d;
  font: 950 .73rem/1.15 var(--body-font);
}
.text-button .icon { width: 14px; height: 14px; stroke-width: 2.5; }
.caramel-button, .chocolate-button, .task-button {
  --button-art: url('./assets/ui/gold-glaze.webp');
  --button-slice: 64 70 68;
  --button-light: .86;
  isolation: isolate;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 7px 10px 10px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #fff5dc;
  font: 1000 .87rem/1.15 var(--body-font);
  text-shadow: 0 1px 1px #71330a, 0 2px #68300b87;
}
.caramel-button .icon, .chocolate-button .icon { width: 17px; height: 17px; }
.chocolate-button { --button-art: url('./assets/ui/chocolate-glaze.webp'); --button-light: 1; }
:is(.caramel-button, .chocolate-button, .task-button)::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  border: 1px solid transparent;
  border-image: var(--button-art) var(--button-slice) fill / 16px 20px 17px stretch;
  filter: brightness(var(--button-light)) drop-shadow(0 2px 2px #57261174);
}
:is(.caramel-button, .chocolate-button, .task-button):focus-visible { outline-color: #ab6436; }
:is(.caramel-button, .chocolate-button, .task-button):active:not(:disabled) { transform: translateY(2px); }
:is(.caramel-button, .chocolate-button, .task-button):disabled { cursor: default; }
.part-buy, .task-button {
  --button-art: url('./assets/tasks/caramel-action.webp');
  --button-slice: 50 58 55;
  --button-light: 1;
  color: #572609;
  text-shadow: 0 1px #ffe6ac;
}
:is(.part-buy, .task-button):disabled { color: #6a422b; }
:is(.part-buy, .task-button):disabled::before { filter: saturate(.46) brightness(.92) drop-shadow(0 1px 1px #783c2666); }
#tasks, #friends, #wallet {
  padding-block: 5px 22px;
  font-weight: 800;
}
.tasks-heading, .friends-heading { padding-block: 11px 19px; }
.subpage :is(.tasks-heading, .friends-heading) h1 {
  font-size: clamp(2rem, 9.7vw, 2.65rem);
}
.task-reward {
  color: #fff0c6;
  background: radial-gradient(ellipse at 40% 0%, #bf6d42 0%, transparent 75%), linear-gradient(#994421, #713219 72%, #682616);
  border: 1px solid #a45d36;
  border-radius: 12px;
  box-shadow: inset 0 1px #ffca88ab, inset 0 -2px #53211385, 0 1px 2px #713b2633;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 1px #5a2313;
  white-space: nowrap;
}
.task-list { display: grid; gap: 12px; }
.task-card {
  grid-template-columns: minmax(0, .46fr) minmax(0, 1fr);
  grid-template-rows: auto;
  gap: clamp(10px, 3.1vw, 13px);
  padding: 14px clamp(16px, 5.4vw, 24px) 15px;
  min-height: 112px;
}
.task-art {
  display: block;
  justify-self: center;
  width: min(100%, 90px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 3px #7d3a263f);
}
.task-details { min-width: 0; }
.task-details h3 {
  color: #572408;
  font-size: clamp(1.02rem, 4.72vw, 1.28rem);
  line-height: 1.17;
  text-shadow: 0 1px #fff5d2;
  overflow-wrap: break-word;
}
.task-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 6px; }
.task-reward { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 5px 7px; font-size: clamp(.83rem, 3.7vw, 1.04rem); line-height: 1; }
.task-reward img { flex: none; width: clamp(17px, 5.2vw, 21px); height: auto; }
.task-button {
  flex: 1 1 auto;
  min-width: max-content;
  min-height: 46px;
  padding-inline: 8px;
  font-size: clamp(.81rem, 3.75vw, 1.03rem);
  white-space: nowrap;
}
.part-card.news-task {
  grid-template-columns: clamp(38px, 14vw, 64px) minmax(0, 1fr) minmax(95px, 37%);
  grid-template-rows: auto;
  align-items: center;
  gap: 6px;
  min-height: 88px;
  padding: 11px clamp(12px, 4vw, 18px);
}
.news-task-art {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 3px 3px #7d3a263f);
}
.news-task h3 {
  margin: 0;
  color: #572408;
  font-size: clamp(.82rem, 3.85vw, 1.04rem);
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.news-task-actions { display: grid; justify-items: stretch; gap: 3px; }
.news-task-actions .task-button {
  min-height: 36px;
  min-width: 0;
  padding: 4px 7px;
  font-size: clamp(.72rem, 3.3vw, .9rem);
  line-height: 1.05;
  text-align: center;
  white-space: normal;
}
.news-task-actions { min-inline-size: 0; max-inline-size: 100%; }
.news-task-reward {
  display: inline-flex; align-items: center; justify-content: center; justify-self: center; gap: 5px;
  min-height: 18px; min-inline-size: 0; max-inline-size: 100%; padding: 0 2px; border: 0; border-radius: 0;
  background: none;
  box-shadow: none;
  color: #28684f; font: 950 clamp(.74rem, 3.2vw, .83rem)/1 var(--body-font);
  font-variant-numeric: tabular-nums; letter-spacing: .015em; text-shadow: 0 1px #fffaf0;
  text-align: center; white-space: nowrap;
}
.news-task-reward img { display: block; width: 14px; height: 14px; flex: none; object-fit: contain; filter: drop-shadow(0 1px 1px #38735426); }
.task-reward-value { display: block; }

.friend-hero {
  overflow: hidden;
  padding: 4px;
  border: 2px solid #b56c35;
  border-radius: 24px;
  background: linear-gradient(#84401f, #582413 59%, #7f371b);
  box-shadow: inset 0 0 0 1px #ffdc91, inset 0 0 0 3px #c2783f, inset 0 -3px #482012, 0 4px 8px #220f0b99;
}
.friend-hero-art { display: block; width: 100%; height: auto; border-radius: 17px 17px 3px 3px; }
.friend-hero-copy {
  position: relative;
  margin-top: -34px;
  padding: 19px 9px 13px;
  background: linear-gradient(transparent, #542411 42%, #642a15);
  text-align: center;
}
.friend-hero-copy h2 {
  color: #fff2cc;
  font-size: clamp(1.12rem, 5.9vw, 1.65rem);
  line-height: 1.12;
  text-shadow: 0 1px #f5bc79, 0 2px #b26030, 0 3px 5px #2f140fb3;
  -webkit-text-stroke: .18px currentColor;
  text-wrap: balance;
}
.friend-hero-copy p { margin-top: 6px; color: #ffda9f; font-size: clamp(.72rem, 3.65vw, .99rem); line-height: 1.24; font-weight: 950; text-shadow: 0 1px 2px #3d160c; text-wrap: balance; }
.friend-link-panel {
  padding: 12px 11px 14px;
  border: 1px solid #d88d43;
  border-radius: 17px;
  color: #622e17;
  background: radial-gradient(ellipse at 48% 0%, #ffeec3, #f4ca8c);
  box-shadow: inset 0 0 0 1px #ffeda9, inset 0 -2px #c07a44a1, 0 2px 4px #3b170c8c;
  text-align: center;
}
.friend-link-panel h3 { font-size: clamp(.96rem, 4.1vw, 1.13rem); line-height: 1.15; }
.friend-link-field {
  margin-top: 6px;
  padding: 8px 7px;
  border: 1px solid #e5b677;
  border-radius: 20px;
  background: #fff2d0;
  box-shadow: inset 0 1px #fff9e4, 0 2px 2px #b36e3745;
  color: #805331;
  font-size: clamp(.7rem, 3.2vw, .89rem);
  font-weight: 850;
  line-height: 1.25;
}
.friend-actions { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 7px; margin-top: 10px; }
.friend-invite-button, .friend-copy-button {
  gap: clamp(4px, 1.5vw, 7px);
  min-width: 0;
  min-height: 49px;
  padding: 6px 5px 9px;
  font-size: clamp(.72rem, 3.6vw, 1rem);
  line-height: 1.12;
  white-space: nowrap;
}
.friend-invite-button { --button-light: .92; }
.friend-actions img { flex: none; width: clamp(21px, 7.2vw, 32px); height: auto; filter: drop-shadow(0 1px 1px #68311085); }
.friend-copy-button img { width: clamp(18px, 6.2vw, 28px); }
.friend-section-heading { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 17px 2px 8px; text-align: center; }
.friend-section-heading h2 { color: #fff0c8; font-size: clamp(1.05rem, 5.1vw, 1.38rem); line-height: 1.2; text-shadow: 0 2px #9c542b, 0 3px 4px #1e0b0d99; -webkit-text-stroke: .12px currentColor; }
.friend-levels-heading .leaf-title { gap: 7px; }
.friend-levels-heading .leaf-title::before, .friend-levels-heading .leaf-title::after { width: clamp(18px, 5.8vw, 26px); height: clamp(18px, 5.8vw, 26px); }
.friend-section-heading:not(.friend-levels-heading)::before, .friend-section-heading:not(.friend-levels-heading)::after { content: ''; flex: 1; max-width: 42px; height: 2px; background: linear-gradient(90deg, transparent, #c58a4c); }
.friend-section-heading:not(.friend-levels-heading)::after { transform: rotate(180deg); }
.friend-panel {
  border: 1px solid transparent;
  border-image: url('./assets/adsgram-frame.webp') 42 118 48 120 fill / 13px 16px 14px stretch;
  color: #602b11;
  filter: drop-shadow(0 2px 3px #1e0b0b80);
}
.referral-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin: 0; padding: 0; list-style: none; }
.referral-level { display: grid; justify-items: center; gap: 2px; padding: 8px 6px 22px; text-align: center; }
.referral-level img { display: block; width: clamp(42px, 13vw, 60px); height: auto; filter: drop-shadow(0 3px 2px #75432859); }
.referral-level strong { font-size: clamp(1.36rem, 6.7vw, 1.87rem); font-weight: 1000; line-height: 1; text-shadow: 0 1px #fff3c6; }
.referral-level span { color: #622e15; font-size: clamp(.73rem, 3.25vw, .88rem); font-weight: 900; line-height: 1.2; white-space: nowrap; }
.friend-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 10px 0 0; padding: 13px 12px; }
.friend-stat { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 3px 7px; padding: 0 5px; }
.friend-stat + .friend-stat { padding-left: 10px; border-left: 1px solid #b67c4f7a; }
.friend-stat img { grid-row: span 2; width: clamp(28px, 9.5vw, 43px); height: auto; object-fit: contain; }
.friend-stat dt { font-size: clamp(.57rem, 2.8vw, .77rem); line-height: 1.15; }
.friend-stat dd { margin: 0; font-size: 1.32rem; line-height: 1; font-variant-numeric: tabular-nums; }
.friend-empty { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 12px 15px; background: transparent; text-align: left; font: 1000 clamp(.8rem, 3.9vw, 1.05rem)/1.2 var(--body-font); }
.friend-empty img { flex: none; width: clamp(46px, 15vw, 64px); height: auto; }
.app-shell[data-page='wallet'] {
  background: radial-gradient(ellipse at 45% 6%, #68333780, transparent 52%),
    linear-gradient(#421e26, #4b231c 57%, #35150f);
}
.app-shell[data-page='wallet'] .content { padding-inline: 5px; }
#wallet { container-type: inline-size; }
.wallet-heading { padding-block: 1cqw 3cqw; }
.wallet-heading .chocolate-tile { top: 2cqw; }
.subpage :is(.wallet-heading h1, .wallet-history-heading h2) {
  color: #ffe8ba;
  line-height: 1.08;
  text-shadow: 0 .25cqw #fff0cf, 0 .55cqw #b46a37, 0 1cqw 1.2cqw #2b110f;
  -webkit-text-stroke: .07cqw #ffeac5;
}
.subpage .wallet-heading h1 { font-size: 9.2cqw; }
.wallet-panel {
  --wallet-corner: 7.7cqw;
  position: relative;
  isolation: isolate;
  border-radius: var(--wallet-corner);
  color: #57230c;
  background: radial-gradient(ellipse at 24% 0, #f4ad68, transparent 46%),
    linear-gradient(155deg, #a74a20, #813413 58%, #6f2c13 77%, #b65c28);
  box-shadow: inset 0 .22cqw #ffd096a6, inset 0 -.5cqw #71300f, 0 .75cqw 1.2cqw #220c0c99;
}
.wallet-panel::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 1.25cqw;
  border: .78cqw solid transparent;
  border-radius: calc(var(--wallet-corner) - 1.25cqw);
  background: radial-gradient(ellipse at 46% 42%, #ffebc5 0%, #ffdfab 76%, #f3c383 100%) padding-box,
    linear-gradient(155deg, #ffdb70, #fff4c3 10%, #ffbe27 27%, #ac5408 53%, #ffb52e 75%, #fff1a3 90%, #d17915) border-box;
  box-shadow: 0 0 0 .26cqw #8f390d, 0 0 .6cqw .22cqw #ffae2a91,
    inset 0 .58cqw .8cqw #8d441163, inset 0 -.5cqw .75cqw #bd783459;
  pointer-events: none;
}
.wallet-banner {
  --wallet-corner: 10.1cqw;
  display: grid;
  grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
  align-items: center;
  row-gap: 1.25cqw;
  padding: 5.3cqw 4.25cqw 4.4cqw;
}
.wallet-balance-copy { padding-left: 2.4cqw; }
.wallet-balance-copy h2 { font-size: 5.5cqw; line-height: 1.08; }
.wallet-banner output {
  display: block;
  margin-top: 2.15cqw;
  color: #531f09;
  font-size: 13.7cqw;
  font-weight: 1000;
  line-height: 1;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.wallet-unit { display: flex; align-items: center; gap: 1.2cqw; margin-top: 1.1cqw; color: #7c4526; font-size: 5.05cqw; font-weight: 900; line-height: 1.1; }
.wallet-unit img { display: block; flex: none; width: 5.6cqw; height: 5.6cqw; }
.money-dialog {
  width: min(calc(100% - 24px), 390px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 20px;
  border: 3px solid #e69a31;
  border-radius: 26px;
  background: radial-gradient(ellipse at top, #fff0cc, #ffdda3 80%);
  color: #58240d;
  box-shadow: inset 0 0 0 2px #fff7d6, 0 0 0 4px #7e310f, 0 12px 40px #180a10bb;
  font-family: inherit;
}
.money-dialog::backdrop { background: #1c0b17c9; backdrop-filter: blur(4px); }
.money-dialog .close-button { background: #773517; color: #fff0cb; font-size: 26px; }
.money-art { display: block; margin: 0 auto 6px; width: 66px; height: 66px; object-fit: contain; }
.money-dialog h2 { margin: 0 0 20px; text-align: center; font-size: 25px; line-height: 1.2; font-weight: 1000; }
.money-dialog form, #money-invoice { display: grid; gap: 14px; }
.money-dialog label { display: grid; gap: 7px; font-size: 15px; font-weight: 900; }
.money-dialog input:not([type='radio']) {
  box-sizing: border-box; width: 100%; min-width: 0; min-height: 48px; padding: 11px 13px;
  border: 2px solid #c78540; border-radius: 14px; background: #fff4db; color: #58240d;
  box-shadow: inset 0 2px 4px #9752222b, 0 2px #fff4d6; font-family: inherit; font-size: 17px; font-weight: 900; line-height: 1.3;
  color-scheme: light;
}
.money-dialog input:focus-visible { outline: 3px solid #eda526; outline-offset: 2px; }
.money-method-picker { min-width: 0; margin: 0; padding: 0; border: 0; }
.money-method-picker legend { padding: 0 1px 7px; font-size: 15px; font-weight: 1000; }
.money-method-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.money-dialog .money-method-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 50px;
  padding: 7px;
  border: 1px solid #a05227;
  border-radius: 14px;
  background: var(--chocolate);
  box-shadow: var(--bevel);
  color: #fff1cc;
  cursor: pointer;
}
.money-method-card img { flex: none; width: 25px; height: 25px; object-fit: contain; }
.money-method-card strong, .money-method-card small { display: block; line-height: 1.1; overflow-wrap: anywhere; }
.money-method-card strong { font-size: 14px; font-weight: 1000; }
.money-method-card small { margin-top: 3px; font-size: 11px; color: #ffd4a7; }
.money-method-card:has(input:checked) {
  border-color: #b87120;
  background: linear-gradient(#ffe2a0, #ffc55f 60%, #e89938);
  box-shadow: inset 0 2px #fff3ca, inset 0 -2px #bb60184f, 0 2px 3px #7f431e54;
  color: #572408;
}
.money-method-card:has(input:checked) small { color: #663313; }
.money-method-card:has(input:focus-visible) { outline: 2px solid #874217; outline-offset: 2px; }
.money-dialog p { margin: 0; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.money-dialog #money-minimum { margin-top: -8px; color: #87522d; font-weight: 800; }
.money-dialog .money-quote {
  margin-top: -8px;
  padding: 7px 10px;
  border: 1px solid #ba7a35;
  border-radius: 12px;
  background: linear-gradient(#fff1c6, #ffe0a2);
  color: #633412;
  font-weight: 900;
}
.money-dialog #invoice-credit { margin-top: 0; text-align: center; }
.money-dialog #money-rule { padding: 10px 12px; border-radius: 12px; background: #edc18480; }
.money-dialog #money-error { margin-top: 14px; color: #972b16; font-weight: 900; }
.money-dialog #money-error:empty { display: none; }
.money-dialog .caramel-button, .money-dialog .chocolate-button { min-height: 51px; width: 100%; font-size: 18px; }
.money-dialog .invoice-status {
  --status-edge: #ce8b26;
  --status-top: #fff1ba;
  --status-bottom: #ffcf70;
  --status-ink: #6b3b08;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--status-edge);
  border-radius: 999px;
  background: linear-gradient(var(--status-top), var(--status-bottom));
  box-shadow: inset 0 1px #ffffff80, 0 2px 4px #8b451726;
  color: var(--status-ink);
  text-align: center;
  font-size: 14px;
  font-weight: 1000;
}
.invoice-status::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-edge);
  box-shadow: 0 0 0 2px #ffffff62;
}
.money-dialog .invoice-status[data-tone='progress'] { --status-edge: #8b6caa; --status-top: #fff1ff; --status-bottom: #e4c9f7; --status-ink: #53336c; }
.money-dialog .invoice-status[data-tone='success'] { --status-edge: #709339; --status-top: #f8ffce; --status-bottom: #c8e28e; --status-ink: #36520b; }
.money-dialog .invoice-status[data-tone='review'] { --status-edge: #cc7850; --status-top: #fff1d6; --status-bottom: #ffc39e; --status-ink: #76371f; }
.money-dialog .invoice-status[data-tone='closed'] { --status-edge: #a77a70; --status-top: #fff0e9; --status-bottom: #ecd1c3; --status-ink: #713f33; }
.invoice-details { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 8px; }
.invoice-tile {
  min-width: 0;
  padding: 10px;
  border: 1px solid #bd7939;
  border-radius: 15px;
  background: linear-gradient(#fff3d3, #ffe1ab);
  box-shadow: inset 0 1px #fffaf0, 0 2px 3px #82431b28;
  color: #57250c;
}
.invoice-tile small { display: block; color: #794420; font-size: 12px; font-weight: 900; }
.invoice-tile strong { display: block; margin-top: 4px; font-size: clamp(15px, 4.4vw, 19px); line-height: 1.14; font-weight: 1000; overflow-wrap: anywhere; }
.invoice-address-card { width: 100%; display: grid; gap: 5px; text-align: left; }
.invoice-address-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
#invoice-copy-label { border-radius: 999px; padding: 3px 7px; background: var(--chocolate); color: #fff1c9; font-size: 11px; font-weight: 1000; }
#invoice-address { font: 800 13px/1.4 ui-monospace, monospace; overflow-wrap: anywhere; direction: ltr; user-select: text; }
.money-dialog .invoice-copy-status { margin-top: -8px; color: #5e451b; font-size: 12px; font-weight: 900; }
.money-dialog .invoice-note { padding: 8px 10px; border-radius: 10px; background: #efbd7c70; font-weight: 850; }
.wallet-withdrawals { display: grid; gap: 3cqw; margin-top: 3cqw; }
.friend-list-person { padding: 5cqw; font-size: 4.6cqw; font-weight: 900; margin: 3cqw 0 0; }
.withdrawal-status { display: grid; gap: 1.2cqw; padding: 4cqw; }
.withdrawal-status strong { font-size: 4.1cqw; }
.withdrawal-status small, .withdrawal-status p, .withdrawal-status a { margin: 0; font-size: 3.3cqw; color: #7b3a1c; overflow-wrap: anywhere; }
.wallet-safe {
  display: block;
  width: calc(100% + 1.4cqw);
  height: auto;
  aspect-ratio: 1.19;
  object-fit: cover;
  object-position: center 44%;
  filter: drop-shadow(0 3px 3px #944e2854);
}
.wallet-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.65cqw; margin-inline: .8cqw; }
.wallet-actions button {
  min-width: 0;
  min-height: max(44px, 15.8cqw);
  gap: 1.55cqw;
  padding: 1.2cqw 1.4cqw 1.8cqw;
  font-size: 4.75cqw;
  white-space: nowrap;
}
.wallet-panel .caramel-button { --button-light: 1; }
.wallet-actions button::before { border-image-width: 4.1cqw 5.6cqw 4.4cqw; }
.wallet-actions img { display: block; flex: none; width: 11.5cqw; height: auto; filter: drop-shadow(0 1px 2px #491c12a6); }
.wallet-history-heading { margin: 3cqw 0 2.6cqw; text-align: center; }
.wallet-history-heading h2 { gap: 3.2cqw; font-size: 6.2cqw; }
.wallet-history-heading .leaf-title::before, .wallet-history-heading .leaf-title::after { width: 5.8cqw; height: 5.8cqw; }
.history-list { padding: 2.5cqw 4.8cqw 3cqw; }
.history-empty { display: grid; justify-items: center; gap: 4px; padding: 18px 7px 19px; color: #7b4628; text-align: center; }
.history-empty img { display: block; width: 64px; height: 64px; object-fit: contain; }
.history-empty h3 { font-size: .98rem; color: #602b11; }
.history-empty p { font-size: .75rem; line-height: 1.35; }
.history-row { display: grid; grid-template-columns: 20.5cqw minmax(0, 1fr) auto; align-items: center; gap: 2.35cqw; padding: 1.65cqw 0; }
.history-row + .history-row { border-top: 1px solid #c68755a6; }
.history-row img { display: block; width: 100%; height: 16.8cqw; object-fit: contain; filter: drop-shadow(0 2px 2px #89482945); }
.history-description { min-width: 0; padding-left: 2.7cqw; border-left: 1px solid #be824ea6; }
.history-row strong { display: block; color: #572309; font-size: 4.45cqw; line-height: 1.12; font-weight: 1000; overflow-wrap: break-word; }
.history-row small { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .9cqw; margin-top: .7cqw; color: #855133; font-size: 3.45cqw; line-height: 1.2; font-weight: 850; }
.history-row time { font-size: max(.8em, 10px); }
.history-row b { max-width: 30cqw; color: #477319; font-size: 6.9cqw; font-weight: 1000; line-height: 1; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.history-row.outgoing b { color: #863115; }
.history-unit { display: block; margin-top: 3px; font-size: .47em; }
.detail-dialog > img { display: block; width: 150px; height: 150px; margin: -3px auto 10px; object-fit: contain; }
.detail-dialog .detail-note { margin-top: 12px; padding-top: 12px; border-top: 1px solid #a6693c59; color: #c6a07e; font-size: .71rem; }
.detail-dialog > form:last-child { margin-top: 16px; }
.detail-dialog .caramel-button { width: 100%; }

@media (max-height: 660px) {
  .app-shell { --frame-height: calc(var(--scene-width) * var(--choco-scene-aspect, 1.36)); }
}
@media (hover: hover) {
  button:hover:not(:disabled) { filter: brightness(1.09); }
  .brand:hover { filter: drop-shadow(0 3px 3px #210c16b0) brightness(1.09); }
}

.friend-list-person { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; overflow-wrap: anywhere; }
.friend-list-person > strong { min-width: 0; font-size: clamp(14px,4.2cqw,18px); }
.friend-list-person > small { align-self: center; color: #7b3a1c; font-size: clamp(11px,3cqw,13px); white-space: nowrap; }
.friend-contribution { grid-column: 1 / -1; display: grid; gap: 5px; font-size: clamp(12px,3.5cqw,15px); font-weight: 800; line-height: 1.35; }
.friend-contribution span { min-width: 0; overflow-wrap: anywhere; }
