/* ============================================================
   CANDLE.CSS — игра «Свеча»
   ============================================================ */

/* ---------- СЦЕНА: всё прижато к низу — тарелка на месте,
   свеча тает сверху вниз ---------- */
.candle-zone {
  display:flex; flex-direction:column;
  align-items:center; justify-content:flex-end;
  height:320px; position:relative;
}

/* ---------- огонёк ---------- */
.cd-flame-wrap {
  position:relative; z-index:2;
  height:38px; margin-bottom:-3px;
  transition:opacity .8s ease;
}
.cd-flame {
  width:18px; height:34px;
  background:radial-gradient(ellipse at 50% 75%,
    #fff3b0 0%, #ffc94d 45%, #e8842a 75%, transparent 100%);
  border-radius:50% 50% 50% 50% / 62% 62% 38% 38%;
  filter:blur(.6px);
  transform-origin:50% 100%;
  animation:cd-flicker 1.6s ease-in-out infinite alternate;
  box-shadow:0 0 24px 8px rgba(255,190,80,.35);
}
@keyframes cd-flicker {
  0%   { transform:scaleY(1)    rotate(-2deg); }
  30%  { transform:scaleY(1.12) rotate(2deg); }
  60%  { transform:scaleY(.94)  rotate(-1deg); }
  100% { transform:scaleY(1.06) rotate(3deg); }
}
.cd-flame-wrap.out { opacity:0; }

/* ---------- тело свечи ---------- */
.cd-body {
  width:48px; height:170px;             /* высоту меняет скрипт */
  background:linear-gradient(90deg, #f7ead2 0%, #fdf6e8 45%, #ecd9b8 100%);
  border:1px solid #d8c39a;
  border-radius:8px 8px 3px 3px;
  position:relative;
  transition:height .9s linear;
  overflow:visible;
}
.cd-body::before { /* фитиль */
  content:''; position:absolute;
  top:-8px; left:50%; transform:translateX(-50%);
  width:2px; height:10px; background:#5a4a38; border-radius:2px;
}
.cd-shine { /* блик */
  position:absolute; left:8px; top:8px; bottom:5px;
  width:5px; border-radius:4px;
  background:rgba(255,255,255,.55); filter:blur(1px);
}

/* неровная расплавленная верхушка */
.cd-melt {
  position:absolute; top:-6px; left:-3px; right:-3px; height:13px;
  background:#fdf6e8; border:1px solid #d8c39a;
  border-radius:50% 50% 45% 45% / 90% 90% 40% 40%;
  box-shadow:inset 0 -2px 3px rgba(216,195,154,.5);
}

/* ---------- капли воска: падают ровно до тарелки
   (дистанцию задаёт скрипт через --cd-fall) ---------- */
.cd-drop {
  position:absolute;
  width:8px; height:13px;
  background:#fdf6e8; border:1px solid #d8c39a;
  border-radius:50% 50% 60% 60%;
  animation:cd-drop 1.4s ease-in forwards;
  pointer-events:none;
}
@keyframes cd-drop {
  0%   { transform:translateY(0)                    scaleY(.6);  opacity:0; }
  15%  { transform:translateY(8px)                  scaleY(1);   opacity:1; }
  100% { transform:translateY(var(--cd-fall,150px)) scaleY(1.4); opacity:.85; }
}

/* ---------- тарелка-подсвечник: стоит на месте ---------- */
.cd-holder {
  width:120px; height:16px;
  background:linear-gradient(180deg, var(--accent), #8a5a3a);
  border-radius:0 0 14px 14px;
  box-shadow:0 5px 12px rgba(74,55,40,.28);
  z-index:1;
}

/* ---------- лужица воска на тарелке ---------- */
.cd-pool {
  position:absolute;
  bottom:13px; left:50%; transform:translateX(-50%);
  width:60px; height:14px;
  pointer-events:none;
}
.cd-wax {
  position:absolute; bottom:0;
  background:#fdf6e8; border:1px solid #d8c39a;
  border-radius:50% 50% 45% 45%;
  opacity:.95;
}
.cd-bg-night .cd-wax { background:#e8dcc4; }

/* ---------- догоревшая свеча — огарок ---------- */
.candle-zone.finnish .cd-body { height:26px !important; }

/* ============================================================
   ДОПОЛНЕНИЕ: раскладка и большая свеча
   ============================================================ */

/* настройки слева, сцена справа */
.cd-layout {
  display:grid;
  grid-template-columns:280px 1fr;
  gap:14px;
  align-items:start;
}
@media (max-width:860px) {
  .cd-layout { grid-template-columns:1fr; }
}
.cd-side {
  background:var(--surface2);
  border-radius:12px; padding:12px;
}
.cd-side .pane-head { margin-bottom:6px; }

/* сцена: большая, прижата к низу */
.cd-stage-big {
  display:flex; flex-direction:column;
  align-items:center; justify-content:flex-end;
  min-height:440px; position:relative;
  border-radius:14px;
  background:
    radial-gradient(circle at 50% 85%, rgba(255,205,120,.18), transparent 55%),
    linear-gradient(180deg, #fdf9f1 0%, #f3e7d3 76%, #d9b98c 76%, #c9a273 100%);
}
.cd-idle {
  font-size:12px; color:var(--muted); text-align:center;
  padding-bottom:40px;
}

/* большая свеча */
.cd-stage-big .cd-body { width:64px; }
.cd-stage-big .cd-flame { width:24px; height:44px; }
.cd-stage-big .cd-holder { width:150px; height:18px; }
.cd-stage-big .cd-pool { width:80px; }

/* капли для большой свечи */
.cd-stage-big .cd-drop { width:11px; height:18px; }
.cd-stage-big .cd-pool { min-height:18px; }
.cd-stage-big .cd-wax {
  box-shadow:0 -1px 3px rgba(160,130,80,.35);
}

/* время под свечой — крупное */
.cd-stage-big .gm-time { font-size:48px; }

/* ---------- фоны-сцены ---------- */
/* Ночь */
.cd-stage-big.cd-bg-night {
  background:
    radial-gradient(circle at 50% 80%, rgba(255,190,90,.22), transparent 55%),
    linear-gradient(180deg, #2b2536 0%, #3a3148 74%, #241f2e 74%, #1b1723 100%);
}
.cd-bg-night .cd-idle, .cd-bg-night .gm-time {
  color:#ffe9c4;
  text-shadow:0 0 12px rgba(255,190,80,.55);
}
.cd-bg-night .cd-flame { box-shadow:0 0 30px 12px rgba(255,190,80,.5); }
/* Мята */
.cd-stage-big.cd-bg-mint {
  background:
    radial-gradient(circle at 50% 85%, rgba(255,255,255,.3), transparent 55%),
    linear-gradient(180deg, #eef7f0 0%, #dcefe2 76%, #b9d9c2 76%, #9cc4a8 100%);
}
.cd-stage-big.cd-bg-mint .gm-time {
  color:#2e5e3d;
  text-shadow:0 1px 0 rgba(255,255,255,.5);
}
.cd-stage-big.cd-bg-mint .cd-idle { color:#4a7a58; }
/* Вечер */
.cd-stage-big.cd-bg-evening {
  background:
    radial-gradient(circle at 50% 80%, rgba(255,150,90,.28), transparent 55%),
    linear-gradient(180deg, #fce8d8 0%, #f6cdb0 74%, #d99a6c 74%, #b97a4e 100%);
}
.cd-stage-big.cd-bg-evening .gm-time {
  color:#7a3b1e;
  text-shadow:0 1px 0 rgba(255,255,255,.35);
}
.cd-stage-big.cd-bg-evening .cd-idle { color:#8a5a3a; }

/* базовый цвет времени и подсказки (дерево) */
.cd-stage-big .gm-time {
  color:var(--accent);
  text-shadow:0 1px 0 rgba(255,255,255,.65);
}

/* ---------- во весь экран (candle.html) ---------- */
.cd-scene:fullscreen {
  background:#fff;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
}
.cd-scene:fullscreen .cd-stage-big { min-height:78vh; width:100vw; border-radius:0; }
.cd-scene:fullscreen .candle-zone {
  transform:scale(1.3);
  transform-origin:center bottom;
}
.cd-scene:fullscreen .gm-time { font-size:60px; }
.cd-scene:fullscreen { position:relative; }
.cd-scene:fullscreen .cd-bgchips {
  position:absolute; left:16px; top:50%;
  transform:translateY(-50%);
  flex-direction:column; gap:8px;
  background:rgba(255,255,255,.85);
  padding:10px 8px; border-radius:14px;
  box-shadow:0 2px 12px rgba(74,55,40,.15);
}

/* ---------- плашки-награды в финале ---------- */
.cd-badges { display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin-top:10px; }
.cd-badge {
  font-size:13px; font-weight:700;
  padding:6px 14px; border-radius:999px;
  background:var(--accent-soft); color:var(--accent);
}
.cd-badge.green { background:rgba(79,158,88,.15); color:#3d7a45; }

/* ---------- статистика игры ---------- */
.gm-stats {
  font-size:10px; color:var(--muted);
  padding:2px 8px; border-radius:999px;
  background:var(--surface2);
  width:fit-content;
}

/* ---------- другие игры снизу ---------- */
.cd-others { margin-top:14px; }
.cd-others .gm-grid { grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); }
.cd-others .gm-card { padding:10px; }
.cd-others .gm-card .gm-emoji { font-size:26px; }
