* {
  box-sizing: border-box;
}

body {
  /* Soft Background: Light Cream (#f7f1c1) */
  background: #f7f1c1; 
  font-family: Arial, sans-serif;
  text-align: center;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden; 
  display: flex;
  flex-direction: column;
}

/* Header Styles */
.app-header {
  width: 100%;
  padding: 1.5vmin 4vmin;
  background: #7a9159;
  box-shadow: 0 0.5vmin 1vmin rgba(0, 0, 0, 0.2);
  z-index: 100;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1vmin;
}

.welcome-text {
  color: #f7f1c1;
  font-size: 2vmin;
  font-weight: normal;
}

.user-name {
  color: #f7f1c1;
  font-size: 2.2vmin;
  font-weight: bold;
  letter-spacing: 0.05em;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.8vmin;
  padding: 1vmin 2vmin;
  background: rgba(247, 241, 193, 0.15);
  border: 1px solid rgba(247, 241, 193, 0.4);
  border-radius: 0.6vmin;
  color: #f7f1c1;
  font-size: 1.6vmin;
  font-family: Arial, sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  margin-right: 1vmin;
}

.theme-toggle-btn:hover {
  background: rgba(247, 241, 193, 0.25);
  border-color: rgba(247, 241, 193, 0.6);
  transform: translateY(-0.2vmin);
  box-shadow: 0 0.3vmin 0.8vmin rgba(0, 0, 0, 0.15);
}

.theme-toggle-btn:active {
  transform: translateY(0);
}

.theme-toggle-btn svg {
  width: 1.8vmin;
  height: 1.8vmin;
  flex-shrink: 0;
}

.theme-toggle-btn span {
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* Logout Button */
.logout-btn {
  display: flex;
  align-items: center;
  gap: 0.8vmin;
  padding: 1vmin 2vmin;
  background: rgba(247, 241, 193, 0.15);
  border: 1px solid rgba(247, 241, 193, 0.4);
  border-radius: 0.6vmin;
  color: #f7f1c1;
  font-size: 1.6vmin;
  font-family: Arial, sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.logout-btn:hover {
  background: rgba(247, 241, 193, 0.25);
  border-color: rgba(247, 241, 193, 0.6);
  transform: translateY(-0.2vmin);
  box-shadow: 0 0.3vmin 0.8vmin rgba(0, 0, 0, 0.15);
}

.logout-btn:active {
  transform: translateY(0);
}

.logout-btn svg {
  width: 1.8vmin;
  height: 1.8vmin;
  flex-shrink: 0;
}

.logout-btn span {
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* Footer Styles */
.app-footer {
  width: 100%;
  padding: 1.5vmin 4vmin;
  background: #7a9159;
  box-shadow: 0 -0.5vmin 1vmin rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.app-footer p {
  color: #f7f1c1;
  font-size: 1.6vmin;
  margin: 0;
  letter-spacing: 0.05em;
}

/* Main Content Area */
.main-app-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vmin 0;
  width: 100%;
}

.container {
  position: relative;
  display: inline-block;
  padding: 4vmin;
  /* Soft Frame: Slightly Darker Cream (#f4f3e9) */
  background: #f4f3e9;
  border-radius: 2vmin;
  box-shadow: 0 1vmin 3vmin rgba(0, 0, 0, 0.3);
}

.title {
  font-size: 3vmin;
  /* Text Color: Olive Green (#7a9159) */
  color: #7a9159; 
  margin-bottom: 3vmin;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.cards-wrapper {
  display: flex;
  gap: 2vmin;
  justify-content: center;
  margin-bottom: 3vmin;
}

.card-container {
  position: relative;
  width: 20vmin;
  height: 28vmin;
  perspective: 1000px;
}

.number {
  position: absolute;
  width: 100%;
  height: 100%;
  display: none;
}

.number.is-active {
  display: block;
  z-index: 2;
  animation: zIndexUp 0.5s forwards;
}

.number.outgoing {
  display: block;
  z-index: 1;
  animation: zIndexDown 0.5s forwards;
}

@keyframes zIndexUp {
  0% {
    z-index: 1;
  }
  100% {
    z-index: 2;
  }
}

@keyframes zIndexDown {
  0% {
    z-index: 2;
  }
  100% {
    z-index: 1;
  }
}

.up,
.down {
  position: absolute;
  width: 100%;
  height: calc(50% - 1px);
  overflow: hidden;
  /* Card Background: Dusty Red/Maroon (User Request) */
  background: #a14747;
  border-radius: 1vmin;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  transition: none;
}

.up:before,
.down:before {
  position: absolute;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  content: "";
  transition: opacity 0.25s;
}

.up {
  top: 0;
  transform-origin: bottom center;
}

.up:before {
  bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
}

.up .digit {
  line-height: 26vmin;
}

.down {
  bottom: 0;
  transform: perspective(100vmin) rotateX(180deg);
  transform-origin: top center;
}

.down:before {
  top: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
}

.down .digit {
  position: absolute;
  bottom: 0;
  width: 100%;
  line-height: 30vmin;
}

.digit {
  width: 100%;
  /* Digit Color: Medium Yellow/Orange (User Request) */
  color: #e8a74e; 
  font-size: 20vmin;
  font-weight: bold;
  text-align: center;
}

.is-active .up:before,
.is-active .down:before {
  opacity: 0;
}

.is-active .down {
  transform: perspective(100vmin) rotateX(0deg);
  transition: transform 0.5s;
}

.outgoing .up {
  transform: perspective(100vmin) rotateX(-180deg);
  transition: transform 0.5s;
}

.outgoing .down {
  transform: perspective(100vmin) rotateX(0deg);
  transition: transform 0.5s;
}

.btn {
  padding: 2vmin 4vmin;
  /* Button Background: Olive Green (#7a9159) - Complementary to cards */
  background: #7a9159; 
  /* Button Text: Light Cream (#f7f1c1) */
  color: #f7f1c1;
  border: none;
  border-radius: 1vmin;
  font-size: 2vmin;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  /* Kept the soft shadow for the old school feel */
  box-shadow: 0 0.5vmin 1vmin rgba(0, 0, 0, 0.2);
  transition: all 0.3s;
}

.btn:hover {
  /* Kept the hover shadow */
  box-shadow: 0 0.75vmin 1.5vmin rgba(0, 0, 0, 0.3);
  transform: translateY(-0.5vmin);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status {
  margin-top: 2vmin;
  font-size: 1.8vmin;
  /* Status Color: Olive Green (#7a9159) */
  color: #7a9159;
  min-height: 2.5vmin;
}

.lion-logo-placeholder {
  position: absolute;
  top: -10vmin;
  right: -10vmin;
  width: 20vmin;
  height: 20vmin;
  border-radius: 50%;
  background-color: #a14747; 
  z-index: 100;
  mask: url("/static/images/hl-logo-fine.svg") no-repeat center;
  -webkit-mask: url("/static/images/hl-logo-fine.svg") no-repeat center;
  mask-size: contain;
  -webkit-mask-size: contain;
}

.main-app-content.blurred {
  filter: blur(5px);
  pointer-events: none; /* Disables interaction with blurred content */
  user-select: none;
}

/* --- Generic Modal/Alert Styles --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4); /* Slightly darker backdrop for alerts */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 1100; /* Higher than login-overlay */
}

.modal-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  padding: 4vmin; /* Slightly smaller padding than login box */
  background: #f4f3e9; /* Soft Frame color */
  border-radius: 1vmin;
  box-shadow: 0 1vmin 4vmin rgba(0, 0, 0, 0.6); /* More pronounced shadow */
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.modal-box h2 {
  color: #7a9159; /* Olive Green Title color */
  margin-top: 0;
  font-size: 2.2vmin;
  margin-bottom: 2vmin;
}

.modal-box p {
  color: #333; 
  margin-bottom: 3vmin;
  font-size: 1.6vmin;
  line-height: 1.5;
}

.modal-box .btn {
  /* Inherits .btn styling */
  padding: 1.5vmin 3vmin;
  margin: 0.5vmin;
  min-width: 12vmin;
}


/* Login Overlay Styles (Existing) */
.login-overlay {
  /* Position the overlay over the entire viewport */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  
  /* Use a slight dark/transparent backdrop */
  background: rgba(0, 0, 0, 0.2);
  
  /* Center the login box */
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Initially hidden */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 1000;
}

.login-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.login-box {
  padding: 5vmin;
  background: #f4f3e9; /* Light container color */
  border-radius: 1vmin;
  box-shadow: 0 2vmin 5vmin rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 400px;
}

.login-box h2 {
  color: #4b4b62; /* Espresso/Title color */
  margin-top: 0;
  font-size: 2.5vmin;
}

.login-box p {
  color: #4b4b62; /* Espresso/Title color */
  margin-bottom: 3vmin;
  font-size: 1.8vmin;
}

.login-btn {
  /* Inherits button styling from .btn but overrides padding/margins for modal */
  padding: 1.5vmin 3vmin;
  margin-top: 1vmin;
}

/* Floating Help Button */
.help-button {
  position: fixed;
  bottom: 3vmin;
  right: 3vmin;
  width: 7vmin;
  height: 7vmin;
  background: #7a9159;
  border: 2px solid rgba(247, 241, 193, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0.5vmin 1.5vmin rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  z-index: 1000;
  padding: 0;
  font-family: Arial, sans-serif;
}

.help-button:hover {
  transform: translateY(-0.5vmin) scale(1.05);
  box-shadow: 0 0.75vmin 2vmin rgba(0, 0, 0, 0.4);
  background: #8aa569;
}

.help-button svg {
  width: 3.5vmin;
  height: 3.5vmin;
  color: #f7f1c1;
}

.help-button::before {
  content: 'User Guide';
  position: absolute;
  right: 100%;
  margin-right: 1.5vmin;
  padding: 0.8vmin 1.5vmin;
  background: #7a9159;
  color: #f7f1c1;
  border-radius: 0.6vmin;
  font-size: 1.6vmin;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  box-shadow: 0 0.3vmin 0.8vmin rgba(0, 0, 0, 0.2);
}

.help-button::after {
  content: '';
  position: absolute;
  right: 100%;
  margin-right: 0.5vmin;
  border: 0.6vmin solid transparent;
  border-left-color: #7a9159;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.help-button:hover::before,
.help-button:hover::after {
  opacity: 1;
}