:root {
  --ui-border: #0f0f0f;
  --ui-body: #f2feff;
  --ui-footer: #c1e4e4;
  --panel-ink: #141414;
  --text-light: #f5f5f5;
  --tile-body-hi: #dcdedf;
  --tile-body: #b7bbbe;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: var(--panel-ink);
}

body {
  min-height: 100vh;
  background: #2a2a22 url('../assets/backgrounds/cracked-earth.jpg') center / cover no-repeat fixed;
}

#wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  gap: 10px;
}

#title-banner {
  position: relative;
  width: min(90vw, 560px);
  aspect-ratio: 701 / 158;
  background: url('../assets/ui/ribbon-narrow.png') center / contain no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}
#title-banner h1 {
  margin: 0;
  padding: 0 10%;
  padding-bottom: 8%;
  font-size: clamp(20px, 3.6vw, 32px);
  text-align: center;
  color: var(--text-light);
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

#subtitle {
  margin: 4px 0 22px;
  color: var(--text-light);
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
  font-size: 16px;
}

#sections {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
  width: 100%;
  max-width: 640px;
}

.section-card {
  text-decoration: none;
  color: inherit;
  border: 4px solid var(--ui-border);
  border-radius: 22px;
  background: linear-gradient(160deg, #ffffff, var(--ui-body) 55%, var(--ui-body));
  overflow: hidden;
  position: relative;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}
.section-card:hover,
.section-card:focus-visible { transform: translateY(-3px); }
.section-card:active { transform: translateY(1px); }

.section-card::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 6px;
  background: var(--ui-footer);
}

.section-icon {
  display: flex;
  justify-content: center;
  padding: 18px 20px 0;
}
.section-icon img {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.section-body {
  padding: 6px 20px 22px;
  text-align: center;
}
.section-body h2 {
  margin: 0 0 8px;
  font-size: 24px;
}
.section-body p {
  margin: 0 auto;
  max-width: 460px;
  font-size: 13px;
  line-height: 1.45;
  color: #3a4a4e;
}

/* ---- Per-level tile-count previews - three small grids showing the
   actual level 1/2/3 art, so the difficulty jump is visible at a glance
   instead of just stated in text. ---- */
.level-previews {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 18px;
  margin-top: 18px;
}

.level-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.preview-grid {
  display: grid;
  gap: 3px;
  padding: 5px;
  border: 2px solid var(--ui-border);
  border-radius: 8px;
  background: linear-gradient(160deg, var(--tile-body-hi), var(--tile-body) 60%, var(--tile-body));
}
.preview-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.preview-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.preview-grid img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.level-preview-label {
  font-size: 11px;
  font-weight: 600;
  color: #3a4a4e;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .section-icon img { width: 96px; height: 96px; }
  .level-previews { gap: 12px; }
  .preview-grid img { width: 16px; height: 16px; }
  .level-preview-label { font-size: 10px; }
}
