* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1a1a;
  color: #e0e0e0;
  line-height: 1.4;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100dvh;
}

header {
  background: #1a1a1a;
  color: #f0f0f0;
  text-align: center;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

header h1 {
  font-size: 1.8rem;
  margin: 0;
  font-weight: 700;
  color: #ffffff;
}

header p {
  margin: 0.25rem 0 0 0;
  font-size: 0.9rem;
  opacity: 0.8;
}

main {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  border: 1px solid #efefef;
  border-radius: 6px;
  margin: 12.5px;
  max-height: calc(100dvh - 25px);
  overflow: auto;
}

#game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1a1a1a;
  padding: 0.75rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e0e0e0;
}

.game-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
}

.info-icon {
  font-size: 1rem;
  color: #888;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.2s ease;
  border-radius: 500px;
}

.info-icon:hover {
  opacity: 1;
  color: #aaa;
  background: rgba(255, 255, 255, 0.1);
}

.instructions {
  background: #2a2a2a;
  padding: 1rem;
  
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.instructions.hidden {
  display: none;
}

.instructions p {
  margin: 0;
  color: #ccc;
  font-size: 0.9rem;
}

#letter-pool {
  background: #1a1a1a;
  padding: 1rem;
  border-radius: 12px;
}

#letter-pool h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  color: #e0e0e0;
  text-align: center;
}

#letters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.letter-tile {
  background: #4a4a4a;
  color: #ffffff;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: grab;
  user-select: none;
  transition: all 0.2s ease;

  border: 1px solid #555;
}

.letter-tile:hover {
  transform: translateY(-2px) scale(1.05);
  background: #5a5a5a;
}

.letter-tile.dragging {
  opacity: 0.7;
  cursor: grabbing;
  transform: rotate(5deg);
}

.letter-tile.selected {
  background: #88ff88;
  color: #000;
  box-shadow: 0 0 10px rgba(136, 255, 136, 0.6);
}

#game-grid {
  background: #1a1a1a;
  border-radius: 12px;
  margin-bottom: 1rem;
}

#game-grid h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  color: #e0e0e0;
  text-align: center;
}

#grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  gap: 6px;
  background: #1a1a1a;
  border-radius: 8px;
  aspect-ratio: 1;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.grid-cell {
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  position: relative;
  border-radius: 3px;
  border: 1px solid #444;
}

.grid-cell.occupied {
  background: #6a6a6a;
  color: #ffffff;
  border: 1px solid #777;
}

.grid-cell.drop-zone {
  background: #555 !important;
  border: 2px solid #888 !important;
}

#letters.drop-zone {
  background: rgba(136, 136, 136, 0.2) !important;
  border: 2px dashed #888;
}

.grid-cell.occupied {
  cursor: grab;
}

.grid-cell.occupied:hover {
  transform: scale(1.1);
  z-index: 10;
}

.grid-cell.selected {
  background: #88ff88 !important;
  color: #000 !important;
  box-shadow: 0 0 10px rgba(136, 255, 136, 0.6);
}

#controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

button {
  background: #4a4a4a;
  color: #ffffff;
  border: 1px solid #666;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

button:hover {
  transform: translateY(-1px);
  background: #5a5a5a;
}

button:active {
  transform: translateY(0);
}

button:disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
  transform: none;
}

#share-twitter {
  background: #1da1f2;
  border-color: #1da1f2;
}

#share-twitter:hover {
  background: #1a8cd8;
  border-color: #1a8cd8;
}

#share-twitter svg {
  flex-shrink: 0;
}

#results {
  background: #1a1a1a;
  padding: 1rem;
  border-radius: 12px;
}

#results h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  color: #e0e0e0;
}

.word-list {
  margin-top: 0.75rem;
}

.word-list h4 {
  display: inline;
  font-size: 0.9rem;
  margin: 0 0 0.5rem 0;
  color: #cccccc;
}

.valid-word {
  color: #90ee90;
  font-weight: 600;
}

.invalid-word {
  color: #ff9999;
  font-weight: 600;
}

.notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #4a4a4a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 1000;

  border: 1px solid #666;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.notification.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-30px) scale(0.8);
  pointer-events: none;
}

.notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  transition: all 0.3s ease;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: #2a2a2a;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  max-width: 400px;
  margin: 0 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.modal-content h3 {
  margin: 0 0 1rem 0;
  color: #ffffff;
  font-size: 1.3rem;
}

.modal-content p {
  margin: 0 0 1.5rem 0;
  color: #cccccc;
  line-height: 1.5;
}

.modal-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.modal-button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-button.primary {
  background: #00b894;
  color: white;
}

.modal-button.primary:hover {
  background: #00a085;
  transform: translateY(-1px);
}

.modal-button.secondary {
  background: #636e72;
  color: white;
}

.modal-button.secondary:hover {
  background: #555;
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  main {
    padding: 0 0.5rem 1.5rem;
  }

  #grid {
    max-width: 320px;
    gap: 2px;
    padding: 4px;
  }

  .letter-tile {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
  }

  #game-info {
    gap: 0.5rem;
    text-align: center;
    padding: 0.5rem;
  }

  button {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  header h1 {
    font-size: 1.5rem;
  }
}