/* Shared cabinet styling for the start screen, course picker, and garage. */
html:has(body:is([data-screen="levels"],[data-screen="marbles"])),
body:is([data-screen="levels"],[data-screen="marbles"]) { touch-action: auto; }
#title .mainnav {
  padding: 10px;
  background: linear-gradient(146deg, #4a3bf0f4, #231899f0);
  border: 2px solid #b4b4ff;
  box-shadow: inset 0 2px #e6e6ff54, 0 6px #18125c, 0 18px 36px #160d6073;
  border-radius: 9px;
}
#title .nrow { border-bottom: 1px solid #b5b0ff3b; }
#title .nrow:last-child { border-bottom-color: transparent; }
#title .nrow:first-child { background: #d7f9ae20; }
#title .nrow:is(:hover,.focus,:focus-visible) { background: #aaa1ff68; }
#title .wordmark { filter: drop-shadow(0 14px 26px #1611505e); }

#levels {
  background: linear-gradient(135deg, #161348e8, #1c1262ed),
    url('../assets/art/arcade-course.webp') center / cover;
}
:is(#levels,#marbles) .sheet-head {
  background: linear-gradient(155deg, #4137ae, #222069);
  border-bottom: 2px solid #9f93ff;
  min-height: 65px;
  gap: 14px;
  padding-block: 9px;
}
.screen-brand { width: clamp(100px, 14vw, 170px); height: auto; }
#levels .lv-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(285px, 31%);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  padding: clamp(12px, 2.4vw, 34px);
  width: min(1520px, 100%);
  margin-inline: auto;
  overflow: auto;
  touch-action: pan-y;
}
#levels .tiers {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  background: none;
  border: 0;
  overflow: visible;
  flex: none;
}
.tier-message { grid-column: 1/-1; color: #fff7ae; font-size: 12px; }
.tier-message:empty { display: none; }
#levels .trow {
  min-width: 0;
  margin: 0;
  padding: 9px 12px;
  background: #2d236f;
  border: 1px solid #776ac7;
  border-radius: 7px;
}
#levels .trow.on { background: #4536b8; border-color: #d8ff9b; }
#levels .trow .nm { font-size: clamp(11px, 1.3vw, 16px); margin-block: 3px 6px; }
.course-grid {
  align-self: start;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.course-card {
  display: grid;
  text-align: start;
  overflow: hidden;
  border: 2px solid #8275d8;
  border-radius: 10px;
  background: linear-gradient(155deg, #423095, #232066);
  box-shadow: 0 4px #120c44;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.course-card:is(:hover,.focus,.sel) { border-color: #ddff9e; }
.course-card.sel { box-shadow: 0 4px #799945, 0 0 22px #d9ff8d26; }
.course-picture {
  position: relative;
  aspect-ratio: 16 / 9;
  display: block;
  isolation: isolate;
  background: #392d7e url('../assets/ui/checker.svg') center / 70px;
}
.course-picture img { display: block; width: 100%; height: 100%; object-fit: cover; }
.course-picture::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, #130b42a3, transparent 50%);
  pointer-events: none;
}
.course-card.locked img { filter: saturate(.48) brightness(.84); }
.course-number,.course-picture :is(.i,.medal) {
  position: absolute;
  top: 7px;
  z-index: 1;
}
.course-number { inset-inline-start: 8px; color: #fff; font: 700 11px var(--f-mono); }
.course-picture :is(.i,.medal) { inset-inline-end: 8px; }
.course-picture .medal.none { display: none; }
.course-copy { padding: 10px; display: grid; gap: 3px; }
.course-copy strong { font-size: clamp(12px, 1.1vw, 17px); }
.course-copy small { color: #cdc4fc; font-size: 11px; }
#levels .detail {
  display: block;
  min-width: 0;
  border: 1px solid #9383eb;
  border-radius: 10px;
  background: #211958;
  overflow: auto;
}
#levels .detail .th { background: #433ca1; }
#levels .detail .bd { padding: 14px; gap: 12px; }
#levels .detail h3 { color: #faffd5; text-shadow: 2px 3px #110a37; }
#levels .detail .th { aspect-ratio: 2.2; }
#levels .course-lock-note { color: #f4e5ff; }

#marbles .ga-body {
  grid-template-columns: minmax(180px, 25%) minmax(0, 1fr) minmax(210px, 25%);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  touch-action: pan-y;
}
#marbles :is(.mlist,.mspec) { max-height: none; background: #231c59; border: 1px solid #796cc2; border-radius: 10px; }
#marbles .mrow { grid-template-columns: 38px minmax(0, 1fr); gap: 9px; padding: 8px; }
#marbles .mrow :is(img,.ph) { width: 38px; height: 38px; }
#marbles .mrow.sel { border-color: #d8ff9b; background: #453899; }
#marbles .mrow .eq { grid-column: 2; }
.garage-stage {
  position: relative;
  min-height: 260px;
  border: 1px solid #8774db;
  border-radius: 12px;
  cursor: grab;
  touch-action: none;
}
.garage-stage:active { cursor: grabbing; }
.garage-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(#181244c2, transparent 28%, transparent 74%, #1812448c);
  pointer-events: none;
}
.garage-caption { position: absolute; inset: 12px 12px auto; display: grid; gap: 4px; text-align: center; pointer-events: none; text-shadow: 0 1px 4px #0e082c; }
.garage-caption strong { font-family: var(--f-disp); font-size: clamp(13px, 2vw, 22px); color: #f4ffc5; }
.garage-caption span { font-size: 11px; color: #f0eaff; }
.garage-course {
  position: absolute;
  inset-inline-start: 10px;
  bottom: 12px;
  max-width: calc(50% - 54px);
  padding: 6px 8px;
  border-radius: 5px;
  background: #211951e8;
  color: #eee7ff;
  font-size: 10px;
  pointer-events: none;
}
.garage-course b { display: block; }
.garage-turn { position: absolute; inset: auto 10px 12px; display: flex; justify-content: center; gap: 8px; }
.garage-turn button { width: 36px; height: 36px; }
@media (max-width: 860px) {
  #levels .lv-body { grid-template-columns: minmax(0, 1fr) minmax(210px, 35%); }
  .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #marbles .ga-body { grid-template-columns: minmax(145px,32%) minmax(0,1fr); grid-template-rows: minmax(260px, 1fr) auto; overflow: auto; }
  #marbles .mspec { grid-column: 1/-1; }
}
@media (max-width: 600px) {
  #levels .lv-body { display: flex; flex-direction: column; }
  #levels .tiers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .course-grid { width: 100%; }
  #levels .detail { flex: none; }
  #levels .detail .th { display: none; }
  #marbles .ga-body { display: flex; flex-direction: column; }
  #marbles .garage-stage { order: -1; flex: none; height: min(42vh, 330px); min-height: 215px; }
  #marbles .mlist { display: flex; flex: none; overflow-x: auto; padding: 5px; touch-action: pan-x; }
  #marbles .mrow { display: flex; flex: 0 0 114px; flex-direction: column; align-items: center; text-align: center; margin: 3px; }
  #marbles .mrow .nm { font-size: 11px; }
  #marbles .mrow :is(.cl,.eq) { font-size: 9px; }
  #marbles .mspec { flex: none; }
}
