/* 🌙 Ночная экспедиция: карта мира, сцена, книга, сундуки.
   Те же переменные и приёмы, что во всей игре — новой палитры здесь нет. */

/* ---------------------------------------------------------- карта мира */

/* Шапка компактная: карта должна занимать экран, а не ютиться под панелью. */
.world-head { padding: 10px 14px; margin-bottom: 8px; }
.world-head .path-title { font-size: 16px; letter-spacing: 2.4px; }
.world-head .path-sub { margin: 2px 0 6px; font-size: 11.5px; }
.world-abilities { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ability-chip {
  font-size: 11px; padding: 4px 9px; border-radius: 999px;
  background: rgba(255, 138, 205, .12); border: 1px solid rgba(255, 138, 205, .25);
  color: var(--ink);
}

.world-box {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--panel-line); background: #0a0712;
  height: calc(100vh - var(--tabbar-h) - var(--safe-b) - 132px); min-height: 420px;
  touch-action: none;                 /* карту тащим сами, страница не едет */
}
#worldCanvas { display: block; width: 100%; height: 100%; touch-action: none; }

.world-tools { position: absolute; right: 10px; top: 10px; display: grid; gap: 6px; }
.world-tool {
  width: 38px; height: 38px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--panel-line); background: rgba(16, 10, 26, .82);
  color: var(--ink); font-size: 17px; line-height: 1;
}
.world-tool:active { transform: scale(.94); }

.world-card {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 3;
  padding: 13px 14px; border-radius: var(--radius);
  background: rgba(14, 9, 22, .95); border: 1px solid var(--panel-line);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
}
.world-card-top { display: flex; align-items: flex-start; gap: 10px; }
.world-card-emoji { font-size: 26px; line-height: 1; }
.world-card-name { font-family: var(--serif); font-size: 17px; font-weight: 700; }
.world-card-sub { font-size: 11.5px; color: var(--ink-dim); margin-top: 2px; }
.world-card-close {
  margin-left: auto; background: none; border: none; color: var(--ink-faint);
  font-size: 15px; cursor: pointer;
}
.world-card-line { font-size: 12.5px; margin-top: 8px; }
.world-reqs { display: grid; gap: 5px; margin-top: 9px; }
.world-req {
  display: flex; justify-content: space-between; gap: 10px; font-size: 12px;
  padding: 6px 9px; border-radius: 10px; background: rgba(255, 255, 255, .04);
  color: var(--ink-dim);
}
.world-req.done { color: #8fd98f; background: rgba(103, 217, 139, .1); }
.world-go { width: 100%; margin-top: 11px; }
.world-tip { font-size: 11px; color: var(--ink-faint); text-align: center; padding: 9px 0 2px; }

/* --------------------------------------------------------------- сцена */

.scene {
  position: fixed; inset: 0; z-index: 60; background: #07050c;
  touch-action: none; overscroll-behavior: none; user-select: none;
}
.scene-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.scene-top {
  position: absolute; left: 0; right: 0; top: 0; padding: 13px 16px 10px;
  background: linear-gradient(to bottom, rgba(7, 5, 12, .9), transparent);
  pointer-events: none;
}
.scene-name { font-family: var(--serif); font-size: 17px; font-weight: 700; color: #fff; }
.scene-sub { font-size: 11px; color: var(--ink-dim); margin-bottom: 7px; }
.scene-bar {
  height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .12); overflow: hidden;
}
.scene-bar-fill {
  height: 100%; width: 0; background: linear-gradient(90deg, #ff7ab0, #c9a8ff);
  transition: width .3s ease;
}
.scene-bar-text { font-size: 10px; color: var(--ink-faint); margin-top: 3px; }
.scene-close {
  position: absolute; right: 10px; top: 10px; pointer-events: auto;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--panel-line);
  background: rgba(20, 12, 28, .8); color: var(--ink-dim); font-size: 15px; cursor: pointer;
}
.scene-hint {
  position: absolute; left: 0; right: 0; bottom: 14px; text-align: center;
  font-size: 10.5px; color: var(--ink-faint); pointer-events: none;
}

/* Кнопки действия на весь экран больше нет: подсказка рисуется прямо над
   объектом, к которому подошёл, и гаснет, когда отходишь. */

/* Механизм: кольца крутятся руками, видно, как они стоят. */
.dial-row { display: flex; gap: 9px; flex-wrap: wrap; justify-content: center; }
.dial-ring {
  width: 88px; padding: 10px 0; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--panel-line); background: rgba(255, 255, 255, .05);
  color: var(--ink); display: grid; gap: 4px; justify-items: center;
}
.dial-ring:active { transform: scale(.95); }
.dial-marks { font-size: 17px; letter-spacing: 2px; color: var(--pink); line-height: 1; }
.dial-num { font-size: 9.5px; color: var(--ink-faint); }
.dial-row .primary-btn { flex: 1 0 100%; margin-top: 6px; }

.scene-panel {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: end center;
  background: rgba(6, 4, 12, .55); padding: 16px;
}
.scene-panel-card {
  position: relative; width: 100%; max-width: 520px; margin-bottom: 18px;
  padding: 16px 16px 14px; border-radius: var(--radius);
  background: rgba(16, 10, 26, .97); border: 1px solid var(--panel-line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6);
}
.scene-panel-close {
  position: absolute; right: 10px; top: 8px; background: none; border: none;
  color: var(--ink-faint); font-size: 15px; cursor: pointer;
}
.scene-panel-title { font-family: var(--serif); font-size: 17px; font-weight: 700; }
.scene-panel-text { font-size: 12.5px; color: var(--ink-dim); margin: 4px 0 10px; }

.lantern-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lantern-btn {
  width: 48px; height: 58px; border-radius: 12px; cursor: pointer; font-size: 15px;
  border: 1px solid var(--panel-line); background: rgba(255, 255, 255, .05); color: var(--ink);
}
.lantern-btn.lit {
  background: radial-gradient(circle at 50% 35%, rgba(255, 180, 100, .55), rgba(255, 180, 100, .1));
  border-color: rgba(255, 180, 100, .6); color: #fff;
}
.seal-line { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.seal-slot {
  width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; border: 1px dashed var(--panel-line); color: var(--ink-faint);
}
.seal-slot.filled { border-style: solid; border-color: var(--pink); color: #fff; }
.seal-grid { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 10px; }
.seal-btn {
  width: 58px; height: 62px; border-radius: 12px; cursor: pointer; padding: 4px 0;
  border: 1px solid var(--panel-line); background: rgba(255, 255, 255, .05); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.seal-kanji { font-size: 21px; line-height: 1; }
.seal-word { font-size: 9.5px; color: var(--ink-faint); letter-spacing: .3px; }
.seal-btn:active { transform: scale(.94); }
.find-list { display: grid; gap: 7px; margin-bottom: 12px; }
.find-line { font-size: 13px; display: flex; align-items: center; gap: 7px; }
.find-line b { color: var(--pink); }

/* --------------------------------------------------------------- книга */

.book-region { padding: 13px 15px; margin-bottom: 10px; }
.book-region.locked { opacity: .55; }
.book-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.book-emoji { font-size: 22px; }
.book-name { font-family: var(--serif); font-size: 16px; font-weight: 700; }
.book-sub { font-size: 11px; color: var(--ink-dim); }
.book-head .pill { margin-left: auto; }
.book-groups { display: flex; flex-wrap: wrap; gap: 7px; margin: 9px 0; }
.book-group {
  font-size: 11px; padding: 4px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .05); color: var(--ink-dim);
}
.book-group b { color: var(--ink); }
.book-quest {
  margin-top: 9px; padding: 9px 11px; border-radius: 12px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--panel-line);
}
.book-quest.done { border-color: rgba(103, 217, 139, .35); }
.book-quest-name { font-size: 13px; font-weight: 700; }
.book-quest-text { font-size: 11.5px; color: var(--ink-dim); margin: 3px 0 6px; }
.book-step { font-size: 12px; color: var(--ink-faint); padding: 1px 0; }
.book-step.done { color: #8fd98f; }
.book-hint {
  margin-top: 10px; font-size: 12px; color: #ffd24a; font-style: italic;
}

/* ------------------------------------------------------------- сундуки */

.keys-panel { padding: 14px 16px; margin-bottom: 12px; }
.keys-row { display: flex; align-items: baseline; gap: 9px; margin-bottom: 6px; }
.keys-big { font-size: 17px; }
.keys-big b { font-size: 21px; color: var(--pink); }
.keys-panel .primary-btn { width: 100%; margin-top: 10px; }

.chest-card { padding: 14px 16px; margin-bottom: 12px; }
.chest-head { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 10px; }
.chest-emoji { font-size: 27px; line-height: 1; }
.chest-name { font-family: var(--serif); font-size: 16px; font-weight: 700; }
.chest-sub { font-size: 11.5px; color: var(--ink-dim); margin-top: 2px; }
.chest-drops { display: grid; gap: 5px; margin-bottom: 12px; }
.drop-line {
  display: flex; align-items: center; gap: 7px; font-size: 12px;
  padding: 6px 9px; border-radius: 10px; background: rgba(255, 255, 255, .04);
}
.drop-line span { flex: 1 1 auto; color: var(--ink-dim); }
.drop-line b { color: var(--ink); font-size: 11.5px; }
.drop-chance {
  flex: 0 0 auto !important; color: var(--pink) !important; font-weight: 700; font-size: 11px;
}
.chest-card .primary-btn { width: 100%; }
.chest-card.locked { opacity: .78; }
.chest-lock {
  font-size: 11.5px; color: #ffb020; text-align: center; margin-bottom: 10px;
}

/* --------------------------------------------------- открытие сундука */

.chest-scene {
  position: fixed; inset: 0; z-index: 70; background: #06040c;
  touch-action: none; overscroll-behavior: none; user-select: none;
}
.chest-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.chest-top {
  position: absolute; left: 0; right: 0; top: 0; padding: 14px 16px 10px;
  text-align: center; pointer-events: none;
}
.chest-title { font-family: var(--serif); font-size: 19px; font-weight: 700; color: #fff; }
.chest-sub { font-size: 11.5px; color: var(--ink-dim); margin-top: 2px; }
.chest-close {
  position: absolute; right: 10px; top: 10px; pointer-events: auto;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--panel-line);
  background: rgba(20, 12, 28, .8); color: var(--ink-dim); font-size: 15px; cursor: pointer;
}
.chest-hint {
  position: absolute; left: 0; right: 0; bottom: 96px; text-align: center;
  font-size: 12.5px; color: #fff; pointer-events: none; padding: 0 20px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .8);
}
.chest-hint.quiet { color: var(--ink-faint); font-size: 11px; }

/* Награда: вещи вылетают по одной и складываются снизу вверх. */
.chest-prizes {
  position: absolute; left: 12px; right: 12px; bottom: 124px; z-index: 2;
  display: grid; gap: 7px; max-height: 42vh; overflow: hidden;
}
.chest-prize {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 14px; background: rgba(16, 10, 26, .92);
  border: 1px solid var(--panel-line);
  animation: prize-in .34s cubic-bezier(.2, 1.5, .4, 1) both;
}
.chest-prize-art {
  width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 10px; background: color-mix(in srgb, var(--tone) 16%, transparent);
}
.chest-prize-icon { width: 24px; height: 24px; }
.chest-prize-main { display: flex; flex-direction: column; min-width: 0; }
.chest-prize-main b { font-size: 13.5px; font-weight: 700; }
.chest-prize-main i { font-style: normal; font-size: 10.5px; color: var(--ink-faint); }
.chest-prize-qty { margin-left: auto; font-weight: 800; font-size: 14px; color: var(--ink); }
/* Редкая находка — главное событие открытия, её видно сразу. */
.chest-prize.rare {
  border-color: color-mix(in srgb, var(--tone, #ffd24a) 60%, transparent);
  box-shadow: 0 0 26px color-mix(in srgb, var(--tone, #ffd24a) 28%, transparent);
  animation: prize-in .34s cubic-bezier(.2, 1.5, .4, 1) both, prize-pulse 1.6s ease 2;
}
.chest-prize.rare .chest-prize-qty { color: #fff; }
@keyframes prize-in {
  from { opacity: 0; transform: translateY(22px) scale(.86); }
  to   { opacity: 1; transform: none; }
}
@keyframes prize-pulse {
  0%, 100% { box-shadow: 0 0 26px color-mix(in srgb, var(--tone, #ffd24a) 22%, transparent); }
  50%      { box-shadow: 0 0 44px color-mix(in srgb, var(--tone, #ffd24a) 50%, transparent); }
}

.chest-actions {
  position: absolute; left: 14px; right: 14px; bottom: 22px; z-index: 3;
  display: flex; gap: 9px;
}
.chest-actions button { flex: 1 1 0; }

@media (max-width: 360px) {
  .world-box { height: calc(100vh - var(--tabbar-h) - 190px); }
  .seal-slot, .seal-btn { width: 46px; height: 46px; font-size: 19px; }
}
