/* Оверлей замка-диска (js/ui/dialLock.js). Все классы с префиксом dial-. */

.dial-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  pointer-events: auto;
  font-family: var(--font-hand);
  color: var(--ink);
}

.dial-overlay[hidden] {
  display: none;
}

.dial-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 36, 64, 0.6);
}

.dial-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 340px);
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 16px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 14px 18px 12px 16px / 16px 12px 18px 14px;
  box-shadow: 4px 5px 0 rgba(43, 42, 51, 0.35);
}

.dial-title {
  margin: 0;
  font-size: 22px;
  font-weight: bold;
  text-align: center;
  border-bottom: 3px solid var(--gold);
  padding: 0 6px 2px;
}

.dial-hint {
  margin: 0;
  min-height: 1.4em;
  font-size: 16px;
  text-align: center;
}

.dial-hint.dial-wrong {
  color: var(--red);
  font-weight: bold;
}

.dial-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
}

/* Колесо: размер диска, указатель и центр наследуют --dial-size. */
.dial-wheel {
  --dial-size: min(62vw, 46vh, 300px);
  position: relative;
  flex: none;
  width: var(--dial-size);
  height: var(--dial-size);
}

.dial-disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff8e6, var(--paper) 72%);
  border: 3px solid var(--gold);
  box-shadow: inset 0 0 0 2px var(--ink), 3px 4px 0 rgba(43, 42, 51, 0.3);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.dial-disc.dial-snap {
  transition: transform 150ms ease-out;
}

.dial-disc:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

.dial-tick {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.dial-digit {
  position: absolute;
  left: 50%;
  top: 7%;
  transform: translateX(-50%);
  font-size: calc(var(--dial-size) * 0.12);
  font-weight: bold;
  line-height: 1;
  color: var(--ink);
}

/* Указатель сверху, вне вращающегося диска. */
.dial-pointer {
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 22px solid var(--red);
  pointer-events: none;
  z-index: 2;
}

/* Выбранная цифра в центре, не вращается. */
.dial-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(var(--dial-size) * 0.36);
  height: calc(var(--dial-size) * 0.36);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: rgba(255, 250, 235, 0.9);
  font-size: calc(var(--dial-size) * 0.22);
  font-weight: bold;
  color: var(--red);
  pointer-events: none;
}

.dial-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.dial-cells {
  display: flex;
  gap: 8px;
}

.dial-cell {
  width: 46px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: bold;
  background: #fffdf6;
  border: 2px solid var(--ink);
  border-radius: 8px 10px 7px 9px;
}

.dial-cell.dial-empty {
  color: rgba(43, 42, 51, 0.35);
}

.dial-cell.dial-ok {
  background: var(--gold);
  animation: dial-flash 0.3s ease-in-out 2;
}

.dial-cell.dial-pop {
  animation: dial-pop 0.25s ease-out;
}

.dial-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.dial-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 14px;
  font-family: var(--font-hand);
  font-size: 16px;
  color: var(--ink);
  background: #fffdf6;
  border: 2px solid var(--ink);
  border-radius: 12px 14px 10px 13px;
  cursor: pointer;
  touch-action: manipulation;
}

.dial-btn:active {
  transform: translateY(1px);
}

.dial-btn-enter {
  background: var(--gold);
}

.dial-btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.dial-card.dial-shake {
  animation: dial-shake 0.45s ease-in-out;
}

@keyframes dial-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-7px); }
  80% { transform: translateX(4px); }
}

@keyframes dial-pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes dial-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(233, 185, 73, 0); }
  50% { box-shadow: 0 0 0 6px rgba(233, 185, 73, 0.7); }
}

/* Короткий альбом (812×375): диск слева, ячейки и кнопки справа. */
@media (max-height: 480px) and (orientation: landscape) {
  .dial-card {
    width: min(94vw, 680px);
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px;
  }

  .dial-title {
    font-size: 18px;
  }

  .dial-hint {
    font-size: 14px;
  }

  .dial-body {
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding-top: 10px;
  }

  .dial-side {
    gap: 12px;
  }

  .dial-cell {
    width: 40px;
    height: 46px;
    font-size: 24px;
  }
}
