* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
body { margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #e8f5e9; color: #2e7d32; }
.app { max-width: 480px; margin: 0 auto; padding: 12px; }
.topbar { display: flex; justify-content: space-between; align-items: center; }
.topbar h1 { font-size: 22px; margin: 0; }
.stats span { font-size: 16px; margin-left: 12px; font-variant-numeric: tabular-nums; }
.difficulty { display: flex; gap: 8px; margin: 12px 0; }
.difficulty button { flex: 1; padding: 8px 4px; border: 1.5px solid #a5d6a7; background: #fff;
  border-radius: 10px; font-size: 13px; color: #2e7d32; cursor: pointer; }
.difficulty button.active { background: #81c784; color: #fff; border-color: #81c784; }
.board { display: grid; gap: 2px; background: #c8e6c9; padding: 4px; border-radius: 8px;
  overflow-x: auto; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.cell { aspect-ratio: 1 / 1; min-width: 22px; display: flex; align-items: center;
  justify-content: center; background: #a5d6a7; border-radius: 3px; font-weight: 700;
  font-size: 14px; user-select: none; cursor: pointer; }
.cell.revealed { background: #f1f8e9; cursor: default; }
.cell.flagged::after { content: "🚩"; }
.cell.mine { background: #ef9a9a; }
.cell.n1 { color: #1976d2; } .cell.n2 { color: #388e3c; } .cell.n3 { color: #d32f2f; }
.cell.n4 { color: #7b1fa2; } .cell.n5 { color: #ff8f00; } .cell.n6 { color: #0097a7; }
.cell.n7 { color: #455a64; } .cell.n8 { color: #000; }
.actions { display: flex; gap: 8px; margin: 12px 0; }
.actions button { flex: 1; padding: 12px; border: none; border-radius: 12px; font-size: 15px;
  font-weight: 600; cursor: pointer; }
#restart { background: #c8e6c9; color: #2e7d32; }
#share-btn { background: #81c784; color: #fff; }
.records h2 { font-size: 16px; }
.records ul { list-style: none; padding: 0; margin: 0; }
.records li { display: flex; justify-content: space-between; padding: 8px 10px; background: #fff;
  border-radius: 8px; margin-bottom: 6px; font-size: 13px; }
.records li .win { color: #2e7d32; } .records li .lose { color: #d32f2f; }
.share-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  z-index: 200; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.share-overlay.active { display: flex; }
.share-card-img { max-width: 90vw; max-height: 70vh; border-radius: 16px;
  box-shadow: 0 8px 32px rgba(201,168,76,0.25); object-fit: contain; }
.share-hint { color: #ccc; font-size: 14px; margin-top: 16px; text-align: center; opacity: .85; }
.share-close { color: #ccc; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.25);
  padding: 10px 32px; border-radius: 24px; font-size: 15px; cursor: pointer; margin-top: 16px; }
