/* Mobile-First Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  overflow-x: hidden;
  touch-action: manipulation;
}

.mobile-container {
  width: 100vw;
  height: 100vh;
  background: white;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Compact Header */
.mobile-header {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.menu-icon {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}

.header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.level {
  font-weight: 600;
  font-size: 14px;
}

.resources {
  display: flex;
  gap: 12px;
  font-size: 12px;
}

.coins, .hints {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Compact Progress */
.progress-compact {
  background: #f8f9fa;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #e9ecef;
  flex-shrink: 0;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #48bb78, #38a169);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 11px;
  font-weight: 600;
  color: #4a5568;
  min-width: 35px;
}

/* Grid Section - Optimized for Mobile */
.grid-section {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5px 5px 0 5px;
  overflow: hidden;
  background: #f8f9fa;
}

.grid-wrapper {
  display: grid;
  background: #a0aec0;
  padding: 3px;
  border-radius: 6px;
  gap: 1px;
  max-width: 100%;
  max-height: 100%;
}

.grid-cell {
  background: white;
  border: 1px solid #cbd5e0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 16px;
  font-weight: bold;
}

.grid-cell.clue-cell {
  background: linear-gradient(135deg, #4a5568, #2d3748);
  color: white;
  padding: 2px;
  font-size: 7px;
  font-weight: 600;
  line-height: 1.1;
  text-align: left;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  overflow: hidden;
}

.clue-text {
  font-size: 7px;
  line-height: 1.1;
  word-wrap: break-word;
  width: 100%;
  z-index: 1;
}

.arrow {
  position: absolute;
  color: #4299e1;
  font-weight: bold;
  font-size: 12px;
}

.arrow-right {
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
}

.grid-cell.blocked-cell {
  background: #2d3748;
  border-color: #2d3748;
}

.grid-cell.input-cell {
  background: white;
}

.grid-cell.input-cell.active {
  background: #ebf8ff;
  border-color: #3182ce;
  box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.3);
}

.grid-cell.correct {
  background: #c6f6d5;
  border-color: #48bb78;
}

.grid-cell.incorrect {
  background: #fed7d7;
  border-color: #f56565;
}

.grid-cell input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-weight: bold;
  color: #2d3748;
  text-transform: uppercase;
  font-size: inherit;
  outline: none;
}

/* Mobile Controls */
.mobile-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px;
  background: white;
  border-top: 1px solid #e9ecef;
  flex-shrink: 0;
}

.control-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  font-weight: 600;
  font-size: 10px;
  transition: transform 0.2s;
}

.control-btn:active {
  transform: scale(0.95);
}

.control-btn i {
  font-size: 16px;
}

.control-btn.hint {
  background: linear-gradient(135deg, #ed8936, #dd6b20);
}

/* Side Menu */
.side-menu {
  position: fixed;
  top: 0;
  left: -250px;
  width: 250px;
  height: 100vh;
  background: white;
  box-shadow: 2px 0 10px rgba(0,0,0,0.2);
  transition: left 0.3s ease;
  z-index: 1000;
}

.side-menu.active {
  left: 0;
}

.menu-header {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-menu {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

.menu-items {
  padding: 10px 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.menu-item:active {
  background: #f8f9fa;
}

.menu-item i {
  width: 18px;
  color: #4facfe;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  max-width: 320px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.success-icon {
  font-size: 48px;
  color: #48bb78;
  margin-bottom: 12px;
}

.modal-content h2 {
  color: #2d3748;
  margin-bottom: 8px;
  font-size: 20px;
}

.modal-content h3 {
  color: #2d3748;
  margin-bottom: 12px;
  font-size: 18px;
}

.modal-content p {
  color: #4a5568;
  margin-bottom: 16px;
  font-size: 14px;
}

.modal-btns {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}

.btn-secondary {
  background: #e2e8f0;
  color: #4a5568;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}

.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.98);
}
