/* ===================== GLOBAL ===================== */
* { box-sizing: border-box; }

.hidden { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body.desktop {
  background: url("/images/mebg.jpg") center/cover no-repeat;
  font-family: Tahoma;
  overflow: hidden; /* desktop: no page scroll, only window scrolls */
}

/* ===================== DESKTOP ICONS ===================== */
.icons {
  position: absolute;
  top: 40px;
  right: 40px;
  display: flex;
  flex-direction: column;
  gap: 25px;
  align-items: center;
  z-index: 5;
}

.icon {
  text-align: center;
  cursor: pointer;
  font-size: 32px;
  color: white;
}

.icon span {
  display: block;
  font-size: 14px;
}

/* ===================== WINDOW BASE ===================== */
.window {
  width: 750px;
  height: 500px;
  background: #FAF8DC;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.window-bar {
  background: #F5F2B8;
  border-bottom: 2px solid #CEA986;
  padding: 12px 16px;
  display: flex;
  align-items: center;
}

.window-title {
  font-size: 14px;
  font-weight: 600;
}

.toolbar {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.toolbar button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 2px solid #CEA986;
  background: #F5F2B8;
  cursor: pointer;
}

/* make desktop draggable bars draggable */
#mailBar, #photosBar {
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
}

/* ===================== MAIL (DESKTOP) ===================== */
.mail-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  width: 100px;
  flex: 0 0 100px;
  background: #F5F2B8;
  padding: 12px;
  padding-top: 16px;
  border-right: 2px solid #CEA986;
}

.sidebar h4 {
  margin: 0 0 16px 0;
  text-align: center;
  font-size: 13px;
}

.mailbox {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.mailbox .item {
  text-align: center;
  width: 100%;
}

.inbox {
  min-width: 110px;
  max-width: 280px;
  flex: 0 0 auto;
  padding: 12px;
  border-right: 2px solid #CEA986;
  overflow: auto;
}

.divider {
  flex: 0 0 10px;
  cursor: col-resize;
  background: rgba(0,0,0,0.05);
}

.message {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 26px 32px;
  line-height: 1.65;
  overflow-y: auto;
}

.message img {
  height: auto;
  max-width: 100%;
}

.email-item {
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.email-item:hover { background: #FCD4C5; }
.email-item.active { background: #FCD4C5; }

.email-item.active .subject,
.email-item.active .preview {
  color: #FF474A;
}

/* ===================== POPUP ===================== */
.popup {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(3px);
  z-index: 1000;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.popup-box {
  background: white;
  padding: 25px 30px;
  border-radius: 14px;
  border: 5px solid #6A041D;
  width: 260px;
  text-align: center;
  color: #6A041D;

  transform: translateY(12px) scale(0.95);
  transition: transform 0.25s ease;
}

.popup.show .popup-box {
  transform: translateY(0) scale(1);
}

.popup-box button {
  margin-top: 12px;
  background: white;
  border: 3px solid #6A041D;
  color: #6A041D;
  font-family: Tahoma;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.popup-box button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.popup-box button:active { transform: translateY(1px); filter: brightness(0.95); }

/* ===================== MODAL ===================== */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(3px);
  z-index: 2000;
}

.modal-box {
  width: min(520px, 90vw);
  background: white;
  border-radius: 14px;
  border: 2px solid #ff8fb1;
  overflow: hidden;
}

.modal-top {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #FEF1EC;
  border-bottom: 2px solid pink;
}

.modal-close {
  margin-left: auto;
  border: 2px solid pink;
  background: #FEF1EC;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

.modal-body {
  padding: 18px;
  font-size: 14px;
  white-space: pre-wrap;
}

/* ===================== PHOTOS (DESKTOP DEFAULT) ===================== */
.photos-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  background: #FAF8DC;
}

/* DESKTOP shows desktop block */
.photos-desktop {
  display: flex;
  flex: 1;
  min-height: 0;
}

.photos-left,
.photos-right {
  flex: 1;
  padding: 20px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: lowercase;
  text-align: center;
}

.polaroid-grid {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.polaroid {
  width: 180px;
  background: white;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.12);
  transform: rotate(var(--r));
}

.polaroid img {
  width: 100%;
  height: 110px;
  object-fit: cover;
}

.polaroid .cap {
  margin-top: 8px;
  font-size: 12px;
}

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

.file {
  width: 160px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e2e2e6;
  background: white;
  text-align: left;
  cursor: pointer;
}

.sticky-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

.sticky {
  width: 170px;
  min-height: 120px;
  padding: 14px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  background: #fff2a8;
  font-size: 12px;
}

.sticky:nth-child(2){ background:#ffd1dc; }
.sticky:nth-child(3){ background:#cfe9ff; }
.sticky:nth-child(4){ background:#d7ffd9; }

.quiz {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-input {
  border: 1px solid #d9d9db;
  border-radius: 10px;
  padding: 10px 12px;
}

.quiz-btn {
  width: 120px;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: #ff8fb1;
  color: white;
  cursor: pointer;
}

/* MOBILE container hidden on desktop */
.photos-mobile { display: none; }

/* ===================== MOBILE LAYOUT ===================== */
@media (max-width: 640px) {
  body.desktop {
    overflow: auto; /* allow page scroll if needed */
  }

  .icons {
    top: 18px;
    right: 18px;
    gap: 18px;
  }

  .window {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    left: 8px;
    top: 8px;
    transform: none;
    border-radius: 16px;
    max-width: none;
    max-height: none;
  }

  /* keep X always visible */
  .window-bar {
    position: sticky;
    top: 0;
    z-index: 50;
  }

  /* MOBILE: mail becomes vertical and scrolls inside */
  .mail-layout {
    flex-direction: column;
    min-height: 0;
  }

  .sidebar {
    width: 100%;
    flex: 0 0 auto;
    border-right: 0;
    border-bottom: 2px solid #CEA986;
  }

  .mailbox {
    flex-direction: row;
    justify-content: center;
    gap: 14px;
  }

  .inbox {
    max-width: none;
    width: 100%;
    border-right: 0;
    border-bottom: 2px solid #CEA986;
  }

  .divider { display: none; }

  .message {
    flex: 1;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* PHOTOS: hide desktop, show mobile tabs */
  .photos-desktop { display: none; }
  .photos-mobile {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
  }

  .photos-layout {
    flex-direction: column;
    min-height: 0;
  }

  .photos-tabs {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    overflow-x: auto;
    border-bottom: 2px solid #CEA986;
    background: #FAF8DC;
  }

  .photos-tabs .tab {
    flex: 0 0 auto;
    border: 2px solid #CEA986;
    background: #FAF8DC;
    border-radius: 999px;
    padding: 8px 12px;
    font-family: Tahoma;
    cursor: pointer;
  }

  .photos-tabs .tab.active { background: #FCD4C5; }

  .photos-pages {
    flex: 1;
    min-height: 0;
    overflow: auto;               /* THIS is the mobile scroll fix */
    -webkit-overflow-scrolling: touch;
    padding: 16px;
  }

  .photos-page { display: none; }
  .photos-page.active { display: block; }

  /* optional: tighten big elements so they fit */
  .polaroid { width: 160px; }
  .sticky { width: 160px; }
}
