/*
 * HD Puzzles. Colors and fonts follow the theme when it defines --ink, --glacier, --rail-gold,
 * --display, --ui and friends (The Skagway News theme does); otherwise the fallbacks below apply.
 */
.hdpz {
	--hdpz-ink: var(--ink, #1c2422);
	--hdpz-soft: var(--ink-soft, #55625f);
	--hdpz-faint: var(--ink-faint, #86918e);
	--hdpz-accent: var(--glacier, #2b7479);
	--hdpz-pale: var(--glacier-pale, #d8eae8);
	--hdpz-gold: var(--rail-gold, #e6c77f);
	--hdpz-deep: var(--rail, #23402f);
	--hdpz-paper: var(--paper, #fff);
	--hdpz-fog: var(--fog, #eff3f2);
	--hdpz-line: var(--line, #d3dcd9);
	--hdpz-bad: var(--fireweed, #b3306c);
	--hdpz-display: var(--display, Georgia, serif);
	--hdpz-ui: var(--ui, system-ui, sans-serif);
	--hdpz-text: var(--text, Georgia, serif);
	--e: cubic-bezier(.16, 1, .3, 1);
	color: var(--hdpz-ink);
	margin: 1rem 0 3rem;
}
.hdpz *, .hdpz *::before, .hdpz *::after { box-sizing: border-box; }
.hdpz svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hdpz button { font: inherit; color: inherit; cursor: pointer; }
.hdpz .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- heading and tickets */
.hdpz-head { display: flex; flex-wrap: wrap; gap: .5rem 2rem; align-items: end; justify-content: space-between; margin: 0 0 1.25rem; }
.hdpz-title:empty { display: none; }
.hdpz-title { margin: 0; font-family: var(--hdpz-display); font-size: clamp(2rem, 4vw, 2.9rem); line-height: 1.05; letter-spacing: -.01em; }
.hdpz-date { margin: .3rem 0 0; font-family: var(--hdpz-ui); font-size: 1.05rem; font-weight: 600; color: var(--hdpz-soft); }
.hdpz-lede { max-width: 34rem; margin: 0; font-family: var(--hdpz-text); color: var(--hdpz-soft); }

.hdpz-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 1.5rem; }
/* each kind of puzzle is a ticket: a stub with a punched notch, stamped when solved */
.hdpz-tab { position: relative; display: grid; gap: 2px; padding: 14px 16px 13px 18px; border: 0; border-radius: 6px; background: var(--hdpz-fog); text-align: left; transition: background .25s, color .25s, transform .3s var(--e); -webkit-mask: radial-gradient(circle 7px at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle 7px at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat; mask: radial-gradient(circle 7px at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle 7px at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat; }
.hdpz-tab:hover { transform: translateY(-2px); }
.hdpz-tab__name { font-family: var(--hdpz-display); font-size: 1.2rem; font-weight: 700; line-height: 1.15; }
.hdpz-tab__state { font-family: var(--hdpz-ui); font-size: .95rem; font-weight: 600; color: var(--hdpz-soft); }
.hdpz-tab[aria-selected=true] { background: var(--hdpz-deep); color: #fff; }
.hdpz-tab[aria-selected=true] .hdpz-tab__state { color: var(--hdpz-gold); }
.hdpz-tab[data-state=done]::after { content: "✓"; position: absolute; top: 9px; right: 14px; display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--hdpz-gold); border-radius: 50%; color: var(--hdpz-gold); font: 700 14px/1 var(--hdpz-ui); transform: rotate(-12deg); }
.hdpz-tab[data-state=done]:not([aria-selected=true])::after { border-color: var(--hdpz-accent); color: var(--hdpz-accent); }
.hdpz-tab:focus-visible { outline: 3px solid var(--hdpz-accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- the bar above a board */
.hdpz-bar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; margin: 0 0 .75rem; padding: 0 0 .75rem; border-bottom: 1px solid var(--hdpz-line); font-family: var(--hdpz-ui); }
.hdpz-bar__l, .hdpz-bar__r { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.hdpz-bar__l { flex: 1 1 auto; }
.hdpz-when { margin: 0; font-family: var(--hdpz-display); font-size: 1.35rem; }
.hdpz-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--hdpz-fog); }
.hdpz-seg button { height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: none; font-weight: 700; font-size: 1rem; }
.hdpz-seg button[aria-pressed=true] { background: var(--hdpz-paper); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.hdpz-timer { min-width: 3.5em; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--hdpz-soft); }
.hdpz-tools { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.hdpz-btn { display: inline-flex; gap: 6px; align-items: center; height: 38px; padding: 0 13px; border: 1px solid var(--hdpz-line); border-radius: 999px; background: var(--hdpz-paper); font-family: var(--hdpz-ui); font-size: 1rem; font-weight: 600; transition: border-color .2s, background .2s; list-style: none; }
.hdpz-btn:hover { border-color: var(--hdpz-accent); }
.hdpz-btn[aria-pressed=true] { border-color: var(--hdpz-accent); background: var(--hdpz-accent); color: #fff; }
.hdpz-btn--icon { width: 38px; padding: 0; justify-content: center; }
.hdpz-btn--icon span { display: none; }
.hdpz-menu { position: relative; margin: 0; padding: 0; border: 0; }
.hdpz-menu > summary { margin: 0; }
.hdpz-menu summary::-webkit-details-marker { display: none; }
.hdpz-menu > div { position: absolute; right: 0; top: 44px; z-index: 20; display: grid; min-width: 190px; padding: 6px; border-radius: 12px; background: var(--hdpz-paper); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .4), 0 0 0 1px var(--hdpz-line); }
.hdpz-menu > div button { padding: 9px 12px; border: 0; border-radius: 8px; background: none; text-align: left; font-family: var(--hdpz-ui); font-weight: 600; }
.hdpz-menu > div button:hover { background: var(--hdpz-fog); }
.hdpz-reset span { display: none; }
@media (min-width: 900px) { .hdpz-reset span { display: inline; } }
.hdpz-say { min-height: 1.6em; margin: 0 0 .6rem; font-family: var(--hdpz-ui); font-size: 1.05rem; font-weight: 600; color: var(--hdpz-accent); opacity: 0; transition: opacity .3s; }
.hdpz-say.is-on { opacity: 1; }
.hdpz-msg { padding: 2rem; text-align: center; color: var(--hdpz-soft); }
.hdpz-key { position: absolute; z-index: 0; opacity: 0; border: 0; padding: 0; margin: 0; font-size: 16px; caret-color: transparent; background: transparent; color: transparent; pointer-events: none; }
.hdpz-theme { margin: 0 0 .75rem; font-family: var(--hdpz-display); font-size: 1.25rem; font-weight: 700; }
.hdpz-theme::before { content: "Theme "; font-family: var(--hdpz-ui); font-size: .95rem; font-weight: 600; color: var(--hdpz-soft); }

/* ---------------------------------------------------------------- crossword */
.hdpz-cw { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 860px) { .hdpz-cw { grid-template-columns: 1fr; } }
.hdpz-clue { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; min-height: 58px; margin: 0 0 10px; border-radius: 8px; background: var(--hdpz-pale); }
.hdpz-clue p { margin: 0; padding: 8px 4px; font-family: var(--hdpz-text); font-size: 1.15rem; line-height: 1.3; }
.hdpz-clue b { margin-right: .35em; font-family: var(--hdpz-ui); }
.hdpz-clue__nav { display: grid; place-items: center; height: 100%; border: 0; background: none; }
.hdpz-cw__grid { position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); max-width: 560px; border: 2px solid var(--hdpz-ink); background: var(--hdpz-ink); gap: 1px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.hdpz-cell { position: relative; aspect-ratio: 1; background: var(--hdpz-paper); cursor: pointer; transition: background .15s; }
.hdpz-cell.is-block { background: var(--hdpz-ink); cursor: default; }
.hdpz-cell small { position: absolute; top: 3px; left: 4px; font: 600 clamp(9px, 1.6vw, 13px)/1 var(--hdpz-ui); color: var(--hdpz-soft); }
.hdpz-cell b { position: absolute; inset: 0; display: grid; place-items: center; padding-top: 10%; font-family: var(--hdpz-ui); font-size: clamp(20px, calc(48vw / var(--n)), 44px); font-weight: 700; line-height: 1; }
.hdpz-cell.is-word { background: var(--hdpz-pale); }
.hdpz-cell.is-cur { background: var(--hdpz-gold); }
.hdpz-cell.is-wrong b { color: var(--hdpz-bad); }
.hdpz-cell.is-wrong::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top right, transparent 47%, var(--hdpz-bad) 48%, var(--hdpz-bad) 52%, transparent 53%); opacity: .55; pointer-events: none; }
.hdpz-cell.is-revealed b { color: var(--hdpz-accent); }
.hdpz-cell.is-revealed::before { content: ""; position: absolute; right: 0; top: 0; border: 7px solid transparent; border-top-color: var(--hdpz-accent); border-right-color: var(--hdpz-accent); }
.hdpz-cw__lists { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 520px) { .hdpz-cw__lists { grid-template-columns: 1fr; } }
.hdpz-cw__lists h3 { margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--hdpz-line); font-family: var(--hdpz-ui); font-size: 1.15rem; }
.hdpz-cw__lists ol { max-height: 520px; margin: 0; padding: 0; list-style: none; overflow: auto; }
.hdpz-cw__lists li { display: grid; grid-template-columns: 2.1em 1fr; gap: 2px; padding: 6px 8px; border-left: 4px solid transparent; border-radius: 0 6px 6px 0; font-family: var(--hdpz-text); font-size: 1.02rem; line-height: 1.35; cursor: pointer; transition: background .15s; }
.hdpz-cw__lists li b { font-family: var(--hdpz-ui); }
.hdpz-cw__lists li:hover { background: var(--hdpz-fog); }
.hdpz-cw__lists li.is-on { border-left-color: var(--hdpz-accent); background: var(--hdpz-pale); }
.hdpz-cw__lists li.is-cross { border-left-color: var(--hdpz-pale); }
.hdpz-cw__lists li.is-done span { color: var(--hdpz-faint); }

/* ---------------------------------------------------------------- sudoku */
.hdpz-sd { display: grid; grid-template-columns: minmax(0, 540px) minmax(220px, 300px); gap: 28px; align-items: start; }
@media (max-width: 820px) { .hdpz-sd { grid-template-columns: 1fr; } }
.hdpz-sd__grid { position: relative; display: grid; grid-template-columns: repeat(9, 1fr); max-width: 540px; border: 3px solid var(--hdpz-ink); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.hdpz-sq { position: relative; display: grid; place-items: center; aspect-ratio: 1; border-right: 1px solid var(--hdpz-line); border-bottom: 1px solid var(--hdpz-line); background: var(--hdpz-paper); font-family: var(--hdpz-ui); font-size: clamp(20px, 5vw, 32px); cursor: pointer; }
.hdpz-sq:nth-child(9n) { border-right: 0; }
.hdpz-sq:nth-child(3n):not(:nth-child(9n)) { border-right: 2px solid var(--hdpz-ink); }
.hdpz-sq:nth-child(n+19):nth-child(-n+27), .hdpz-sq:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--hdpz-ink); }
.hdpz-sq:nth-child(n+73) { border-bottom: 0; }
.hdpz-sq b { font-weight: 600; color: var(--hdpz-accent); }
.hdpz-sq.is-given b { color: var(--hdpz-ink); font-weight: 700; }
.hdpz-sq.is-peer { background: var(--hdpz-fog); }
.hdpz-sq.is-same { background: var(--hdpz-pale); }
.hdpz-sq.is-cur { background: var(--hdpz-gold); }
.hdpz-sq.is-clash b, .hdpz-sq.is-wrong b { color: var(--hdpz-bad); }
.hdpz-sq.is-wrong { box-shadow: inset 0 0 0 2px var(--hdpz-bad); }
.hdpz-notes { position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(3, 1fr); font-style: normal; font-size: clamp(8px, 1.5vw, 12px); line-height: 1; color: var(--hdpz-soft); }
.hdpz-notes span { display: grid; place-items: center; }
.hdpz-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 820px) { .hdpz-pad { grid-template-columns: repeat(9, 1fr); gap: 4px; } }
.hdpz-pad__n { position: relative; aspect-ratio: 1.15; border: 1px solid var(--hdpz-line); border-radius: 10px; background: var(--hdpz-paper); font-family: var(--hdpz-ui); font-size: clamp(20px, 4vw, 28px); font-weight: 700; transition: background .15s, transform .15s; }
.hdpz-pad__n:hover { background: var(--hdpz-fog); }
.hdpz-pad__n:active { transform: scale(.95); }
.hdpz-pad__n:disabled { opacity: .3; cursor: default; }
.hdpz-pad__n small { position: absolute; right: 6px; bottom: 4px; font-size: 11px; font-weight: 600; color: var(--hdpz-faint); }
.hdpz-pad__tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* ---------------------------------------------------------------- word search */
.hdpz-ws { display: grid; grid-template-columns: minmax(0, 600px) minmax(200px, 1fr); gap: 28px; align-items: start; }
@media (max-width: 820px) { .hdpz-ws { grid-template-columns: 1fr; } }
.hdpz-ws__board { position: relative; max-width: 600px; }
.hdpz-ws__grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); user-select: none; -webkit-user-select: none; touch-action: none; }
.hdpz-lt { display: grid; place-items: center; aspect-ratio: 1; font-family: var(--hdpz-ui); font-size: clamp(14px, calc(62vw / var(--n)), 30px); font-weight: 700; cursor: pointer; }
.hdpz-lt.is-hint { animation: hdpz-flash .55s ease-in-out 4; border-radius: 50%; }
@keyframes hdpz-flash { 50% { background: var(--hdpz-gold); } }
.hdpz .hdpz-ws__marks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.hdpz-ws__marks line { stroke-width: .74; stroke-linecap: round; }
.hdpz-ws__marks .is-drag { stroke: var(--hdpz-gold); opacity: .55; }
.hdpz-ws__marks .is-found { stroke: hsl(var(--hue, 180) 45% 62%); opacity: .42; }
.hdpz-ws__words { columns: 2; gap: 16px; margin: 0; padding: 0; list-style: none; font-family: var(--hdpz-ui); font-size: 1.1rem; font-weight: 600; }
.hdpz-ws__words li { padding: 3px 0; break-inside: avoid; transition: color .3s; }
.hdpz-ws__words li.is-found { color: var(--hdpz-faint); text-decoration: line-through; text-decoration-thickness: 2px; }
.hdpz-ws__count { margin: .8rem 0 0; font-family: var(--hdpz-ui); color: var(--hdpz-soft); }

/* ---------------------------------------------------------------- cryptoquote */
.hdpz-cq { max-width: 980px; }
.hdpz-cq__text { position: relative; display: flex; flex-wrap: wrap; gap: 18px 22px; padding: 6px 0 10px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.hdpz-cq__w { display: inline-flex; gap: 4px; align-items: flex-end; }
.hdpz-cq__s { display: grid; justify-items: center; gap: 3px; width: clamp(24px, 4.2vw, 38px); cursor: pointer; }
.hdpz-cq__s b { display: grid; place-items: center; width: 100%; height: clamp(30px, 5vw, 44px); border-bottom: 2px solid var(--hdpz-ink); font-family: var(--hdpz-ui); font-size: clamp(18px, 3.4vw, 28px); line-height: 1; transition: background .15s; }
.hdpz-cq__s small { font-family: var(--hdpz-ui); font-size: clamp(12px, 2vw, 15px); font-weight: 600; color: var(--hdpz-soft); }
.hdpz-cq__s.is-same b { background: var(--hdpz-pale); }
.hdpz-cq__s.is-cur b { background: var(--hdpz-gold); }
.hdpz-cq__s.is-given b { color: var(--hdpz-accent); }
.hdpz-cq__s.is-wrong b { color: var(--hdpz-bad); border-bottom-color: var(--hdpz-bad); }
.hdpz-cq__p { align-self: flex-end; padding-bottom: 22px; font-family: var(--hdpz-ui); font-size: clamp(18px, 3.4vw, 28px); }
.hdpz-cq__by { margin: .5rem 0 0; font-family: var(--hdpz-display); font-size: 1.3rem; font-style: italic; }

/* ---------------------------------------------------------------- scramble */
.hdpz-sc { max-width: 760px; }
.hdpz-sc__list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: sc; }
.hdpz-sc__row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--hdpz-fog); counter-increment: sc; }
@media (max-width: 600px) { .hdpz-sc__row { grid-template-columns: 1fr auto; } .hdpz-sc__row label { grid-column: 1 / -1; grid-row: 2; } .hdpz-sc__row input { width: 100%; } }
.hdpz-tiles { display: flex; flex-wrap: wrap; gap: 5px; perspective: 400px; }
.hdpz-tiles span { display: grid; place-items: center; width: clamp(30px, 6vw, 40px); aspect-ratio: 1; border-radius: 7px; background: var(--hdpz-paper); box-shadow: 0 2px 0 var(--hdpz-line), 0 0 0 1px var(--hdpz-line); font-family: var(--hdpz-ui); font-size: clamp(18px, 3.4vw, 24px); font-weight: 700; }
.hdpz-sc__row input { width: calc(var(--len) * 1.6rem + 32px); max-width: 100%; min-width: 140px; height: 46px; padding: 0 14px; border: 2px solid var(--hdpz-line); border-radius: 10px; background: var(--hdpz-paper); font-family: var(--hdpz-ui); font-size: 1.4rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--hdpz-ink); }
.hdpz-sc__row input:focus { outline: 0; border-color: var(--hdpz-accent); }
.hdpz-sc__row.is-wrong input { border-color: var(--hdpz-bad); animation: hdpz-shake .35s; }
@keyframes hdpz-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.hdpz-sc__row.is-done { background: var(--hdpz-pale); }
.hdpz-sc__row.is-done .hdpz-tiles span { background: var(--hdpz-deep); color: var(--hdpz-gold); box-shadow: none; }
.hdpz-sc__row.is-done input { border-color: transparent; background: none; color: var(--hdpz-deep); }
.hdpz-sc__row.is-done button { visibility: hidden; }

/* ---------------------------------------------------------------- after solving */
.hdpz-after { margin: 1.5rem 0 0; padding: 22px 24px; border-radius: 12px; background: var(--hdpz-deep); color: #fff; }
.hdpz-after__head { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: baseline; }
.hdpz-after__big { margin: 0; font-family: var(--hdpz-display); font-size: 2rem; }
.hdpz-after__big span { margin-left: .4em; font-family: var(--hdpz-ui); font-size: 1.2rem; color: var(--hdpz-gold); }
.hdpz-after__streak { margin: 0; font-family: var(--hdpz-ui); font-weight: 700; color: var(--hdpz-gold); }
.hdpz-after__go { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 6px; }
.hdpz-go { height: 46px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--hdpz-gold); color: var(--hdpz-deep) !important; font-family: var(--hdpz-ui) !important; font-size: 1.1rem !important; font-weight: 700; transition: transform .2s var(--e); }
.hdpz-go:hover { transform: translateY(-2px); }
.hdpz-go--alt { background: rgba(255, 255, 255, .12); color: #fff !important; }
.hdpz-after__past { margin-top: 12px; }
.hdpz-after__past p { margin: 0 0 6px; font-family: var(--hdpz-ui); font-weight: 600; color: rgba(255, 255, 255, .7); }
.hdpz-after__past div { display: flex; flex-wrap: wrap; gap: 6px; }
.hdpz-after__past button { height: 32px; padding: 0 11px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; background: none; color: #fff; font-family: var(--hdpz-ui); font-size: .95rem; }
.hdpz-after__past button.is-done { border-color: var(--hdpz-gold); color: var(--hdpz-gold); }

@media (prefers-reduced-motion: reduce) { .hdpz * { transition-duration: .01ms !important; animation-duration: .01ms !important; } }
.hdpz-head > div > .hdpz-date:first-child { margin: 0; font-family: var(--hdpz-display); font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; color: var(--hdpz-ink); }
