/* ═══════════════════════════════════════════════════════════
   Azulo Daily — the page-specific layer on top of /styles.css
   ═══════════════════════════════════════════════════════════ */

:root {
  --grout: #cfc3ad;
  --plaster-hi: #f6f1e6;
  --plaster-lo: #e7dfcf;
  --gold: #d7a849;
}

/* ═══════════════════════ head ═══════════════════════ */

/* the harbour scene behind the puzzle; the cream fade at the top keeps the
   title readable against the sky and blends into the header */
.daily {
  padding-block: 4px clamp(28px, 4vw, 48px);
  background:
    linear-gradient(180deg, var(--cream) 0, rgba(241, 236, 225, .75) 90px, rgba(241, 236, 225, 0) 220px),
    url("/assets/daily/bg.webp") center 65% / cover no-repeat,
    var(--sky-low);
}
.daily__wrap { max-width: 1060px; }

.daily__head { text-align: center; }
.daily__kicker {
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--blue);
}
.daily__title {
  margin-top: 6px;
  font-size: clamp(26px, 3.6vw, 40px);
  font-weight: 600;
  line-height: 1.15;
}

/* ═══════════════════════ play area ═══════════════════════
   As in the game: the wall in the middle, the shelf of tiles under it, and
   a column on the side with the small mural preview, stats and tools. */

.play {
  /* wall + shelf width: keeps both on one laptop screen (board height is width × 5/9) */
  --stage-w: max(520px, calc((100svh - 380px) * 1.8));
  display: grid;
  grid-template-columns: minmax(0, var(--stage-w)) 188px;
  justify-content: center;
  gap: 18px;
  align-items: start;
  margin-top: clamp(16px, 2vw, 24px);
}
.stage { min-width: 0; }
.side {
  order: 2;
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--cream-lit);
  box-shadow: var(--shadow-card);
}

/* the small mural preview; tap to see it large over the wall */
.mural-box {
  display: grid;
  gap: 6px;
  padding: 8px 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--cream);
  text-align: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.mural-box:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(20, 49, 94, .16); }
.mural-box__label { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--blue); }
.mural-box__img { width: 100%; aspect-ratio: 9 / 5; border-radius: 4px; box-shadow: 0 2px 6px rgba(20, 49, 94, .18); }

.stats { display: grid; gap: 8px; margin: 0; }
.stats div { display: flex; justify-content: space-between; align-items: baseline; }
.stats dt { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.stats dd { margin: 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

.side__tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--cream-line);
  background: #fff;
  font-size: 14px;
  color: var(--ink);
  transition: border-color .15s ease, opacity .15s ease;
}
.tool svg { width: 18px; height: 18px; flex: none; }
.tool:hover:not(:disabled) { border-color: var(--blue); }
.tool:disabled { opacity: .4; cursor: default; }
.tool--icon { flex: none; padding: 9px; }
.tool__off { display: none; }
#soundBtn[aria-pressed="false"] .tool__on { display: none; }
#soundBtn[aria-pressed="false"] .tool__off { display: block; }
/* Undo and Sound on the first row, Start over across the second */
.tool--restart { flex-basis: 100%; }

/* ═══════════════════════ the wall ═══════════════════════
   A limewashed wall with the panel's empty slots set into it. Grout shows
   between tiles while you work and closes up once it's restored. */

.wall {
  position: relative;
  padding: clamp(8px, 2vw, 24px);
  border-radius: var(--radius) var(--radius) 0 0;
  background:
    radial-gradient(120% 90% at 30% 10%, var(--plaster-hi), transparent 60%),
    radial-gradient(90% 80% at 80% 100%, rgba(197, 180, 150, .35), transparent 70%),
    var(--plaster-lo);
  box-shadow: var(--shadow-card);
}

.wall__frame {
  position: relative;
  padding: clamp(3px, .5vw, 6px);
  border-radius: 6px;
  background: var(--grout);
  box-shadow:
    0 0 0 1px rgba(20, 49, 94, .10),
    0 1px 0 1px rgba(255, 255, 255, .6),
    inset 0 2px 6px rgba(60, 45, 20, .25);
}

.board {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: clamp(1.5px, .3vw, 3px);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: gap .9s ease;
}

.slot {
  position: relative;
  aspect-ratio: 1;
  border-radius: 2px;
}
.slot.is-empty {
  background: rgba(236, 228, 212, .9);
  box-shadow: inset 0 1px 3px rgba(60, 45, 20, .22);
}
.slot.is-target { box-shadow: inset 0 0 0 2px var(--blue), 0 0 0 1px var(--blue); z-index: 2; }
.slot:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; z-index: 3; }

/* ═══════════════════════ tiles ═══════════════════════ */

.tile, .tile-ghost {
  background-image: var(--mural);
  background-size: 900% 500%;
  background-repeat: no-repeat;
  border-radius: 3px;
}

.tile {
  --dx: 0px;
  --dy: 0px;
  --rot: 0deg;
  --lift: 1;
  position: relative;
  cursor: grab;
  transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(var(--lift));
  transition: transform .28s cubic-bezier(.3, .7, .3, 1), box-shadow .2s ease, border-radius .9s ease, opacity .15s ease;
  box-shadow: 0 1px 3px rgba(40, 30, 10, .3);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.slot > .tile { position: absolute; inset: 0; }
.tile:hover { box-shadow: 0 2px 8px rgba(20, 49, 94, .35); }
.tile:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* a thin glaze highlight so each tile reads as ceramic */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, .22), transparent 45%, rgba(0, 0, 0, .05));
  pointer-events: none;
  transition: opacity .9s ease;
}

.tile.is-lifted { opacity: .25; }
.tile.is-held { box-shadow: 0 0 0 3px var(--gold), 0 8px 18px rgba(20, 49, 94, .3); z-index: 5; }

/* the tile under the finger while dragging */
.tile-ghost {
  position: fixed;
  left: 0; top: 0;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 16px 30px rgba(20, 49, 94, .4);
}

/* right place, right way up: a light sweep across the tile */
.tile.is-glint::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 244, 205, .85) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: glint .7s ease-out forwards;
  pointer-events: none;
}
@keyframes glint {
  from { background-position: 120% 0; opacity: 1; }
  to   { background-position: -40% 0; opacity: 0; }
}

/* "Stuck?" points at a wrong tile */
.tile.is-clue { z-index: 4; animation: clue 1s ease-in-out 3; box-shadow: 0 0 0 3px var(--gold); }
@keyframes clue {
  50% { scale: 1.12; box-shadow: 0 0 0 4px var(--gold), 0 0 18px 4px rgba(215, 168, 73, .7); }
}

/* ═══════════════════════ the shelf ═══════════════════════ */

.shelf {
  --tray-tile: clamp(50px, 6vw, 66px);
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  padding: 10px 4px 14px;
  border-radius: 0 0 var(--radius) var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .18), transparent 30%),
    linear-gradient(180deg, #b48a5f, #9a7148);
  box-shadow: var(--shadow-card), inset 0 3px 0 rgba(255, 255, 255, .2), inset 0 -4px 0 rgba(60, 35, 10, .25);
}
.shelf[hidden] { display: none; }
.shelf.is-empty .tray::before {
  content: "Every tile is on the wall";
  margin: auto;
  font-size: 14px;
  color: rgba(255, 248, 235, .85);
}

.tray {
  display: flex;
  gap: 10px;
  min-height: calc(var(--tray-tile) + 12px);
  padding: 6px 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  touch-action: pan-x;
}
.tray::-webkit-scrollbar { display: none; }
.tray:focus-visible { outline: 2px solid #fff; outline-offset: -2px; border-radius: 8px; }
.tray > .tile {
  flex: none;
  width: var(--tray-tile);
  height: var(--tray-tile);
  box-shadow: 0 3px 6px rgba(40, 20, 5, .35);
}

.shelf__arrow {
  height: 100%;
  font-size: 28px;
  line-height: 1;
  color: rgba(255, 248, 235, .9);
}
.shelf__arrow:disabled { opacity: .25; cursor: default; }

/* sits on the empty shelf once every tile is on the wall */
.stuck {
  position: absolute;
  left: 50%; top: 50%;
  translate: -50% -50%;
  white-space: nowrap;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: #fff8e6;
  font-size: 14px;
  color: var(--ink);
  animation: pop .35s ease;
}
.stuck[hidden] { display: none; }
.shelf:has(.stuck:not([hidden])) .tray::before { content: none; }

/* the large mural over the wall, from the side box */
.wall__zoom {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: clamp(3px, .5vw, 6px);
  border-radius: 6px;
  background: var(--cream-lit);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 20;
}
.wall.is-zoomed .wall__zoom { opacity: 1; pointer-events: auto; cursor: zoom-out; }

/* loading */
.wall__loading {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
  color: var(--blue);
}
.wall__loading svg { width: 42px; height: 42px; animation: spin 2.4s linear infinite; }
.wall.is-loading .wall__loading { display: grid; }
.wall.is-loading .wall__frame { aspect-ratio: 9 / 5; }
@keyframes spin { to { transform: rotate(360deg); } }

.board__error { grid-column: 1 / -1; padding: 40px 16px; text-align: center; color: var(--ink-soft); }

/* restored: grout closes, glaze settles, one light sweep over the whole panel */
.wall.is-solved { border-radius: var(--radius); }
.wall.is-solved .board { gap: 0; }
.wall.is-solved .tile { border-radius: 0; box-shadow: none; cursor: default; }
.wall.is-solved .tile::after { opacity: 0; }
.wall.is-solved .wall__frame { background: #b9ab91; }

.wall.is-celebrating .wall__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 15;
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 240, 200, .75) 50%, transparent 65%);
  background-size: 300% 100%;
  animation: sweep 1.6s .5s ease-in-out both;
  pointer-events: none;
}
@keyframes sweep {
  from { background-position: 130% 0; }
  to   { background-position: -30% 0; }
}


/* ═══════════════════════ done bar ═══════════════════════ */

.done-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin-top: 18px;
  text-align: center;
  color: var(--ink-soft);
}
.done-bar[hidden] { display: none; }
.done-bar strong { color: var(--ink); }

.btn--small { padding: 11px 24px; font-size: 16px; gap: 10px; }
.btn--ghost {
  background: #fff;
  border: 1px solid var(--cream-line);
  color: var(--ink);
  transition: border-color .15s ease;
}
.btn--ghost:hover { border-color: var(--blue); }

/* ═══════════════════════ today's mural ═══════════════════════ */

.today { text-align: center; }
.today .rule { margin-inline: auto; }
.today__kicker { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--blue); }
.today__title { margin-top: 6px; font-size: clamp(24px, 3vw, 32px); font-weight: 600; }
.today__story { max-width: 640px; margin-inline: auto; color: var(--ink-soft); }

/* ═══════════════════════ get the game ═══════════════════════ */

.section--get { padding-block: clamp(16px, 2.4vw, 26px); }
.panel--get { grid-template-columns: auto minmax(0, 1fr); }
.get__copy { text-align: left; }
.get__copy .wordmark__sub { justify-content: flex-start; }
.get__badges { justify-content: flex-start; }

/* ═══════════════════════ how to play / about ═══════════════════════ */

.about { max-width: 820px; margin-inline: auto; color: var(--ink-soft); }
.about p + p { margin-top: 14px; }
.about__title {
  margin: 34px 0 14px;
  font-size: clamp(21px, 2.4vw, 26px);
  font-weight: 600;
  color: var(--ink);
}
.about__title:first-child { margin-top: 0; }

.howto { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.howto li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--cream);
}
.howto strong { color: var(--ink); }
.howto__num {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  flex: none;
  border-radius: 50%;
  background: var(--blue-deep);
  color: #fff;
  font-size: 14px;
}
.about__note { margin-top: 16px; font-size: 15px; }
kbd {
  padding: 1px 6px;
  border: 1px solid var(--cream-line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  font: 13px system-ui, sans-serif;
}

.faq dt { margin-top: 14px; font-weight: 600; color: var(--ink); }
.faq dd { margin: 4px 0 0; }
.faq a, .about__note a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }

/* ═══════════════════════ result modal ═══════════════════════ */

.result {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 30px clamp(20px, 5vw, 32px) 26px;
  border: 0;
  border-radius: 22px;
  background: var(--cream-lit);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 30px 80px rgba(10, 25, 50, .45);
  overflow-y: auto;
}
.result::backdrop { background: rgba(14, 30, 58, .55); backdrop-filter: blur(3px); }
.result[open] { animation: pop .35s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.96); } }

.result__close {
  position: absolute;
  top: 10px; right: 12px;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  color: var(--ink-soft);
}
.result__close:hover { background: var(--cream); }

.result__kicker { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--blue); }
.result__heading { margin-top: 4px; font-size: 28px; font-weight: 600; }

.result__art { margin-top: 16px; }
.result__art img { width: 100%; aspect-ratio: 9 / 5; border-radius: 8px; box-shadow: var(--shadow-card); }
.result__art figcaption { margin-top: 10px; font-size: 17px; font-weight: 600; }
.result__story { margin-top: 6px; font-size: 14px; line-height: 1.5; color: var(--ink-soft); }

.result__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 18px 0 0;
  padding: 12px 6px;
  border-radius: var(--radius-sm);
  background: var(--cream);
}
.result__stats dt { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.result__stats dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }

.result__tomorrow { margin-top: 18px; font-size: 15px; color: var(--ink-soft); }
.result__countdown { margin-top: 2px; }
.result__countdown strong { font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: .03em; }

.result__replays { margin-top: 10px; font-size: 14px; color: var(--ink-soft); }
.result__replays p + p { margin-top: 2px; }
.result__replays strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.result__note { font-size: 12.5px; }
.result__new { color: var(--gold); font-weight: 600; }

.result__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

.result__promo {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 6px 14px;
  align-items: center;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--cream-line);
  text-align: left;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-soft);
}
.result__promo strong { display: block; color: var(--ink); font-size: 15px; }
.result__icon { width: 56px; height: 56px; border-radius: 13px; box-shadow: var(--shadow-card); }
.result__badges { grid-column: 1 / -1; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.result__badges .badge__store { font-size: 15px; }

/* ═══════════════════════ small screens ═══════════════════════ */

@media (max-width: 1000px) {
  .panel--get { grid-template-columns: 1fr; }
  .get__copy { text-align: center; }
  .get__copy .wordmark__sub, .get__badges { justify-content: center; }
}

/* the side column becomes a strip above the wall */
@media (max-width: 760px) {
  .play { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .side {
    order: 0;
    grid-template-columns: 104px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
  }
  .mural-box { padding: 5px 5px 6px; gap: 3px; }
  .mural-box__label { font-size: 9px; }
  .stats { grid-template-columns: repeat(3, auto); justify-content: start; gap: 14px; }
  .stats div { display: grid; }
  .stats dt { font-size: 10px; }
  .stats dd { font-size: 16px; }
  .side__tools { display: grid; grid-template-columns: repeat(2, auto); gap: 6px; }
  .tool--restart { grid-column: 1 / -1; }
  .tool span { display: none; }
  .tool { padding: 8px; }
}

@media (max-width: 640px) {
  .daily__wrap { padding-inline: 8px; }
  .daily__head { padding-inline: 8px; }
  .shelf { --tray-tile: 52px; grid-template-columns: 22px minmax(0, 1fr) 22px; }
  .howto { grid-template-columns: 1fr; }
  .result__stats dd { font-size: 18px; }
}

/* the narrowest phones: room for the two-column tools beside the stats */
@media (max-width: 400px) {
  .side { grid-template-columns: 84px minmax(0, 1fr) auto; gap: 8px; }
  .stats { gap: 10px; }
}


/* ═══════════════════════ earlier days ═══════════════════════ */

.today-link { margin-top: 10px; font-size: 15px; }
.today-link[hidden], .result__tomorrow[hidden] { display: none; }
.today-link a, .result__tomorrow a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }

.archive { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 20px; }
.archive a { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--cream-line); color: var(--ink); }
.archive a:hover { color: var(--blue); }
.archive__no { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; min-width: 2.6em; }
.archive [aria-current] { font-weight: 600; }
