/* Магазин і конструктор акваріума. Усе велике: палець дитини, iPad. */

/* У режимі прикрашання звичайна панель ховається, натомість - своя. */
body.dc-on .bar { display: none; }
body.dc-shopping .toast { bottom: calc(min(64vh, 600px) + 12px); }

.dc-tools {
  /* Збоку, а не внизу: низ екрана - пісок, туди дитина садить рослини. */
  position: fixed; right: max(10px, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%);
  display: none; flex-direction: column; gap: 10px; padding: 8px; z-index: 3;
  background: rgba(255, 255, 255, 0.18); border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 44px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
body.dc-on .dc-tools { display: flex; }
body.dc-shopping .dc-tools { display: none; }
.dc-t {
  position: relative; width: 76px; height: 72px; padding: 4px; border-radius: 36px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: rgba(255, 255, 255, 0.16); color: #fff;
}
.dc-t .i { font-size: 28px; line-height: 1; }
.dc-t .l { font-size: 12px; opacity: 0.9; }
.dc-t .n:not(:empty) {
  position: absolute; top: -4px; right: -2px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px;
  background: #ffb547; color: #0b2236; font-size: 14px; line-height: 24px;
}
.dc-t.on { background: #ffb547; color: #0b2236; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7); }
.dc-t.done { background: #3fbf6f; color: #fff; height: 84px; font-weight: 700; margin-top: 6px; }
.dc-t.done .i { font-size: 30px; }
.dc-t.done .l { font-size: 14px; opacity: 1; }

/* Кнопки біля вибраної речі */
.dc-handles {
  position: fixed; left: 0; top: 0; z-index: 3; display: none; gap: 8px; padding: 6px;
  flex-wrap: wrap; justify-content: center; max-width: min(calc(100vw - 16px), 560px);
  background: rgba(11, 34, 54, 0.35); border-radius: 36px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.dc-handles.show { display: flex; }
body:not(.dc-on) .dc-handles { display: none; }
.dc-h {
  width: 62px; height: 62px; padding: 0; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fdfaf3; color: #0b2236; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}
.dc-h .i { font-size: 24px; line-height: 1.05; }
.dc-h .l { font-size: 10px; line-height: 1.1; color: #4a5a68; max-width: 58px; overflow: hidden; text-overflow: ellipsis; }
.dc-h:active { transform: scale(0.92); }
#dc-h-rotate { touch-action: none; }


/* Кошик: з'являється, коли щось тягнеш */
.dc-bin {
  position: fixed; left: 16px; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 92px); z-index: 3;
  width: 88px; height: 88px; border-radius: 50%; display: none; align-items: center; justify-content: center;
  font-size: 40px; background: rgba(255, 255, 255, 0.85); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s, background 0.15s; pointer-events: none;
}
.dc-bin.show { display: flex; }
.dc-bin.hot { transform: scale(1.25); background: #ff8a7a; }

/* Вітрина */
.dc-shop {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; height: min(64vh, 600px);
  display: flex; flex-direction: column; color: #0b2236; background: #fdfaf3;
  border-radius: 26px 26px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.3);
  transform: translateY(105%); transition: transform 0.28s cubic-bezier(.2, .8, .2, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.dc-shop.open { transform: none; }
.dc-shop-head { display: flex; gap: 8px; align-items: center; padding: 10px 10px 6px; }
.dc-tabs { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.dc-tab {
  flex: 1 0 auto; min-width: 64px; height: 66px; padding: 4px 10px; border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: #ece6d9; color: #0b2236;
}
.dc-tab .i { font-size: 28px; line-height: 1; }
.dc-tab .l { font-size: 12px; }
.dc-tab.on { background: #0b6e8a; color: #fff; }
.dc-close { width: 62px; height: 62px; padding: 0; border-radius: 50%; background: #ece6d9; font-size: 26px; flex: none; }

.dc-grid {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 12px 16px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; align-content: start;
  /* Без max-content рядок не враховував квадратну картинку (aspect-ratio) і ціна ховалась під низом картки. */
  grid-auto-rows: max-content;
}
.dc-grid[data-cat="themes"] { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.dc-card {
  /* Колонка flex, а не grid: у grid висота квадратної картинки не входила в рядок, і ціна ховалась під низом. */
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: flex-start;
  padding: 8px 8px 10px; border-radius: 20px; background: #fff; color: #0b2236;
  box-shadow: 0 2px 8px rgba(11, 34, 54, 0.12); white-space: normal; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; touch-action: pan-y;
}
.dc-card:active { transform: scale(0.96); }
.dc-card .pic {
  position: relative; flex: none; width: 100%; aspect-ratio: 1; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #6fd3e3, #1d7fa6);
}
.dc-card .pic img { width: 88%; height: 88%; object-fit: contain; pointer-events: none; }
.dc-grid[data-cat="themes"] .pic { aspect-ratio: 3 / 2; overflow: hidden; }
.dc-grid[data-cat="themes"] .pic img { width: 100%; height: 100%; object-fit: cover; }
.dc-card .nm { font-size: 13px; line-height: 1.2; text-align: center; color: #4a5a68; min-height: 2.4em; }
.dc-card .pr {
  font-weight: 700; font-size: 17px; padding: 4px 12px; border-radius: 999px; background: #fff1d6; color: #7a4a00;
}
.dc-card .pr.free { background: #dff5e3; color: #1d6b35; font-size: 15px; }
.dc-card .pr.own { background: #e3f1f6; color: #0b6e8a; }
.dc-card.poor { opacity: 0.6; }
.dc-card.current { box-shadow: 0 0 0 4px #ffb547, 0 2px 8px rgba(11, 34, 54, 0.12); }
.dc-card .nm, .dc-card .pr { flex: none; }
.dc-card .pr { margin-top: auto; }

/* «Натисни й тримай»: кільце довкола картинки заповнюється за 1 с; пальчик-значок у кутку. */
.dc-card .ring { position: absolute; inset: 4%; width: 92%; height: 92%; pointer-events: none; transform: rotate(-90deg); }
.dc-card .ring circle { fill: none; stroke-width: 7; }
.dc-card .ring .bg { stroke: rgba(255, 255, 255, 0.35); stroke-dasharray: 3 5; }
.dc-card .ring .fg { stroke: #ffb547; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.dc-card.holding .ring .fg { stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear; }
.dc-card.holding { transform: scale(0.97); }
.dc-card .hand {
  position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: 17px; background: rgba(255, 255, 255, 0.85); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.dc-card.holding .hand { animation: dc-press .5s ease-in-out infinite alternate; }
@keyframes dc-press { to { transform: translateY(3px) scale(0.92); } }

/* Мушель не вистачає: картка «каже ні», а над нею - як заробити (годувати + чистити). */
.dc-card.shake { animation: dc-shake .45s ease-in-out; }
@keyframes dc-shake {
  0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px) rotate(-2deg); } 40% { transform: translateX(7px) rotate(2deg); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(3px); }
}
.dc-earn {
  position: absolute; z-index: 2; left: 50%; top: 0; transform: translate(-50%, -6px) scale(0.6); opacity: 0; pointer-events: none;
  padding: 8px 16px; border-radius: 999px; background: #fff; color: #0b2236; font-size: 26px; line-height: 1.2; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(11, 34, 54, 0.28); transition: opacity .2s, transform .25s cubic-bezier(.2, 1.4, .4, 1);
}
.dc-earn.show { opacity: 1; transform: translate(-50%, -6px) scale(1); }

@media (max-width: 480px) {
  .dc-tools { gap: 8px; padding: 6px; right: 6px; }
  .dc-t { width: 66px; height: 66px; }
  .dc-t.done { height: 78px; }
  .dc-t .l { font-size: 11px; }
  .dc-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; padding: 4px 10px 14px; }
  .dc-grid[data-cat="themes"] { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .dc-tab { min-width: 58px; padding: 4px 6px; }
  .dc-tab .l { font-size: 11px; }
  .dc-h { width: 58px; height: 58px; }
}

/* ➕ уперся в найбільший розмір (або ➖ у найменший): кнопка м'яко хитається «ні». */
.dc-h.dc-nope { animation: dc-shake .4s ease-in-out; }
/* Річ під замком («Більше магії»): видно добре, замість ціни - замочок. */
.dc-card .pr.lock { background: #fff0d2; color: #7a4b00; font-size: 15px; }
.dc-card.locked .pic::after { content: '🔒'; position: absolute; right: 6px; top: 6px; font-size: 18px; filter: drop-shadow(0 1px 2px rgba(11, 34, 54, 0.35)); }
