:root {
  --phone-w: min(360px, 90dvw, calc((100dvh - 80px) * 360 / 760));
  --phone-h: calc(var(--phone-w) * 760 / 360);
  --ios-bg: #e1e4ea;
  --ios-dark: #111827;
  --ios-text: #f7f9ff;
}

html,
body {
  width: 100%;
  overflow: hidden;
  height: 100%;
  background: #454a57;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #454a57;
  font-family: "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  overflow: hidden;
}

.scene {
  width: 100%;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  background: transparent;
}

.phone-shell {
  position: relative;
  width: 90%;
  max-width: 360px;
  min-width: 280px;
  height: var(--phone-h);
  border-radius: 40px;
  background: #30333b;
  padding: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: floatIn 0.6s ease;
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.screen,
.app-screen {
  position: absolute;
  inset: 0;
  border-radius: 38px;
  overflow: hidden;
}

.screen {
  z-index: 1;
}

.app-screen {
  z-index: 1;
}

.app-screen.active,
.app-screen.closing {
  z-index: 15;
}

.view {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 240ms ease,
    visibility 0s linear 240ms;
}

.view.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 240ms ease,
    visibility 0s linear 0s;
}

.phone-shell.unlocking-transition .view {
  transition:
    opacity 700ms ease,
    visibility 0s linear 700ms;
}

.phone-shell.unlocking-transition .view.active {
  transition:
    opacity 700ms ease,
    visibility 0s linear 0s;
}

.screen.active {
  z-index: 5;
}

#lockScreen.active {
  z-index: 20;
}

#homeScreen.active {
  z-index: 5;
}

.app-screen.closing {
  opacity: 0;
  visibility: visible;
  pointer-events: none;
  transition: opacity 240ms ease, visibility 0s linear 0s;
}

.lock-screen {
  background: linear-gradient(180deg, #2f3440 0%, #1f2430 55%, #171b24 100%);
  color: var(--ios-text);
}

.lock-screen.pin-mode {
  background: linear-gradient(180deg, #2f3440 0%, #1f2430 55%, #171b24 100%);
}

.status {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-top: 84px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.time {
  margin: 0;
  font-size: clamp(48px, 9vw, 74px);
  font-weight: 500;
  letter-spacing: 1px;
}

.date {
  margin: 0;
  font-size: 1rem;
  opacity: 0.95;
}

.lock-entry,
.lock-card {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 82%;
  z-index: 2;
  background: rgba(32, 34, 43, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 18px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.lock-entry {
  width: auto;
  top: 55%;
  bottom: auto;
  transform: translate(-50%, -50%);
  background: transparent;
  border: none;
  backdrop-filter: none;
  padding: 0;
  display: grid;
  place-items: center;
}

.lock-entry.active,
.lock-card.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.enter-btn {
  width: auto;
  min-width: 170px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 14px;
  padding: 13px 30px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.lock-card {
  bottom: 46px;
}

.lock-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  text-align: center;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 16px;
}

.pin-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: transparent;
}

.pin-dot.filled {
  background: #fff;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pin-key {
  height: 52px;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.17);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

.pin-key-empty {
  opacity: 0;
  pointer-events: none;
}

.pin-delete {
  font-size: 1rem;
}

.error-message {
  min-height: 18px;
  margin: 8px 0 0;
  color: #ffd2d2;
  font-size: 0.8rem;
}

.home-screen {
  background: url("photos/wallpaper2.png") center / cover no-repeat;
  color: #fff;
  padding: 26px 16px 16px;
  display: flex;
  flex-direction: column;
}

.home-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px 10px;
  font-size: 0.95rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

#homeTime {
  margin: 0 0 0 6px;
}

.home-apps-area {
  flex: 1;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
}

.ghost-btn {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 12px;
  padding: 7px 11px;
  cursor: pointer;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 12px;
  margin-top: 6px;
  max-width: 320px;
  align-content: start;
}

.app-icon {
  border: none;
  background: transparent;
  color: #fff;
  display: grid;
  gap: 5px;
  justify-items: center;
  align-content: start;
  cursor: pointer;
}

.app-icon span {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 16px rgba(16, 16, 32, 0.25);
}

.app-icon small {
  font-size: 0.67rem;
  white-space: nowrap;
  line-height: 1.1;
}

.home-dock {
  height: 84px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(10px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  justify-items: center;
  padding: 0 14px;
}

.dock-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.app-screen {
  background: linear-gradient(180deg, #2f3440 0%, #1f2430 55%, #171b24 100%);
  color: #fff;
  padding: 40px 18px 18px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 2px;
}

.app-header .ghost-btn {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.14);
}

.gallery-slider {
  margin-top: 6px;
  width: 100%;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.gallery-slider::-webkit-scrollbar {
  display: none;
}

.slide {
  margin: 0;
  min-width: 100%;
  scroll-snap-align: start;
  position: relative;
}

.photo-item {
  width: 100%;
  height: 520px;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #dfe6f5;
}

.photo-caption {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 14px;
  margin: 0;
  padding: 9px 12px;
  border-radius: 12px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
  background: linear-gradient(180deg, rgba(20, 24, 34, 0.65), rgba(20, 24, 34, 0.2));
}

.gallery-dots {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  background: #c2cada;
  padding: 0;
}

.dot.active {
  background: #1f2738;
}

.chat-list-view {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 2px 0 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 240ms ease, visibility 0s linear 240ms;
}

.chat-list-view.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 240ms ease, visibility 0s linear 0s;
}

.chat-thread-item {
  border: 1px solid #d3d9e3;
  background: #f8fafc;
  border-radius: 14px;
  padding: 11px 12px;
  text-align: left;
  display: grid;
  gap: 4px;
  cursor: pointer;
}

.chat-thread-item strong {
  color: #1f2738;
  font-size: 0.96rem;
}

.chat-thread-item small {
  color: #6f7788;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-detail-view {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding-top: 2px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 240ms ease, visibility 0s linear 240ms;
}

.chat-detail-view.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 240ms ease, visibility 0s linear 0s;
}

.chat-back-btn {
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 10px;
  padding: 8px 11px;
  cursor: pointer;
}

.chat-thread {
  display: grid;
  gap: 10px;
}

.chat-thread[hidden] {
  display: none !important;
}

.chat-stage {
  position: relative;
  min-height: calc(100% - 4px);
}

.chat-bubble {
  max-width: 92%;
  border-radius: 14px;
  padding: 10px 12px;
  line-height: 1.35;
  font-size: 0.9rem;
}

.chat-bubble strong {
  display: block;
  margin-bottom: 3px;
}

.chat-bubble.user {
  justify-self: end;
  background: #dcf4ff;
  color: #1f2738;
  border: 1px solid #b8deef;
}

.chat-bubble.bot {
  justify-self: start;
  background: #f7f8fb;
  color: #1f2738;
  border: 1px solid #cfd5df;
}

.note-card {
  background: #f7f8fb;
  color: #1f2738;
  border-radius: 18px;
  padding: 16px;
  line-height: 1.45;
  border: 1px solid #cfd5df;
  box-shadow: 0 8px 18px rgba(10, 15, 28, 0.08);
}

.notes-stage {
  position: relative;
  min-height: calc(100% - 4px);
}

.notes-list-view {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 240ms ease, visibility 0s linear 240ms;
}

.notes-list-view.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 240ms ease, visibility 0s linear 0s;
}

.notes-subtitle {
  margin: 0 0 4px;
  color: #6f7788;
  font-size: 0.9rem;
}

.note-list-item {
  border: 1px solid #d3d9e3;
  background: #f8fafc;
  border-radius: 16px;
  padding: 12px 14px;
  text-align: left;
  display: grid;
  gap: 4px;
  cursor: pointer;
}

.note-list-item strong {
  color: #1f2738;
  font-size: 1rem;
}

.note-list-item small {
  color: #6f7788;
  font-size: 0.86rem;
}

.notes-detail-view {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 8px 0 14px;
  border-radius: 0;
  background: transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 240ms ease, transform 240ms ease, visibility 0s linear 240ms;
  overflow-y: auto;
}

.notes-detail-view.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 240ms ease, transform 240ms ease, visibility 0s linear 0s;
}

.notes-back-btn {
  width: fit-content;
  border: 1px solid #cfd5df;
  background: #f7f8fb;
  color: #1f2738;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}

.note-panel h3 {
  margin: 0 0 10px;
  color: #1f2738;
}

.note-panel p {
  color: #2d374b;
}

.note-panel {
  display: none;
}

.note-panel.active {
  display: block;
  animation: notePanelFade 240ms ease;
}

@keyframes notePanelFade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.retrospective-screen {
  padding: 0;
  color: #fff;
  overflow: hidden;
}

.retrospective-screen.is-closing {
  opacity: 0;
  pointer-events: none;
}

.retro-close-btn {
  position: absolute;
  top: 40px;
  right: 20px;
  z-index: 30;
}

.retro-stage {
  position: absolute;
  inset: 0;
}

.retro-view {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 12px;
  padding: 70px 22px 28px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 360ms ease, visibility 0s linear 360ms;
}

.retro-view.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 360ms ease, visibility 0s linear 0s;
}

.retro-theme-1 {
  background:
    radial-gradient(120% 90% at 15% 10%, rgba(72, 0, 122, 0.75), transparent 55%),
    radial-gradient(90% 80% at 90% 20%, rgba(255, 80, 80, 0.55), transparent 55%),
    linear-gradient(160deg, #0e1020, #1f1243 55%, #0f233b);
}

.retro-theme-2 {
  background:
    radial-gradient(120% 90% at 80% 0%, rgba(44, 255, 201, 0.35), transparent 52%),
    linear-gradient(160deg, #080d1f, #132b68 55%, #111019);
}

.retro-theme-3 {
  background:
    radial-gradient(100% 80% at 15% 20%, rgba(255, 191, 0, 0.35), transparent 52%),
    linear-gradient(160deg, #120f2b, #3e176e 58%, #160d2e);
}

.retro-theme-4 {
  background:
    radial-gradient(95% 75% at 80% 15%, rgba(123, 248, 0, 0.25), transparent 52%),
    linear-gradient(160deg, #0d1c11, #113b27 58%, #0d141f);
}

.retro-theme-5 {
  background:
    radial-gradient(100% 85% at 10% 15%, rgba(255, 71, 190, 0.26), transparent 52%),
    linear-gradient(160deg, #1a0d2f, #381a75 56%, #181622);
}

.retro-theme-6 {
  background:
    radial-gradient(100% 85% at 80% 20%, rgba(116, 193, 255, 0.26), transparent 52%),
    linear-gradient(160deg, #0d1323, #122541 56%, #171229);
}

.retro-kicker {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.82;
}

.retro-title {
  margin: 0;
  font-size: clamp(1.8rem, 7.8vw, 2.5rem);
  line-height: 1.1;
}

.retro-subtitle {
  margin: 0 0 8px;
  font-size: 1.02rem;
  opacity: 0.92;
}

.retro-big-copy {
  margin: 0;
  font-size: clamp(1.1rem, 4.8vw, 1.45rem);
  font-weight: 700;
  line-height: 1.3;
}

.retro-count-line {
  margin: 4px 0;
  font-size: clamp(1.8rem, 8.8vw, 3.1rem);
  font-weight: 800;
  line-height: 1.05;
}

.retro-count {
  display: inline-block;
  min-width: 1ch;
}

.retro-footnote {
  margin: 0;
  max-width: 28ch;
  font-size: 0.96rem;
  opacity: 0.9;
}

.retro-main-btn,
.retro-next-btn {
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.retro-next-btn {
  margin-top: 6px;
}

.retro-ranking,
.retro-quotes {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
  width: min(92%, 340px);
  font-size: 1.08rem;
  font-weight: 700;
}

.retro-ranking li,
.retro-quotes li {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 9px 12px;
}

.retro-quotes {
  font-size: 0.92rem;
  font-weight: 600;
}

.retro-activity {
  font-size: clamp(1.7rem, 8.2vw, 3rem);
}

.surprise-screen {
  background:
    radial-gradient(120% 90% at 15% 10%, rgba(255, 120, 190, 0.22), transparent 55%),
    radial-gradient(90% 80% at 90% 20%, rgba(95, 196, 255, 0.2), transparent 55%),
    rgba(8, 10, 18, 0.84);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 52px 18px 20px;
}

.surprise-close-btn {
  position: absolute;
  top: 40px;
  right: 20px;
  z-index: 30;
}

.surprise-confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}

.surprise-confetti {
  position: absolute;
  top: -14%;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  opacity: 0.95;
  animation-name: surpriseFall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes surpriseFall {
  0% {
    transform: translate3d(0, -10%, 0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.95;
  }
  100% {
    transform: translate3d(var(--drift, 0px), 118vh, 0) rotate(720deg);
    opacity: 0.9;
  }
}

.surprise-ticket {
  position: relative;
  z-index: 10;
  width: min(92%, 360px);
  border-radius: 22px;
  padding: 18px 18px 16px;
  background:
    radial-gradient(120% 100% at 85% 0%, rgba(255, 241, 192, 0.45), transparent 45%),
    linear-gradient(165deg, #fff7e1, #ffe8b2 52%, #ffd89d);
  border: 1px solid rgba(92, 62, 0, 0.24);
  box-shadow:
    0 16px 30px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  color: #33230a;
  transform: translateY(14px) scale(0.94);
  opacity: 0;
  transition: opacity 420ms ease, transform 420ms ease;
}

.surprise-ticket.revealed {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.surprise-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.75rem;
  opacity: 0.82;
}

.surprise-title {
  margin: 6px 0 8px;
  font-size: clamp(1.6rem, 8vw, 2.2rem);
  line-height: 1.1;
  color: #2a1803;
  text-shadow: 0 0 12px rgba(255, 240, 174, 0.95);
  animation: surpriseGlow 1800ms ease-in-out infinite alternate;
}

@keyframes surpriseGlow {
  from {
    text-shadow: 0 0 6px rgba(255, 236, 165, 0.55);
  }
  to {
    text-shadow: 0 0 16px rgba(255, 239, 185, 0.95);
  }
}

.surprise-message,
.surprise-redeem,
.surprise-note {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.35;
}

.surprise-message strong,
.surprise-redeem strong {
  color: #1f1304;
}

.surprise-redeem {
  margin-top: 10px;
}

.surprise-includes {
  margin-top: 12px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px dashed rgba(91, 60, 0, 0.35);
}

.surprise-includes p {
  margin: 0 0 6px;
  font-weight: 700;
}

.surprise-includes ul {
  margin: 0;
  padding-left: 17px;
  display: grid;
  gap: 2px;
}

.surprise-meta {
  margin-top: 10px;
  font-size: 0.82rem;
  display: grid;
  gap: 3px;
}

.surprise-meta p {
  margin: 0;
}

.surprise-note {
  margin-top: 10px;
  text-align: center;
  font-weight: 700;
}

@media (max-width: 420px) {
  :root {
    --phone-w: min(360px, 92dvw, calc((100dvh - 28px) * 360 / 760));
  }

  .scene {
    padding: 0;
  }

  .phone-shell {
    min-width: 0;
    border-radius: 40px;
  }

  .screen,
  .app-screen {
    border-radius: 28px;
  }

  .apps-grid {
    gap: 14px 10px;
    max-width: 320px;
  }

  .app-icon span {
    width: 58px;
    height: 58px;
  }

  .photo-item {
    height: 450px;
  }
}
