:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --vv-height: 100vh;
  --header-base: 0px;
  --header-height: calc(var(--header-base) + var(--safe-top));
  --bg: #fff;
  --border: #444;
  --accent: #2c4a5e;
  --muted: #888;
  --toast-gap: 5px;
  font-size: 112.5%;
  -webkit-text-size-adjust: 100%;

  /* Journal background variables */
  --chat-bg: url('/backgrounds/chat.jpg');
  --journal-personal-bg: url('/backgrounds/journal.jpg');
  --journal-relationship-bg: url('/backgrounds/relationship.jpg');
  --aimeru-bg: url('/backgrounds/aimeru.jpg');
}

input, textarea, select, button {
  font-size: 1rem;
  line-height: 1.4;
}

body.loggedIn #header { transform: translateY(-100%); }
body.loggedIn #app { margin-top: 0; }

* {
  box-sizing: border-box;
  font-family: sans-serif;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: #000;
  display: flex;
  flex-direction: column;
  height: 100svh;
  overflow: hidden;
}

@supports (height: 100dvh) {
  body { height: 100dvh; }
}

#app {
  flex: 1;
  position: relative;
  overflow: hidden;
  padding-bottom: 60px;
  margin-top: var(--header-height);
}

/* Screen backgrounds */
#chatScreen {
  background-image: var(--chat-bg);
  background-size: cover;
  background-position: center;
}

#journalScreen {
  background-image: var(--journal-personal-bg);
  background-size: cover;
  background-position: center;
}

#relationshipScreen {
  background-image: var(--journal-relationship-bg);
  background-size: cover;
  background-position: center;
}

#trackingScreen {
  background-image: var(--aimeru-bg);
  background-size: cover;
  background-position: center;
}

/* Header */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--accent);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--safe-top) 15px 0 15px;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
}


.title-section {
  margin-top: -50px;
  display: flex;
  align-items: center;
}

.title-section h2 {
  font-size: 2rem; /* Increased from default */
  margin: 0;
  align-items: center;
  height: var(--header-base);
  line-height: 1;
}

.auth-section {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--header-base);
}

.auth-button {
  margin-top: -40px;
  padding: 6px 14px;
  min-width: 120px; /* Slightly increased from 110px */
  text-align: center;
  border-radius: 4px;
  cursor: pointer;
  font-size: 24px; /* Increased from 14px */
  border: none;
}

#loginBtn {
  background-color: white;
  color: var(--accent);
  font-size: 24px; /* Increased from 14px */
  padding: 6px 14px; /* Adjusted padding to maintain fit */
}

#logoutBtn {
  background-color: rgba(255,255,255,0.2);
  color: white;
  display: none;
}

#userEmail {
  font-size: 14px;
  color: rgba(255,255,255,0.9);
  display: none;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Screen display */
.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* Bottom Navigation */
nav.bottomNav {
  height: calc(60px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--accent);
  z-index: 50;
}

nav.bottomNav button {
  flex: 1;
  border: none;
  background: none;
  font-size: .8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.8);
  cursor: pointer;
}

nav.bottomNav button.active {
  color: #FFF;
  font-weight: bold;
}

/* Journal entries */
.entry {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  background: #fff;
  position: relative;
  transition: opacity 0.3s;
}

.entry.partner-entry {
  border-left: 5px solid #e91e63;
}

.entry .timestamp {
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: .5rem;
}

.entry img {
  max-width: 100%;
  border-radius: 4px;
  margin-top: .5rem;
}

.delete-entry {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.6;
}

.delete-entry:hover {
  opacity: 1;
  color: #d9534f;
}

/* Chat styles */
.chatList {
  flex: 1;
  overflow-y: auto;
  padding-bottom: var(--chat-bottom-padding, 60px);
  scroll-behavior: smooth;
}

.chatBubble {
  margin: .5rem 0;
  padding: .5rem .75rem;
  border-radius: 12px;
  max-width: 70%;
  word-wrap: break-word;
  position: relative;
  white-space: pre-wrap;
}

.chatBubble.user {
  background: var(--accent);
  color: #fff;
  margin-left: auto;
}

.chatBubble.ai {
  background: #e5e5ea;
  color: #000;
}

.chatBubble.loading:after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 8px;
  height: 8px;
  border: 2px solid #555;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Input areas */
.chatInput, .journalInput {
  position: fixed;
  bottom: calc(60px + var(--safe-bottom));
  left: 0;
  right: 0;
  display: flex;
  padding: 10px;
  z-index: 40;
  height: auto;
}

.chatInput textarea, .journalInput textarea {
  flex: 1;
  padding: .5rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--accent);
  color: white;
  resize: none;
  overflow-y: hidden;
  min-height: 38px;
  max-height: 150px;
  line-height: 1.4;
  box-sizing: border-box;
  height: auto;
}

.chatInput button, .journalInput button {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: .5rem 1rem;
  border-radius: 20px;
  margin-left: 5px;
  cursor: pointer;
}

/* Scrollable lists */
.scrollList {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding-right: .5rem;
  padding-bottom: 50px;
}

.sentinel {
  height: 1px;
}

/* Settings */
#settingsScreen {
  padding: 1rem;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(1rem + var(--safe-bottom) + 60px);
}

.settingsGroup {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
}

.settingsGroup:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.settingsGroup h3 {
  margin-bottom: .5rem;
  font-size: 1.1rem;
}

.settingsGroup label {
  display: block;
  margin: .4rem 0;
}

.settingsGroup input,
.settingsGroup select {
  width: 100%;
  padding: .4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.small {
  font-size: .8rem;
  color: var(--muted);
}

/* Professional Button Styles */

/* Base button styles - apply to all buttons in settings */
.settingsGroup button {
  font-size: 16px;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  margin: 8px 0;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Primary action buttons (submit, save, etc.) */
.submit-btn {
  background: linear-gradient(135deg, #2c4a5e 0%, #1e3444 100%);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 6px rgba(44, 74, 94, 0.2);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(44, 74, 94, 0.3);
  background: linear-gradient(135deg, #345167 0%, #243a4d 100%);
}

.submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(44, 74, 94, 0.2);
}

/* Add subtle shine effect on hover */
.submit-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.submit-btn:hover::before {
  left: 100%;
}

/* Danger/destructive buttons */
.danger-btn {
  background: #fff;
  color: #d9534f;
  border: 2px solid #d9534f;
  padding: 12px 24px;
  border-radius: 8px;
  margin: 8px 0;
  cursor: pointer;
  width: 100%;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(217, 83, 79, 0.1);
}

.danger-btn:hover {
  background: #d9534f;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(217, 83, 79, 0.2);
}

.danger-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(217, 83, 79, 0.2);
}

/* File input styling */
.settingsGroup input[type="file"] {
  display: none;
}

.settingsGroup input[type="file"] + label,
.file-input-wrapper {
  display: inline-block;
  background: #f8f9fa;
  color: #495057;
  border: 2px dashed #dee2e6;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  margin: 8px 0;
  font-weight: 500;
  transition: all 0.3s ease;
}

.settingsGroup input[type="file"] + label:hover,
.file-input-wrapper:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  color: #212529;
}

/* Create custom file input buttons */
#chatBgInput,
#personalBgInput,
#relationshipBgInput,
#aimeruBgInput {
  display: none;
}

/* Style file inputs as buttons */
.upload-btn {
  display: inline-block;
  background: #f8f9fa;
  color: #495057;
  border: 2px solid #dee2e6;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  margin: 8px 0;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
}

.upload-btn:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  color: #212529;
  transform: translateY(-1px);
}

.upload-btn::before {
  content: '📤 ';
  margin-right: 8px;
}

/* Reset buttons - secondary style */
button[id$="Bg"] {
  background: #f8f9fa;
  color: #6c757d;
  border: 2px solid #dee2e6;
  padding: 12px 24px;
  border-radius: 8px;
  margin: 8px 0;
  cursor: pointer;
  width: 100%;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}

button[id$="Bg"]:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  color: #495057;
  transform: translateY(-1px);
}

/* Special styling for feedback button */
#sendFeedbackBtn {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

#sendFeedbackBtn:hover {
  background: linear-gradient(135deg, #1cadc4 0%, #149bae 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(23, 162, 184, 0.3);
}

#sendFeedbackBtn::before {
  content: '💬 ';
  margin-right: 8px;
}

/* Accept/Connect buttons */
#acceptInviteBtn,
#resendInviteBtn {
  background: linear-gradient(135deg, #28a745 0%, #218838 100%);
  color: white;
}

#acceptInviteBtn:hover,
#resendInviteBtn:hover {
  background: linear-gradient(135deg, #2fb34b 0%, #259642 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(40, 167, 69, 0.3);
}

/* Cancel/Disconnect buttons - styled differently from danger */
#cancelInviteBtn,
#disconnectPartnerBtn {
  background: #6c757d;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  margin: 8px 0;
  cursor: pointer;
  width: 100%;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}

#cancelInviteBtn:hover,
#disconnectPartnerBtn:hover {
  background: #5a6268;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

/* Button group styling */
.button-group {
  display: flex;
  gap: 12px;
  margin: 12px 0;
}

.button-group button {
  flex: 1;
  margin: 0;
}

/* Loading state for buttons */
button.loading {
  color: transparent;
  pointer-events: none;
  position: relative;
}

button.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  margin: auto;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: button-spin 0.8s linear infinite;
}

@keyframes button-spin {
  to { transform: rotate(360deg); }
}

/* Disabled state */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Small utility buttons */
.small-btn {
  padding: 8px 16px;
  font-size: 14px;
  width: auto;
  display: inline-block;
  margin: 4px;
}

/* Icon buttons */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Add subtle animation to all buttons */
@keyframes subtle-pulse {
  0% { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
  50% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); }
  100% { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
}

/* Add ripple effect on click */
button {
  position: relative;
  overflow: hidden;
}

button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

button:active::after {
  width: 300px;
  height: 300px;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  position: relative;
}

.close {
  position: absolute;
  right: 15px;
  top: 10px;
  font-size: 24px;
  cursor: pointer;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
}

.form-group input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.error-message {
  color: #d9534f;
  margin: 10px 0;
  font-size: 14px;
  display: none;
}

/* Toast Notifications */
.toast-notification {
  position: fixed;
  right: 16px;
  bottom: calc(60px + var(--safe-bottom) + var(--toast-gap));
  z-index: 1000;
  font-size: 1.2rem;
  max-width: 360px;
  padding: 18px 24px;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.25);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .4s ease, transform .4s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.toast-notification[style*="cursor: pointer"]:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.3);
}

.toast-notification.show {
  opacity: 1;
  transform: translateY(0);
}

/* Toast variants */
.toast--info { background: #0077FF; }
.toast--success { background: #00C853; }
.toast--warn { background: #FF6F00; }
.toast--error { background: #D50000; }

.toast-icon { margin-right: 10px; }

/* Custom confirm dialog */
.confirm-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.confirm-dialog {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  width: 85%;
  max-width: 350px;
  overflow: hidden;
  animation: dialogFadeIn 0.25s ease;
}

.confirm-content {
  padding: 20px;
  text-align: center;
  font-size: 1.1rem;
  color: #333;
}

.confirm-buttons {
  display: flex;
  border-top: 1px solid #eee;
}

.confirm-btn {
  flex: 1;
  padding: 15px 0;
  border: none;
  background: none;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.confirm-cancel {
  color: #777;
}

.confirm-cancel:hover {
  background-color: #f5f5f5;
}

.confirm-ok {
  color: var(--accent, #2c4a5e);
  border-left: 1px solid #eee;
  font-weight: 600;
}

.confirm-ok:hover {
  background-color: rgba(44, 74, 94, 0.05);
}

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

/* Partner badge */
.partner-badge {
  background-color: #e91e63;
  color: white;
  font-size: 0.7rem;
  padding: 2px 5px;
  border-radius: 10px;
  margin-left: 5px;
}

/* Invite code */
.invite-code {
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
  padding: 15px;
  background: #f5f5f5;
  border-radius: 8px;
  margin: 20px 0;
  letter-spacing: 2px;
  color: var(--accent);
}

.invite-code-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.invite-input-container {
  display: flex;
  align-items: center;
  margin-top: 12px;
  margin-bottom: 16px;
  width: 100%;
  gap: 12px;
}

/* Responsive adjustment for mobile */
@media (max-width: 480px) {
  .invite-input-container {
    flex-direction: column;
    gap: 8px;
  }
  
  .invite-code-input {
    width: 100% !important;
    margin-right: 0 !important;
  }
  
  #acceptInviteBtn {
    width: 100%;
  }
}

.invite-code-input {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px !important;
  font-size: 18px !important;
  font-family: monospace !important;
  letter-spacing: 2px !important;
  height: 44px !important;
  margin-right: 10px;
  border: 2px solid var(--border) !important;
  border-radius: 8px !important;
  background-color: #f5f5f5 !important;
  text-align: center !important;
  text-transform: uppercase !important;
}

/* Analysis container */
.analysis-container {
  margin-top: 15px;
  background: #fff;
  border-radius: 8px;
  padding: 15px;
  display: none;
}

.analysis-container.active {
  display: block;
  animation: fadeIn 0.5s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.rating-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.rating-score {
  font-size: 1.5rem;
  font-weight: bold;
  margin-right: 10px;
}

.rating-title {
  font-size: 1.2rem;
  font-weight: 500;
}

.rating-details {
  margin-top: 10px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.rating-date {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 12px;
  text-align: right;
}

/* Loading indicator */
.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 1s ease-in-out infinite;
  margin-right: 10px;
}

/* Aimeru journal entries */
.aimeru-journal-entry {
  padding: 15px;
  margin-bottom: 15px;
  background: #fff;
  border-radius: 8px;
  border-left: 5px solid var(--accent);
}

.aimeru-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.aimeru-score {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  color: white;
  font-weight: bold;
  font-size: 0.9rem;
  margin-left: 8px;
}

.score-high { background-color: #5cb85c; }
.score-medium { background-color: #f0ad4e; }
.score-low { background-color: #d9534f; }

/* Conversation modal */
.conversation-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.conversation-container {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.conversation-header {
  padding: 15px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.conversation-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--accent);
}

.conversation-content {
  padding: 15px;
  overflow-y: auto;
  flex: 1;
}

.conversation-bubble {
  padding: 10px 15px;
  border-radius: 16px;
  max-width: 80%;
  margin-bottom: 10px;
}

.conversation-user {
  background: var(--accent);
  color: white;
  margin-left: auto;
}

.conversation-ai {
  background: #e5e5ea;
  color: black;
  margin-right: auto;
}

/* iPhone specific adjustments */
@supports (padding-top: max(0px)) {
  #header {
    padding-top: max(var(--safe-top), 20px);
  }
}

/* iPhone 16 Pro Max and similar tall devices */
@media screen and (min-height: 900px) {
  #header {
    padding-top: max(var(--safe-top), 20px);
  }
}

/* iPhone 16 specific - move header down */
@media screen and (min-height: 874px) and (max-height: 956px) and (-webkit-min-device-pixel-ratio: 3) {
  #header {
    top: 0;
    padding-top: calc(var(--safe-top) + 20px);
    padding-bottom: 15px;
    height: auto;
    min-height: calc(var(--header-base) + var(--safe-top) + 35px);
  }
  
  #header::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    height: 50px;
    background: var(--accent);
    z-index: -1;
  }
  
  #app {
    margin-top: calc(var(--header-base) + var(--safe-top) + 35px);
  }
}

/* iPhone 16 Pro/Pro Max with Dynamic Island */
@supports (padding: max(0px)) and (height: 100dvh) {
  @media screen and (min-width: 390px) and (min-height: 844px) {
    #header {
      top: 0;
      padding-top: calc(max(var(--safe-top), 44px) + 15px);
      padding-bottom: 15px;
      height: auto;
      min-height: calc(var(--header-base) + var(--safe-top) + 30px);
    }
    
    #header::before {
      content: '';
      position: absolute;
      top: -50px;
      left: 0;
      right: 0;
      height: 50px;
      background: var(--accent);
      z-index: -1;
    }
    
    #app {
      margin-top: calc(var(--header-base) + var(--safe-top) + 30px);
    }
  }
}

.signup-modal-content {
  max-width: 500px;
}

.signup-subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 20px;
  font-size: 16px;
}

.beta-warning {
  background-color: #fff3cd;
  border: 2px solid #ffeaa7;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
}

.beta-warning h4 {
  margin: 0 0 10px 0;
  color: #856404;
  font-size: 16px;
}

.beta-warning ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.beta-warning li {
  margin-bottom: 8px;
  color: #856404;
  font-size: 14px;
  line-height: 1.4;
}

.beta-warning li strong {
  color: #6c5a04;
}

/* Legal Modals */
.legal-modal .modal-content {
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.legal-modal-content {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.legal-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.legal-modal-header h2 {
  margin: 0;
  color: #2c4a5e;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  color: #666;
}

.legal-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.legal-modal-body h3 {
  color: #2c4a5e;
  margin: 20px 0 10px 0;
}

.legal-modal-body ul {
  margin: 10px 0 20px 20px;
}

.legal-modal-body li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.legal-modal-footer {
  padding: 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.view-full-link {
  color: #2c4a5e;
  text-decoration: none;
  font-weight: 500;
}

.view-full-link:hover {
  text-decoration: underline;
}

.critical-box {
  background: #f8d7da;
  border: 2px solid #f5c6cb;
  padding: 15px;
  margin: 20px 0;
  border-radius: 8px;
  color: #721c24;
}

.critical-box h3 {
  margin-top: 0;
  color: #721c24;
}

.highlight-box {
  background: #e7f3ff;
  border-left: 4px solid #2c4a5e;
  padding: 15px;
  margin: 20px 0;
  border-radius: 4px;
}

.privacy-badge {
  display: inline-block;
  background: #d4edda;
  color: #155724;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
}

.beta-badge {
  display: inline-block;
  background: #ffc107;
  color: #000;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
}

/* Rest of the existing CSS... */
.password-hint {
  display: block;
  color: #888;
  font-size: 13px;
  margin-top: 5px;
}

.checkbox-group {
  margin: 20px 0;
  background-color: #f8f9fa;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.checkbox-group label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
}

.checkbox-group label a {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 600;
}

.checkbox-group label a:hover {
  color: #1e3444;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  margin-right: 10px;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Legal buttons */
.legal-btn {
  background: #f8f9fa;
  color: #2c4a5e;
  border: 1px solid #dee2e6;
  padding: 6px 16px;
  margin: 0 4px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.legal-btn:hover {
  background: #2c4a5e;
  color: white;
  border-color: #2c4a5e;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legal-btn:active {
  transform: translateY(0);
}

.success-message {
  color: #28a745;
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  padding: 12px;
  border-radius: 4px;
  margin: 15px 0;
  font-size: 14px;
  display: none;
  text-align: center;
}

.signup-footer, .login-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.signup-footer a, .login-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.signup-footer a:hover, .login-footer a:hover {
  text-decoration: underline;
}

.submit-btn.loading {
  position: relative;
  color: transparent;
}

.submit-btn.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  margin: auto;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: button-spin 0.8s linear infinite;
}

@media (max-width: 480px) {
  .signup-modal-content {
    width: 95%;
    padding: 20px;
  }
  
  .beta-warning {
    padding: 12px;
  }
  
  .beta-warning h4 {
    font-size: 15px;
  }
  
  .beta-warning li {
    font-size: 13px;
  }
  
  .legal-modal-content {
    width: 95%;
    margin: 10px;
  }
}
