* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1025;
  color: #fff;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* ---------- Экран-замок ---------- */

#lock-screen {
  background: radial-gradient(120% 100% at 50% 0%, #3b1d4f 0%, #1a1025 70%);
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s, transform 0.6s;
}

#lock-screen.unlocking {
  opacity: 0;
  transform: scale(1.08);
}

.floating-hearts {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.floating-hearts span {
  position: absolute;
  bottom: -40px;
  opacity: 0;
  animation: float-up linear infinite;
}

@keyframes float-up {
  0%   { transform: translateY(0) rotate(-8deg); opacity: 0; }
  10%  { opacity: 0.5; }
  90%  { opacity: 0.3; }
  100% { transform: translateY(-110vh) rotate(8deg); opacity: 0; }
}

.lock-content {
  position: relative;
  text-align: center;
  padding: 32px 28px;
  max-width: 360px;
  width: 100%;
}

.lock-emoji {
  font-size: 64px;
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

.lock-title {
  margin-top: 16px;
  font-size: 30px;
  line-height: 1.2;
  background: linear-gradient(90deg, #fbc2eb, #f8b195);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lock-subtitle {
  margin-top: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
}

.lock-question {
  margin-top: 36px;
  font-size: 18px;
  font-weight: 600;
}

#lock-form {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#lock-input {
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}

#lock-input:focus {
  border-color: #fbc2eb;
}

#lock-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

#lock-input.shake {
  animation: shake 0.45s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

#lock-btn {
  padding: 14px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  color: #2b0f3a;
  background: linear-gradient(90deg, #fbc2eb, #f8b195);
  transition: transform 0.15s;
}

#lock-btn:active {
  transform: scale(0.97);
}

.lock-error {
  margin-top: 14px;
  min-height: 20px;
  font-size: 14px;
  color: #ff9d9d;
}

/* ---------- Категории ---------- */

#categories-screen {
  background: radial-gradient(120% 100% at 50% 0%, #3b1d4f 0%, #1a1025 70%);
  overflow-y: auto;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
}

.cat-header {
  text-align: center;
  margin-bottom: 24px;
}

.cat-header h1 {
  font-size: 26px;
  line-height: 1.2;
  background: linear-gradient(90deg, #fbc2eb, #f8b195);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cat-header p {
  margin-top: 8px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
}

.cat-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

.cat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 20px 22px;
  border-radius: 20px;
  color: #fff;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s;
}

.cat-card:active {
  transform: scale(0.97);
}

.cat-card-emoji {
  font-size: 32px;
}

.cat-card-title {
  font-size: 20px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.cat-card-count {
  font-size: 13px;
  opacity: 0.85;
}

.cat-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
}

/* ---------- Сторис ---------- */

.story-screen {
  background: #000;
}

.story-bg {
  position: absolute;
  inset: 0;
  transition: background 0.4s;
}

.story-top {
  position: relative;
  z-index: 3;
  padding: calc(12px + env(safe-area-inset-top)) 14px 0;
}

.story-progress {
  display: flex;
  gap: 4px;
}

.story-seg {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
  transition: background 0.25s;
}

.story-seg.filled {
  background: #fff;
}

.story-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.story-cat-title {
  font-size: 15px;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.story-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 16px;
}

.story-slide {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 20px 32px;
  text-align: center;
}

.story-slide.slide-in {
  animation: slide-in 0.35s ease-out;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.story-emoji {
  font-size: 88px;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.3));
}

.story-text {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.35;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.story-chosen-badge {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 13px;
}

.story-bottom {
  position: relative;
  z-index: 3;
  padding: 0 24px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.choose-btn {
  width: 100%;
  max-width: 340px;
  padding: 16px;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 700;
  color: #2b0f3a;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s, opacity 0.2s;
}

.choose-btn:active {
  transform: scale(0.97);
}

.choose-btn:disabled {
  opacity: 0.6;
}

.story-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

.tap-zone {
  position: absolute;
  top: 90px;
  bottom: 130px;
  z-index: 2;
}

.tap-left {
  left: 0;
  width: 33%;
}

.tap-right {
  right: 0;
  width: 67%;
}

/* ---------- Оверлей успеха ---------- */

.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 5, 18, 0.75);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  overflow: hidden;
}

.success-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.success-card {
  position: relative;
  z-index: 2;
  max-width: 340px;
  width: 100%;
  padding: 32px 26px;
  border-radius: 24px;
  background: linear-gradient(160deg, #3b1d4f, #241333);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.success-overlay.show .success-card {
  transform: scale(1);
}

.success-emoji {
  font-size: 56px;
}

.success-title {
  margin-top: 12px;
  font-size: 22px;
  font-weight: 700;
}

.success-text {
  margin-top: 12px;
  font-size: 16px;
  color: #fbc2eb;
  line-height: 1.4;
}

.success-note {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.6);
}

.success-close {
  margin-top: 22px;
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  color: #2b0f3a;
  background: linear-gradient(90deg, #fbc2eb, #f8b195);
}

.burst-heart {
  position: absolute;
  bottom: -30px;
  z-index: 1;
  animation: burst-up 2.4s ease-out forwards;
  pointer-events: none;
}

@keyframes burst-up {
  0%   { transform: translateY(0) rotate(-10deg); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translateY(-90vh) rotate(12deg); opacity: 0; }
}
