:root {
  --background: #101210;
  --surface: #171b16;
  --border: #30372c;
  --text: #f1f4eb;
  --muted: #a9b2a4;
  --accent: #d2f774;
  --difficulty: #ffa79b;
  --snapshot: #e6c28b;
  --interface: "Segoe UI", system-ui, sans-serif;
  --display: Bahnschrift, "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); font: 15px/1.55 var(--interface); }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
.wrap { width: min(1192px, calc(100% - 88px)); margin-inline: auto; }
.top { border-bottom: 1px solid var(--border); }
.top-inner { min-height: 69px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font: 700 22px/1 var(--display); letter-spacing: -.035em; text-decoration: none; }
.mark { display: grid; place-items: center; width: 26px; aspect-ratio: 1; background: var(--accent); border-radius: 4px; }
.mark::after { content: ""; width: 13px; height: 13px; border: 2px solid #1a2112; transform: rotate(45deg); border-radius: 1px; }
.top a:not(.brand) { color: var(--muted); font-size: 13px; text-decoration: none; }
.top a:hover { color: var(--accent); }
main.wrap { padding: 44px 0 54px; }

.toolbar { display: grid; grid-template-columns: .8fr 1.2fr; gap: 36px; align-items: center; margin-bottom: 27px; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(31px, 4vw, 49px); line-height: 1.16; letter-spacing: -.055em; font-weight: 730; }
.toolbar form { position: relative; min-width: 0; }
.search-label { display: block; margin: 0 0 8px 1px; color: var(--muted); font-size: 13px; }
.search { display: flex; gap: 12px; align-items: center; padding: 5px; border: 1px solid #424b3a; border-radius: 10px; background: var(--surface); }
.search:focus-within { border-color: var(--accent); }
.magnify { width: 15px; height: 15px; flex: 0 0 15px; margin-left: 12px; border: 1.5px solid var(--muted); border-radius: 50%; position: relative; }
.magnify::after { content: ""; position: absolute; right: -5px; bottom: -2px; width: 6px; height: 1.5px; background: var(--muted); transform: rotate(45deg); }
.search input { width: 100%; min-width: 0; background: transparent; color: var(--text); border: 0; padding: 8px 3px; }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: 0; }
.search button { flex: 0 0 auto; min-height: 42px; padding: 0 20px; border: 0; border-radius: 6px; background: var(--accent); color: #17200d; font-weight: 720; }
.search button:hover { background: #e0ff9b; }
.examples { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.examples a { text-underline-offset: 3px; }
.examples a:hover { color: var(--accent); }
.notice { padding: 16px 20px; margin-bottom: 20px; border: 1px solid var(--border); border-radius: 12px; color: var(--muted); }

.matches { margin-bottom: 24px; }
.matches h2 { font-size: 18px; margin-bottom: 10px; }
.matches ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.match { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); text-decoration: none; }
.match:hover, .match[aria-current] { border-color: var(--accent); }
.match-name { min-width: 0; font-weight: 650; overflow-wrap: anywhere; }
.match-name small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.match-id { flex: none; color: var(--accent); font-size: 13px; font-variant-numeric: tabular-nums; }

.level { display: grid; grid-template-columns: 1.34fr 1fr; min-height: 310px; background: var(--surface); border: 1px solid var(--border); border-radius: 15px; overflow: hidden; }
.gameplay { position: relative; margin: 0; min-height: 100%; background: #251410; }
.gameplay img { display: block; width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; object-position: center; }
.gameplay img[alt=""] { object-fit: contain; background: var(--surface); }
.thumbnail-fallback { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; background: repeating-linear-gradient(135deg, #1b2219 0 1px, #151914 1px 15px); color: var(--muted); font-size: 13px; }
.thumbnail-fallback::before { content: ""; width: 24px; aspect-ratio: 1; border: 2px solid #6d7b60; border-radius: 3px; transform: rotate(45deg); }
.level-info { padding: 29px 31px 27px; align-self: center; min-width: 0; }
.difficulty { display: inline-flex; align-items: center; gap: 8px; color: var(--difficulty); font: 650 14px/1 var(--display); }
.difficulty::before { content: ""; width: 8px; height: 8px; background: currentColor; transform: rotate(45deg); }
.level-title { margin: 11px 0 2px; font: 750 clamp(48px, 6vw, 83px)/.98 var(--display); letter-spacing: -.05em; overflow-wrap: anywhere; }
.publisher { color: var(--muted); margin-top: 10px; }
.publisher strong { margin-left: 6px; color: var(--text); font-weight: 620; }
.facts { display: grid; grid-template-columns: minmax(97px, 1fr) minmax(42px, .65fr) minmax(55px, 1fr); gap: 10px; margin-top: 28px; border-top: 1px solid var(--border); padding-top: 20px; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin-top: 3px; font-size: 15px; font-weight: 640; overflow-wrap: anywhere; }
.song-link { text-underline-offset: 3px; }
.song-link:hover { color: var(--accent); }
.song-artist { color: var(--muted); font-weight: 500; }
.id-button { border: 0; padding: 0; background: transparent; color: var(--accent); font: 650 16px/1.45 var(--display); font-variant-numeric: tabular-nums; }
.id-button:hover { text-decoration: underline; }
.id-button::after { content: ""; display: inline-block; margin-left: 10px; width: 8px; height: 9px; border: 1px solid currentColor; box-shadow: 2px -2px 0 -1px var(--surface), 3px -3px 0 -1px currentColor; opacity: .8; }

.details { display: grid; grid-template-columns: 1.34fr 1fr; gap: 33px; margin-top: 28px; }
.details h2 { font-size: 20px; line-height: 1.3; letter-spacing: -.018em; }
.chart { min-width: 0; }
.source-list { margin-top: 9px; }
.source { display: grid; grid-template-columns: minmax(97px, .78fr) minmax(143px, 1.45fr) auto; gap: 12px; align-items: center; min-height: 57px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.provider { display: flex; align-items: center; gap: 10px; font: 680 15px/1.3 var(--display); }
.provider::before { content: ""; width: 5px; height: 19px; border-radius: 2px; background: #67765b; }
.value { font: 650 21px/1.15 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.value-group { display: flex; flex-wrap: wrap; gap: 8px 15px; align-items: baseline; }
.value-group span { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.metric { font: 500 12px/1 var(--interface); color: var(--muted); letter-spacing: 0; }
.stamp { color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; }
.detail-status { margin-top: 8px; font-size: 13px; color: var(--snapshot); overflow-wrap: anywhere; }

.notes { align-self: start; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 21px 20px; }
.note { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; }
.note h3, .note summary { margin: 0; color: var(--text); font: 640 14px/1.45 var(--interface); }
.note summary { cursor: pointer; padding: 6px 0; }
.note summary::marker { color: var(--accent); }
.note[open] .when-closed, .note:not([open]) .when-open { display: none; }
.note p { margin-top: 7px; color: #ccd2c7; line-height: 1.67; overflow-wrap: anywhere; white-space: pre-line; }
.long-descriptions { grid-column: 1 / -1; display: grid; gap: 12px; }
.long-descriptions .note { width: min(100%, 76ch); margin: 0 auto; padding: 12px clamp(16px, 3vw, 30px); border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.long-descriptions .note p { padding-bottom: 10px; }
.skill { display: flex; gap: 8px 12px; flex-wrap: wrap; padding-top: 12px; margin-top: 14px; border-top: 1px solid var(--border); font-size: 13px; }
.skill dt { color: var(--muted); }
.skill dd { min-width: 0; overflow-wrap: anywhere; }
.footer { margin-top: 24px; color: var(--muted); font-size: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 930px) {
  .wrap { width: calc(100% - 52px); }
  .level-info { padding-inline: 22px; }
  .details { gap: 23px; }
  .source { grid-template-columns: minmax(76px, .65fr) minmax(112px, 1.35fr) auto; gap: 8px; }
  .value-group { gap: 6px 10px; }
}

@media (max-width: 750px) {
  .wrap { width: calc(100% - 36px); }
  .top-inner { min-height: 58px; }
  main.wrap { padding: 25px 0 36px; }
  .toolbar { grid-template-columns: 1fr; gap: 15px; margin-bottom: 18px; }
  .search input { font-size: 16px; }
  .level, .details { grid-template-columns: 1fr; }
  .gameplay { aspect-ratio: 16 / 9; }
  .level-info { padding: 19px 18px; }
  .level-title { margin-top: 8px; }
  .publisher { margin-top: 5px; }
  .facts { margin-top: 17px; padding-top: 13px; }
  .details { gap: 22px; margin-top: 23px; }
  .notes { padding: 14px 16px 16px; }
  .stamp { white-space: normal; }
  .stamp time { display: block; }
}

@media (max-width: 380px) {
  .source { grid-template-columns: minmax(64px, .75fr) minmax(100px, 1.35fr) auto; }
  .stamp { white-space: normal; }
  .value { font-size: 18px; }
}
