body {
  background: #0a0a0a !important;
  color: #cccccc;
  font-family: 'Times New Roman', serif;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Times New Roman', serif; /* Ensured consistency */
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--heading-color);
    transition: color 0.3s ease;
}

.subtitle {
  font-size: 0.95rem;
  margin-bottom: 2rem;
  color: #999999;
}

.section-title {
  font-size: 1.2rem;
  margin-top: 2rem;
  color: #ffffff;
  border-bottom: 1px solid #333333;
  padding-bottom: 0.3rem;
}
.text-block {
  background-color: #151515;
  padding: 1rem;
  border: 1px solid #2a2a2a;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
  margin-top: 0.8rem;
  font-size: 1rem;
  line-height: 1.5;
}

button {
  background-color: transparent;
  border: 1px solid #333333;
  color: #6699ff;
  padding: 0.5rem 1.2rem;
  font-size: 0.95rem;
  font-family: 'Times New Roman', serif;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border 0.2s ease;
  /* NO width, box-sizing, or margin-right here. This is the general button style. */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

button:hover {
  background-color: #1a1a1a;
  border-color: #6699ff;
  color: #ffffff;
}

/* --- THE FIX IS HERE --- */

/* Common styles for both button wrappers */
.main-menu-buttons-wrapper,
.sub-menu-buttons-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem; /* This creates the space between buttons */
  width: 100%;
  justify-content: center; /* Center the buttons for consistent spacing */
}

.sub-menu-buttons-wrapper {
  padding-bottom: 0.75rem;
  max-height: 60vh; /* Limit height to prevent overflow */
  overflow-y: auto; /* Make scrollable */
  scrollbar-width: thin;
  scrollbar-color: #333333 #151515;
}

/* Custom scrollbar for sub-menu-buttons-wrapper */
.sub-menu-buttons-wrapper::-webkit-scrollbar {
  width: 6px;
}

.sub-menu-buttons-wrapper::-webkit-scrollbar-track {
  background: #151515;
}

.sub-menu-buttons-wrapper::-webkit-scrollbar-thumb {
  background: #333333;
  border-radius: 3px;
}

.sub-menu-buttons-wrapper::-webkit-scrollbar-thumb:hover {
  background: #555555;
}

/* Make buttons INSIDE the wrappers grow to fill the space */
.main-menu-buttons-wrapper > button,
.sub-menu-buttons-wrapper > button {
    flex-grow: 1; /* This is the key property to make buttons stretch */
    text-align: center; /* Ensures text is centered inside the grown button */
    min-height: 44px; /* Ensure minimum touch target size */
    touch-action: manipulation; /* Optimize for touch */
}

/* --- END OF THE FIX --- */


.back-button {
  display: block;
  text-align: center;
  margin-top: 3rem;
  font-size: 0.9rem;
  color: #6699ff;
  text-decoration: none;
}

.back-button:hover {
  text-decoration: underline;
}

/* --- Log entry styling --- */
#log {
  max-height: 250px;
  overflow-y: scroll;
  padding-right: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: #333333 #151515;
  flex: 1;
  min-height: 0;
}

/* Custom scrollbar for webkit browsers */
#log::-webkit-scrollbar {
  width: 6px;
}

#log::-webkit-scrollbar-track {
  background: #151515;
}

#log::-webkit-scrollbar-thumb {
  background: #333333;
  border-radius: 3px;
}

#log::-webkit-scrollbar-thumb:hover {
  background: #555555;
}

#log div {
  margin-bottom: 0.5rem;
  padding-left: 0.5rem;
  border-left: 3px solid;
}

#log div.log-event-default {
  border-left-color: #6699ff;
}

#log div.log-event-positive {
  border-left-color: #00cc66;
}

#log div.log-event-negative {
  border-left-color: #ff3333;
}

#log div.log-event-action {
  border-left-color: #ffaa00;
}

/* --- Menu-specific UI Adjustments (These are from the previous correct steps) --- */

.current-job-display {
  background-color: #1a1a1a;
  padding: 0.8rem;
  border: 1px solid #333333;
  color: #dddddd;
  margin-top: 0.5rem;
  margin-bottom: 0.8rem;
  text-align: center;
  font-size: 1.1rem;
}

.text-block.menu-active {
    padding-top: 0;
    padding-bottom: 1rem;
}

.section-title.category-menu-title {
  margin-top: 0;
  margin-bottom: 0.8rem;
  padding-top: 0.8rem;
  padding-bottom: 0.3rem;
}

/* Mobile-only Aspirinlife title */
#mobile-title {
  display: none;
}

@media screen and (max-width: 480px) {
  #mobile-title {
    display: block;
    text-align: center;
    font-size: 1.3rem;
    font-weight: bold;
    padding: 0.7rem 0 0.5rem 0;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
    z-index: 10;
  }
}

/* --- Mobile Responsive Design --- */

/* Tablet and smaller screens */
@media screen and (max-width: 768px) {
  .container {
    padding: 1rem;
    max-width: 100%;
  }
  
  .title {
    font-size: 1.5rem;
  }
  
  .subtitle {
    font-size: 0.85rem;
  }
  
  .section-title {
    font-size: 1.1rem;
  }
  
  .text-block {
    padding: 0.8rem;
    font-size: 0.9rem;
  }
  
  /* Adjust button layout for mobile */
  .main-menu-buttons-wrapper,
  .sub-menu-buttons-wrapper {
    gap: 0.5rem;
  }
  
  .main-menu-buttons-wrapper > button,
  .sub-menu-buttons-wrapper > button {
    flex: 1 1 calc(50% - 0.25rem); /* Two buttons per row on mobile */
    min-width: 120px;
  }
  
  /* Ensure consistent spacing for main menu */
  .main-menu-buttons-wrapper {
    justify-content: center;
  }
  
  /* Special styling for age-up button */
  .age-up-button {
    flex: 1 1 100% !important; /* Full width on mobile */
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: #1a1a1a;
    border-color: #6699ff;
    font-weight: bold;
  }
  
  #log {
    max-height: 200px;
  }
}

/* Mobile phones */
@media screen and (max-width: 480px) {
  .container {
    padding: 0.5rem;
  }
  
  /* Character creation positioning for mobile */
  .character-creation-mode .container {
    padding: 2rem 0.5rem 0.5rem 0.5rem !important;
    justify-content: flex-start !important;
    height: 100vh !important;
    min-height: 100vh !important;
    max-height: 100vh !important;
  }
  
  .title {
    font-size: 1.3rem;
    text-align: center;
  }
  
  .subtitle {
    font-size: 0.8rem;
    text-align: center;
  }
  
  .section-title {
    font-size: 1rem;
    text-align: center;
  }
  
  /* Hide section titles on very small screens for cleaner look */
  .section-title:not(.category-menu-title) {
    display: none;
  }
  
  .text-block {
    padding: 0.6rem;
    font-size: 0.85rem;
  }
  
  button {
    padding: 0.7rem 0.8rem;
    font-size: 0.85rem;
    min-height: 48px; /* Even better touch target for phones */
  }
  
  /* Three buttons per row layout for mobile */
  .main-menu-buttons-wrapper > button,
  .sub-menu-buttons-wrapper > button {
    flex: 1 1 calc(33.333% - 0.33rem); /* Three buttons per row */
    min-width: 80px;
    margin-bottom: 0.3rem;
    margin-right: 0.3rem;
  }
  
  /* Special handling for classmates list on mobile */
  .sub-menu-buttons-wrapper {
    max-height: 50vh; /* Smaller max height on mobile */
    gap: 0.4rem; /* Tighter spacing for more classmates */
  }
  
  /* Bigger emojis and smaller text for buttons */
  button {
    font-size: 1.2rem; /* Bigger emoji size */
    line-height: 1.2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
  }
  
  /* Hide text content in buttons, show only emojis */
  button span {
    font-size: 0.7rem; /* Smaller subtitle text */
    opacity: 0.8;
  }
  
  /* Fix spacing for main menu buttons - ensure consistent gaps */
  .main-menu-buttons-wrapper {
    gap: 0.3rem !important;
    justify-content: center;
  }
  
  /* Make life log and stats more readable on mobile */
  #log {
    max-height: 180px;
    font-size: 0.9rem;
  }
  
  #log div {
    font-size: 0.9rem;
    line-height: 1.5;
    padding-left: 0.8rem;
    margin-bottom: 0.4rem;
  }
  
  #stats {
    font-size: 1rem;
    line-height: 1.7;
  }
  
  .age-up-button {
    flex: 1 1 100% !important; /* Full width for age-up button */
    margin-top: 0.8rem;
    margin-bottom: 0.8rem;
    font-size: 1rem;
    flex-direction: row; /* Keep age-up button horizontal */
  }
  
  #log {
    max-height: 150px;
    font-size: 0.8rem;
  }
  
  #stats {
    font-size: 0.9rem;
    line-height: 1.6;
  }
  
  .back-button {
    margin-top: 2rem;
    font-size: 0.85rem;
    padding: 0.5rem;
  }
}

/* Landscape orientation adjustments */
@media screen and (max-width: 768px) and (orientation: landscape) {
  .container {
    padding: 0.5rem 1rem;
  }
  
  .title {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
  }
  
  .subtitle {
    font-size: 0.75rem;
    margin-bottom: 1rem;
  }
  
  .section-title {
    font-size: 0.95rem;
    margin-top: 1rem;
  }
  
  .text-block {
    padding: 0.5rem;
    margin-top: 0.5rem;
  }
  
  #log {
    max-height: 120px;
  }
  
  #stats {
    font-size: 0.8rem;
  }
  
  /* Better classmates list in landscape */
  .sub-menu-buttons-wrapper {
    max-height: 40vh; /* Even smaller in landscape */
    gap: 0.3rem;
  }
  
  .sub-menu-buttons-wrapper > button {
    flex: 1 1 calc(25% - 0.25rem); /* Four buttons per row in landscape */
    min-width: 70px;
  }
}

/* Ensure buttons are touch-friendly on all mobile devices */
@media (hover: none) and (pointer: coarse) {
  button {
    min-height: 44px;
    padding: 0.6rem 1rem;
    -webkit-tap-highlight-color: rgba(102, 153, 255, 0.3);
    touch-action: manipulation;
  }
  
  button:hover {
    background-color: transparent; /* Disable hover effects on touch devices */
    border-color: #333333;
    color: #6699ff;
  }
  
  button:active {
    background-color: #1a1a1a;
    border-color: #6699ff;
    color: #ffffff;
  }
  
  button:focus {
    outline: 2px solid #6699ff;
    outline-offset: 2px;
  }
  
  /* Touch-friendly passport optimizations */
  .passport-display {
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
  }
  
  .passport-section {
    min-height: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.5rem;
  }
  
  .passport-section h3 {
    margin-bottom: 0.3rem;
    font-size: 0.7rem;
  }
  
  .passport-section p {
    margin: 0.1rem 0;
    line-height: 1.4;
    font-size: 0.65rem;
  }
  
  .passport-avatar {
    touch-action: manipulation;
  }
}

/* Additional mobile improvements */
@media screen and (max-width: 480px) {
  /* Improve job application screen on mobile */
  #choices h3 {
    font-size: 1rem;
    text-align: center;
    margin-bottom: 1rem;
  }
  
  #choices p {
    text-align: center;
    font-size: 1rem;
    margin: 1rem 0;
  }
  
  /* Better spacing for category menus */
  .category-menu-title {
    margin-bottom: 1rem !important;
  }
  
  /* Improve log readability on mobile */
  #log div {
    font-size: 0.9rem;
    line-height: 1.5;
    padding-left: 0.8rem;
    margin-bottom: 0.4rem;
  }
  
  /* Improve stats readability on mobile */
  #stats {
    font-size: 1rem;
    line-height: 1.7;
  }
  
  /* Better button text wrapping */
  button {
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
    min-height: 48px;
    padding: 0.8rem 1rem;
    font-size: 1rem;
  }
  
  /* Hide project info on very small screens */
  .title,
  .subtitle {
    display: none;
  }
}

/* Stats section specific styling */
#stats {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  min-height: 120px;
  padding: 1rem 1.1rem;
}

/* Stats progress bars */
.stat-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.2rem 0.2rem;
}

.stat-label {
  min-width: 70px;
  font-size: 1rem;
  color: var(--text-color);
  text-align: right;
}

.stat-emoji {
  width: 24px;
  text-align: center;
  font-size: 1.1rem;
}

.stat-bar {
  flex: 1;
  height: 24px;
  background-color: #2a2a2a;
  border-radius: 0;
  position: relative;
  overflow: hidden;
  border: 0px;
  display: flex;
  align-items: stretch;
}

.stat-fill {
  height: 100%;
  border-radius: 0;
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
}

.stat-text {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 0.8rem;
  font-weight: bold;
  z-index: 1;
}

/* Character creation styles */
.creation-form {
  max-width: 400px;
  margin: 0 auto;
}

/* Hide elements during character creation */
.character-creation-mode .title,
.character-creation-mode .subtitle,
.character-creation-mode .section-title,
.character-creation-mode #log,
.character-creation-mode #stats,
.character-creation-mode #mobile-title {
  display: none;
}

.character-creation-mode .container {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  min-height: 100vh;
  padding: 2rem 0.5rem 0.5rem 0.5rem;
}

.character-creation-mode #character-creation {
  width: 100% !important;
  max-width: 350px !important;
  margin-top: 0 !important;
  text-align: center !important;
}

.character-creation-mode #character-creation h3 {
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
  color: var(--heading-color);
}

.pill-glow {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8)) 
          drop-shadow(0 0 20px rgba(255, 255, 255, 0.6))
          drop-shadow(0 0 30px rgba(255, 255, 255, 0.4));
  animation: pillPulse 2s ease-in-out infinite alternate;
}

@keyframes pillPulse {
  0% {
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8)) 
            drop-shadow(0 0 20px rgba(255, 255, 255, 0.6))
            drop-shadow(0 0 30px rgba(255, 255, 255, 0.4));
  }
  100% {
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 1)) 
            drop-shadow(0 0 25px rgba(255, 255, 255, 0.8))
            drop-shadow(0 0 35px rgba(255, 255, 255, 0.6));
  }
}

.form-group {
  margin-bottom: 0.7rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.2rem;
  font-weight: bold;
  color: var(--text-color);
  font-size: 0.8rem;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #444;
  background-color: #1a1a1a;
  color: var(--text-color);
  font-family: 'Times New Roman', serif;
  font-size: 0.8rem;
  box-sizing: border-box;
}

.form-group input[type="text"]:focus {
  outline: none;
  border-color: #6699ff;
  box-shadow: 0 0 5px rgba(102, 153, 255, 0.3);
}

.name-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.name-input-group input[type="text"] {
  flex: 1;
}

.randomize-btn {
  padding: 0.6rem;
  font-size: 0.9rem;
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radio-group {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  cursor: pointer;
  font-weight: normal;
  margin-bottom: 0;
  font-size: 0.75rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0px;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
}

.radio-group label:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.radio-group input[type="radio"] {
  margin: 0;
  cursor: pointer;
  display: none;
}

.radio-group input[type="radio"]:checked + span {
  color: #6699ff;
  font-weight: bold;
}

.radio-group label:has(input[type="radio"]:checked) {
  background: rgba(102, 153, 255, 0.1);
  border-color: #6699ff;
  color: #6699ff;
}

.radio-group input[type="radio"] {
  margin: 0;
  cursor: pointer;
}

#start-button {
  width: 100%;
  padding: 1rem;
  font-size: 1.1rem;
  margin-top: 1rem;
  background-color: transparent;
  border-color: #333333;
  color: #6699ff;
  font-weight: bold;
}

#start-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #333;
  border-color: #555;
  color: #888;
}

#start-button:disabled:hover {
  background-color: #333;
  border-color: #555;
  color: #888;
}

.form-actions {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.randomize-all-btn {
  flex: 1;
  padding: 0.6rem;
  font-size: 0.8rem;
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #dddddd;
}

.randomize-all-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

#start-button {
  flex: 2;
  padding: 0.6rem;
  font-size: 0.9rem;
  margin-top: 0;
  background-color: rgba(102, 153, 255, 0.1);
  border-color: #6699ff;
  color: #6699ff;
  font-weight: bold;
}

#start-button:hover {
  background-color: rgba(102, 153, 255, 0.2);
  border-color: #6699ff;
  color: #6699ff;
}

/* NPC and Relationship Styles */
.npc-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0px;
    padding: 15px;
    margin-bottom: 10px;
    backdrop-filter: blur(10px);
}

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

.npc-name {
    font-weight: bold;
    color: #fff;
}

.npc-age {
    color: #ccc;
    font-size: 0.9em;
}

.relationship-bar {
    position: relative;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0px;
    overflow: hidden;
    margin-bottom: 10px;
}

.relationship-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.relationship-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 0.8em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.npc-actions {
    text-align: center;
}

.relationship-display {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0px;
}

/* Passport Display Styles - Desktop */
.passport-display {
    display: flex;
    gap: 0.7rem;
    margin-bottom: 0.7rem;
    padding: 0.7rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0px;
}

.passport-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 0px;
}

.avatar-emoji {
    font-size: 2rem;
    text-align: center;
    line-height: 1;
}

.passport-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.passport-section {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.4rem;
    border-radius: 0px;
}

.passport-section h3 {
    margin: 0 0 0.2rem 0;
    color: #6699ff;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.passport-section p {
    margin: 0.05rem 0;
    color: #dddddd;
    font-size: 0.7rem;
}

.passport-section strong {
    color: #ffffff;
    font-weight: bold;
}

/* Mobile Passport Popup */
@media screen and (max-width: 768px) {
    .passport-popup-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.8);
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 1rem;
    }
    
    .passport-popup {
        background: #151515;
        border: 1px solid #2a2a2a;
        border-radius: 0;
        width: 100%;
        max-width: 350px;
        max-height: 90vh;
        overflow-y: auto;
        padding: 1rem;
        position: relative;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
    }
    
    .passport-popup-header {
        text-align: center;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .passport-popup-title {
        font-size: 1.2rem;
        color: #6699ff;
        font-weight: bold;
        margin: 0;
    }
    
    .passport-popup-avatar {
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .passport-popup-emoji {
        font-size: 4rem;
        display: block;
        margin: 0 auto;
    }
    
    .passport-popup-info {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .passport-popup-section {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0px;
        padding: 0.6rem;
    }
    
    .passport-popup-section h3 {
        font-size: 0.7rem;
        margin: 0 0 0.3rem 0;
        color: #6699ff;
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
    
    .passport-popup-section p {
        font-size: 0.65rem;
        margin: 0.1rem 0;
        color: #dddddd;
        line-height: 1.3;
    }
    
    .passport-popup-section strong {
        color: #ffffff;
        font-weight: bold;
    }
    
    .passport-popup-close {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        background: none;
        border: none;
        color: #999;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.2rem;
        line-height: 1;
    }
    
    .passport-popup-close:hover {
        color: #fff;
    }
}

@media screen and (max-width: 480px) {
    .passport-popup {
        max-width: 95vw;
        padding: 0.8rem;
        max-height: 80vh;
    }
    
    .passport-popup-title {
        font-size: 1.1rem;
    }
    
    .passport-popup-emoji {
        font-size: 3.5rem;
    }
    
    .passport-popup-section {
        padding: 0.5rem;
    }
    
    .passport-popup-section h3 {
        font-size: 0.65rem;
        margin-bottom: 0.25rem;
    }
    
    .passport-popup-section p {
        font-size: 0.6rem;
    }
}

@media screen and (max-width: 360px) {
    .passport-popup {
        max-width: 98vw;
        padding: 0.6rem;
        max-height: 75vh;
    }
    
    .passport-popup-title {
        font-size: 1rem;
    }
    
    .passport-popup-emoji {
        font-size: 3rem;
    }
    
    .passport-popup-section {
        padding: 0.4rem;
    }
    
    .passport-popup-section h3 {
        font-size: 0.6rem;
        margin-bottom: 0.2rem;
    }
    
    .passport-popup-section p {
        font-size: 0.55rem;
    }
}

/* Landscape mobile passport popup */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .passport-popup {
        max-width: 90vw;
        max-height: 70vh;
        display: flex;
        flex-direction: row;
        gap: 1rem;
        padding: 1rem;
    }
    
    .passport-popup-header {
        flex-shrink: 0;
        width: 120px;
        margin-bottom: 0;
        border-bottom: none;
        border-right: 1px solid rgba(255, 255, 255, 0.2);
        padding-right: 1rem;
        padding-bottom: 0;
    }
    
    .passport-popup-emoji {
        font-size: 3rem;
    }
    
    .passport-popup-info {
        flex: 1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
        overflow-y: auto;
        max-height: 100%;
    }
    
    .passport-popup-section {
        padding: 0.4rem;
    }
    
    .passport-popup-section h3 {
        font-size: 0.6rem;
        margin-bottom: 0.2rem;
    }
    
    .passport-popup-section p {
        font-size: 0.55rem;
    }
}

.passport-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  padding: 1rem;
  box-sizing: border-box;
}

/* Remove the desktop .passport-popup rule and force mobile style for all */
.passport-popup {
  background: #151515;
  border: 1px solid #2a2a2a;
  border-radius: 0;
  width: 100%;
  max-width: 320px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 0.8rem;
  position: relative;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
  scrollbar-width: thin;
  scrollbar-color: #333333 #151515;
}

/* Custom scrollbar for passport popup */
.passport-popup::-webkit-scrollbar {
  width: 6px;
}

.passport-popup::-webkit-scrollbar-track {
  background: #151515;
}

.passport-popup::-webkit-scrollbar-thumb {
  background: #333333;
  border-radius: 3px;
}

.passport-popup::-webkit-scrollbar-thumb:hover {
  background: #555555;
}

.passport-popup-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  z-index: 10001;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 600px) {
  .passport-popup {
    max-width: 98vw;
    padding: 12px 4px 8px 4px;
  }
}

.passport-popup-title {
  font-size: 1.1rem;
  color: #6699ff;
  font-weight: bold;
  margin: 0;
}

.passport-popup-emoji {
  font-size: 3.5rem;
  display: block;
  margin: 0 auto;
}

.passport-popup-section {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0px;
  padding: 0.5rem;
}

.passport-popup-section h3 {
  font-size: 0.65rem;
  margin-bottom: 0.25rem;
  color: #6699ff;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.passport-popup-section p {
  font-size: 0.6rem;
  margin: 0.1rem 0;
  color: #dddddd;
  line-height: 1.3;
}

@media screen and (min-width: 601px) {
  .passport-popup {
    max-width: 500px;
    max-height: 80vh;
    font-size: 1.35em;
  }
}

/* Ultra-compact classmates list for very small screens */
@media screen and (max-width: 360px) {
  .sub-menu-buttons-wrapper {
    max-height: 45vh;
    gap: 0.2rem;
  }
  
  .sub-menu-buttons-wrapper > button {
    flex: 1 1 calc(50% - 0.1rem); /* Two buttons per row on very small screens */
    min-width: 60px;
    font-size: 0.8rem;
    padding: 0.4rem 0.3rem;
  }
  
  /* Ultra-compact passport popup for very small screens */
  .passport-popup-close {
    top: 4px;
    right: 8px;
    font-size: 1.5rem;
    min-width: 40px;
    min-height: 40px;
  }
}

/* Changelog scrollbar styling - matches life log exactly */
.text-block[style*="overflow-y: auto"] {
  scrollbar-width: thin;
  scrollbar-color: #333333 #151515;
}

.text-block[style*="overflow-y: auto"]::-webkit-scrollbar {
  width: 6px;
}

.text-block[style*="overflow-y: auto"]::-webkit-scrollbar-track {
  background: #151515;
}

.text-block[style*="overflow-y: auto"]::-webkit-scrollbar-thumb {
  background: #333333;
  border-radius: 3px;
}

.text-block[style*="overflow-y: auto"]::-webkit-scrollbar-thumb:hover {
  background: #555555;
}