: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;
}
.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;
}

/* 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;
}

[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: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  padding: 3px 4px 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;
}
.ui-moves {
  
}
.btn {}
.btn-primary {
  background: #4CAF50;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 5px;
  cursor: pointer;
}

.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: 10px;
  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 {
  /*background: var(--button-bg-color);*/
  color: #333;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  margin: 10px 5px;
}

.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;
}
/* sm */
/* md */
@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;
  }
}

