:root {
  --toolbar-height: 60px;
  --title-color: #fff;
  --bg-color: #fff;
  --pp-max-width: 600px;
  --elements-bg-color: #efefef;
  --modal-bg-color: white;
  --modal-text-color: #333;
  --modal-text-muted: #666;
  --button-bg-color: #4CAF50;
}

[data-theme="dark"] {
  --title-color: #e0e0e0;
  --bg-color: #121212;
  --elements-bg-color: #2a2a2a;
  --modal-bg-color: #2a2a2a;
  --modal-text-color: #e0e0e0;
  --modal-text-muted: #b0b0b0;
  --button-bg-color: #388e3c;
}

[data-theme="dark"] body {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

[data-theme="dark"] canvas {
  box-shadow: 0 10px 30px rgba(255, 255, 255, 0.1);
}
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.game {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  width: 100%;
  max-width: var(--pp-max-width);
}

#ui {
  color: white;
  margin-bottom: 20px;
  font-size: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

#controls {
  color: white;
  margin-top: 20px;
  font-size: 14px;
  opacity: 0.8;
  max-width: 600px;
}

#pixi-game {
  display: block;
  justify-content: center;
  align-items: center;
  min-width: 360px;
  min-height: 360px;
}

canvas {
  /*border-radius: 10px;*/
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: block;
}

.toolbar {
  display: flex;
  height: var(--toolbar-height);
  justify-content: space-around;
  align-items: center;
  width: 100%;
}
.toolbar-title {
  color: var(--title-color);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: 0.2rem;
  text-transform: uppercase;
  text-align: center;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar-logo {
  width: 40px;
  height: 40px;
  /*border-radius: 6px;*/
  /*box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);*/
}
.icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--title-color);
  border-radius: 5px;
  transition: background-color 0.2s;
}

.icon:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  display: block;
}

.game-controls {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}


/* Ensure settings button is visible */
#settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toolbar-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Help Modal Styles */
.help-modal {
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  text-align: left;
}

.help-section {
  margin: 20px 0;
  /*padding: 15px;*/
  border-radius: 8px;
  /*background: rgba(0, 0, 0, 0.05);*/
}

[data-theme="dark"] .help-section {
  background: rgba(255, 255, 255, 0.05);
}

.help-section h3 {
  margin-top: 0;
  color: var(--modal-text-color);
  font-size: 18px;
}

.help-section ul, .help-section ol {
  color: var(--modal-text-muted);
  font-size: 14px;
  line-height: 1.6;
  text-align: left;
  margin: 0;
  padding: 0 30px 0;
}

.help-section li {
  margin: 8px 0;
}

/* Gameplay Demo Styles */
.gameplay-example {
  margin: 20px 0;
  text-align: center;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(5, 32px);
  grid-template-rows: repeat(5, 32px);
  gap: 2px;
  justify-content: center;
  margin: 20px auto;
  padding: 10px;
  background: #333;
  border-radius: 8px;
  position: relative;
}

.demo-piece {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  font-size: 12px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  position: relative;
  grid-row: calc(var(--row) + 1);
  grid-column: calc(var(--col) + 1);
  cursor: pointer;
}

.demo-empty {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  grid-row: calc(var(--row) + 1);
  grid-column: calc(var(--col) + 1);
}

.demo-green { background: #4a7c59; }
.demo-red { background: #b85450; }
.demo-blue { background: #5b9bd5; }
.demo-brand { background: #ffd700; color: #000; }

.demo-moving {
  background: #b85450;
  animation: slideDemo 3s infinite;
  z-index: 10;
}

@keyframes slideDemo {
  0%, 70%, 100% {
    transform: translate(0, 0);
  }
  35% {
    transform: translate(34px, 0);
  }
}

.demo-caption {
  font-size: 12px;
  color: var(--modal-text-muted);
  margin-top: 10px;
  font-style: italic;
}

.demo-rings {
  margin-top: 15px;
}

.ring-legend {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--modal-text-muted);
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  font-size: 10px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.legend-color.demo-brand {
  color: #000;
}

/* Help Attribution Styles */
.help-attribution {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  text-align: center;
}

[data-theme="dark"] .help-attribution {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.help-attribution p {
  margin: 0;
  font-size: 14px;
  color: var(--modal-text-muted);
  font-style: italic;
}

.help-attribution a {
  color: var(--button-bg-color);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.help-attribution a:hover {
  color: #45a049;
  text-decoration: underline;
}

[data-theme="dark"] .setting-button {
  background: var(--button-bg-color);
}

[data-theme="dark"] .setting-button:hover {
  background: #2e7d32;
}
.ui-elements {
  color: var(--title-color);
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 3px 10px 4px;
  margin: 20px 0;
}
.ui-elements-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.ui-element {
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  backdrop-filter: blur(5px);
  display: flex;
  flex-direction: row;
}
.ui-element strong {
  font-weight: 700;
  margin-right: 10px;
}
.ui-time {
  font-style: normal;
  font-weight: 300;
  text-transform: uppercase;
  color: #ffd700;
  transition: color 0.3s ease;
}

.ui-time.urgent {
  color: #ff4444;
  animation: timer-flash 1s infinite;
}

@keyframes timer-flash {
  0%, 50% {
    color: #ff4444;
  }
  51%, 100% {
    color: #ff8888;
  }
}
.ui-moves {
  
}
.btn {}
.btn-primary {
  background: linear-gradient(45deg, #4CAF50, #66bb6a);
  color: white !important;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: linear-gradient(45deg, #45a049, #5cb85c);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
}

.modal-content {
  background-color: var(--modal-bg-color);
  margin: 5% auto;
  padding: 20px;
  border-radius: 0;
  width: 80%;
  max-width: 460px;
  text-align: center;
  position: relative;
}

.modal h2 {
  margin-top: 0;
  color: var(--modal-text-color);
}

.modal p {
  color: var(--modal-text-muted);
  margin: 10px 0;
}

.modal button {
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  margin: 5px 5px;
  font-weight: 500;
}

.modal .btn-primary {
  color: white !important;
}

.modal .btn-secondary {
  color: white !important;
}

.modal .btn-twitter {
  color: white !important;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0;
  color: var(--modal-text-color);
}

.toggle-switch {
  appearance: none;
  width: 50px;
  height: 25px;
  background: #ccc;
  border-radius: 25px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-switch:checked {
  background: var(--button-bg-color);
}

.toggle-switch::before {
  content: '';
  position: absolute;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
}

.toggle-switch:checked::before {
  transform: translateX(25px);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  font-weight: bold;
  color: var(--modal-text-muted);
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s, color 0.2s;
}

.modal-close:hover {
  background-color: rgba(255, 0, 0, 0.1);
  color: #ff0000;
}

.setting-button {
  background: var(--button-bg-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.setting-button:hover {
  background: #45a049;
}

.import-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Start Game Modal Styles */
.start-game-modal {
  backdrop-filter: blur(5px);
  z-index: 2000;
}

#clearProgressModal {
  z-index: 3000;
  backdrop-filter: blur(10px);
}

#helpModal {
  z-index: 2500;
}

.start-game-content {
  background-color: var(--modal-bg-color);
  margin: 2% auto 0;
  padding: 25px 20px;
  border-radius: 0;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.start-game-content h2 {
  font-size: 32px;
  margin-bottom: 15px;
  color: var(--modal-text-color);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.start-game-content p {
  font-size: 16px;
  margin-bottom: 30px;
  color: var(--modal-text-muted);
  line-height: 1.5;
}

.btn-large {
  font-size: 18px;
  padding: 15px 30px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(45deg, var(--button-bg-color), #66bb6a);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
  transition: all 0.3s ease;
  border: none;
  color: white;
  cursor: pointer;
}

.btn-large:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-large:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

.continue-info {
  display: block;
  font-size: 14px;
  font-weight: normal;
  opacity: 0.8;
  margin-top: 4px;
  text-transform: none;
  letter-spacing: normal;
}

/* Enhanced Start Game Modal Styles */
.start-game-content {
  max-width: 420px;
  padding: 20px;
}

.start-game-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 26px;
  margin-bottom: 8px;
  color: var(--modal-text-color);
  font-weight: 500;
  letter-spacing: 0.2rem;
  text-transform: uppercase;
}

.start-game-logo {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.welcome-text {
  font-size: 14px;
  color: var(--modal-text-muted);
  margin-bottom: 15px;
  font-style: italic;
}

.how-to-play-quick {
  margin: 15px 0;
  text-align: left;
}

.how-to-play-quick h3 {
  font-size: 18px;
  color: var(--modal-text-color);
  margin-bottom: 15px;
  text-align: center;
}

.quick-steps {
  margin-bottom: 20px;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  padding: 8px 0;
}

.step-number {
  background: var(--button-bg-color);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-text {
  color: var(--modal-text-color);
  font-size: 14px;
  line-height: 1.4;
}

.color-guide {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
}

[data-theme="dark"] .color-guide {
  background: rgba(255, 255, 255, 0.05);
}

.color-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--modal-text-muted);
}

.color-sample {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  text-align: center;
  line-height: 16px;
  font-size: 10px;
  font-weight: bold;
}

.center-color {
  background: #ffd700;
  color: #000;
}

.ring-color {
  background: #9b59b6;
  color: white;
}

/* Level Complete Modal Styles */
.level-complete-content {
  max-width: 450px;
  padding: 30px;
  text-align: center;
}

.level-complete-content h2 {
  font-size: 28px;
  margin-bottom: 25px;
  color: var(--modal-text-color);
}

.level-stats {
  display: flex;
  justify-content: space-around;
  margin: 10px 0;
  padding: 20px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

[data-theme="dark"] .level-stats {
  background: rgba(255, 255, 255, 0.05);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--modal-text-muted);
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--modal-text-color);
}

.modal-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 15px;
  flex-wrap: wrap;
}

.modal-buttons-secondary {
  display: flex;
  justify-content: flex-start;
}

.btn-secondary {
  background: #6c757d;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-outline {
  background: none;
  border: 1px solid #ffffff;
}

.btn-outline:hover {
  background: none;
  border: 1px solid #b4b4b4;
}

.btn-twitter {
  background: #1da1f2;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.btn-twitter:hover {
  background: #1991da;
}

.btn-twitter svg {
  flex-shrink: 0;
}

.btn-whatsapp {
  background: #25d366;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.btn-whatsapp:hover {
  background: #128c7e;
}

.btn-whatsapp svg {
  flex-shrink: 0;
}

.btn-icon {
  padding: 12px;
  min-width: 44px;
  justify-content: center;
  gap: 0;
}

/* All Levels Complete Modal Styles */
.all-levels-complete {
  max-width: 500px;
  padding: 30px;
}

.completion-message {
  font-size: 16px;
  margin-bottom: 25px;
  color: var(--modal-text-muted);
  font-style: italic;
}

.all-levels-stats {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  padding: 10px;
  margin: 15px 0;
  text-align: left;
}

[data-theme="dark"] .all-levels-stats {
  background: rgba(255, 255, 255, 0.05);
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.summary-item {
  text-align: center;
  padding: 10px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
}

[data-theme="dark"] .summary-item {
  background: rgba(255, 255, 255, 0.05);
}

.summary-label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--modal-text-muted);
  margin-bottom: 5px;
}

.summary-value {
  font-size: 18px;
  font-weight: bold;
  color: var(--modal-text-color);
}

.level-details {
  max-height: 120px;
  overflow-y: auto;
}

.level-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .level-item {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.level-item:last-child {
  border-bottom: none;
}

.level-name {
  font-weight: 500;
  color: var(--modal-text-color);
}

.level-stats {
  font-size: 12px;
  color: var(--modal-text-muted);
}

/* Confirmation Modal Styles */
.confirmation-content {
  max-width: 400px;
  padding: 30px;
  text-align: center;
}

.confirmation-content h2 {
  font-size: 24px;
  margin-bottom: 15px;
  color: var(--modal-text-color);
}

.confirmation-content p {
  font-size: 16px;
  margin-bottom: 25px;
  color: var(--modal-text-muted);
  line-height: 1.5;
}
/* sm */
/* md */
/* Mobile adjustments for logo and start modal */
@media (max-width: 480px) {
  .level-stats {
    flex-direction: column;
    gap: 15px;
  }
  
  .stat-item {
    flex-direction: row;
    justify-content: space-between;
  }
  
  .modal-buttons {
    flex-direction: column;
  }

  .toolbar {
    padding: 0 5px;
    justify-content: space-between;
    min-height: 50px;
  }
  
  .toolbar-title {
    font-size: 18px;
    letter-spacing: 0.05rem;
    gap: 6px;
    flex: 1;
    justify-content: start;
    max-width: calc(100vw - 120px);
    margin: 0 10px;
  }
  
  .toolbar-logo {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
  }
  
  .toolbar-menu {
    gap: 3px;
    flex-shrink: 0;
    margin: 0 10px;
  }
  
  .toolbar-menu .btn {
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 11px;
    white-space: nowrap;
  }
  
  .icon {
    padding: 4px;
  }
  
  .icon svg {
    width: 20px;
    height: 20px;
  }
  .game-controls {
    padding: 0 10px;
    justify-content: normal;
  }
  .game-controls .btn-primary {
    width: 100%;
  } 
  .start-game-content {
    padding: 15px;
    max-width: 95vw;
    margin: 5% auto 0;
  }
  
  .start-game-title {
    font-size: 16px;
    gap: 6px;
    letter-spacing: 0.05rem;
  }
  
  .start-game-logo {
    width: 24px;
    height: 24px;
  }
  
  .color-guide {
    /*flex-direction: column;*/
    gap: 10px;
    align-items: center;
  }
  
  .modal-buttons {
    flex-direction: column;
    gap: 5px;
  }
  .modal-buttons-secondary {
    justify-content: flex-start;
  }
  .modal-buttons-secondary .btn-icon {
    width: 100%;
  }
  .btn-secondary {
    font-size: 12px;
    padding: 8px 16px;
  }
}

/* Extra small mobile devices */
@media (max-width: 360px) {
  .toolbar-title {
    font-size: 12px;
    letter-spacing: 0.02rem;
    gap: 4px;
    max-width: calc(100vw - 100px);
  }
  
  .toolbar-logo {
    width: 20px;
    height: 20px;
  }
  
  .toolbar-menu .btn {
    padding: 3px 6px;
    font-size: 10px;
  }
  
  .start-game-title {
    font-size: 14px;
    gap: 4px;
    letter-spacing: 0.02rem;
  }
  
  .start-game-logo {
    width: 20px;
    height: 20px;
  }
}

@media screen and (min-width: 48em) {
  #pixi-game {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-width: 600px;
    min-height: 600px;
  }
  .toolbar {
    justify-content: space-between;
  }
}
