:root {
  color-scheme: light;
  --bg: #0b1026;
  --bg-2: #151b3b;
  --accent: #ff2e63;
  --accent-2: #00f5ff;
  --accent-3: #f9d65c;
  --text: #f8f6ff;
  --muted: rgba(248, 246, 255, 0.65);
  --card: rgba(16, 22, 48, 0.86);
  --glass: rgba(255, 255, 255, 0.05);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  background: radial-gradient(circle at top, #2d1f5a 0%, #0b1026 45%, #05060f 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.fx-bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 46, 99, 0.12), rgba(0, 245, 255, 0.12));
  pointer-events: none;
  z-index: 0;
}

.hero {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 24px;
  padding: 42px 8vw 20px;
  align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.brand-tag {
  letter-spacing: 3px;
  color: var(--accent-2);
  font-size: 0.8rem;
  margin: 0 0 10px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(2.6rem, 4vw, 4.4rem);
  font-family: "BIZ UDPMincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  text-shadow: 0 0 18px rgba(0, 245, 255, 0.35);
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.2rem);
}

.hero-panel {
  background: var(--card);
  padding: 18px 20px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  font-size: 0.75rem;
  letter-spacing: 1px;
}

.hero-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 24px;
  padding: 20px 8vw 40px;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 2fr) minmax(240px, 1fr);
}

.control-card,
.legend-card,
.community-card {
  background: var(--card);
  padding: 20px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.control-row {
  display: grid;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  grid-template-columns: 80px 1fr auto;
}

.control-row:last-child {
  margin-bottom: 0;
}

.label {
  font-size: 0.8rem;
  letter-spacing: 1px;
  color: var(--muted);
}

.seed-input,
.select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--glass);
  color: var(--text);
  font-size: 0.9rem;
}

.btn {
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  font-family: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px) scale(1.01);
}

.btn-glow {
  background: linear-gradient(120deg, var(--accent-2), #7effff);
  color: #031d2b;
}

.btn-solid {
  background: linear-gradient(120deg, var(--accent), #ff7aa8);
  color: #1c0a12;
}

.btn-line {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--text);
}

.status-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.status-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 10px 12px;
}

.status-title {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 1px;
}

.status-value {
  font-size: 1.2rem;
}

.arena {
  background: radial-gradient(circle at top, #10173a, #0b0f26);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 360px;
}

.board {
  display: grid;
  gap: 4px;
  justify-content: center;
  margin: 0 auto;
  --cell-size: 32px;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, background 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.cell:hover {
  transform: translateY(-1px);
}

.cell.revealed {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  cursor: default;
}

.cell.mine {
  background: linear-gradient(120deg, #ff2e63, #ff7aa8);
  color: #2c0814;
}

.cell.flagged {
  background: linear-gradient(120deg, #00f5ff, #7effff);
  color: #00333b;
}

.cell.safe-hint {
  box-shadow: 0 0 12px rgba(0, 245, 255, 0.6);
}

.cell.mine-hint {
  box-shadow: 0 0 12px rgba(255, 46, 99, 0.6);
}

.cell.start-cell {
  background: linear-gradient(140deg, rgba(255, 46, 99, 0.35), rgba(0, 245, 255, 0.35));
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--accent-3);
  text-shadow: 0 0 10px rgba(249, 214, 92, 0.8);
}

.cell.n1 {
  color: #7effff;
}

.cell.n2 {
  color: #9eff7e;
}

.cell.n3 {
  color: #ffd27e;
}

.cell.n4 {
  color: #ff7aa8;
}

.cell.n5 {
  color: #ff2e63;
}

.cell.n6 {
  color: #f9d65c;
}

.cell.n7 {
  color: #c7b3ff;
}

.cell.n8 {
  color: #f8f6ff;
}

.message {
  margin-top: 16px;
  font-size: 1rem;
  color: var(--accent-3);
  min-height: 24px;
  text-align: center;
}

.hint {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  min-height: 20px;
}

.legend-card h2 {
  margin-top: 0;
}

.community-card h2 {
  margin-top: 0;
}

.community-copy {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.community-actions {
  display: grid;
  gap: 10px;
}

.legend-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.legend-card li {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}

.term {
  color: var(--accent-2);
  font-size: 1rem;
}

.footer {
  position: relative;
  z-index: 1;
  padding: 0 8vw 30px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .control-row {
    grid-template-columns: 1fr;
  }

  .board {
    justify-content: start;
  }
}

@media (max-width: 720px) {
  .hero {
    padding: 32px 6vw 16px;
  }

  .layout {
    padding: 16px 6vw 28px;
  }

  .control-card,
  .legend-card,
  .arena {
    padding: 16px;
  }

  .btn,
  .seed-input,
  .select {
    width: 100%;
  }

  .btn {
    padding: 12px 14px;
  }

  .status-row {
    grid-template-columns: 1fr;
  }

  .board {
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .cell {
    font-size: 0.75rem;
  }

  .board {
    --cell-size: 26px;
  }
}
