* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  width: 100%;
}

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0b0e11;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.wrapper {
  width: 80vw;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
}

.percent {
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  width: 100%;
}

.label {
  opacity: 0.6;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  width: 100%;
}

.grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  margin-bottom: 2rem;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0;
  width: 100%;
  max-width: 100%;
}

.cell {
  width: 6px;
  height: 6px;
  min-width: 6px;
  border-radius: 1px;
  background: #1e2228;
  flex-shrink: 0;
}

.cell.filled {
  background: #4fd1c5;
}

.info {
  font-size: 1rem;
}

.sub {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  opacity: 0.6;
}

/* Language Selector Styles */
.language-selector {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.lang-btn {
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  background: #1e2228;
  color: #ffffff;
  border: 2px solid #2a2f38;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 60px;
  font-weight: 500;
}

.lang-btn:hover {
  border-color: #4fd1c5;
  background: #252932;
}

.lang-btn.active {
  background: linear-gradient(135deg, #4fd1c5 0%, #38b2ac 100%);
  color: #0b0e11;
  border-color: #4fd1c5;
  box-shadow: 0 4px 12px rgba(79, 209, 197, 0.3);
}

/* Top Controls Layout */
.top-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 2rem;
  flex-wrap: wrap;
  width: 100%;
  position: relative;
}

.top-controls .language-selector {
  margin-bottom: 0;
}

.top-controls .reset-btn {
  position: static;
}

/* Setup page styles */
.setup-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 80vw;
}

.setup-header {
  margin-bottom: 2.5rem;
}

.setup-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.setup-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  background: linear-gradient(135deg, #4fd1c5 0%, #81e6d9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.setup-subtitle {
  font-size: 1rem;
  opacity: 0.7;
  margin: 0;
  line-height: 1.5;
}

.setup-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.form-label {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #ffffff;
  opacity: 0.9;
}

.form-input {
  padding: 0.875rem 1rem;
  font-size: 1rem;
  background: #1e2228;
  color: #ffffff;
  border: 2px solid #2a2f38;
  border-radius: 8px;
  transition: all 0.2s;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: #4fd1c5;
  background: #252932;
}

.form-input:hover {
  border-color: #3a3f48;
}

.form-help {
  font-size: 0.85rem;
  opacity: 0.5;
  margin-top: 0.5rem;
  font-style: italic;
}

.setup-btn {
  margin-top: 1rem;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #4fd1c5 0%, #38b2ac 100%);
  color: #0b0e11;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  min-height: 52px;
  width: 100%;
  max-width: 100%;
  box-shadow: 0 4px 15px rgba(79, 209, 197, 0.3);
}

.setup-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 209, 197, 0.4);
}

.setup-btn:active {
  transform: translateY(0);
}

.mode-selector {
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
}

.mode-btn {
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  background: #1e2228;
  color: #ffffff;
  border: 1px solid #2a2f38;
  transition: all 0.2s;
  min-height: 40px;
  min-width: 70px;
  opacity: 0.6;
  cursor: pointer;
}

.mode-btn:hover {
  background: #2a2f38;
  opacity: 0.85;
}

.mode-btn.active {
  background: #4fd1c5;
  color: #0b0e11;
  border-color: #4fd1c5;
  opacity: 1;
}

.reset-btn {
  padding: 0.5rem;
  font-size: 1.2rem;
  background: transparent;
  color: #ffffff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0.25;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.reset-btn:hover {
  opacity: 0.6;
  background: rgba(79, 209, 197, 0.1);
  transform: rotate(90deg);
}

.reset-btn:active {
  transform: rotate(90deg) scale(0.9);
}

/* Tablet and larger screens */
@media (min-width: 768px) {
  body {
    padding: 2rem;
  }

  .wrapper {
    width: 90%;
  }

  .percent {
    font-size: 3rem;
  }

  .label {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .grid {
    gap: 3px;
    overflow-x: visible;
    padding: 0;
  }

  .cell {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 2px;
  }

  .info {
    font-size: 1.1rem;
  }

  .sub {
    font-size: 0.9rem;
  }

  input:not(.form-input), button:not(.setup-btn) {
    width: auto;
    max-width: none;
  }
  
  .setup-container {
    padding: 3rem 2rem;
  }
  
  .setup-title {
    font-size: 3rem;
  }
  
  .setup-subtitle {
    font-size: 1.1rem;
  }
  
  .form-input {
    max-width: 400px;
  }
  
  .setup-btn {
    max-width: 400px;
  }

  .mode-btn {
    flex: 0;
    max-width: none;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  body {
    padding: 2rem;
  }
  
  .wrapper {
    max-width: 1200px;
  }
  
  .grid {
    overflow-x: visible;
    max-width: 100%;
    width: 100%;
  }
  
  .mode-btn:hover {
    background: #2a2f38;
  }
}
