/* Alpha art on tactile materials. Colour stops stay within neighbouring hue
   families; state changes animate transforms/opacity, never gold into blue. */
.illustrated-icon {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  overflow: visible;
  vertical-align: middle;
  perspective: 180px;
  transform-origin: 50% 65%;
  pointer-events: none;
}
.illustrated-icon img,
.illustrated-icon .art-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.illustrated-icon img {
  opacity: 0;
}
.illustrated-icon.has-art img {
  opacity: 1;
}
.illustrated-icon.has-art .art-fallback {
  visibility: hidden;
}

body:not(.playing) .bottom-nav {
  gap: 6px;
  padding: 9px;
  border: 2px solid #ba813a;
  border-radius: 27px;
  background: linear-gradient(
    165deg,
    #fff5bc 0%,
    #f9d577 28%,
    #f0b755 64%,
    #df9751 100%
  );
  box-shadow:
    inset 0 0 0 2px #fff3b7,
    inset 0 5px 0 #fffce0b3,
    inset 0 -4px 0 #b5743866,
    0 4px 0 #976431,
    0 10px 18px #87502529,
    0 17px 26px -8px #764c2d30;
}
body:not(.playing) .bottom-nav::before {
  inset: 5px 22px auto;
  height: 3px;
  background: linear-gradient(
    90deg,
    #fffbe400,
    #fffdea 20%,
    #fff2b9 80%,
    #fffbe400
  );
}
body:not(.playing) .bottom-nav button {
  isolation: isolate;
  min-width: 0;
  min-height: 84px;
  flex-direction: column;
  gap: 1px;
  padding: 3px 2px 7px;
  overflow: hidden;
  border: 1px solid #c79340;
  border-radius: 21px;
  background: linear-gradient(
    150deg,
    #fff8cc 0%,
    #ffe7a0 35%,
    #fbd380 69%,
    #edb565 100%
  );
  box-shadow:
    inset 0 0 0 2px #fff8d1,
    inset 0 4px 0 #fffde4aa,
    inset 0 -3px 0 #d6964355,
    0 3px 0 #b87c38,
    0 5px 7px #87552325;
  color: #48351f;
  transition: transform 130ms ease;
}
body:not(.playing) .bottom-nav .illustrated-icon {
  width: 52px;
  height: 52px;
}
.bottom-nav .nav-label {
  position: relative;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
  text-shadow: 0 1px 0 #fff8d599;
}
body:not(.playing) .bottom-nav button.active {
  color: #fff;
  border-color: #22528a;
  background: linear-gradient(
    150deg,
    #28a9be 0%,
    #158db4 34%,
    #267cb2 66%,
    #3c59a0 100%
  );
  box-shadow:
    inset 0 0 0 2px #a2e4ebaa,
    inset 0 4px 0 #c7f4ef55,
    inset 0 -4px 0 #27487955,
    0 3px 0 #24426b,
    0 5px 9px #3b568333;
}
.bottom-nav button.active .nav-label {
  text-shadow: 0 2px 0 #234c8070;
}
body:not(.playing) .bottom-nav button::after {
  inset: -35% -30%;
  height: auto;
  z-index: -1;
  background: linear-gradient(
    110deg,
    transparent 35%,
    #fff8d566 46%,
    #ffffff99 50%,
    transparent 60%
  );
  opacity: 0;
  transform: translateX(-90%);
}
body:not(.playing) .bottom-nav button.active::after {
  animation: nav-success-shine 650ms ease-out;
}
@keyframes nav-success-shine {
  0% {
    opacity: 0;
    transform: translateX(-90%);
  }
  25% {
    opacity: 0.65;
  }
  80% {
    opacity: 0.35;
  }
  100% {
    opacity: 0;
    transform: translateX(90%);
  }
}
body:not(.playing) .bottom-nav button:active {
  transform: translateY(2px) scale(0.97);
}
@media (hover: hover) and (pointer: fine) {
  :where(html:not(.touch-preview)) body:not(.playing) .bottom-nav button:hover {
    transform: translateY(-2px);
  }
}

.home-themes .theme-card {
  --scene-top: var(--tint);
  display: grid;
  grid-template-rows: 86px minmax(42px, 1fr) 18px 16px;
  align-content: end;
  gap: 6px;
  min-height: 188px;
  padding: 8px 14px 16px;
  margin-top: 8px;
  isolation: isolate;
  border: 0;
  border-radius: 24px;
  overflow: visible;
  background: none;
  box-shadow: none;
}
.home-themes .theme-card::before {
  content: "";
  position: absolute;
  inset: 22px 0 0;
  z-index: -1;
  pointer-events: none;
  border: 1px solid #d5b47b;
  border-radius: inherit;
  background:
    radial-gradient(ellipse at 15% 0%, #fffbe788, transparent 65%),
    linear-gradient(
      180deg,
      var(--scene-top) 0%,
      var(--tint) 48%,
      #fff9ec 76%,
      #f8e5c7 100%
    );
  box-shadow:
    inset 0 0 0 2px #fff8df99,
    inset 0 2px 0 #fff,
    0 3px 0 #ddb77888,
    0 7px 12px #9c6b2512;
}
.home-themes .theme-card[data-theme="space"] {
  --scene-top: #b7addb;
}
.home-themes .theme-card[data-theme="sea"] {
  --scene-top: #a4d7d5;
}
.home-themes .theme-card[data-theme="books"] {
  --scene-top: #d8b3d0;
}
.home-themes .theme-card[data-theme="wisdom"] {
  --scene-top: #f3d28a;
}
.home-themes .theme-card[data-theme="humor"] {
  --scene-top: #f7d59a;
}
.home-themes .theme-card[data-theme="cinema"] {
  --scene-top: #f1c3a3;
}
.home-themes .theme-card[data-theme="bible"] {
  --scene-top: #c3d39b;
}
.home-themes .theme-card[data-theme="values"] {
  --scene-top: #ebbdc7;
}
.home-themes .theme-card[data-theme="everyday"] {
  --scene-top: #b2d5aa;
}
.home-themes .theme-card .theme-symbol {
  position: relative;
  float: none;
  width: 100%;
  height: 86px;
  margin: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.home-themes .theme-symbol::before {
  content: "";
  position: absolute;
  inset: 0 -2px;
  opacity: 0.8;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 100'%3E%3Cg fill='%23fffcec'%3E%3Cpath d='m18 20 2 5 5 2-5 2-2 5-2-5-5-2 5-2zM143 38l2 6 6 2-6 2-2 6-2-6-6-2 6-2zM128 10l1 3 3 1-3 1-1 3-1-3-3-1 3-1z'/%3E%3Ccircle cx='30' cy='74' r='1.7'/%3E%3Ccircle cx='150' cy='78' r='1.5'/%3E%3Ccircle cx='35' cy='8' r='1.5'/%3E%3C/g%3E%3C/svg%3E")
    center / 100% 100% no-repeat;
  pointer-events: none;
}
.home-themes .theme-symbol .illustrated-icon {
  width: 110px;
  height: 110px;
  margin-top: -6px;
}
.home-themes .theme-card h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 900;
  line-height: 1.1;
  align-self: center;
  color: #283650;
}
.home-themes .theme-card .theme-meta {
  font-size: 11px;
  font-weight: 700;
  color: #526072;
}
.home-themes .theme-card .progress {
  height: 7px;
  margin: 0;
  background: #d8d1bf88;
  box-shadow:
    inset 0 1px 2px #816b3b22,
    0 1px 0 #fff9ee;
}
.home-themes .theme-card .progress > span {
  background: linear-gradient(180deg, #b8f0ec 0%, #61c3da 45%, #369acf 100%);
  box-shadow:
    inset 0 1px 0 #fff9,
    inset 0 -1px 0 #2584b2;
}
.home-themes .theme-card .theme-progress {
  position: relative;
  align-self: end;
}
.home-themes .theme-card.is-complete .progress {
  height: 9px;
}
.home-themes .theme-card.is-complete .progress > span {
  background: linear-gradient(
    120deg,
    #ffe89a,
    #ffcf40 40%,
    #f4aa2f 80%,
    #ffdc6d
  );
  box-shadow:
    inset 0 1px 0 #fff3b8,
    inset 0 -1px 0 #c58725;
}
.theme-complete-stars {
  position: absolute;
  inset: auto 0 -8px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  color: #ffc847;
  filter: drop-shadow(0 2px 0 #b77925);
}
.theme-complete-stars .icon {
  width: 20px;
  height: 20px;
  fill: #ffd45b;
  stroke: #b77925;
  stroke-width: 1.4;
}
.theme-complete-stars .icon:nth-child(2) {
  width: 25px;
  height: 25px;
  transform: translateY(-2px);
}
.home-themes .theme-card .theme-meta > .icon {
  width: 22px;
  height: 22px;
  color: #283650;
}

@media (max-width: 760px) {
  body:not(.playing) .bottom-nav {
    padding: 8px 7px calc(9px + var(--safe-bottom, env(safe-area-inset-bottom)));
    padding-left: max(7px, var(--safe-left, env(safe-area-inset-left)));
    padding-right: max(7px, var(--safe-right, env(safe-area-inset-right)));
    border-bottom: 0;
    border-radius: 26px 26px 0 0;
    box-shadow:
      inset 0 0 0 2px #fff1b2,
      inset 0 5px 0 #fffadb99,
      inset 0 -4px 0 #b9783355,
      0 -3px 0 #ab7535,
      0 -8px 16px -4px #87502530,
      0 -20px 28px -14px #764c2d30;
  }
  body:not(.playing) .app {
    padding-bottom: 114px;
  }
  .kids-page {
    height: calc(
      100dvh - 182px - var(--safe-top, env(safe-area-inset-top)) -
        var(--safe-bottom, env(safe-area-inset-bottom))
    );
  }
}
@media (min-width: 761px) {
  body:not(.playing) .bottom-nav {
    width: min(600px, calc(100% - 64px));
    max-width: 600px;
  }
  body:not(.playing) .bottom-nav button {
    min-height: 92px;
  }
  body:not(.playing) .app {
    padding-bottom: 128px;
  }
  .kids-page {
    height: min(
      740px,
      calc(
        100dvh - 208px - var(--safe-top, env(safe-area-inset-top)) -
          var(--safe-bottom, env(safe-area-inset-bottom))
      )
    );
  }
}
@media (max-width: 350px) {
  body:not(.playing) .bottom-nav {
    gap: 4px;
    padding-left: max(5px, var(--safe-left, env(safe-area-inset-left)));
    padding-right: max(5px, var(--safe-right, env(safe-area-inset-right)));
  }
  body:not(.playing) .bottom-nav button {
    min-height: 78px;
    border-radius: 18px;
  }
  body:not(.playing) .bottom-nav .illustrated-icon {
    width: 46px;
    height: 46px;
  }
  .bottom-nav .nav-label {
    font-size: 10px;
  }
  .home-themes .theme-card {
    padding-inline: 12px;
    grid-template-rows: 76px minmax(40px, 1fr) 18px 16px;
    min-height: 174px;
  }
  .home-themes .theme-symbol {
    height: 76px;
  }
  .home-themes .theme-symbol .illustrated-icon {
    width: 98px;
    height: 98px;
  }
  .home-themes .theme-card h3 {
    font-size: 17px;
  }
  .home-themes .theme-card .theme-meta {
    font-size: 10px;
  }
}
@media (max-height: 450px) {
  body:not(.playing) .bottom-nav button {
    min-height: 64px;
  }
  body:not(.playing) .bottom-nav .illustrated-icon {
    width: 36px;
    height: 36px;
  }
}
@media (prefers-reduced-motion: reduce) {
  body:not(.playing) .bottom-nav button.active::after {
    animation: none;
  }
  body:not(.playing) .bottom-nav button,
  .theme-card {
    transition: none;
  }
}
