/* ═══════════════════════════════════════════════════
   СЕЙФ — combination lock game
═══════════════════════════════════════════════════ */

/* ── Safe top row: flex row, column hidden during setup ── */
.safe-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}

/* ── Canvas wrap ────────────────────────────────── */
.safe-scene {
  position: relative;
  height: auto;
  aspect-ratio: 16 / 10;
  max-height: min(50vh, calc(100vw - 28px));
  width: 100%;
  margin: 0;
  min-width: 0;
  border-radius: var(--ld-r-card, 16px);
  overflow: hidden;
  perspective: 900px;
  box-shadow: 0 0 0 1px rgba(95,245,223,.10), 0 10px 40px rgba(0,0,0,.55);
  transition: box-shadow .3s;
}

/* ── Цифры ввода — прямо в LCD-экранчике, нарисованном на двери canvas'ом ── */
.safe-door-slots {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  pointer-events: none;
}
.safe-door-slot {
  min-width: 10px;
  text-align: center;
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  line-height: 1;
  color: rgba(255,90,90,.35);
  border-bottom: 2px solid rgba(255,90,90,.22);
  padding-bottom: 1px;
}
.safe-door-slot.filled {
  color: #7be8ff;
  border-bottom-color: rgba(123,232,255,.6);
  text-shadow: 0 0 6px currentColor;
}
.safe-scene.won {
  box-shadow: 0 0 0 1px rgba(255,200,58,.35),
              0 0 40px rgba(255,180,0,.30),
              0 10px 40px rgba(0,0,0,.55);
}
.safe-scene.fail {
  box-shadow: 0 0 0 1px rgba(255,60,60,.4),
              0 0 30px rgba(255,0,0,.20),
              0 10px 40px rgba(0,0,0,.55);
  transition: box-shadow .08s;
}

/* Gold light leak from behind the door on win */
.safe-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
  border-radius: inherit;
  z-index: 3;
  transition: background .5s .25s;
}
.safe-scene.won::before {
  background: radial-gradient(ellipse at 4% 50%,
    rgba(255,210,58,.55) 0%, rgba(255,140,0,.22) 45%, transparent 72%);
}

.safe-canvas-wrap {
  width: 100%; height: 100%;
  transform-origin: left center;
  transition: transform .75s cubic-bezier(.3,.1,.2,1);
  will-change: transform;
}
.safe-canvas-wrap.opening {
  transform: rotateY(-74deg) scaleX(.82);
}

@keyframes safeShake {
  0%,100% { transform: translateX(0); }
  15%     { transform: translateX(-9px); }
  35%     { transform: translateX(9px); }
  55%     { transform: translateX(-6px); }
  75%     { transform: translateX(4px); }
}
.safe-canvas-wrap.shake { animation: safeShake .40s ease-in-out; }

@keyframes safeFlashFade {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

#safe-canvas { display: block; width: 100%; height: 100%; }

/* Interior revealed when door opens */
.safe-interior {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 40% 50%,
    rgba(40,18,60,.97) 0%, rgba(8,5,18,1) 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
  opacity: 0;
  transform: scale(.9);
  transition: opacity .35s .52s, transform .5s .45s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
  z-index: 2;
}
.safe-interior.show { opacity: 1; transform: scale(1); }
.safe-interior-label {
  font-family: var(--ld-font-ui, sans-serif);
  font-size: 11px; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase;
  color: rgba(255,200,58,.65);
  text-shadow: 0 0 12px rgba(255,200,58,.35);
}
.safe-interior-mult {
  font-family: var(--ld-font-display, 'Unbounded', sans-serif);
  font-weight: 800; font-style: italic;
  font-size: 52px; line-height: 1;
  background: var(--ld-holo, linear-gradient(120deg,#5FF5DF,#A98BFF,#F58BF0));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(95,245,223,.55));
}
.safe-interior-mult.lose {
  background: linear-gradient(120deg,#556,#334);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: none;
}
.safe-interior-payout {
  font-size: 20px; font-weight: 800;
  color: var(--ld-star, #FFC83A);
  text-shadow: 0 0 14px rgba(255,200,58,.5);
}

/* Floating star particles inside interior */
.safe-interior-stars {
  position: absolute; inset: 0;
  pointer-events: none; overflow: hidden;
}
@keyframes safeStarFloat {
  0%   { transform: translateY(0) scale(1);   opacity: 0; }
  12%  { opacity: .9; }
  100% { transform: translateY(-90px) scale(.3); opacity: 0; }
}
.safe-star-p {
  position: absolute;
  bottom: 15%;
  animation: safeStarFloat 1.6s ease-in forwards;
}

/* ── Divider ────────────────────────────────────── */
.safe-divider {
  height: 1px;
  margin: 6px 14px 0;
  background: linear-gradient(90deg,
    transparent, rgba(95,245,223,.18) 50%, transparent);
}

/* ── Action area ────────────────────────────────── */
.safe-action { padding: 8px 14px 6px; }

/* Difficulty picker */
.safe-diff-row {
  display: flex; gap: 8px; margin-bottom: 8px;
}
.safe-diff-btn {
  flex: 1; padding: 7px 4px;
  border: 1.5px solid rgba(95,245,223,.22);
  border-radius: 12px;
  background: rgba(95,245,223,.04);
  color: rgba(255,255,255,.6);
  font-family: var(--ld-font-display, 'Unbounded', sans-serif);
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-align: center; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  -webkit-tap-highlight-color: transparent;
}
.safe-diff-btn .safe-diff-n {
  font-size: 18px; font-weight: 800;
  background: var(--ld-holo, linear-gradient(120deg,#5FF5DF,#A98BFF));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1;
}
.safe-diff-btn.active {
  border-color: rgba(95,245,223,.65);
  background: rgba(95,245,223,.10);
  color: #fff;
  box-shadow: 0 0 14px rgba(95,245,223,.18);
}
.safe-diff-btn:active { opacity: .75; }
.safe-diff-mult {
  font-size: 11px; font-weight: 800;
  color: var(--ld-star, #FFC83A);
  letter-spacing: .02em;
  margin-top: 1px;
}

/* Tries hint */
.safe-tries-hint {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-bottom: 8px;
  padding: 5px 14px;
  border-radius: 10px;
  background: rgba(95,245,223,.06);
  border: 1px solid rgba(95,245,223,.14);
}
.safe-tries-hint-icon { font-size: 13px; }
.safe-tries-hint span:last-child {
  font-family: var(--ld-font-ui, sans-serif);
  font-size: 12px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: rgba(95,245,223,.7);
}

/* Bet input */
.safe-bet-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.safe-bet-label {
  font-size: 10px; font-weight: 700;
  color: rgba(95,245,223,.6);
  letter-spacing: 1.1px; text-transform: uppercase;
  white-space: nowrap;
}
.safe-bet-wrap { position: relative; flex: 1; }
.safe-bet-wrap input {
  width: 100%;
  background: rgba(95,245,223,.04);
  border: 1px solid rgba(95,245,223,.16);
  border-radius: 10px;
  padding: 8px 12px 8px 30px;
  color: var(--ld-text, #e8eaf6);
  font-size: 16px; font-weight: 700;
  outline: none; font-feature-settings: "tnum";
  transition: border-color .2s;
}
.safe-bet-wrap input:focus { border-color: rgba(95,245,223,.45); }
.safe-bet-star {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%); font-size: 13px; pointer-events: none;
}
.safe-start-btn {
  width: 100%; padding: 12px;
  border: none; border-radius: var(--ld-r-btn, 14px);
  background: var(--ld-holo, linear-gradient(120deg,#5FF5DF,#5BB8FF,#A98BFF));
  color: var(--ld-on-holo, #0d0f1a);
  font-family: var(--ld-font-display, 'Unbounded', sans-serif);
  font-weight: 800; font-style: italic;
  font-size: 16px; letter-spacing: .06em;
  cursor: pointer;
  box-shadow: var(--ld-glow-btn, 0 4px 22px rgba(95,245,223,.3));
  transition: transform .1s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.safe-start-btn:active { transform: scale(.97); }
.safe-start-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

/* ── Game panel ─────────────────────────────────── */

/* Guess history — horizontal row of attempts */
.safe-history {
  display: flex; flex-direction: row;
  flex-wrap: wrap;
  gap: 0;
  align-items: center;
  align-content: flex-start;
  margin-bottom: 8px;
  min-height: 0;
  overflow: visible;
}
.safe-guess-row {
  display: flex; align-items: center; gap: 3px;
  padding: 4px 10px 4px 0;
  margin-right: 10px;
  border-right: 1px solid rgba(95,245,223,.18);
}
.safe-guess-row:last-child {
  border-right: none;
  margin-right: 0;
  padding-right: 0;
}
.safe-guess-syms {
  display: flex; gap: 3px;
}
.safe-guess-chip {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900;
  font-family: var(--ld-font-display, 'Unbounded', sans-serif);
  border: 1.5px solid;
  flex-shrink: 0;
}

/* Code reveal strip (shown on game end) */
.safe-code-reveal {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 10px;
  margin-bottom: 8px;
  background: rgba(255,200,58,.06);
  border: 1px solid rgba(255,200,58,.18);
  border-radius: 10px;
}
.safe-code-reveal-label {
  font-family: var(--ld-font-ui, sans-serif);
  font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255,200,58,.7);
  white-space: nowrap;
}
.safe-feedback {
  display: flex; flex-direction: column; gap: 3px;
  margin-left: 8px; flex: 1;
  justify-content: center;
}
.safe-fb-bull, .safe-fb-cow, .safe-fb-miss {
  font-family: var(--ld-font-ui, sans-serif);
  font-size: 11px; font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.3;
}
.safe-fb-bull  { color: #44ee88; }
.safe-fb-cow   { color: #FFC83A; }
.safe-fb-miss  { color: rgba(255,255,255,.3); }

/* Symbol keyboard */
.safe-keyboard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-bottom: 8px;
}
.safe-sym-btn {
  padding: 11px 0;
  border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.82);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900;
  font-family: var(--ld-font-display, 'Unbounded', sans-serif);
  letter-spacing: -.02em;
  transition: transform .1s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.safe-sym-btn:active { transform: scale(.88); background: rgba(255,255,255,.12); }

/* Action row */
.safe-action-row {
  display: flex; gap: 8px;
}
.safe-delete-btn {
  padding: 13px 16px;
  border: 1.5px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.6);
  font-size: 18px; cursor: pointer;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.safe-delete-btn:active { background: rgba(255,255,255,.10); }
.safe-submit-btn {
  flex: 1; padding: 13px;
  border: none; border-radius: 12px;
  background: var(--ld-holo, linear-gradient(120deg,#5FF5DF,#5BB8FF,#A98BFF));
  color: var(--ld-on-holo, #0d0f1a);
  font-family: var(--ld-font-display, 'Unbounded', sans-serif);
  font-weight: 800; font-size: 14px; letter-spacing: .06em;
  cursor: pointer;
  transition: transform .1s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.safe-submit-btn:active { transform: scale(.97); }
.safe-submit-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

/* Inline combo (shown right of tries dots on game end) */
.safe-combo-inline {
  display: flex; gap: 5px; align-items: center; margin-left: auto;
}
.safe-combo-chip {
  width: 28px; height: 28px;
  border-radius: 7px;
  border: 1.5px solid;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ld-font-display, 'Unbounded', sans-serif);
  font-size: 13px; font-weight: 900;
  flex-shrink: 0;
}

/* Result / again buttons */
.safe-result-row {
  display: flex; gap: 8px; margin-top: 6px;
}
.safe-again-btn {
  flex: 1; padding: 14px;
  border: 1px solid var(--ld-panel-border, rgba(95,245,223,.18));
  border-radius: 12px;
  background: var(--ld-panel, rgba(255,255,255,.04));
  color: var(--ld-text, #e8eaf6);
  font-family: var(--ld-font-display, 'Unbounded', sans-serif);
  font-weight: 800; font-style: italic;
  font-size: 15px; cursor: pointer;
  transition: transform .1s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.safe-again-btn:active { transform: scale(.97); background: rgba(95,245,223,.07); }

/* Tries indicator (shown in game panel header) */
.safe-tries-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.safe-tries-label {
  font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,.35);
  letter-spacing: .12em; text-transform: uppercase;
}
.safe-tries-dots {
  display: flex; gap: 4px;
}
.safe-try-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(95,245,223,.25);
  transition: background .2s;
}
.safe-try-dot.used { background: rgba(255,80,80,.6); }
.safe-try-dot.active { background: rgba(95,245,223,.9); box-shadow: 0 0 5px rgba(95,245,223,.6); }

/* ── How-to button & modal ──────────────────────── */
.safe-howto-btn {
  width: 100%; margin-bottom: 8px;
  padding: 8px;
  border: 1.5px solid rgba(95,245,223,.22);
  border-radius: 12px;
  background: rgba(95,245,223,.05);
  color: rgba(95,245,223,.75);
  font-family: var(--ld-font-display, 'Unbounded', sans-serif);
  font-weight: 700; font-size: 11px; letter-spacing: .1em;
  cursor: pointer;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.safe-howto-btn:active { background: rgba(95,245,223,.12); }

.safe-rules-section { margin-bottom: 16px; }
.safe-rules-label {
  font-size: 9px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase;
  color: rgba(95,245,223,.55); margin-bottom: 8px;
}
.safe-rules-text {
  font-size: 13px; color: rgba(255,255,255,.75); line-height: 1.6;
}
.safe-rules-fb-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.safe-rules-fb-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
}
.safe-rules-fb-dot.bull { background: #44ee88; box-shadow: 0 0 6px rgba(68,238,136,.5); }
.safe-rules-fb-dot.cow  { background: #FFC83A; box-shadow: 0 0 6px rgba(255,200,58,.5); }
.safe-rules-fb-text { font-size: 13px; color: rgba(255,255,255,.82); line-height: 1.4; }
.safe-rules-fb-text strong { color: #fff; font-weight: 700; }
.safe-rules-diff-table { width: 100%; border-collapse: collapse; }
.safe-rules-diff-table td {
  padding: 7px 6px; font-size: 12px;
  border-bottom: 1px solid rgba(95,245,223,.08);
  color: rgba(255,255,255,.75);
}
.safe-rules-diff-table td:first-child { font-weight: 700; color: #fff; }
.safe-rules-diff-table td:last-child {
  text-align: right;
  font-family: var(--ld-font-display, 'Unbounded', sans-serif);
  font-size: 13px; font-weight: 800;
  background: var(--ld-holo, linear-gradient(120deg,#5FF5DF,#A98BFF));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.safe-rules-example {
  background: rgba(95,245,223,.05);
  border: 1px solid rgba(95,245,223,.12);
  border-radius: 12px;
  padding: 12px;
}
.safe-rules-ex-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.safe-rules-ex-row:last-child { margin-bottom: 0; }
.safe-rules-ex-chips { display: flex; gap: 4px; }
.safe-rules-ex-chip {
  width: 26px; height: 26px; border-radius: 7px; border: 1.5px solid;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ld-font-display, 'Unbounded', sans-serif);
  font-size: 11px; font-weight: 900; flex-shrink: 0;
}
.safe-rules-ex-fb {
  font-size: 11px; color: rgba(255,255,255,.5); flex: 1;
}
.safe-rules-ex-fb span { font-weight: 700; }
.safe-rules-ex-fb .g { color: #44ee88; }
.safe-rules-ex-fb .y { color: #FFC83A; }
.safe-rules-swatch {
  width: 32px; height: 32px; border-radius: 9px; font-size: 13px;
}
