/* The Ultimate Hatch and Fill: color gallery. Match the site by changing the variables below. */
:root {
  --paper: #f4eddf;
  --card: #fffaf0;
  --ink: #183e34;
  --muted: #4c655a;
  --line: #d3cab8;
  --title: #183e34;
  --accent: #183e34;
  --accent-ink: #fff3dc;
  --gold: #8a6526;
  --warn-bg: #f6e7d6;
  --warn-ink: #7a3a14;
  --cover: #efe7d6;
  --cover-grid: rgba(120, 115, 107, .16);
  --font-head: Georgia, "Times New Roman", serif;
  --font-body: Arial, sans-serif;
  --radius: 10px;
}
* { box-sizing: border-box; }
body.uhf { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 17px; line-height: 1.55; }
.uhf a { color: var(--accent); }
.uhf-wrap { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
.uhf-head { text-align: center; padding: 18px 0 6px; max-width: 720px; margin: 0 auto; }
.uhf-kicker { font-family: var(--font-head); font-weight: 700; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin: 0; }
.uhf h1 { font-family: var(--font-head); font-weight: 900; color: var(--title); font-size: clamp(30px, 7vw, 48px); line-height: 1.08; margin: 8px 0 12px; text-transform: uppercase; text-wrap: balance; }
.uhf h2 { font-family: var(--font-head); font-weight: 800; color: var(--title); font-size: 22px; line-height: 1.25; margin: 4px 0 8px; }
.uhf-lede { color: var(--muted); margin: 0 auto 14px; }
.uhf-warn { display: inline-block; background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius); padding: 10px 14px; margin: 0; font-size: 15px; }

/* controls */
.uhf-bar { position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); padding: 14px 0 10px; margin: 18px 0 18px; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.uhf-levels { display: flex; flex-wrap: wrap; gap: 8px; }
.uhf-chip { font: inherit; font-size: 15px; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 13px; cursor: pointer; }
.uhf-chip span { font-weight: 400; color: var(--muted); font-size: 13px; }
.uhf-chip[aria-pressed="true"] { background: var(--title); border-color: var(--title); color: #fff; }
.uhf-chip[aria-pressed="true"] span { color: #dfe7ec; }
.uhf-goto { display: flex; gap: 6px; align-items: center; }
.uhf-goto label { font-size: 14px; font-weight: 600; white-space: nowrap; }
.uhf-goto input { font: inherit; width: 84px; padding: 6px 8px; border: 1px solid #b9ad9a; border-radius: 8px; background: #fff; color: var(--ink); }
.uhf-btn { display: inline-block; font: inherit; font-weight: 600; padding: 7px 15px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink) !important; cursor: pointer; text-decoration: none; }
.uhf-btn.ghost { background: transparent; color: var(--accent) !important; }
.uhf-link { font: inherit; font-size: 14px; background: none; border: 0; padding: 0 0 0 8px; color: var(--accent); text-decoration: underline; cursor: pointer; }
.uhf-progress { margin: 0; font-size: 15px; color: var(--muted); }
.uhf-msg { margin: 0; flex-basis: 100%; font-size: 14px; color: var(--warn-ink); min-height: 0; }
.uhf-msg:empty { display: none; }
.uhf button:focus-visible, .uhf input:focus-visible, .uhf a:focus-visible, .uhf-dialog button:focus-visible, .uhf-dialog a:focus-visible { outline: 3px solid #d9a441; outline-offset: 2px; }

/* the grid of pictures */
.uhf-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.uhf-grid li { min-width: 0; }
.uhf-card { display: block; width: 100%; text-align: left; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; cursor: pointer; scroll-margin-top: 140px; }
.uhf-card:hover { border-color: #c4b79f; }
.uhf-pic { position: relative; display: block; aspect-ratio: 40 / 56; border-radius: 6px; overflow: hidden; background: var(--cover);
  background-image: linear-gradient(var(--cover-grid) 1px, transparent 1px), linear-gradient(90deg, var(--cover-grid) 1px, transparent 1px);
  background-size: 10% 7.142857%; }
.uhf-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.uhf-q { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--title); }
.uhf-q b { font-family: var(--font-head); font-weight: 900; font-size: 34px; line-height: 1; }
.uhf-q i { font-style: normal; font-size: 13px; color: var(--muted); }
.uhf-card.armed .uhf-q { background: rgba(46, 125, 123, .12); }
.uhf-card.armed .uhf-q i { color: var(--accent); font-weight: 600; }
.uhf-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin: 8px 2px 0; }
.uhf-num { font-family: var(--font-head); font-weight: 800; color: var(--title); font-size: 15px; }
.uhf-lvl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.uhf-rid { display: block; margin: 2px 2px 0; font-size: 14px; line-height: 1.3; color: var(--muted); }
.uhf-ans { display: block; margin: 4px 2px 2px; font-weight: 600; font-size: 15px; line-height: 1.3; color: var(--ink); }
.uhf-grid li[hidden] { display: none; }

/* bonus */
.uhf-bonus { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; background: var(--card); border: 2px solid var(--title); border-radius: var(--radius); padding: 22px; margin: 36px 0 22px; scroll-margin-top: 20px; }
.uhf-bonus-tile { flex: 0 0 120px; aspect-ratio: 40 / 56; border-radius: 6px; background: var(--cover);
  background-image: linear-gradient(var(--cover-grid) 1px, transparent 1px), linear-gradient(90deg, var(--cover-grid) 1px, transparent 1px);
  background-size: 10% 7.142857%; display: flex; align-items: center; justify-content: center; }
.uhf-bonus-tile span { font-family: var(--font-head); font-weight: 900; font-size: 32px; color: var(--title); }
.uhf-bonus-body { flex: 1 1 280px; min-width: 0; }
.uhf-bonus-body p { margin: 0 0 10px; }
.uhf-riddle { color: var(--muted); }
.uhf-signup { margin: 14px 0 4px; }
.uhf-unlocked { margin-top: 12px; padding: 14px; border-radius: 8px; background: #e6f1ef; }
.uhf-small { font-size: 14px; color: var(--muted); }

/* key */
.uhf-key { margin: 26px 0 8px; }
.uhf-swatches { list-style: none; margin: 10px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.uhf-swatches li { display: flex; gap: 8px; align-items: center; font-size: 14px; line-height: 1.2; min-width: 0; }
.uhf-swatches i { flex: 0 0 26px; height: 26px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); }
.uhf-swatches b { font-family: var(--font-head); }
.uhf-swatches small { display: block; color: var(--muted); font-size: 12px; }
.uhf-foot { margin-top: 30px; font-size: 13px; color: var(--muted); text-align: center; }

/* viewer */
.uhf-dialog { border: 0; border-radius: 12px; padding: 18px 18px 14px; max-width: min(520px, calc(100vw - 32px)); width: 100%; background: var(--card); color: var(--ink); font-family: var(--font-body); }
.uhf-dialog::backdrop { background: rgba(30, 30, 30, .6); }
.uhf-dialog h2 { font-family: var(--font-head); font-weight: 800; color: var(--title); font-size: 22px; margin: 2px 0 10px; }
.uhf-dialog img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; background: #fff; border-radius: 6px; }
.uhf-dialog-close { text-align: right; margin: 0; }
.uhf-dialog-actions { margin: 12px 0 0; }

@media (max-width: 520px) {
  body.uhf { font-size: 16px; }
  .uhf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .uhf-bar { position: static; }
  .uhf-bonus { padding: 16px; }
  .uhf-bonus-tile { flex-basis: 90px; }
}
