/* ohbabyblocks.com/daily: the board, the meter, the result card (on top of /style.css). */

:root {
  --cell: 64px;
  --cols: 6;
  --rows: 7;
  --case: #3a2a5c;
  --case-dark: #24183d;
  --mark-g: #70d86f;
  --mark-y: #ffe347;
  --mark-b: #4a4060;
}

body.daily { padding-bottom: 24px; }

.hero.compact { padding-top: 18px; }
.hero.compact .home { text-decoration: none; color: inherit; display: block; }
.hero.compact .logo { width: min(220px, 52%); }
.hero.compact .title { font-size: clamp(34px, 8vw, 56px); -webkit-text-stroke: 7px var(--outline); text-shadow: 0 4px 0 var(--outline), 0 8px 18px rgba(0, 0, 0, 0.5); }
.hero.compact h1 { margin-top: 10px; font-size: clamp(20px, 5vw, 28px); }
.hero.compact h1 span { color: var(--gold); }
.puzzle-title { margin: 2px 0 0; color: var(--hint); font-size: 15px; }

main.play { max-width: 520px; margin: 0 auto; display: grid; gap: 18px; }

/* ---- cards (the knit frame from the main page) ------------------------------------------------------------ */

.card {
  position: relative;
  border: 26px solid transparent;
  border-image: url("/img/frame_teal.webp") 42 fill / 26px / 0 round;
  min-width: 0;
}
.card.purple { border-image-source: url("/img/frame_purple.webp"); }
.card.gold { border-image-source: url("/img/frame_gold.webp"); }
.card::before {
  content: "";
  position: absolute;
  inset: -6px;
  background: var(--plate);
  border-radius: 14px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
  z-index: 0;
}
.card > * { position: relative; z-index: 1; }
.card h2 { font-size: 22px; color: var(--header); margin: 0 0 6px; }
.card p { margin: 4px 0; }

.brief { text-align: center; padding: 2px 6px; }
.goal { font-size: 17px; margin: 0; }
.goal b { color: var(--gold); }
.hint { font-size: 14px; }

/* ---- the stage ------------------------------------------------------------------------------------------- */

.stage { display: grid; justify-items: center; gap: 10px; }

.meter { display: flex; justify-content: space-between; width: 100%; max-width: 100%; padding: 0 4px; }
.meter .label { display: block; font: 400 11px "Bungee", sans-serif; color: var(--muted); letter-spacing: 0.1em; }
.swaps, .tries { font: 400 22px "Bungee", sans-serif; color: var(--gold); }
.tries { text-align: right; }
.tries .dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-left: 6px; background: var(--mark-b); vertical-align: middle; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5); }
.tries .dot.now { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.tries .dot.won { background: var(--mark-g); }
.tries .dot.lost { background: #e0564f; }

.board-wrap { width: 100%; display: grid; justify-items: center; }

/* the case: a knit-coloured slab with the dark well the panels sit in */
.board-case {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #4a3774, var(--case) 40%, var(--case-dark));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 2px 0 rgba(255, 255, 255, 0.12);
  border-image: url("/img/knit_button.webp") 40 fill / 18px / 0 round;
  border: 18px solid transparent;
}

.board-grid {
  position: relative;
  width: calc(var(--cell) * var(--cols));
  height: calc(var(--cell) * var(--rows));
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px var(--cell)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px var(--cell)),
    linear-gradient(180deg, #120b22, #1a1030);
  border-radius: 10px;
  box-shadow: inset 0 6px 18px rgba(0, 0, 0, 0.8);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
  overflow: hidden;
}
.board-grid:focus-visible { box-shadow: inset 0 6px 18px rgba(0, 0, 0, 0.8), 0 0 0 3px var(--teal); }

.cell {
  position: absolute;
  width: var(--cell);
  height: var(--cell);
  left: calc(var(--cell) * var(--x));
  bottom: calc(var(--cell) * (var(--y) - 1));
  padding: 2px;
  pointer-events: none;
}
.cell img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.45)); }
.cell[data-c=""] { visibility: hidden; }
.cell.from-left img { animation: slide-l 70ms ease-out; }
.cell.from-right img { animation: slide-r 70ms ease-out; }
@keyframes slide-l { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes slide-r { from { transform: translateX(100%); } to { transform: none; } }
.cell.flash img { animation: flash 100ms steps(2, end) infinite; }
@keyframes flash { from { filter: brightness(1.9) saturate(0.4) drop-shadow(0 0 6px #fff); } to { filter: brightness(1) drop-shadow(0 3px 2px rgba(0, 0, 0, 0.45)); } }
.cell.popped img { opacity: 0; transform: scale(1.35); transition: opacity 140ms ease-out, transform 140ms ease-out; }
.cell.picked img { filter: brightness(1.25) drop-shadow(0 0 8px var(--gold)); transform: translateY(-3px); }
.cell.picked[data-c=""] { visibility: visible; }
.cell.picked[data-c=""]::after { content: ""; position: absolute; inset: 8px; border: 3px dashed var(--gold); border-radius: 10px; opacity: 0.8; }

.cursor {
  position: absolute;
  width: calc(var(--cell) * 2);
  height: var(--cell);
  left: calc(var(--cell) * var(--x));
  bottom: calc(var(--cell) * (var(--y) - 1));
  border: 3px solid #fff;
  border-radius: 10px;
  box-shadow: 0 0 0 2px var(--outline), inset 0 0 0 2px var(--outline), 0 0 14px rgba(255, 255, 255, 0.45);
  pointer-events: none;
  z-index: 5;
  transition: left 60ms linear, bottom 60ms linear;
}
.cursor[hidden] { display: none; }
.board-grid.locked .cursor { opacity: 0.35; }
.board-grid.shake { animation: shake 220ms ease-in-out; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.how { font-size: 13px; text-align: center; margin: 0; max-width: 420px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--outline);
  font: 400 15px "Bungee", sans-serif;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  z-index: 20;
  animation: toast-in 180ms ease-out;
}
.toast[hidden] { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translateX(-50%); } }

/* ---- result ----------------------------------------------------------------------------------------------- */

.result { text-align: center; }
.result h2 { font-size: 28px; color: var(--gold); text-shadow: 0 3px 0 var(--outline); }
.rsub { color: var(--hint); }
.grid { font-size: 26px; line-height: 1.25; margin: 10px 0 12px; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; letter-spacing: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.btn {
  display: inline-block;
  padding: 11px 22px;
  font: 400 16px "Bungee", sans-serif;
  color: var(--outline);
  background: var(--gold);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 4px 0 #b88a1a;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #b88a1a; }
.btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.btn.alt { background: var(--teal); box-shadow: 0 4px 0 #2e8a82; }
.btn.alt:active { box-shadow: 0 2px 0 #2e8a82; }
.btn.steam { background: #66c0f4; box-shadow: 0 4px 0 #2a6f9a; margin-top: 10px; }
.btn.steam:active { box-shadow: 0 2px 0 #2a6f9a; }
.btn[disabled] { opacity: 0.5; cursor: default; }

.streak { font: 400 18px "Bungee", sans-serif; color: var(--gold); margin-top: 14px; }
.next { font-size: 14px; }
#countdown { font-family: "Bungee", sans-serif; color: var(--gold); }

/* ---- wishlist --------------------------------------------------------------------------------------------- */

.wishlist { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: start; }
.wishlist .heart { width: 56px; height: auto; margin-top: 4px; animation: bob 2.4s ease-in-out infinite; }
.wishlist h2 { font-size: 19px; }
.wishlist p { color: var(--hint); font-size: 14px; }
.small-link { display: inline-block; margin: 10px 0 0 14px; color: var(--teal); font-size: 14px; }

footer { max-width: 520px; }

@media (max-width: 520px) {
  .card { border-width: 20px; border-image-width: 20px; }
  .board-case { padding: 10px; border-width: 14px; }
  .wishlist { grid-template-columns: 44px 1fr; gap: 10px; }
  .wishlist .heart { width: 44px; }
  .grid { font-size: 22px; }
}

/* ---- account (Discord sign-in) ------------------------------------------------------------------------------ */

.account { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--hint); margin-top: -6px; }
.account[hidden] { display: none; }
.account img { width: 28px; height: 28px; border-radius: 50%; box-shadow: 0 0 0 2px var(--outline); }
.account .who { color: #fff; }
.account .linkish { background: none; border: 0; color: var(--teal); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.account .gamelink { flex-basis: 100%; text-align: center; font-size: 13px; }
.account .gamelink input { width: 6.5em; padding: 3px 6px; font: inherit; text-align: center; letter-spacing: 2px; }
.btn.discord { background: #5865f2; color: #fff; box-shadow: 0 4px 0 #3b45b8; }
.btn.discord:active { box-shadow: 0 2px 0 #3b45b8; }
.btn.discord.small { padding: 7px 14px; font-size: 13px; }
.keep { margin-top: 12px; font-size: 13px; }
.keep .btn { margin-bottom: 6px; }
