:root {
  --bg-base: #0d0d12;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.1);
  --accent-primary: #ccff00;
  --accent-secondary: #00f0ff;
  --accent-tertiary: #ff007f;
  --text-main: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.6);
  --border-glass: rgba(255, 255, 255, 0.1);
  --border-glass-bright: rgba(255, 255, 255, 0.2);
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Courier New', monospace;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-body);
  touch-action: manipulation;
}

/* Background effects */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 75% 25%, rgba(204, 255, 0, 0.05) 0%, transparent 40%),
              radial-gradient(circle at 25% 75%, rgba(0, 240, 255, 0.05) 0%, transparent 40%);
  z-index: -1;
  pointer-events: none;
}

.screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.screen.active {
  display: flex;
}

/* Hub */
.hub-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 440px;
}

.title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  text-transform: uppercase;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(255,255,255,0.1));
}

.small-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.game-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}

.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  overflow: hidden;
}

.game-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.game-card:hover, .game-card:active {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-bright);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3),
              inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.game-card:hover::after, .game-card:active::after {
  opacity: 1;
}

.game-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
}

.game-name {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-main);
  position: relative;
  z-index: 1;
}

.game-card.wide {
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: center;
  gap: 16px;
  padding: 20px 24px;
}

.game-card.wide .game-icon {
  width: 48px;
  height: 48px;
}

.hub-footer {
  display: flex;
  gap: 16px;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-muted);
  font-size: 1.1rem;
  width: 48px;
  height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover, .icon-btn:active {
  background: var(--bg-card-hover);
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
  transform: scale(1.05);
}

.icon-btn.muted {
  color: rgba(255,255,255,0.15);
}

/* Menu Buttons */
.menu-btn {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 16px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.menu-btn:hover, .menu-btn:active {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-2px);
}

.difficulty-list,
.mode-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.menu-btn.secondary {
  border-color: var(--border-glass);
  color: var(--text-muted);
  margin-top: 1rem;
}

/* Game Screen */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  width: 100%;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(13, 13, 18, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
  z-index: 10;
}

.game-header .icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.game-title {
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.game-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-primary);
  text-align: right;
  min-width: 80px;
}

.game-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: 100%;
  position: relative;
}

.game-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
  flex-shrink: 0;
  width: 100%;
  background: linear-gradient(to top, rgba(13, 13, 18, 0.9), transparent);
}

.ctrl-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-main);
  font-size: 1.5rem;
  width: 64px;
  height: 64px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ctrl-btn:active, .ctrl-btn.pressed {
  background: var(--accent-secondary);
  color: var(--bg-base);
  border-color: var(--accent-secondary);
  transform: scale(0.9);
}

/* Game Over */
.gameover-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass-bright);
  border-radius: 32px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  max-width: 360px;
  width: 90%;
  box-shadow: 0 24px 48px rgba(0,0,0,0.5);
}

.gameover-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  letter-spacing: -0.01em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-tertiary);
}

.gameover-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.gameover-stats .label {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.gameover-stats .highlight {
  font-family: var(--font-mono);
  color: #fff;
  font-size: 3.5rem;
  font-weight: 700;
  text-shadow: 0 0 30px rgba(255,255,255,0.2);
}

.gameover-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.gameover-actions .menu-btn:first-child {
  background: var(--accent-primary);
  color: var(--bg-base);
  border: none;
}

.gameover-actions .menu-btn:first-child:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

/* Minesweeper Grid */
.mine-grid {
  display: grid;
  gap: 2px;
  background: var(--border-glass);
  border: 2px solid var(--border-glass);
  border-radius: 12px;
  padding: 2px;
}

.mine-cell {
  background: var(--bg-card);
  border-radius: 4px;
  transition: all 0.1s;
}

.mine-cell.hidden {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.05);
}

.mine-cell.hidden:hover {
  background: rgba(255, 255, 255, 0.15);
}

.mine-cell.revealed {
  background: rgba(255, 255, 255, 0.03);
}

/* Animations */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.game-card:nth-child(even) { animation-delay: 0.2s; }

/* Responsive Adjustments */
@media (max-height: 700px) {
  .title { font-size: 1.8rem; }
  .hub-container { gap: 1.5rem; }
  .game-card { padding: 16px 12px; }
  .game-list { gap: 12px; }
}

@media (min-width: 768px) {
  .game-list { max-width: 440px; }
  .ctrl-btn { width: 72px; height: 72px; font-size: 1.8rem; }
}
