/* ── Netwalk — style.css ──────────────────────── */
/* No frameworks. No resets from npm. Just what we need. */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: #0d0d1a;
  color: #cbd5e1;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(0,184,212,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(240,152,55,0.03) 0%, transparent 50%),
    linear-gradient(rgba(255,255,255,0.008) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.008) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
}

/* ── Layout ──────────────────────────────────── */
.site-header {
  width: 100%;
  max-width: 720px;
  padding: 24px 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.site-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 0.02em;
}
.site-title span {
  color: #00b8d4;
  font-weight: 400;
}

.lang-switch {
  font-size: 0.85rem;
  display: flex;
  gap: 12px;
}
.lang-switch a {
  color: #64748b;
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid #1e293b;
  transition: all 0.15s;
}
.lang-switch a:hover,
.lang-switch a.active {
  color: #00b8d4;
  border-color: #00b8d4;
}

main {
  width: 100%;
  max-width: 720px;
  padding: 16px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Controls bar ────────────────────────────── */
.controls {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.diff-group {
  display: flex;
  gap: 0;
  border: 1px solid #1e293b;
}
.diff-btn {
  background: transparent;
  color: #64748b;
  border: none;
  padding: 6px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.diff-btn + .diff-btn { border-left: 1px solid #1e293b; }
.diff-btn:hover { color: #94a3b8; background: rgba(255,255,255,0.03); }
.diff-btn.active {
  color: #00b8d4;
  background: rgba(0,184,212,0.1);
}

.stats {
  display: flex;
  gap: 20px;
  font-size: 0.9rem;
}
.stat-label { color: #64748b; margin-right: 6px; }
.stat-value {
  color: #e2e8f0;
  font-family: "JetBrains Mono","SF Mono","Cascadia Code","Consolas",monospace;
}

#new-game-btn {
  background: transparent;
  color: #00b8d4;
  border: 1px solid #00b8d4;
  padding: 6px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
#new-game-btn:hover {
  background: rgba(0,184,212,0.1);
}

/* ── Canvas ──────────────────────────────────── */
.canvas-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}
#game-canvas {
  cursor: pointer;
  display: block;
  max-width: 100%;
}
#game-canvas:active { cursor: pointer; }

/* ── Ad slots ────────────────────────────────── */
/* Ad containers: invisible when empty, hold space when filled.
   To see ad boundaries during development, uncomment the
   background rule in .ad-slot below. */
.ad-slot {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  /*  Uncomment to debug placement:
      background: rgba(255,0,0,0.1);
      outline: 1px dashed rgba(255,0,0,0.3);
      color: rgba(255,0,0,0.4);
      font-size: 0.75rem;
  */
}
.ad-slot::before {
  /* Slot label, shown only when container is empty */
  content: attr(data-ad-slot);
  display: block;
  color: #334155;
  font-size: 0.7rem;
  font-family: "JetBrains Mono",monospace;
}
.ad-slot:not(:empty)::before {
  display: none;
}

.ad-top {
  min-height: 60px;  /* desktop banner; override to 90px for 728x90 */
  margin-bottom: 12px;
}

.ad-bottom {
  min-height: 100px; /* rectangle; override to 250px for 300x250 */
  margin-top: 20px;
  margin-bottom: 8px;
}
.win-message {
  display: none;
  text-align: center;
  margin-top: 16px;
  animation: fadeUp 0.4s ease-out;
}
.win-message h2 {
  font-size: 1.3rem;
  color: #00e5ff;
  font-weight: 600;
  margin-bottom: 4px;
}
.win-message p {
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 12px;
}
#play-again-btn {
  background: #00b8d4;
  color: #0d0d1a;
  border: none;
  padding: 8px 24px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
#play-again-btn:hover { background: #00e5ff; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── How to play ─────────────────────────────── */
.howtoplay {
  width: 100%;
  margin-top: 32px;
  padding: 24px;
  border: 1px solid #1e293b;
  background: rgba(255,255,255,0.015);
}
.howtoplay h3 {
  font-size: 1rem;
  color: #e2e8f0;
  margin-bottom: 12px;
}
.howtoplay ol {
  list-style-position: inside;
  color: #94a3b8;
  font-size: 0.9rem;
}
.howtoplay li { margin-bottom: 6px; }
.howtoplay li:last-child { margin-bottom: 0; }
.howtoplay kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 0.8rem;
  font-family: "JetBrains Mono","SF Mono",monospace;
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  vertical-align: 1px;
}

/* ── Footer ──────────────────────────────────── */
.site-footer {
  width: 100%;
  max-width: 720px;
  padding: 0 20px 24px;
  text-align: center;
  font-size: 0.78rem;
  color: #475569;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 500px) {
  .site-header { padding-top: 16px; }
  .site-title { font-size: 1.25rem; }
  .controls { justify-content: center; }
  .diff-btn { padding: 5px 10px; font-size: 0.78rem; }
  .stats { gap: 12px; font-size: 0.8rem; }
  #new-game-btn { padding: 5px 12px; font-size: 0.8rem; }
  .howtoplay { padding: 16px; }
  .ad-top  { min-height: 50px; }
  .ad-bottom { min-height: 80px; }
}
