/* Dog or Bog? (tricky letters): the camp on the left (on top on a tall screen), the word on a sign and
   two or three big picture cards on the right (underneath). Everything he taps is at least 80px. The
   letter flip uses .fl-y/.fl-x/.fl-z from finishword.css. */
.game.dogorbog { background: linear-gradient(160deg, #e6f6dd, #fff4dc 58%, #dff0ff); }
.dogorbog button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.dogorbog .game-top { padding-top: 5px; padding-bottom: 5px; }
.dogorbog .db-back { min-height: 60px; min-width: 60px; white-space: nowrap; }
.dogorbog .db-body {
  flex: 1; min-height: 0; position: relative; display: grid; align-items: center; gap: 14px 22px;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
}

/* the camp: a square as big as fits, or taller than wide (more sky) when there's room */
.dogorbog .db-stage { container-type: size; align-self: stretch; min-width: 0; min-height: 0; display: grid; place-items: center; }
.dogorbog .db-frame { position: relative; width: min(100cqw, 100cqh); height: min(100cqh, 135cqw); }
.dogorbog .db-frame > .db-scene {
  display: block; width: 100%; height: 100%; box-sizing: border-box; overflow: hidden;
  border: 4px solid var(--ink); border-radius: 28px; box-shadow: var(--shadow); background: #8fd4ff;
}
.dogorbog .db-dots { position: absolute; left: 12px; top: 12px; z-index: 2; display: flex; gap: 5px; padding: 6px 9px; background: rgba(255, 255, 255, .88); border: 3px solid var(--ink); border-radius: 999px; pointer-events: none; }
.dogorbog .db-dots i { width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--ink); background: #fff; }
.dogorbog .db-dots i.on { background: #3ccf7a; }
.dogorbog .db-dots i.now { background: var(--sun); animation: db-pulse .9s ease-in-out infinite; }

/* ---------- the word on its sign ---------- */
.dogorbog .db-body.waiting .db-side { visibility: hidden; }
.dogorbog .db-side { min-width: 0; width: 100%; max-width: 640px; justify-self: center; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.dogorbog .db-sign {
  position: relative; display: flex; align-items: stretch; gap: 10px; padding: 10px;
  background: repeating-linear-gradient(180deg, #c98f55 0 22px, #b97f47 22px 25px); border: 4px solid var(--ink); border-radius: 24px; box-shadow: var(--shadow);
}
.dogorbog .db-sign.nudge { animation: db-wiggle .5s ease-in-out 2; }
.dogorbog .db-wordbox { position: relative; flex: 1; min-width: 0; display: grid; place-items: center; min-height: 130px; background: #fffaf0; border: 4px solid var(--ink); border-radius: 18px; }
.dogorbog .db-word { margin: 0; padding: 0 10px; font-size: clamp(60px, 7.6vw, 110px); font-weight: 700; line-height: 1.15; color: var(--ink); letter-spacing: .04em; white-space: nowrap; }
.dogorbog .db-word.pop { animation: db-askpop .35s cubic-bezier(.2, 1.5, .4, 1); }
.dogorbog .db-word.say { font-family: var(--font); font-size: clamp(40px, 4vw, 60px); letter-spacing: .1em; }
.dogorbog .db-hl { display: inline-block; background: #ffe27a; border-radius: 12px; box-shadow: 0 0 0 4px #ffb52e; animation: db-hl .5s ease-out; }
.dogorbog .db-btns { flex: none; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.dogorbog .db-hear, .dogorbog .db-hint {
  width: 80px; height: 80px; padding: 0; border-radius: 50%; border: 4px solid var(--ink); background: #fff8d6;
  font-size: 36px; line-height: 1; box-shadow: 0 4px 0 rgba(58, 42, 74, .3); cursor: pointer; display: grid; place-items: center;
}
.dogorbog .db-hint .fw-hicon { width: 54px; height: 54px; display: block; }
.dogorbog .db-hint.used { background: #ffe8b0; }
.dogorbog .db-hear.wait { animation: db-wake 2.5s linear both; }
.dogorbog .db-hear.no { animation: db-wake 0s both, db-wiggle .35s ease-in-out; }
.dogorbog .db-hear:active:not(:disabled), .dogorbog .db-hint:active:not(:disabled) { transform: scale(.92); }
.dogorbog .db-hear:disabled, .dogorbog .db-hint:disabled { visibility: hidden; }

/* the letter turning over (after a miss) or growing its B (the trick), above the word */
.dogorbog .db-flip { position: absolute; bottom: calc(100% - 14px); z-index: 4; transform: translateX(-50%); pointer-events: none; display: none; }
.dogorbog .db-flip.show { display: block; animation: db-flipin .35s cubic-bezier(.2, 1.5, .4, 1); }
.dogorbog .db-flip:empty { display: none; }
.dogorbog .db-fl { position: relative; display: block; width: 84px; height: 116px; padding: 6px 8px; background: #fff; border: 4px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow); perspective: 500px; }
.dogorbog .db-fl::after { content: ''; position: absolute; left: 50%; bottom: -16px; margin-left: -12px; border: 12px solid transparent; border-top: 12px solid var(--ink); border-bottom: 0; }
.dogorbog .db-fl > svg { display: block; width: 100%; height: 100%; }
.dogorbog .db-fl.done { background: #dcf8e3; }

/* ---------- the pictures (no words: the pictures are the answers) ---------- */
.dogorbog .db-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 1.6vw, 18px); }
.dogorbog .db-cards.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 76%; justify-self: center; align-self: center; margin: 0 auto; }
.dogorbog .db-card {
  position: relative; aspect-ratio: 1; min-height: 80px; min-width: 0; padding: 0; container-type: inline-size; display: grid; place-items: center;
  background: #fff; border: 4px solid var(--ink); border-radius: 26px; box-shadow: var(--shadow); color: var(--ink); cursor: pointer;
  opacity: 0; transform: scale(.7); transition: opacity .18s, transform .25s cubic-bezier(.2, 1.5, .4, 1), background .2s;
}
.dogorbog .db-card[hidden] { display: none; }
.dogorbog .db-card.show { opacity: 1; transform: none; }
.dogorbog .db-card.show:active:not(:disabled) { transform: scale(.94); }
.dogorbog .db-card:disabled { cursor: default; }
@media (hover: hover) { .dogorbog .db-card.show:hover:not(:disabled) { background: #fff8d6; } }
.dogorbog .db-cpic { display: grid; place-items: center; font-size: 72cqw; line-height: 1; transition: font-size .2s, transform .2s; pointer-events: none; }
.dogorbog .db-cpic > svg { display: block; }
.dogorbog .db-emo { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; line-height: 1; }
.dogorbog .db-lbl { display: none; position: absolute; left: 6%; right: 6%; bottom: 5%; font-size: 20cqw; font-weight: 700; line-height: 1.15; text-align: center; color: #a33; background: #fff; border-radius: 12px; pointer-events: none; }
.dogorbog .db-lbl u { text-decoration: none; background: #ffe27a; border-radius: 5px; padding: 0 2px; }
.dogorbog .db-card.bad { background: #ffe8ea; animation: db-shake .35s; }
.dogorbog .db-card.bad .db-cpic { font-size: 50cqw; transform: translateY(-16%); opacity: .75; }
.dogorbog .db-card.bad .db-lbl { display: block; }
.dogorbog .db-card.ok { background: #dcf8e3; box-shadow: 0 0 0 6px var(--good), var(--shadow); }
.dogorbog .db-card.pulse { animation: db-pulse .9s ease-in-out infinite; }
.dogorbog .db-card.gone { opacity: 0; transform: scale(.7); }

/* ---------- inside the camp ---------- */
.db-scene .db-nightsky, .db-scene .db-stars, .db-scene .db-moon, .db-scene .db-dusk, .db-scene .db-glow, .db-scene .db-glow2, .db-scene .db-flames { opacity: 0; transition: opacity 1.6s ease-in-out; }
.db-scene .db-sun { transition: opacity 1.2s, transform 1.6s ease-in; }
.db-scene.night .db-nightsky, .db-scene.night .db-stars, .db-scene.night .db-moon, .db-scene.night .db-flames, .db-scene.night .db-glow { opacity: 1; }
.db-scene.night .db-glow2 { opacity: .8; }
.db-scene.night .db-dusk { opacity: .38; }
.db-scene.night .db-sun { opacity: 0; transform: translateY(120px); }
.db-scene.party .db-flames { transform-box: fill-box; transform-origin: 50% 100%; animation: db-flicker .5s ease-in-out infinite alternate; }
.db-scene.party .db-stars path { transform-box: fill-box; transform-origin: 50% 50%; animation: db-twinkle 1.6s ease-in-out infinite; }
.db-scene.party .db-stars path:nth-child(2n) { animation-delay: .5s; }
.db-scene.party .db-stars path:nth-child(3n) { animation-delay: 1s; }
.db-scene.party .db-it { animation: db-bob 1.2s ease-in-out infinite; }
.db-scene.party .db-spot:nth-child(2n) .db-it { animation-delay: .3s; }
.db-scene .db-emo { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.db-scene .db-it { transform-box: fill-box; transform-origin: 50% 80%; animation: db-pop .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.db-scene .db-it.out { animation: db-out .35s ease-in forwards; }
.db-scene .db-mark { transform-box: fill-box; transform-origin: 50% 50%; animation: db-mark 1.1s ease-in-out infinite; }
.db-scene .db-sp { animation: db-sp .8s cubic-bezier(.2, .8, .4, 1) forwards; }
.db-scene .db-me { transform-box: fill-box; transform-origin: 50% 100%; }
.db-scene .db-me.hop { animation: db-hop .6s ease-out; }
.db-scene .db-me.ha { animation: db-laugh .9s ease-in-out; }
.db-scene.party .db-me { animation: db-hop .8s ease-in-out infinite; }
.db-scene.db-mini *, .db-scene.db-mini { animation: none !important; transition: none !important; }

/* ---------- before the first word ---------- */
.dogorbog .db-start { position: absolute; inset: 0; z-index: 12; display: none; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 14px; overflow: auto; background: rgba(30, 50, 20, .35); }
.dogorbog .db-start.show { display: grid; }
.dogorbog .db-start-card {
  width: min(580px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 14px 20px 22px; text-align: center;
  background: #fff; border: 4px solid var(--ink); border-radius: 28px; box-shadow: var(--shadow);
}
.dogorbog .db-hero { width: min(240px, 28vh); aspect-ratio: 1; border: 4px solid var(--ink); border-radius: 22px; overflow: hidden; }
.dogorbog .db-hero svg { display: block; width: 100%; height: 100%; }
.dogorbog .db-pairs { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 18px; }
.dogorbog .db-pair {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 14px; background: #fff;
  border: 4px solid var(--ink); border-radius: 24px; box-shadow: var(--shadow); cursor: pointer;
}
.dogorbog .db-pair.main { background: #fff8d6; padding: 12px 20px; }
.dogorbog .db-pletters { display: flex; gap: 6px; }
.dogorbog .db-pl { display: block; width: 50px; height: 66px; }
.dogorbog .db-pair:not(.main) .db-pl { width: 38px; height: 58px; }
.dogorbog .db-pl > svg { display: block; width: 100%; height: 100%; }
.dogorbog .db-ppics { display: flex; gap: 6px; font-size: 52px; line-height: 1; }
.dogorbog .db-pair:not(.main) .db-ppics { font-size: 40px; }
.dogorbog .db-ppics > span { display: grid; place-items: center; }
.dogorbog .db-ppics svg { display: block; }
.dogorbog .db-pair:active { transform: scale(.95); }
.dogorbog .db-play { position: absolute; right: -16px; bottom: -16px; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--coral); color: #fff; border: 4px solid var(--ink); font-size: 24px; padding-left: 4px; }
.dogorbog .db-off { margin: 0; font-weight: 700; color: var(--coral-dark); }
.dogorbog .db-off .btn { min-height: 48px; }

/* the camp at night, on the results card */
.results .db-res { display: block; width: 170px; height: 170px; margin: -4px auto 0; border: 3px solid var(--ink); border-radius: 18px; overflow: hidden; }
.results .db-res svg { display: block; width: 100%; height: 100%; }
.results .db-res .db-nightsky, .results .db-res .db-stars, .results .db-res .db-moon, .results .db-res .db-flames, .results .db-res .db-glow { opacity: 1; }
.results .db-res .db-dusk { opacity: .38; }
.results .db-res .db-glow2 { opacity: .8; }
.results .db-res .db-sun { opacity: 0; }
.db-hero .db-nightsky, .db-hero .db-stars, .db-hero .db-moon, .db-hero .db-dusk, .db-hero .db-glow, .db-hero .db-glow2, .db-hero .db-flames { opacity: 0; }

/* ---------- a tall screen (an iPad held up, a phone): the camp on top ---------- */
@media (max-aspect-ratio: 1/1) {
  .dogorbog .db-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 14px; align-items: stretch; }
  .dogorbog .db-side { max-width: 760px; gap: 14px; }
  .dogorbog .db-word { font-size: clamp(54px, 11vw, 100px); }
  .dogorbog .db-wordbox { min-height: 110px; }
  .dogorbog .db-cards { width: min(100%, 64vh); justify-self: center; margin: 0 auto; }
  .dogorbog .db-cards.n2 { width: min(86%, 44vh); }
}
@media (max-width: 560px) {
  .dogorbog .game-top h2 { font-size: 20px; }
  .dogorbog .db-body { padding-top: 8px; padding-bottom: 10px; gap: 10px; }
  .dogorbog .db-side { gap: 12px; }
  .dogorbog .db-sign { padding: 7px; gap: 7px; border-radius: 20px; }
  .dogorbog .db-wordbox { min-height: 96px; border-radius: 14px; }
  .dogorbog .db-btns { flex-direction: column; gap: 7px; }
  .dogorbog .db-hear, .dogorbog .db-hint { width: 80px; height: 80px; font-size: 32px; }
  .dogorbog .db-card { border-width: 3px; border-radius: 20px; }
  .dogorbog .db-frame > .db-scene { border-radius: 22px; border-width: 3px; }
  .dogorbog .db-dots { left: 8px; top: 8px; gap: 4px; padding: 4px 7px; border-width: 2px; }
  .dogorbog .db-dots i { width: 10px; height: 10px; border-width: 2px; }
  .dogorbog .db-fl { width: 62px; height: 88px; }
}
/* short screens: a smaller sign so the cards keep their size */
@media (max-height: 640px) and (min-aspect-ratio: 1/1) {
  .dogorbog .db-wordbox { min-height: 100px; }
  .dogorbog .db-word { font-size: clamp(50px, 5vw, 80px); }
}

@keyframes db-pulse { 50% { transform: scale(1.08); } }
@keyframes db-wiggle { 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
@keyframes db-shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes db-askpop { from { transform: scale(.85); opacity: .3; } }
@keyframes db-hl { from { transform: scale(1.4); } }
@keyframes db-flipin { from { transform: translateX(-50%) scale(.3); opacity: 0; } }
@keyframes db-wake { from { opacity: .35; filter: grayscale(1); } 99% { opacity: .35; filter: grayscale(1); } to { opacity: 1; filter: none; } }
@keyframes db-pop { from { transform: scale(0) rotate(-20deg); opacity: 0; } 60% { opacity: 1; } }
@keyframes db-out { to { transform: scale(0) rotate(40deg); opacity: 0; } }
@keyframes db-mark { 50% { transform: scale(1.08); opacity: .7; } }
@keyframes db-sp { from { transform: scale(.4); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(1) rotate(90deg); opacity: 0; } }
@keyframes db-hop { 30% { transform: translateY(-22px); } 55% { transform: none; } 70% { transform: scale(1.04, .96); } }
@keyframes db-laugh { 20% { transform: rotate(-6deg); } 40% { transform: rotate(6deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(3deg); } }
@keyframes db-flicker { from { transform: scale(.94, 1); } to { transform: scale(1.06, 1.12); } }
@keyframes db-twinkle { 50% { transform: scale(.5); opacity: .5; } }
@keyframes db-bob { 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) {
  .db-scene.party *, .dogorbog .db-dots i.now { animation: none !important; }
}
