/**
 * overlay.css - UI Overlay styling for My Regards Phase 1 Three.js foundation.
 */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-script: "Caveat", "Brush Script MT", cursive;
  --primary-blue: #1d4ed8;
  --primary-blue-hover: #1e40af;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --bg-card: rgba(255, 255, 255, 0.92);
  --border-soft: rgba(226, 232, 240, 0.8);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #f6f5f0;
  font-family: var(--font-sans);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#appCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

#uiOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.overlay-root {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 16px) env(safe-area-inset-right, 16px) env(safe-area-inset-bottom, 16px) env(safe-area-inset-left, 16px);
  position: relative;
}

/* Header */
.overlay-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 38px 22px 12px 22px;
  pointer-events: auto;
  z-index: 20;
}

@media (min-width: 768px) {
  .overlay-top {
    padding: 20px 24px;
  }
}

.brand-title {
  display: flex;
  align-items: center;
}

.brand-logo {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.7px;
  color: #000000;
  text-transform: lowercase;
}

.settings-btn {
  background: transparent;
  border: none;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.15s, opacity 0.15s;
}

.settings-btn:hover {
  transform: scale(1.08);
  opacity: 0.8;
}

.settings-btn svg {
  stroke: #1c1c1e;
  stroke-width: 1.8;
}

/* Floating Friends Spatial Arc (Reference Frames 01-04) */
.spatial-friends-arc {
  position: absolute;
  top: 15%;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  z-index: 15;
}

.friends-arc-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 46px;
  position: relative;
}

.arc-friend {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.35s ease;
  user-select: none;
}

.arc-friend-left {
  opacity: 0.55;
  transform: translate(-10px, 12px);
}

.arc-friend-right {
  opacity: 0.55;
  transform: translate(10px, 12px);
}

.arc-friend-center {
  opacity: 1.0;
  transform: translate(0, 0);
}

.arc-avatar-wrapper {
  position: relative;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.arc-avatar-wrapper.active {
  width: 68px;
  height: 68px;
  padding: 2.5px;
  border: 2.5px solid #5856d6;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(88, 86, 214, 0.22);
}

.arc-avatar-wrapper.small {
  width: 44px;
  height: 44px;
}

.arc-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background-color: #e2e8f0;
}

.arc-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 5px;
}

.arc-name {
  font-size: 13px;
  font-weight: 500;
  color: #8e8e93;
  line-height: 1.2;
}

.arc-name.active {
  font-size: 15px;
  font-weight: 600;
  color: #1c1c1e;
}

.arc-city {
  font-size: 11px;
  font-weight: 400;
  color: #aeaeb2;
  line-height: 1.2;
}

.arc-city.active {
  font-size: 13px;
  font-weight: 400;
  color: #636366;
}

/* Map City Label directly on map view (Reference Frame 01) */
.map-city-container {
  position: absolute;
  top: 48%;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 5;
}

.map-city-label {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: #2c2c2e;
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.8);
}

.phase1-stepper {
  display: none !important;
}

/* Accessible Writing Bridge */
.writing-bridge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(88vw, 380px);
  height: min(60vh, 460px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: auto;
  z-index: 20;
}

.letter-textarea {
  width: 100%;
  height: 75%;
  background: transparent;
  border: none;
  resize: none;
  font-family: var(--font-script);
  font-size: 26px;
  line-height: 1.4;
  color: transparent; /* Text is visually rendered onto 3D canvas texture! */
  caret-color: #1e3a8a;
  padding: 40px 24px;
  outline: none;
  cursor: text;
}

.letter-textarea::placeholder {
  color: transparent;
}

.writing-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}

.seal-btn {
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.seal-btn:hover {
  color: var(--primary-blue);
}

.send-btn {
  background: var(--primary-blue);
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.3);
  transition: transform 0.15s, background-color 0.15s;
}

.send-btn:hover {
  background: var(--primary-blue-hover);
  transform: scale(1.03);
}

/* Flick guide */
.flick-guide {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

/* Bottom Navigation */
.overlay-bottom {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 12px 20px;
  pointer-events: auto;
}

.nav-tab {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.15s;
}

.nav-tab.active, .nav-tab:hover {
  color: var(--text-main);
  background: #ffffff;
  border-color: #cbd5e1;
}

/* Phase 1 Stepper Validator Widget */
.phase1-stepper {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  color: white;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.stepper-label strong {
  color: #60a5fa;
  font-family: monospace;
}

.stepper-buttons button {
  background: #334155;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}
.stepper-buttons button:hover {
  background: #475569;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Question Seal Modal Dialog */
.seal-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: auto;
  padding: 20px;
}

.seal-modal-card {
  background: #ffffff;
  border-radius: 20px;
  max-width: 420px;
  width: 100%;
  padding: 28px 24px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.seal-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #b91c1c;
}

.seal-modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.seal-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.seal-input-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.seal-input-group input {
  padding: 10px 14px;
  border: 1.5px solid var(--border-soft);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}
.seal-input-group input:focus {
  border-color: #3b82f6;
}

.seal-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.btn-cancel {
  background: #f1f5f9;
  border: none;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-save-seal {
  background: #b91c1c;
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.25);
}

/* Flight Destination Pin for Maya (Reference Frames 07, 08, 09) */
.flight-dest-pin {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  z-index: 20;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.pin-launch-pose {
  top: 28%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.pin-flight-pose {
  top: 44%;
  left: 55%;
  transform: translate(-50%, -50%) scale(0.68);
  opacity: 0.95;
}

.pin-arrival-pose {
  top: 48%;
  left: 55%;
  transform: translate(-50%, -50%) scale(1.0);
  opacity: 1;
}

.pin-bubble {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-avatar-img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.pin-pointer {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid #ffffff;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.08));
}

.pin-checkmark-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #34c759; /* Apple crisp green */
  border: 2px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  z-index: 5;
}

.pin-name {
  margin-top: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  color: #1c1c1e;
  letter-spacing: -0.2px;
}

/* Flight Status Overlay (Reference Frames 07, 08, 09) */
.flight-status-overlay {
  position: absolute;
  bottom: 72px;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  pointer-events: none;
  z-index: 25;
}

.flight-action-label {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #1c1c1e;
  letter-spacing: -0.3px;
}

.flight-dist-label {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 5px;
}

.flight-arrow-svg {
  color: #64748b;
}

/* Bottom Stats Bar (Reference Frames 07, 08, 09) */
.stats-bar {
  position: absolute;
  bottom: 24px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  pointer-events: auto;
  z-index: 25;
  padding: 0 16px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #64748b;
}

.stat-item strong {
  font-weight: 700;
  color: #1c1c1e;
}

.stat-plane-icon {
  color: #64748b;
  transform: rotate(45deg);
}

.stat-emoji {
  font-size: 15px;
}

/* Top Arrival Container with Night Map Card (Reference Frame 09) */
.top-arrival-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  z-index: 90;
}

.arrival-night-card {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 160px;
  background: linear-gradient(180deg, #0e1628 0%, #17243c 85%, rgba(23, 36, 60, 0) 100%);
  border-bottom-left-radius: 36px;
  border-bottom-right-radius: 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 24px 16px 24px;
  box-sizing: border-box;
  pointer-events: none;
}

.night-card-title {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
  letter-spacing: -0.5px;
}

.apple-maps-legal {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.4);
}

.notif-pill {
  margin-top: 42px;
  background: rgba(26, 32, 44, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  color: #ffffff;
  border-radius: 38px;
  padding: 9px 12px 9px 9px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  max-width: 90%;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 95;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-pill:active {
  transform: scale(0.98);
}

.notif-avatar-wrapper {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.notif-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.notif-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.notif-title {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.25;
  letter-spacing: -0.1px;
}

.notif-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #007aff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 2px;
  transition: transform 0.15s, background-color 0.15s;
}

.notif-action-btn:hover {
  background: #0062cc;
  transform: scale(1.05);
}

/* Spatial Inbox Header (Reference Frames 10, 11, 13) */
/* Spatial Inbox Header (Reference Frames 10, 11, 12, 13) */
.inbox-header {
  position: absolute;
  top: 54px;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 45;
}

.inbox-avatar-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.inbox-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.inbox-title {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.3px;
}

/* Inbox Compass Widget (Reference Frames 10, 11, 12, 13) */
.inbox-compass {
  position: absolute;
  top: 52px;
  right: 20px;
  pointer-events: auto;
  z-index: 50;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.1));
}

/* Frame 10: Center Harin Speech-Bubble Pin */
.inbox-harin-pin {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  cursor: pointer;
  z-index: 35;
}

.inbox-harin-pin .pin-bubble {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

.inbox-harin-pin .pin-avatar-img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.inbox-harin-pin .pin-pointer {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid #ffffff;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.08));
}

.pin-name-pill {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  padding: 4px 14px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: #1c1c1e;
  letter-spacing: -0.2px;
}

/* Frame 11: Ground Harin Label */
.inbox-ground-label {
  position: absolute;
  top: 56%;
  left: 52%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: #1c1c1e;
  pointer-events: none;
  z-index: 25;
}

/* Floating Reading Card (Reference Frames 12 & 13) */
.reading-card-container {
  position: absolute;
  top: 30.5%;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  max-width: 345px;
  display: flex;
  justify-content: center;
  pointer-events: auto;
  z-index: 55;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.reading-card-container.pose-opening {
  transform: translateX(-50%) rotate(-3.5deg) scale(0.97);
  opacity: 0.98;
}

.reading-card-container.pose-reading {
  transform: translateX(-50%) rotate(0deg) scale(1.0);
  opacity: 1;
}

.reading-paper-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 18px 16px 14px 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  width: 100%;
  box-sizing: border-box;
}

.reading-card-text {
  font-family: var(--font-script), "Caveat", "Brush Script MT", cursive, sans-serif;
  font-size: 17.5px;
  line-height: 1.32;
  color: #1a365d; /* Deep blue fountain ink */
  text-align: center;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

.reading-card-text p {
  margin-bottom: 7px;
}

.reading-card-text p:last-child {
  margin-bottom: 0;
}

.reading-signoff {
  margin-top: 9px;
}

/* Circular Back Button (Reference Frames 10, 11, 12, 13) */
.circular-back-btn {
  position: absolute;
  bottom: 40px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  font-size: 26px;
  font-weight: 300;
  color: #1c1c1e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 50;
  padding-bottom: 2px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.circular-back-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* Reading Action Pill (Reference Frames 12 & 13: Close & Reply) */
.reading-action-pill {
  position: absolute;
  top: 73.5%;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(245, 245, 247, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 30px;
  padding: 7px 22px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.5);
  pointer-events: auto;
  z-index: 60;
}

.pill-btn-close {
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 600;
  color: #1c1c1e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: opacity 0.15s;
}

.pill-btn-close:hover {
  opacity: 0.7;
}

.pill-divider {
  width: 1px;
  height: 16px;
  background: rgba(60, 60, 67, 0.25);
}

.pill-btn-reply {
  background: none;
  border: none;
  font-size: 20px;
  color: #1c1c1e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: opacity 0.15s;
}

.pill-btn-reply:hover {
  opacity: 0.7;
}

/* Bottom Apple Maps Legal for Inbox / Reading (Reference Frames 10, 11, 12, 13) */
.apple-maps-legal-bottom {
  position: absolute;
  bottom: 24px;
  left: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  z-index: 50;
}

/* Secret Question Unlock Modal Dialog */
.unlock-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: auto;
  padding: 20px;
}

.unlock-modal-card {
  background: #ffffff;
  border-radius: 20px;
  max-width: 420px;
  width: 100%;
  padding: 28px 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.unlock-seal-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #b91c1c;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.3);
}

.unlock-modal-title {
  font-size: 19px;
  font-weight: 700;
  color: #0f172a;
}

.unlock-modal-desc {
  font-size: 14px;
  color: #475569;
  font-style: italic;
  line-height: 1.4;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 10px;
  width: 100%;
}

.unlock-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
}

.unlock-input-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.unlock-input-group input {
  padding: 10px 14px;
  border: 1.5px solid var(--border-soft);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}

.unlock-input-group input:focus {
  border-color: #3b82f6;
}

.unlock-error {
  font-size: 12px;
  font-weight: 600;
  color: #b91c1c;
}

.unlock-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  width: 100%;
  margin-top: 6px;
}

.btn-unlock {
  background: #1d4ed8;
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.25);
}

/* ==========================================================================
   Reference Frame 05: Letter Writing Surface & Floating Frosted Toolbar
   ========================================================================== */

.letter-writing-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  z-index: 25;
}

.paper-writing-card {
  position: absolute;
  top: 31%;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 350px;
  height: 53%;
  max-height: 460px;
  background: #ffffff;
  border-radius: 28px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.10), 0 4px 12px rgba(0, 0, 0, 0.04);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
  pointer-events: auto;
  cursor: text;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
}

.paper-writing-card:active {
  transform: translateX(-50%) scale(0.99);
}

.paper-text-content {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-family: 'Caveat', cursive, sans-serif;
  font-style: normal;
  font-weight: 500;
  font-size: 25px;
  line-height: 1.42;
  color: #153270; /* Deep cobalt/navy fountain pen ink matching reference */
  letter-spacing: 0.1px;
  user-select: text;
}

.paper-text-content .text-line {
  display: block;
}

.paper-text-content .text-cursor {
  display: inline-block;
  font-family: -apple-system, sans-serif;
  font-weight: 200;
  font-size: 23px;
  color: #153270;
  opacity: 0.85;
  animation: blinkWritingCursor 1.1s infinite;
  margin-left: 1px;
}

@keyframes blinkWritingCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hidden-letter-textarea {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

/* Floating Frosted Toolbar (Reference Frame 05) */
.writing-floating-toolbar {
  position: absolute;
  bottom: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: auto;
  z-index: 30;
}

.tool-pill-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s;
}

.tool-pill-btn:hover {
  transform: scale(1.06);
  background: #ffffff;
}

.tool-svg-icon {
  width: 22px;
  height: 22px;
  stroke: #1c1c1e;
}

.tool-audio-capsule {
  height: 52px;
  padding: 0 28px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s;
}

.tool-audio-capsule:hover {
  transform: scale(1.03);
  background: #ffffff;
}

.audio-bar {
  display: inline-block;
  width: 4px;
  border-radius: 2px;
  background-color: #5856d6;
}

.bar-1 { height: 16px; }
.bar-2 { height: 22px; }
.bar-3 { height: 18px; }
.bar-4 { height: 24px; }
.bar-5 { height: 20px; }
.bar-6 { height: 24px; }
.bar-7 { height: 18px; }
