/* extinction.meme · the cookie policy (pairs with cookies.js). CSP-clean: no inline styles in the css or the markup, no external requests,
   nothing but emoji and one inline-SVG cookie for art. Everything is prefixed ck-. The base style of every element is its visible,
   finished, STILL state; the squish, floating +1, falling cookies, sliding headline and toast slide only exist inside the
   `no-preference` block at the bottom, and never in calm mode (html[data-calm]). A parody of Cookie Clicker's look (brown wood, a
   starry bakery panel, a news strip, a store of dark rows); not affiliated. */

/* ---------- colours: a bakery in both themes (light = warm wood, dark = night bakery); the accent colours come from the site ---------- */
dialog.dlg.ck-dlg {
  --ck-wood1: #b9794a; --ck-wood2: #8a552f; --ck-wood-line: #3f2212; --ck-deep: #3b2217; --ck-deeper: #26140c;
  --ck-row1: #55341f; --ck-row2: #432719; --ck-row-line: #1f110a; --ck-text: #fff4e4; --ck-dim: #e6cbb0; --ck-key: #ecd7c1;
  --ck-ok: #a6f5ad; --ck-ok-bg: #1f5a2c; --ck-ok-line: #3a9a4c; --ck-none: #dbc6b0; --ck-none-bg: #2d1b12;
  --ck-milk: #f6efe4; --ck-gold: #ffd95a; --ck-ink: #2b1020; --ck-danger: #b8332a; --ck-danger-line: #3a0f0b; --ck-news: #1a0d08;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) dialog.dlg.ck-dlg {
    --ck-wood1: #603d26; --ck-wood2: #452b1a; --ck-wood-line: #0f0805; --ck-deep: #251610; --ck-deeper: #160e09;
    --ck-row1: #36211a; --ck-row2: #2b1912; --ck-row-line: #0c0604; --ck-news: #0d0705; --ck-danger: #c4361b; --ck-milk: #cdc4b6;
  }
}
:root[data-theme="dark"] dialog.dlg.ck-dlg {
  --ck-wood1: #603d26; --ck-wood2: #452b1a; --ck-wood-line: #0f0805; --ck-deep: #251610; --ck-deeper: #160e09;
  --ck-row1: #36211a; --ck-row2: #2b1912; --ck-row-line: #0c0604; --ck-news: #0d0705; --ck-danger: #c4361b; --ck-milk: #cdc4b6;
}

/* ---------- the box ---------- */
dialog.dlg.ck-dlg {
  width: min(1080px, calc(100vw - 20px)); height: min(840px, calc(100dvh - 20px)); max-height: calc(100dvh - 20px); padding: 0; overflow: hidden;
  background: var(--ck-deeper); color: var(--ck-text); border: 3px solid var(--line); border-radius: 22px; box-shadow: 9px 9px 0 var(--shade);
  font-family: var(--body, "Comic Sans MS", "Trebuchet MS", sans-serif);
}
dialog.dlg.ck-dlg::backdrop { background: rgba(20, 8, 4, .66); }
.ck-dlg h2, .ck-dlg h3, .ck-dlg h4, .ck-dlg p, .ck-dlg ul { margin: 0; padding: 0; }
.ck-dlg ul { list-style: none; }
.ck-dlg a { color: var(--ck-gold); }
.ck-dlg a:hover { color: #fff; }
.ck-dlg :focus-visible { outline: 3px dashed var(--ck-gold); outline-offset: 3px; }
.ck-dlg [hidden] { display: none !important; }
.ck-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.ck-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.ck {
  position: relative; display: grid; height: 100%; min-height: 0;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "head head" "news news" "bake store" "foot foot";
}
.ck { text-align: left; }
.ck[inert] { opacity: .35; }

/* ---------- head: the wooden bar with the bakery's name ---------- */
.ck-head {
  grid-area: head; display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 18px;
  background: linear-gradient(var(--ck-wood1), var(--ck-wood2)); border-bottom: 3px solid var(--ck-wood-line);
}
.ck-titles { min-width: 0; margin-right: auto; }
dialog.dlg.ck-dlg .ck-title {
  margin: 0; font: 400 clamp(24px, 4.2vw, 34px)/1.05 var(--display, "Arial Black", "Trebuchet MS", sans-serif); letter-spacing: .01em; color: #fff;
  -webkit-text-stroke: 2px #3a1d0e; paint-order: stroke fill; text-shadow: 2px 3px 0 rgba(0, 0, 0, .35); overflow-wrap: anywhere;
}
dialog.dlg.ck-dlg .ck-title:focus { outline: none; }
.ck-subtitle { margin-top: 2px; font-weight: 700; font-size: 15px; color: #ffe9cc; text-shadow: 1px 1px 0 rgba(0, 0, 0, .45); }
.ck-x { color: var(--ink); }

/* ---------- the news strip ---------- */
.ck-news { grid-area: news; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 12px; background: var(--ck-news); border-bottom: 3px solid var(--ck-wood-line); }
.ck-news-tag {
  flex: none; padding: 1px 10px; border-radius: 999px; background: var(--ck-gold); color: var(--ck-ink); font: 700 13px/1.5 var(--body, sans-serif);
  text-transform: uppercase; letter-spacing: .08em;
}
.ck-news-btn {
  flex: 1; min-width: 0; min-height: 30px; padding: 2px 4px; border: 0; background: none; color: var(--ck-dim); font: italic 700 15px/1.3 var(--body, sans-serif);
  text-align: left; cursor: pointer; overflow: hidden;
}
.ck-news-btn:hover { color: #fff; }
.ck-news-text { display: block; overflow-wrap: anywhere; }

/* ---------- the bakery: counter + the cookie ---------- */
.ck-bake {
  --ck-pad: 14px; grid-area: bake; position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0; padding: var(--ck-pad) var(--ck-pad) 0;
  overflow: hidden auto; text-align: center; border-right: 3px solid var(--ck-wood-line);
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 214, 150, .24), transparent 62%),
    radial-gradient(rgba(255, 255, 255, .5) 1px, transparent 1.7px) 0 0 / 46px 46px,
    radial-gradient(rgba(255, 255, 255, .32) 1px, transparent 1.5px) 23px 23px / 46px 46px,
    linear-gradient(var(--ck-wood2), var(--ck-deep));
}
.ck-bake::after { /* the milk at the end of the panel (in the flow, so a scrolling panel scrolls past it instead of being covered) */
  content: ""; flex: none; align-self: stretch; height: 36px; margin: auto calc(var(--ck-pad) * -1) 0; padding-top: 0; min-height: 36px; position: relative; z-index: 1;
  background:
    radial-gradient(circle at 20px 20px, var(--ck-milk) 17px, transparent 18px) 0 0 / 40px 40px repeat-x,
    linear-gradient(var(--ck-milk), var(--ck-milk)) 0 100% / 100% 18px no-repeat;
}
.ck-bake > * { position: relative; z-index: 1; }
.ck-bake > .ck-rain { position: absolute; z-index: 0; inset: 0; overflow: hidden; pointer-events: none; }
.ck-bake > .ck-sr { position: absolute; }
.ck-count { width: 100%; padding: 8px 14px 8px; border: 2px solid rgba(0, 0, 0, .55); border-radius: 14px; background: rgba(0, 0, 0, .5); }
.ck-big { font-family: var(--display, "Arial Black", sans-serif); line-height: 1.05; color: #fff; text-shadow: 2px 3px 0 rgba(0, 0, 0, .55); }
.ck-big b { font-weight: 400; font-size: clamp(38px, 7vw, 52px); font-variant-numeric: tabular-nums; }
.ck-big span { margin-left: .12em; font-size: clamp(22px, 4vw, 28px); }
.ck-per { margin-top: 2px; font-weight: 700; font-size: 15px; color: var(--ck-dim); }
.ck-honest { margin-top: 3px; font-size: 13.5px; line-height: 1.3; color: var(--ck-dim); text-wrap: balance; }

.ck-cookie {
  flex: none; display: grid; place-items: center; width: min(250px, 62vw); aspect-ratio: 1; margin: 4px 0 2px; padding: 0; border: 0; border-radius: 50%;
  background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.ck-cookie:focus-visible { outline: 4px dashed var(--ck-gold); outline-offset: 4px; }
.ck-art { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 7px 0 rgba(0, 0, 0, .38)); transform-origin: 50% 55%; }
.ck-score { min-height: 1.4em; font-weight: 700; font-size: 16.5px; line-height: 1.3; color: #fff; text-shadow: 1px 2px 0 rgba(0, 0, 0, .6); overflow-wrap: anywhere; text-wrap: balance; }
.ck-achs { display: flex; gap: 8px; justify-content: center; }
.ck-ach {
  display: grid; justify-items: center; min-width: 58px; padding: 4px 6px 3px; border: 2px solid var(--ck-row-line); border-radius: 10px;
  background: linear-gradient(var(--ck-row2), var(--ck-deeper)); color: var(--ck-none); line-height: 1.1;
}
.ck-ach-ico { font-size: 22px; filter: grayscale(1) brightness(.62); }
.ck-ach-tag { font-weight: 700; font-size: 13px; }
.ck-ach.is-on { border-color: var(--ck-gold); background: linear-gradient(#6d4a22, #3f2a12); color: var(--ck-gold); }
.ck-ach.is-on .ck-ach-ico { filter: none; }
.ck-jar { max-width: 32em; padding: 6px 10px; border-radius: 10px; background: rgba(0, 0, 0, .42); font-size: 13.5px; line-height: 1.3; color: var(--ck-dim); overflow-wrap: anywhere; text-wrap: balance; }

/* floating +1, falling mini cookies (only ever placed by the script when motion is allowed) */
.ck-plus {
  position: absolute; z-index: 3; transform: translate(-50%, -50%); font: 400 26px/1 var(--display, "Arial Black", sans-serif); color: #fff;
  -webkit-text-stroke: 2px #3a1d0e; paint-order: stroke fill; pointer-events: none;
}
.ck-mini { position: absolute; top: -40px; display: block; opacity: .9; pointer-events: none; }

/* ---------- the store ---------- */
.ck-store { grid-area: store; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--ck-deeper); }
.ck-store-head { padding: 10px 14px 8px; background: linear-gradient(var(--ck-deep), var(--ck-deeper)); border-bottom: 3px solid var(--ck-wood-line); }
dialog.dlg.ck-dlg .ck-store-head h3 { margin: 0; font: 400 26px/1 var(--display, "Arial Black", sans-serif); letter-spacing: .02em; color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, .5); }
.ck-store-head p { margin-top: 4px; font-size: 14.5px; line-height: 1.3; color: var(--ck-dim); }
.ck-rows { flex: 1; min-height: 0; padding: 10px; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: var(--ck-wood2) var(--ck-deeper); }
.ck-row {
  display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; margin: 0 0 7px; padding: 10px 12px;
  border: 2px solid var(--ck-row-line); border-radius: 12px; background: linear-gradient(var(--ck-row1), var(--ck-row2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
}
.ck-row.is-have { border-left: 6px solid var(--ck-ok-line); }
.ck-row.is-leaves { border-color: #8a6a18; }
.ck-row.is-leaves.is-have { border-left-color: var(--ck-gold); }
.ck-ico {
  display: grid; place-items: center; width: 54px; height: 54px; border: 2px solid var(--ck-row-line); border-radius: 12px; font-size: 29px; line-height: 1;
  background: radial-gradient(circle at 38% 30%, #7a4f36, #3b2218);
}
.ck-row.is-none .ck-ico { filter: grayscale(.9) brightness(.82); }
.ck-info { min-width: 0; }
.ck-name { font: 700 18px/1.2 var(--body, sans-serif); color: #fff; }
.ck-what { margin-top: 2px; font-size: 15px; line-height: 1.35; color: var(--ck-dim); overflow-wrap: anywhere; }
.ck-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 5px; }
.ck-tag { font-weight: 700; font-size: 13.5px; line-height: 1.35; color: var(--ck-none); }
.ck-tag.is-warn { color: var(--ck-gold); }
.ck-keys { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 5px; }
.ck-key {
  padding: 0 7px; border: 1px solid #6a4630; border-radius: 6px; background: #1b0f0a; color: var(--ck-none); font: 12.5px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere;
}
.ck-key code { font: inherit; }
.ck-key::before { content: "– "; }
.ck-key.is-on { border-color: var(--ck-ok-line); color: var(--ck-ok); }
.ck-key.is-on::before { content: "✓ "; }
.ck-note { margin-top: 5px; font-size: 13.5px; line-height: 1.3; color: var(--ck-gold); }
.ck-side { display: grid; justify-items: end; align-content: start; gap: 6px; }
.ck-owned {
  padding: 2px 11px; border: 2px solid var(--ck-row-line); border-radius: 999px; background: var(--ck-none-bg); color: var(--ck-none); font-weight: 700; font-size: 13.5px; line-height: 1.5; white-space: nowrap;
}
.ck-row.is-have .ck-owned { border-color: var(--ck-ok-line); background: var(--ck-ok-bg); color: var(--ck-ok); }
.ck-del {
  min-height: 32px; padding: 3px 12px; border: 2px solid var(--ck-danger-line); border-radius: 9px; background: #6c2b24; color: #ffe6e2; font: 700 14px/1.3 var(--body, sans-serif); cursor: pointer;
}
.ck-del:hover { background: #8a3228; color: #fff; }
.ck-del:active { transform: translateY(1px); }

/* ---------- the foot ---------- */
.ck-foot { grid-area: foot; display: grid; text-align: left; gap: 8px; padding: 10px 16px 12px; border-top: 3px solid var(--ck-wood-line); background: linear-gradient(var(--ck-deep), var(--ck-deeper)); }
.ck-plain { text-align: center; font-weight: 700; font-size: 15.5px; line-height: 1.4; color: #fff; text-wrap: pretty; }
.ck-more[open] { max-height: min(210px, 26dvh); overflow-y: auto; overscroll-behavior: contain; padding-right: 6px; }
.ck-more summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--ck-dim); }
.ck-more summary:hover { color: #fff; }
.ck-more p { margin-top: 6px; font-size: 14px; line-height: 1.4; color: var(--ck-dim); max-width: 70ch; }
.ck-more .ck-parody { font-size: 12.5px; opacity: .9; }
.ck-live { min-height: 0; font-weight: 700; font-size: 14.5px; line-height: 1.3; color: var(--ck-gold); }
.ck-live:empty { display: none; }
.ck-foot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.ck-foot-row .ck-more { flex: 1 1 340px; min-width: 0; }
.ck-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-left: auto; }
.ck-btn {
  min-height: 44px; padding: 8px 18px; border: 3px solid var(--ck-row-line); border-radius: 13px; font: 700 16.5px/1.2 var(--body, sans-serif); cursor: pointer; box-shadow: 0 4px 0 var(--ck-row-line);
}
.ck-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--ck-row-line); }
.ck-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ck-row-line); }
.ck-btn.is-go { background: var(--ck-gold); color: var(--ck-ink); }
.ck-btn.is-danger { background: var(--ck-danger); border-color: var(--ck-danger-line); color: #fff; box-shadow: 0 4px 0 var(--ck-danger-line); }

/* ---------- are you sure ---------- */
.ck-confirm { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 14px; background: rgba(12, 5, 2, .78); overflow: auto; }
.ck-confirm-card {
  width: min(480px, 100%); padding: 18px 18px 16px; border: 4px solid var(--ck-gold); border-radius: 18px; background: var(--ck-deep); color: var(--ck-text); box-shadow: 0 0 0 4px #000, 7px 7px 0 4px var(--ck-danger);
}
dialog.dlg.ck-dlg .ck-confirm-card h3 { margin: 0; font: 400 clamp(22px, 5vw, 28px)/1.1 var(--display, "Arial Black", sans-serif); color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, .5); }
.ck-c-body { display: grid; gap: 8px; margin: 10px 0 12px; font-size: 15.5px; line-height: 1.4; color: var(--ck-dim); }
.ck-c-warn { padding: 7px 10px; border: 2px dashed #8a6a18; border-radius: 10px; color: var(--ck-text); }
.ck-c-warn.is-hot { border: 3px solid var(--ck-danger); background: rgba(196, 54, 27, .28); font-weight: 700; color: #fff; }

/* ---------- achievement toasts ---------- */
.ck-toasts { position: absolute; z-index: 5; top: 70px; right: 14px; display: grid; gap: 8px; width: min(340px, calc(100% - 28px)); pointer-events: none; }
.ck-toast {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 3px solid var(--ck-gold); border-radius: 14px; background: #2a1a0c; color: #fff; box-shadow: 0 0 0 3px #000, 4px 4px 0 3px rgba(0, 0, 0, .4);
}
.ck-toast-ico { flex: none; font-size: 30px; line-height: 1; }
.ck-toast-tx { min-width: 0; line-height: 1.25; }
.ck-toast-tx b { display: block; font-size: 15px; color: var(--ck-gold); overflow-wrap: anywhere; }
.ck-toast-tx small { display: block; font-size: 13.5px; font-style: italic; color: var(--ck-dim); }

/* ---------- short windows: keep two columns, but the whole box scrolls instead of each panel ---------- */
@media (max-height: 800px) {
  .ck-cookie { width: min(205px, 62vw); }
  .ck-big b { font-size: 40px; }
}
@media (max-height: 740px) {
  dialog.dlg.ck-dlg { height: auto; overflow-y: auto; overscroll-behavior: contain; }
  .ck { height: auto; grid-template-rows: auto auto auto auto; }
  .ck-head { position: sticky; top: 0; z-index: 4; }
  .ck-bake { overflow: hidden; }
  .ck-rows { overflow: visible; }
  .ck-more[open] { max-height: none; overflow: visible; }
  .ck-toasts { position: fixed; top: auto; bottom: 12px; right: 50%; transform: translateX(50%); }
  .ck-confirm { position: fixed; }
}
/* ---------- phones: one column, the whole box scrolls ---------- */
@media (max-width: 820px) {
  dialog.dlg.ck-dlg { height: auto; overflow-y: auto; overscroll-behavior: contain; }
  .ck { display: block; height: auto; }
  .ck-head { position: sticky; top: 0; z-index: 4; }
  .ck-bake { overflow: hidden; border-right: 0; border-bottom: 3px solid var(--ck-wood-line); }
  .ck-rows { overflow: visible; }
  .ck-more[open] { max-height: none; overflow: visible; }
  .ck-toasts { position: fixed; top: auto; bottom: 12px; right: 50%; transform: translateX(50%); }
  .ck-confirm { position: fixed; }
}
@media (max-width: 560px) {
  dialog.dlg.ck-dlg { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border-width: 0; border-radius: 0; box-shadow: none; }
  .ck-head { padding: 8px 10px 8px 12px; }
  .ck-subtitle { font-size: 13.5px; }
  .ck-cookie { width: min(210px, 58vw); }
  .ck-bake { --ck-pad: 10px; gap: 6px; }
  .ck-row { grid-template-columns: 44px minmax(0, 1fr); gap: 4px 10px; padding: 9px 10px; }
  .ck-ico { width: 44px; height: 44px; font-size: 24px; }
  .ck-side { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; }
  .ck-name { font-size: 17px; }
  .ck-what { font-size: 14.5px; }
  .ck-foot { padding: 10px 12px 14px; }
  .ck-btns { justify-content: stretch; width: 100%; }
  .ck-btn { flex: 1 1 100%; }
  .ck-store-head { padding: 10px 12px 8px; }
  .ck-rows { padding: 8px; }
}

/* ---------- motion: only when welcome (not prefers-reduced-motion, not calm mode) ---------- */
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-calm]) .ck-art { transition: transform .1s ease-out; }
  :root:not([data-calm]) .ck-cookie:hover .ck-art { transform: scale(1.04); }
  :root:not([data-calm]) .ck-cookie:active .ck-art { transform: scale(.92, .95); }
  :root:not([data-calm]) .ck-art.ck-squish { animation: ck-squish .26s cubic-bezier(.3, 1.6, .5, 1); }
  :root:not([data-calm]) .ck-plus { animation: ck-rise .95s ease-out forwards; }
  :root:not([data-calm]) .ck-mini { animation: ck-fall var(--t, 2s) cubic-bezier(.4, .1, .7, 1) forwards; }
  :root:not([data-calm]) .ck-news-text.ck-in { animation: ck-news .45s ease-out; }
  :root:not([data-calm]) .ck-toast { animation: ck-toast .5s cubic-bezier(.3, 1.5, .5, 1) backwards; }
  :root:not([data-calm]) .ck-row { transition: transform .12s; }
  :root:not([data-calm]) .ck-row:hover { transform: translateX(-2px); }
}
@keyframes ck-squish { 0% { transform: scale(1); } 28% { transform: scale(.88, .93); } 64% { transform: scale(1.06, 1.02); } 100% { transform: scale(1); } }
@keyframes ck-rise { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.8); } 100% { opacity: 0; transform: translate(-50%, -96px) scale(1.15); } }
@keyframes ck-fall { 0% { opacity: .95; transform: translateY(0) rotate(0); } 100% { opacity: .95; transform: translateY(var(--dy, 400px)) rotate(var(--r, 180deg)); } }
@keyframes ck-news { 0% { opacity: 0; transform: translateX(22px); } 100% { opacity: 1; transform: none; } }
@keyframes ck-toast { 0% { opacity: 0; transform: translateY(-18px) scale(.9); } 100% { opacity: 1; transform: none; } }
