:root {
  --bg: #f4f4f5;
  --fg: #111827;
  --muted: #6b7280;
  --border: #d1d5db;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-light: #eff6ff;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 4px 6px rgba(15, 23, 42, 0.08);
  --max-width: 100%; /* changed to full width */
}

/* Basic reset and layout container */
* { box-sizing: border-box; }
html,body{ height:100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

.site-container{
  max-width: var(--max-width);
  margin: 0 auto;
  padding-inline: 16px;
}

/* Skip link for keyboard users */
.skip-link{
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 9999;
  background: #111827;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  transform: translateY(-110%);
  transition: transform 0.18s ease;
}
.skip-link:focus{ transform: translateY(0); outline: 3px solid var(--primary-light); }

header{
  background: var(--primary);
  color: white;
  padding: 16px 0;
}
header .site-container{ display:block; }
header h1{ margin:0; font-size:20px; }
header p{ margin:6px 0 0; color: rgba(255,255,255,0.92); font-size:13px; }

.nav{ display:flex; gap:12px; margin-top:12px; flex-wrap:wrap; }
.nav a{ font-size:13px; color: rgba(245,247,250,0.95); text-decoration:none; padding:6px 12px; border-radius:999px; border:1px solid rgba(255,255,255,0.08); transition: background .15s; }
.nav a:hover{ background: rgba(255,255,255,0.08); }
.nav a[aria-current="page"]{ background: rgba(0,0,0,0.12); box-shadow: 0 2px 6px rgba(0,0,0,0.12); }

main.card{
  background: #ffffff;
  margin: 20px 0;
  padding: 24px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  font-size:15px;
  line-height:1.6;
}

a{ color:var(--primary); }

/* Focus styles for accessibility */
button:focus, a:focus, input:focus, select:focus, textarea:focus { outline: 3px solid var(--primary-light); outline-offset: 2px; }

/* Ad placeholder */
.ad-slot{ max-width:100%; padding:8px 0; text-align:center; }
.ad-placeholder{ border:1px dashed #e5e7eb; background:#fafafa; color:var(--muted); padding:10px; font-size:12px; border-radius:8px; }

/* Controls / filters used on index */
.controls{ padding:12px 0; display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.chip{ font-size:13px; display:flex; align-items:center; gap:6px; background:white; padding:8px 12px; border-radius:8px; box-shadow:var(--shadow-sm); cursor:pointer; position:relative; }
.chip input{ position:absolute; opacity:0; pointer-events:none; }
.chip span{ font-weight:500; }
.chip:has(input:checked){ background:var(--primary); color:white; }

.search-box{ display:flex; align-items:center; gap:8px; background:white; padding:8px 12px; border-radius:8px; box-shadow:var(--shadow-sm); }
.search-box input{ border:none; outline:none; font-size:14px; background:transparent; }

#numbers{ padding:12px 0; display:grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap:12px; }
.num{ background:white; padding:10px 8px; border-radius:8px; box-shadow:var(--shadow-sm); text-align:center; min-height:60px; transition: transform .18s, box-shadow .18s; }
.num:hover{ transform: translateY(-3px); box-shadow:var(--shadow-md); }
.num strong{ display:block; font-size:1.1em; }
.num small{ display:block; font-size:10px; color:var(--muted); margin-top:6px; }
.num.even{ background:#eff6ff; }
.num.odd{ background:#fff7ed; }
.num.prime{ box-shadow: 0 0 0 2px #34d399, var(--shadow-sm); }
.num.digitFancy{ background:#ede9fe; box-shadow: 0 0 0 2px #a855f7, var(--shadow-sm); }
.num.special{ background:#ecfdf5; box-shadow: 0 0 0 2px #22c55e, var(--shadow-md); }

.pagination{ display:flex; gap:8px; align-items:center; padding:12px 0; }
.pagination button{ border-radius:8px; padding:8px 14px; border:none; box-shadow:var(--shadow-sm); background:white; }
.pagination button:hover:not(:disabled){ background:var(--primary); color:white; }
.pagination button:disabled{ opacity:.45; cursor:default; }

.footer{ padding:16px 0; color:var(--muted); font-size:13px; }
.footer a{ color:var(--muted); }

/* Contact form alignment fix */
.contact-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  margin-top: 18px;
}
.contact-form label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}
.contact-form input[type="text"] {
  min-width: 140px;
  padding: 6px 8px;
  font-size: 14px;
}
.contact-form textarea {
  min-width: 220px;
  min-height: 48px;
  padding: 6px 8px;
  font-size: 14px;
  resize: vertical;
}
.contact-form button {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  margin-left: 8px;
}
.contact-form button:hover {
  background: var(--primary-600);
}

/* Responsive */
@media (max-width:900px){ #numbers{ grid-template-columns: repeat(auto-fill, minmax(72px,1fr)); } }
@media (max-width:600px){ .site-container{ padding-inline:12px; } .controls{ flex-direction:column; align-items:stretch; } .search-box, .chip, select { width:100%; } }

/* Small utilities */
.muted{ color:var(--muted); }
.visually-hidden{ position:absolute!important; height:1px;width:1px; overflow:hidden; clip:rect(1px,1px,1px,1px); white-space:nowrap; }

/* Center layout and make content stretch nicely on large screens */
.site-container {
  max-width: var(--max-width);
  width: 100%; /* fill the viewport */
  margin-inline: 0; /* no centering needed when full width */
  padding-inline: clamp(12px, 2.2vw, 32px);
  box-sizing: border-box;
}

/* Make number tiles form a responsive grid so right space is used */
#numbers {
  display: grid;
  /* allow more, smaller columns on very wide screens and more columns overall */
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

/* slightly reduce min column at very small sizes (keep previous mobile rules) */
@media (min-width: 1400px) {
  #numbers { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
}
@media (max-width:900px){ #numbers{ grid-template-columns: repeat(auto-fill, minmax(72px,1fr)); } }
@media (max-width:600px){ .site-container{ padding-inline:12px; } .controls{ flex-direction:column; align-items:stretch; } .search-box, .chip, select { width:100%; } }
