/* Import Google Fonts for Turkish character support - Must be at the top */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&display=swap');

@font-face {
  font-family: Bebas-Regular;
  src: url('fonts/Bebas-Regular.otf');
  unicode-range: U+0020-007F;
  /* Only ASCII characters */
}

html,
body {
  box-sizing: border-box;
  height: 100%;
  margin: 0;
  /* Primary font for Turkish characters, Bebas as fallback for English */
  font-family: 'Montserrat', 'Inter', 'Roboto', 'Oswald', Bebas-Regular, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial', sans-serif;
  font-feature-settings: "liga" 1, "kern" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  background: linear-gradient(0deg, #3a5177, #81b1e0);
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

h1 {
  text-align: center;
  font-size: x-large;
  font-weight: normal;
  margin: 0;
  color: white;
}

#root-window {
  height: 100%;
}

#render-target {
  position: relative;
  height: 100%;
}

#instructions {
  position: absolute;
  color: white;
  left: 0;
  bottom: 0;
  margin: 8px;
}

#version {
  position: absolute;
  color: white;
  right: 0;
  bottom: 0;
  margin: 8px;
}

.text-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  color: white;
  font-size: 5em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon,
.score-icon,
.toolbar-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-svg {
  width: 24px;
  height: 24px;
  color: white;
  transition: transform 0.2s ease;
}

.ui-button:hover .toolbar-svg {
  transform: scale(1.1);
  color: #4CAF50;
}

.ui-button.selected .toolbar-svg {
  color: #4CAF50;
}

.info-svg {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
  color: currentColor;
}

.container {
  background-color: #00000048;
  padding: 12px;
}

#ui-toolbar.container {
  padding: 4px 0;
  background-color: #00000048;
}

#ui-toolbar {
  position: absolute;
  top: 96px;
  left: 0px;
  width: 120px;
  min-width: 120px;
  max-height: 600px;
  height: auto;

  box-shadow: 0px 0px 1px black;

  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  align-content: flex-start;
  gap: 4px;
  padding: 4px;
  overflow-y: auto;
  overflow-x: hidden;

  /* Scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: #3a3f50d3 #1e2331cd;
}

#ui-toolbar::-webkit-scrollbar {
  width: 6px;
}

#ui-toolbar::-webkit-scrollbar-track {
  background: #1e2331cd;
}

#ui-toolbar::-webkit-scrollbar-thumb {
  background: #3a3f50d3;
  border-radius: 3px;
}

#ui-toolbar::-webkit-scrollbar-thumb:hover {
  background: #4a4f60d3;
}

.ui-button {
  height: 48px;
  width: 48px;
  min-height: 48px;
  min-width: 48px;
  margin: 0;

  transition: background-color 0.1s ease-in-out;

  background-color: #1e2331cd;
  border: none;
  border-radius: 6px;

  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.ui-button.selected {
  background-color: #3a3f50d3;
  outline: 2px solid rgb(101, 101, 135);
}

.ui-button:not(.selected):hover {
  background-color: #121622d3;
}

.ui-container {
  background-color: #33333355;
  padding: 16px;
}

.toolbar-icon {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

/* TITLE BAR */

#title-bar {
  position: fixed;

  top: 0;
  left: 0;
  right: 0;
  height: 52px;

  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  padding: 0 20px;

  border-bottom: 1px solid rgba(255, 255, 255, 0.1);

  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  overflow: hidden;
  z-index: 1000;
}

.title-bar-items {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.1em;
  font-weight: 500;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-bar-stat {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  width: 18px;
  height: 18px;
  stroke: rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}

#money-stat .stat-icon {
  stroke: #FFD700;
}

#energy-stat .stat-icon {
  stroke: #00E5FF;
}


.title-bar-left-items {
  flex: 2 1 45%;
  justify-content: flex-start;
  padding-left: 12px;
  gap: 0;
}

.title-bar-center-items {
  flex: 1 1 30%;
  font-size: 2em;
}

.title-bar-right-items {
  flex: 1 1 25%;
  justify-content: flex-end;
  padding-right: 12px;
  gap: 8px;
}


#population-icon {
  position: relative;
  width: 32px;
  height: 32px;
  top: -3px;
}

#population-counter {
  margin-left: 8px;
}

.tb-sep {
  margin: 0 12px;
  opacity: 0.4;
}

/* CITY SCORES BAR */
#scores-bar {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  height: 36px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 0 16px;
  z-index: 999;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.score-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: white;
  font-size: 0.78em;
  white-space: nowrap;
}

.score-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.score-icon svg {
  width: 100%;
  height: 100%;
  stroke: rgba(255, 255, 255, 0.8);
}


.score-label {
  font-weight: 600;
  opacity: 0.85;
  min-width: 38px;
  font-size: 0.85em;
  letter-spacing: 0.3px;
}

.score-bar-bg {
  width: 70px;
  height: 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.score-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease, background 0.3s ease;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.15);
}

.score-val {
  font-weight: 700;
  min-width: 22px;
  text-align: right;
  font-size: 0.9em;
}

/* INFO PANEL */

#info-panel {
  visibility: hidden;
  display: none;
  position: fixed;
  top: 96px;
  right: 0px;
  padding: 0;
  padding-bottom: 16px;
  width: 300px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background-color: #00000048;
  z-index: 100;
}

.info-heading {
  text-align: center;
  font-size: 1em;
  margin-top: 12px;
  margin-bottom: 12px;

  background-color: #00000060;

  box-shadow: 0px 0px 1px black;

  color: white;
  padding: 4px;
}

.info-heading:first-of-type {
  margin-top: 0px;
}

.info-label {
  margin-left: 12px;
  font-size: 1em;
  color: rgb(193, 193, 193)
}

.info-value {
  margin-left: 4px;
  font-size: 1.2em;
  color: #ffffff;
  text-align: right;
}

.info-citizen-list {
  list-style-type: none;
  padding: 0;
}

.info-citizen {
  background-color: #222941a0;
  color: white;
  padding: 4px 16px;
  margin: 4px 0;
  border-radius: 8px;
  box-shadow: 0 2px 0 0px #151820;
}

.info-citizen-name {
  font-size: 1.1em;
}

.info-citizen-icon {
  position: relative;
  width: 18px;
  height: 18px;
  top: 2px;
  margin-right: 2px;
}

.info-citizen-details {
  font-size: 1em;
  display: flex;
  justify-content: flex-start;
  gap: 16px;
}

/* FLOATING RESOURCE PANEL */
.floating-panel {
  position: fixed;
  background-color: #00000080;
  border: 1px solid #ffffff30;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  color: white;
  z-index: 1000;
  min-width: 250px;
  max-width: 350px;
  max-height: 80vh;
  overflow-y: auto;
}

.floating-panel h2, 
.floating-panel h3, 
.floating-panel h4, 
.floating-panel p, 
.floating-panel li, 
.floating-panel td {
  color: #ffffff !important;
}

/* OBJECTIVES PANEL */
#objectives-panel {
  position: fixed;
  bottom: 24px;
  right: 16px;
  width: 280px;
  z-index: 95;
  background-color: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

#objectives-panel .panel-header {
  cursor: move;
  user-select: none;
}

#resource-panel {
  top: 96px;
  left: 16px;
  display: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: #00000060;
  border-bottom: 1px solid #ffffff20;
  font-size: 1.2em;
  cursor: move;
  user-select: none;
}

.panel-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5em;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  line-height: 1;
}

.panel-close:hover {
  color: #ff6666;
}

.panel-content {
  padding: 8px;
  padding-bottom: 40px;
}

.resource-section {
  margin-bottom: 12px;
}

.resource-section-title {
  font-size: 1em;
  color: #aaaaaa;
  margin-bottom: 4px;
  padding: 4px 8px;
  background-color: #00000040;
  border-radius: 4px;
}

.resource-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.resource-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background-color: #22294160;
  border-radius: 4px;
  font-size: 0.9em;
}

.resource-item-name {
  flex: 1;
}

.resource-item-amount {
  font-weight: bold;
  color: #ffffff;
  min-width: 60px;
  text-align: right;
}

/* ACTION BUTTONS */
.action-button {
  background-color: #2a4a6a;
  border: 1px solid #4a6a8a;
  border-radius: 4px;
  color: white;
  padding: 8px 12px;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s;
  font-family: Bebas-Regular, sans-serif;
}

.action-button:hover {
  background-color: #3a5a7a;
  border-color: #5a7a9a;
  transform: translateY(-1px);
}

.action-button:active {
  transform: translateY(0);
  background-color: #1a3a5a;
}

.trade-select {
  background-color: #1a2331;
  border: 1px solid #4a6a8a;
  border-radius: 4px;
  color: white;
  font-family: Bebas-Regular, sans-serif;
}

.trade-select:focus {
  outline: none;
  border-color: #6a8aaa;
}

/* Notification animations */
@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Level Up Modal - Glassmorphism Design */
.level-up-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeInModal 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.level-up-modal {
  background: rgba(30, 35, 49, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 24px;
  padding: 0;
  max-width: 700px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 0 80px rgba(76, 175, 80, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: slideUpModal 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.level-up-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(76, 175, 80, 0.6) 20%,
      rgba(76, 175, 80, 0.9) 50%,
      rgba(76, 175, 80, 0.6) 80%,
      transparent 100%);
  animation: shimmerModal 3s infinite;
  z-index: 1;
}

@keyframes fadeInModal {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUpModal {
  from {
    transform: translateY(30px) scale(0.95);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes shimmerModal {

  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }
}

.level-up-modal-header {
  background: rgba(76, 175, 80, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 24px 32px;
  border-radius: 24px 24px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 2;
}

.level-up-modal-header h2 {
  margin: 0;
  color: white;
  font-size: 32px;
  font-weight: 700;
  font-family: 'Montserrat', 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial', sans-serif;
  background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
  letter-spacing: 0.5px;
}

.level-up-modal-close {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 28px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  line-height: 1;
  padding: 0;
  font-weight: 300;
}

.level-up-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1) rotate(90deg);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

.level-up-modal-content {
  padding: 32px;
  color: rgba(255, 255, 255, 0.95);
  overflow-y: auto;
  flex: 1;
  position: relative;
  z-index: 1;
  font-family: 'Montserrat', 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial', sans-serif;
}

.level-up-modal-content::-webkit-scrollbar {
  width: 6px;
}

.level-up-modal-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.level-up-modal-content::-webkit-scrollbar-thumb {
  background: rgba(76, 175, 80, 0.5);
  border-radius: 3px;
}

.level-up-modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(76, 175, 80, 0.7);
}

.level-up-title {
  font-size: 26px;
  font-weight: 700;
  color: white;
  margin-bottom: 16px;
  text-align: center;
  background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
  letter-spacing: 0.5px;
}

.level-up-description {
  font-size: 17px;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 32px;
  text-align: center;
  line-height: 1.7;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.level-up-section {
  margin-bottom: 28px;
}

.level-up-section h3 {
  font-size: 20px;
  font-weight: 600;
  color: white;
  margin-bottom: 16px;
  border-bottom: 2px solid rgba(76, 175, 80, 0.5);
  padding-bottom: 12px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.3px;
}

.level-up-features,
.level-up-tips {
  list-style: none;
  padding: 0;
  margin: 0;
}

.level-up-features li,
.level-up-tips li {
  padding: 14px 16px;
  margin-bottom: 10px;
  background: rgba(76, 175, 80, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-left: 3px solid rgba(76, 175, 80, 0.8);
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.6;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.95);
}

.level-up-features li:hover,
.level-up-tips li:hover {
  background: rgba(76, 175, 80, 0.2);
  transform: translateX(6px);
  border-left-color: rgba(76, 175, 80, 1);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.level-up-modal-footer {
  padding: 24px 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  z-index: 2;
}

.level-up-modal-button {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.9) 0%, rgba(56, 142, 60, 0.9) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 14px 40px;
  font-size: 17px;
  font-weight: 600;
  font-family: 'Montserrat', 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial', sans-serif;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4),
    0 0 0 0 rgba(76, 175, 80, 0.5);
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.level-up-modal-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.3),
      transparent);
  transition: left 0.5s;
}

.level-up-modal-button:hover {
  background: linear-gradient(135deg, rgba(76, 175, 80, 1) 0%, rgba(56, 142, 60, 1) 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6),
    0 0 0 4px rgba(76, 175, 80, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.level-up-modal-button:hover::before {
  left: 100%;
}

.level-up-modal-button:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 10px rgba(76, 175, 80, 0.4);
}

/* Tutorial Panel Styles - Glassmorphism Design */
.tutorial-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(30, 35, 49, 0.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: white;
  padding: 24px 32px;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset,
    0 0 60px rgba(76, 175, 80, 0.15);
  z-index: 1000;
  font-family: 'Montserrat', 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial', sans-serif;
  max-height: 280px;
  overflow-y: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.tutorial-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(76, 175, 80, 0.6) 20%,
      rgba(76, 175, 80, 0.8) 50%,
      rgba(76, 175, 80, 0.6) 80%,
      transparent 100%);
  animation: shimmer 3s infinite;
}

.tutorial-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.tutorial-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

.tutorial-text {
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-line;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.tutorial-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tutorial-next-button {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.9) 0%, rgba(56, 142, 60, 0.9) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 12px 32px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4),
    0 0 0 0 rgba(76, 175, 80, 0.5);
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  font-family: 'Montserrat', 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial', sans-serif;
}

.tutorial-next-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.3),
      transparent);
  transition: left 0.5s;
}

.tutorial-next-button:hover {
  background: linear-gradient(135deg, rgba(76, 175, 80, 1) 0%, rgba(56, 142, 60, 1) 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6),
    0 0 0 4px rgba(76, 175, 80, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.tutorial-next-button:hover::before {
  left: 100%;
}

.tutorial-next-button:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 10px rgba(76, 175, 80, 0.4);
}

.tutorial-next-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@keyframes slideUpFade {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes shimmer {

  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }
}

/* Scrollbar styling for tutorial panel */
.tutorial-panel::-webkit-scrollbar {
  width: 6px;
}

.tutorial-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.tutorial-panel::-webkit-scrollbar-thumb {
  background: rgba(76, 175, 80, 0.5);
  border-radius: 3px;
}

.tutorial-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(76, 175, 80, 0.7);
}

/* WELCOME SCREEN */
.welcome-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('/images/welcome-screen.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  overflow: hidden;
}

.welcome-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1;
}

.welcome-content {
  position: relative;
  z-index: 2;
  text-align: center;
  width: 100%;
  max-width: 600px;
  padding: 40px;
}

.welcome-title {
  font-size: 4.5em;
  font-weight: bold;
  color: white;
  font-family: 'Montserrat', 'Inter', 'Roboto', 'Oswald', Bebas-Regular, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial', sans-serif;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8), 0 0 20px rgba(76, 175, 80, 0.5);
  margin-bottom: 60px;
  letter-spacing: 0.1em;
  animation: fadeInDown 0.8s ease-out;
}

.welcome-form {
  background: rgba(30, 35, 49, 0.85);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

.welcome-subtitle {
  font-size: 1.5em;
  color: #e0e0e0;
  font-family: 'Montserrat', 'Inter', 'Roboto', 'Oswald', Bebas-Regular, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial', sans-serif;
  margin-bottom: 30px;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.welcome-input-group {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: center;
}

.welcome-input {
  flex: 1;
  padding: 18px 24px;
  font-size: 1.2em;
  font-family: 'Montserrat', 'Inter', 'Roboto', 'Oswald', Bebas-Regular, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial', sans-serif;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  color: white;
  outline: none;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.welcome-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.welcome-input:focus {
  border-color: #4CAF50;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
}

.welcome-button {
  padding: 18px 40px;
  font-size: 1.2em;
  font-family: 'Montserrat', 'Inter', 'Roboto', 'Oswald', Bebas-Regular, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial', sans-serif;
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
  font-weight: bold;
  letter-spacing: 0.05em;
  min-width: 100px;
}

.welcome-button:hover {
  background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.welcome-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(76, 175, 80, 0.4);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive design for welcome screen */
@media (max-width: 768px) {
  .welcome-title {
    font-size: 3em;
    margin-bottom: 40px;
  }

  .welcome-form {
    padding: 30px 20px;
  }

  .welcome-subtitle {
    font-size: 1.2em;
  }

  .welcome-input-group {
    flex-direction: column;
    gap: 15px;
  }

  .welcome-input {
    width: 100%;
  }

  .welcome-button {
    width: 100%;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {
  /* Title Bar adjustments */
  #title-bar {
    height: 44px;
    padding: 0 10px;
    font-size: 14px;
  }

  .title-bar-left-items {
    padding-left: 4px;
  }

  .tb-sep {
    margin: 0 6px;
  }

  .title-bar-center-items {
    font-size: 1.2em;
    display: none; /* Hide city name in title bar on small mobile if needed, or make it smaller */
  }

  #city-name {
    display: none;
  }

  /* Scores Bar adjustments */
  #scores-bar {
    top: 44px;
    height: 32px;
    gap: 12px;
    padding: 0 8px;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }

  .score-item {
    font-size: 0.7em;
  }

  .score-bar-bg {
    width: 40px;
  }

  /* Floating UI Toolbar - Bottom Mobile Menu */
  #ui-toolbar {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 100%;
    max-height: 72px;
    height: 72px;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 2000;
    gap: 12px;
  }

  .ui-button {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
  }

  .toolbar-svg {
    width: 24px;
    height: 24px;
  }

  /* Info Panel - Mobile Slide-up */
  #info-panel {
    top: auto!important;
    bottom: 72px!important;
    left: 0!important;
    right: 0!important;
    width: 100%!important;
    max-height: 35vh!important;
    border-radius: 20px 20px 0 0!important;
    background: rgba(15, 20, 30, 0.95)!important;
    backdrop-filter: blur(15px)!important;
    border-top: 2px solid rgba(255, 255, 255, 0.1)!important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5)!important;
    padding-bottom: 20px!important;
    visibility: visible!important;
    display: block!important;
    animation: slideUpMobile 0.4s ease-out;
  }

  @keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .info-heading {
    border-radius: 10px 10px 0 0;
    margin-top: 0;
    padding: 10px;
  }

  /* Floating Resource Panel */
  #resource-panel {
    top: 85px!important;
    bottom: auto!important;
    left: 10px!important;
    right: 10px!important;
    width: auto!important;
    max-width: none!important;
    max-height: 60vh!important;
    transform: none!important;
  }

  /* Hide instructions on mobile */
  #instructions {
    display: none;
  }

  /* Increase tap targets for lists */
  .info-citizen {
    padding: 10px 20px;
  }

  .action-button {
    padding: 12px 16px;
    font-size: 1.1em;
    width: 100%;
    margin: 8px 0;
  }

  /* Welcome Screen mobile refinements */
  .welcome-title {
    font-size: 2.5em;
  }

  .welcome-input {
    font-size: 1em;
    padding: 15px;
  }

  .welcome-button {
    padding: 15px;
    font-size: 1em;
  }

  /* Tutorial Panel Mobile adjustment - Floating Card + Collapsible */
  .tutorial-panel {
    bottom: 85px!important; /* Elevated above toolbar */
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 92% !important;
    max-width: 400px !important;
    top: auto!important;
    height: auto!important;
    padding: 10px 35px 10px 12px!important;
    max-height: 160px!important;
    z-index: 2500!important;
    overflow-y: visible!important;
    border-radius: 16px!important;
    box-sizing: border-box!important;
    background: rgba(15, 20, 30, 0.8) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(76, 175, 80, 0.4) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
  }

  .tutorial-panel.minimized {
    max-height: 44px!important;
    padding-bottom: 5px!important;
  }

  .tutorial-collapse-btn {
    position: absolute;
    top: -16px; /* Push it slightly outside the card */
    right: 20px;
    width: 36px;
    height: 36px;
    background: rgba(20, 25, 35, 0.95);
    border: 1px solid rgba(76, 175, 80, 0.6);
    border-radius: 50%;
    color: #4CAF50 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 12px rgba(76, 175, 80, 0.2);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  }

  .tutorial-collapse-btn:active {
    background: rgba(76, 175, 80, 0.25);
    transform: scale(0.9);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  }

  .tutorial-collapse-btn svg {
    width: 20px;
    height: 20px;
    stroke: #4CAF50 !important;
    stroke-width: 2.5 !important;
    fill: none !important;
    pointer-events: none;
    display: block;
    margin-top: 2px;
  }

  .tutorial-title {
    font-size: 14px!important;
    margin-bottom: 4px!important;
    font-weight: 800!important;
    max-width: calc(100% - 40px);
  }

  .tutorial-text {
    font-size: 11px!important;
    line-height: 1.3!important;
    margin-bottom: 6px!important;
    opacity: 0.9;
  }

  .tutorial-footer {
    margin-top: 6px!important;
    padding-top: 6px!important;
    border-top: 1px solid rgba(255, 255, 255, 0.1)!important;
  }

  .tutorial-next-button {
    padding: 6px 16px!important;
    font-size: 12px!important;
    border-radius: 8px!important;
    height: 32px!important;
  }
}

/* ============================
   SCENARIO SELECTION STYLES
   ============================ */

.scenario-selection-container {
  width: 95%;
  max-width: 960px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUpModal 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.scenario-selection-header {
  text-align: center;
  margin-bottom: 32px;
}

.scenario-selection-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: white;
  margin: 0 0 8px 0;
  font-family: 'Montserrat', 'Inter', 'Roboto', sans-serif;
  letter-spacing: 0.3px;
}

.scenario-selection-header p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  margin: 0;
  font-family: 'Montserrat', 'Inter', sans-serif;
}

.scenario-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.scenario-card {
  background: rgba(30, 35, 49, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 0;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.scenario-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.25);
}

.scenario-card-accent {
  height: 4px;
  width: 100%;
}

.scenario-card-icon {
  font-size: 40px;
  text-align: center;
  margin: 20px 0 8px 0;
  line-height: 1;
}

.scenario-card-title {
  font-size: 17px;
  font-weight: 700;
  color: white;
  text-align: center;
  margin: 0 16px 8px 16px;
  font-family: 'Montserrat', 'Inter', sans-serif;
  letter-spacing: 0.2px;
}

.scenario-card-difficulty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-bottom: 12px;
}

.scenario-star {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.2);
}

.scenario-star.filled {
  color: #FFD700;
}

.scenario-difficulty-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-left: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.scenario-card-desc {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.5;
  margin: 0 16px 14px 16px;
  text-align: center;
  flex: 1;
  font-family: 'Inter', 'Roboto', sans-serif;
}

.scenario-card-objectives {
  margin: 0 16px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scenario-objective-item {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.04);
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: 'Inter', 'Roboto', sans-serif;
}

.scenario-card-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px 16px 16px;
  padding: 10px 0;
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Montserrat', 'Inter', sans-serif;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
  letter-spacing: 0.3px;
}

.scenario-card-btn:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.scenario-card-btn:active {
  transform: scale(0.98);
}

/* Scenario Objectives HUD */
.scenario-objectives-panel {
  position: fixed;
  bottom: 12px;
  right: 12px;
  background: rgba(20, 24, 36, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: white;
  z-index: 900;
  min-width: 220px;
  max-width: 280px;
  font-family: 'Inter', 'Roboto', sans-serif;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.scenario-objectives-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.scenario-objectives-header:hover {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px 12px 0 0;
}

#scenario-objectives-toggle {
  margin-left: auto;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  transition: transform 0.2s ease;
}

.scenario-objectives-body {
  padding: 8px 14px 12px 14px;
}

.scenario-obj-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.scenario-obj-item:last-child {
  border-bottom: none;
}

.scenario-obj-label {
  color: rgba(255, 255, 255, 0.7);
}

.scenario-obj-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.scenario-obj-value.met {
  color: #4CAF50;
}

.scenario-obj-value.not-met {
  color: rgba(255, 255, 255, 0.5);
}

/* Responsive scenario cards */
@media (max-width: 768px) {
  .scenario-cards {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .scenario-selection-container {
    width: 92%;
    padding: 16px;
  }

  .scenario-selection-header h2 {
    font-size: 22px;
  }

  .scenario-card-icon {
    font-size: 32px;
    margin: 14px 0 6px 0;
  }

  .scenario-card-title {
    font-size: 15px;
  }

  /* --- SCENARIO OBJECTIVES HUD - Mobile --- */
  .scenario-objectives-panel {
    bottom: 80px !important;
    right: 8px !important;
    left: 8px !important;
    max-width: none !important;
    min-width: unset !important;
    border-radius: 10px;
    font-size: 12px;
  }

  .scenario-objectives-header {
    padding: 8px 12px;
  }

  .scenario-objectives-body {
    padding: 6px 12px 10px 12px;
  }

  /* --- FLOATING PANELS - Mobile (trade, market, etc.) --- */
  .floating-panel {
    top: auto !important;
    bottom: 76px !important;
    left: 6px !important;
    right: 6px !important;
    width: auto !important;
    max-width: none !important;
    min-width: unset !important;
    max-height: 55vh !important;
    border-radius: 16px 16px 0 0 !important;
    transform: none !important;
    z-index: 2100 !important;
  }

  .panel-header {
    padding: 10px 14px;
    font-size: 1em;
    border-radius: 16px 16px 0 0;
    cursor: default;
  }

  .panel-content {
    padding: 6px;
    padding-bottom: 16px;
  }

  /* Trade panel mobile adjustments */
  .trade-select {
    font-size: 14px !important;
    padding: 10px !important;
    -webkit-appearance: none;
  }

  /* Score bar mobile - hide labels, keep compact */
  .score-label {
    display: none;
  }

  .score-icon {
    width: 14px;
    height: 14px;
  }

  .score-icon svg {
    width: 14px;
    height: 14px;
  }

  .score-val {
    font-size: 0.8em;
    min-width: 18px;
  }

  .score-bar-bg {
    width: 30px;
    height: 8px;
  }

  /* Level-up modal mobile */
  .level-up-modal {
    width: 95% !important;
    max-height: 85vh;
    border-radius: 16px;
  }

  .level-up-modal-header {
    padding: 16px 20px;
    border-radius: 16px 16px 0 0;
  }

  .level-up-modal-header h2 {
    font-size: 22px;
  }

  .level-up-modal-content {
    padding: 16px 20px;
  }

  .level-up-modal-close {
    width: 36px;
    height: 36px;
    font-size: 22px;
    border-radius: 10px;
  }

  /* Version text - hide on mobile */
  #version {
    display: none;
  }

  /* Safe area insets for notch devices */
  #title-bar {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(44px + env(safe-area-inset-top, 0px));
  }

  #ui-toolbar {
    padding-bottom: env(safe-area-inset-bottom, 4px) !important;
  }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
  #title-bar {
    height: 40px;
    padding: 0 6px;
    font-size: 12px;
  }

  .title-bar-left-items {
    padding-left: 2px;
    gap: 0;
  }

  .tb-sep {
    margin: 0 4px;
    font-size: 10px;
  }

  .stat-icon {
    width: 14px;
    height: 14px;
  }

  #scores-bar {
    top: 40px;
    height: 28px;
    gap: 6px;
    padding: 0 4px;
  }

  #ui-toolbar {
    top: auto;
    bottom: 0;
    max-height: 64px !important;
    height: 64px !important;
    padding: 4px 8px !important;
    gap: 8px !important;
  }

  .ui-button {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    border-radius: 10px;
  }

  .toolbar-svg {
    width: 20px;
    height: 20px;
  }

  .floating-panel {
    bottom: 68px !important;
    max-height: 50vh !important;
  }

  .scenario-objectives-panel {
    bottom: 72px !important;
  }

  .tutorial-panel {
    bottom: 72px !important;
    max-height: 140px !important;
    padding: 8px 30px 8px 10px !important;
  }

  /* Welcome screen extra small */
  .welcome-title {
    font-size: 2em !important;
    margin-bottom: 30px !important;
  }

  .welcome-form {
    padding: 20px 15px !important;
  }

  .welcome-subtitle {
    font-size: 1em !important;
  }
}
