/* By breakplay.fun — Enhanced Mobile-Responsive Version */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Inter:wght@400;600&display=swap');

*,*::before,*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #050e18;
  --bg2: #0a1628;
  --blue: #00d4ff;
  --orange: #f59e0b;
  --red: #ef4444;
  --green: #10b981;
  --card: rgba(0,212,255,0.06);
  --border: rgba(0,212,255,0.2);
  --text: #e0f4ff;
  --muted: #4a7a94;
  --cell-bg: #0f2034;
  --cell-hover: #1a3a5c;
  --cell-clicked: #0a1e30;
}

html { font-size: 62.5%; }

body {
  font-family: 'Orbitron', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(0,212,255,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(245,158,11,0.06) 0%, transparent 60%);
  pointer-events: none;
}

/* ── Layout ── */
.game-display {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px 12px;
  flex: 1;
}

.game-container {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Header ── */
.game-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  backdrop-filter: blur(10px);
}

.h1-container h1 {
  font-family: 'Orbitron', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--blue);
  text-shadow: 0 0 16px rgba(0,212,255,0.5);
  -webkit-text-stroke: unset;
  margin: 0;
}

.score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.score-label {
  font-size: 0.55rem;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.score-counter {
  font-family: 'Orbitron', monospace;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--orange);
  text-shadow: 0 0 12px rgba(245,158,11,0.5);
  letter-spacing: 2px;
}

/* ── Game Board ── */
.game-board {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg2);
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0,212,255,0.06);
}

.grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  background: rgba(0,0,0,0.2);
  gap: 1px;
  padding: 1px;
}

.cell {
  aspect-ratio: 1;
  background: var(--cell-bg);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(0.8rem, 2.5vw, 1.4rem);
  font-weight: 700;
  border: none;
  transition: background 0.1s, box-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
}

.cell:hover { background: var(--cell-hover); }

.cell-clicked {
  background: var(--cell-clicked);
  cursor: default;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.3);
}

.cell-bomb {
  background: rgba(239,68,68,0.25) !important;
  border: 1px solid var(--red);
  box-shadow: 0 0 8px rgba(239,68,68,0.4);
}

.cell-bomb::after {
  content: '💣';
  font-size: clamp(0.7rem, 2vw, 1.1rem);
}

.cell-flagged {
  background: rgba(245,158,11,0.12) !important;
  border: 1px solid var(--orange);
}

.cell-flagged::after {
  content: '🚩';
  font-size: clamp(0.7rem, 2vw, 1.1rem);
}

/* Number colors */
.cell-clicked[data-count="1"] { color: #60a5fa; }
.cell-clicked[data-count="2"] { color: #10b981; }
.cell-clicked[data-count="3"] { color: #ef4444; }
.cell-clicked[data-count="4"] { color: #8b5cf6; }
.cell-clicked[data-count="5"] { color: #f59e0b; }
.cell-clicked[data-count="6"] { color: #06b6d4; }
.cell-clicked[data-count="7"] { color: #ec4899; }
.cell-clicked[data-count="8"] { color: #94a3b8; }

.cellText { font-size: inherit; font-weight: 700; }

/* ── Game Over ── */
.end-game-screen {
  position: absolute;
  inset: 0;
  background: rgba(5,14,24,0.9);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-radius: 12px;
}

.hidden { display: none !important; }

.win { background: rgba(5,14,24,0.88); }

.end-game-text {
  font-family: 'Orbitron', monospace;
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 700;
  color: var(--red);
  text-shadow: 0 0 20px rgba(239,68,68,0.7);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.win .end-game-text {
  color: var(--green);
  text-shadow: 0 0 20px rgba(16,185,129,0.7);
}

.btn {
  font-family: 'Orbitron', monospace;
  font-size: 1rem;
  padding: 10px 28px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--blue);
  box-shadow: 0 0 15px rgba(0,212,255,0.2);
  transition: all 0.2s;
}

.btn:hover {
  background: rgba(0,212,255,0.15);
  box-shadow: 0 0 20px rgba(0,212,255,0.35);
  transform: translateY(-2px);
}

/* ── Mobile controls ── */
.tutorial-container {
  padding: 0 0 8px;
}

.tutorial-pc {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.tutorial-text {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.5px;
  font-family: 'Orbitron', monospace;
}

.tutorial-phone-btn {
  display: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 70px;
  height: 70px;
  cursor: pointer;
  font-size: 1.5rem;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: var(--orange);
  box-shadow: 0 0 15px rgba(245,158,11,0.2);
}

.tutorial-phone-btn::after { content: '🚩'; }

.tutorial-phone-btn-active {
  background: rgba(245,158,11,0.18);
  border-color: var(--orange);
  box-shadow: 0 0 20px rgba(245,158,11,0.5);
  transform: scale(1.08);
}

/* ── Long-press indicator ── */
.long-press-hint {
  text-align: center;
  font-size: 0.6rem;
  color: var(--muted);
  font-family: 'Orbitron', monospace;
  letter-spacing: 0.5px;
  opacity: 0.6;
}

/* ── Mine count + flag count ── */
.info-bar {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--muted);
  font-family: 'Orbitron', monospace;
}

.info-item .val { color: var(--text); font-weight: 700; }

/* ── Mobile responsive ── */
@media screen and (max-width: 600px) {
  body { font-size: 9px; }
  .game-display { padding: 10px 8px; }
  .h1-container h1 { font-size: 1rem; }
  .tutorial-pc { display: none; }
  .tutorial-phone-btn { display: flex; margin: 0 auto; }
  .long-press-hint { display: block; }
}

@media screen and (min-width: 601px) {
  .long-press-hint { display: none; }
}

/* Utilities */
.flex { display: flex; }
