/* Regletas Pop: the bridge over the river, the rods and the tray. --u is the
   size of one unit (the white rod), set by the game from the screen width. */
.pop-dom.rg-dom { padding: 0; justify-content: stretch; align-items: stretch; }
.rg { --rh: max(var(--u), 34px); flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; width: 100%; padding: 10px 8px calc(10px + env(safe-area-inset-bottom, 0px)); gap: 6px; color: #1d2433; }
.emo { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-style: normal; line-height: 1; }

.rg-ask { display: flex; align-items: center; gap: 8px; max-width: 560px; width: 100%; justify-content: center; }
.rg-bug { font-size: clamp(36px, 10vw, 50px); animation: rg-bob 2.4s ease-in-out infinite; }
.rg-bubble { position: relative; background: #fffdf6; border-radius: 18px; border: 3px solid #ffd9b0; padding: 6px 14px; font-weight: 800; font-size: clamp(19px, 5.4vw, 26px); line-height: 1.2; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15); text-align: center; animation: pop-in 0.35s cubic-bezier(0.2, 1.6, 0.4, 1); }
.rg-bubble small { display: block; font-size: 0.62em; color: #5b6475; font-weight: 700; }

.rg-board { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.rg-mid { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.rg-model { display: flex; align-items: center; gap: 0; min-height: var(--u); }
.rg-model:empty { display: none; }
.rg-model .tag { margin-left: 8px; font-weight: 800; color: #5b6475; font-size: 15px; }

/* River and bridge */
.rg-river { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: calc(var(--rh) * 1.1) 0 calc(var(--rh) * 0.8); width: min(100%, 760px); border-radius: 22px; border: 4px solid #fffdf6; background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.35), transparent 60%), repeating-linear-gradient(172deg, rgba(255, 255, 255, 0.14) 0 5px, transparent 5px 26px), linear-gradient(#6fd3ff, #2f9ae0 55%, #1f74c0); background-size: auto, 200px 200px, auto; animation: rg-flow 6s linear infinite; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.12), 0 12px 24px rgba(20, 60, 110, 0.25), inset 0 -10px 18px rgba(10, 40, 90, 0.25); }
.rg-river > i { position: absolute; pointer-events: none; }
.rg-ripple { height: 6px; border-radius: 50%; border-top: 2px solid rgba(255, 255, 255, 0.75); animation: rg-ripple 3.2s ease-in-out infinite; }
.rg-ripple.r1 { width: 34px; left: 12%; bottom: 14%; }
.rg-ripple.r2 { width: 24px; left: 58%; bottom: 8%; animation-delay: -1.2s; }
.rg-ripple.r3 { width: 40px; right: 10%; top: 12%; animation-delay: -2.1s; }
.rg-lily { width: 30px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #8ee26b, #3e9f3c); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 50%, 0 100%); }
.rg-lily::after { content: ""; position: absolute; left: 60%; top: 10%; width: 9px; height: 9px; border-radius: 50%; background: radial-gradient(circle, #fff 30%, #ff8fc4 31%); }
.rg-lily.l1 { left: 20%; bottom: 6%; transform: rotate(-20deg); animation: rg-float 5s ease-in-out infinite; }
.rg-lily.l2 { right: 18%; top: 8%; transform: rotate(160deg) scale(0.8); animation: rg-float 6s ease-in-out infinite reverse; }
.rg-lily.l2::after { display: none; }
.rg-fish { width: 22px; height: 11px; left: -30px; bottom: 22%; border-radius: 60% 40% 40% 60%; background: #ff9a3c; opacity: 0.75; animation: rg-swim 11s linear infinite; }
.rg-fish::after { content: ""; position: absolute; left: -7px; top: 1px; border: 5px solid transparent; border-right: 8px solid #ff9a3c; }
.rg-fish::before { content: ""; position: absolute; right: 5px; top: 3px; width: 3px; height: 3px; border-radius: 50%; background: #1d2433; }
.rg-stone { border-radius: 50%; background: linear-gradient(#c9cdd6, #8a93a6); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15); }
.rg-stone.s1 { width: 22px; height: 11px; left: 6%; top: 18%; }
.rg-stone.s2 { width: 14px; height: 8px; right: 30%; bottom: 10%; }
.rg-bank { position: relative; z-index: 1; width: 46px; height: calc(var(--rh) * 1.9); background: linear-gradient(#7ed957 0 22%, #4fae47 22% 30%, #a9733f 30% 62%, #8a5a32 62% 82%, #6e4426 82%); border-radius: 12px; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.15), inset 0 3px 0 rgba(255, 255, 255, 0.35), 0 4px 0 rgba(0, 0, 0, 0.15); flex: 0 0 auto; }
.rg-bank::before { content: ""; position: absolute; inset: 40% 18% auto; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); box-shadow: 6px 12px 0 -1px rgba(0, 0, 0, 0.15), -4px 22px 0 -1px rgba(255, 255, 255, 0.12); }
.rg-reed { position: absolute; bottom: 74%; width: 3px; height: 20px; background: #3f8f3a; border-radius: 2px; }
.rg-reed::after { content: ""; position: absolute; top: -6px; left: -2px; width: 7px; height: 11px; border-radius: 4px; background: #8a5a32; }
.rg-bank.l .rg-reed { left: 8px; }
.rg-bank.r .rg-reed { right: 8px; }
.rg-flower { position: absolute; bottom: 76%; width: 9px; height: 9px; border-radius: 50%; background: radial-gradient(circle, #ffd23f 30%, #ff6b8a 32%); }
.rg-bank.l .rg-flower { right: 6px; }
.rg-bank.r .rg-flower { left: 6px; }
.rg-bank.l { border-radius: 12px 4px 4px 12px; }
.rg-bank.r { border-radius: 4px 12px 12px 4px; }
.rg-bank .emo { position: absolute; left: 50%; bottom: 70%; transform: translateX(-50%); font-size: 34px; }
.rg-gap { position: relative; z-index: 2; display: flex; height: var(--rh); width: calc(var(--u) * var(--t)); border-radius: 6px; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.55) 0 2px, transparent 2px var(--u)), rgba(255, 255, 255, 0.28); outline: 3px dashed rgba(255, 255, 255, 0.95); outline-offset: 2px; }
.rg-gap .lbl { position: absolute; top: -34px; left: 50%; transform: translateX(-50%); font-weight: 800; color: #fff; font-size: clamp(16px, 4.6vw, 22px); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); white-space: nowrap; }
.rg-gap .run { position: absolute; bottom: -26px; left: 0; right: 0; text-align: center; font-weight: 800; color: #fff; font-size: 15px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.rg-walker { position: absolute; font-size: 34px; left: 0; top: -30px; z-index: 3; transition: left 1.1s cubic-bezier(0.4, 0, 0.3, 1); pointer-events: none; }
.rg-walker.go { animation: rg-step 0.25s ease-in-out infinite alternate; }

/* Wooden posts holding the bridge */
.rg-river .rg-gap::before, .rg-river .rg-gap::after { content: ""; position: absolute; top: calc(var(--rh) * 0.4); width: 9px; height: calc(var(--rh) * 1.6); background: linear-gradient(90deg, #8a5a32, #b7804c 40%, #6e4426); border-radius: 3px; z-index: -1; box-shadow: 0 6px 0 -2px rgba(255, 255, 255, 0.4); }
.rg-river .rg-gap::before { left: -10px; }
.rg-river .rg-gap::after { right: -10px; }

/* A rod: width in units, with faint marks for each unit */
.rg-rod { position: relative; flex: 0 0 auto; height: var(--rh); width: calc(var(--u) * var(--n)); border: 0; padding: 0; border-radius: 5px; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px calc(var(--u) - 2px), rgba(0, 0, 0, 0.16) calc(var(--u) - 2px) var(--u)), linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.12) 28%, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.16)), var(--c); box-shadow: inset 0 0 0 2px var(--e), inset 0 3px 0 rgba(255, 255, 255, 0.35), 0 4px 0 var(--e), 0 6px 8px rgba(0, 0, 0, 0.22); color: #fff; font: 800 calc(var(--rh) * 0.52) "Baloo 2", system-ui, sans-serif; display: flex; align-items: center; justify-content: center; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45); }
.rg-rod.light { color: #5b4a2a; text-shadow: none; }
.rg-rod.nolbl { color: transparent; text-shadow: none; }
.rg-gap .rg-rod { animation: rg-in 0.32s cubic-bezier(0.2, 1.6, 0.4, 1); cursor: pointer; }
.rg-gap .rg-rod.given { cursor: default; filter: saturate(0.85); }
.rg-gap .rg-rod.out { animation: rg-out 0.55s ease-in forwards; }
.rg-gap .rg-rod.short { animation: rg-short 0.7s ease-in forwards; }

/* Stairs */
.rg-stairs { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; padding: 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.4); }
.rg-stairs .rg-gap { height: calc(var(--rh) * 0.8); outline-color: rgba(29, 36, 51, 0.35); background: rgba(255, 255, 255, 0.6); }
.rg-stairs .rg-gap.now { outline-color: #ffb21f; outline-style: solid; box-shadow: 0 0 0 6px rgba(255, 178, 31, 0.3); }
.rg-stairs .rg-rod { height: calc(var(--rh) * 0.8); font-size: 15px; }

/* Quiz */
.rg-opts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.rg-opt { min-width: 64px; height: 64px; border: 0; border-radius: 18px; font: 800 30px "Baloo 2", system-ui, sans-serif; color: #fff; background: linear-gradient(#ff9a3c, #e2560c); box-shadow: 0 5px 0 #8a2e00; cursor: pointer; touch-action: manipulation; }
.rg-opt:active { transform: translateY(3px); box-shadow: 0 2px 0 #8a2e00; }
.rg-opt.no { opacity: 0.35; pointer-events: none; }

.rg-eq { min-height: 34px; font-weight: 800; font-size: clamp(20px, 5.6vw, 28px); color: #1d2433; background: #fffdf6; border-radius: 999px; padding: 0 16px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12); animation: pop-in 0.35s cubic-bezier(0.2, 1.6, 0.4, 1); }
.rg-eq:empty { visibility: hidden; }

/* Tray: the ten rods as a staircase in two columns */
.rg-tray { flex: 0 0 auto; display: grid; grid-template-columns: auto auto; gap: 6px 14px; padding: 12px 14px; border-radius: 20px; border: 6px solid #b7804c; background: repeating-linear-gradient(90deg, rgba(150, 95, 45, 0.07) 0 3px, transparent 3px 11px), linear-gradient(#fff4dc, #f3dfb6); box-shadow: inset 0 4px 10px rgba(110, 68, 38, 0.3), 0 6px 0 #8a5a32, 0 12px 20px rgba(0, 0, 0, 0.2); max-width: 100%; touch-action: manipulation; }
.rg-tray .rg-rod { cursor: pointer; --u: var(--tu); height: max(var(--tu), 34px); font-size: 18px; }
.rg-tray .rg-rod:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px var(--e), 0 1px 0 var(--e); }
.rg-tray .rg-rod.no { opacity: 0.3; }
.rg-actions { display: flex; gap: 10px; }
.rg-btn { border: 0; border-radius: 999px; font: 800 17px "Baloo 2", system-ui, sans-serif; padding: 6px 16px; min-height: 42px; cursor: pointer; color: #1d2433; background: #fffdf6; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15); }
.rg-btn[hidden] { display: none; }

@keyframes rg-flow { to { background-position: 0 0, 200px 0, 0 0; } }
@keyframes rg-ripple { 50% { transform: scaleX(1.4); opacity: 0.4; } }
@keyframes rg-float { 50% { translate: 6px 2px; } }
@keyframes rg-swim { 0% { left: -30px; } 100% { left: 110%; } }
@keyframes rg-bob { 50% { transform: translateY(-5px) rotate(-5deg); } }
@keyframes rg-step { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-5px) rotate(6deg); } }
@keyframes rg-in { from { transform: translateY(-40px) scale(1.1); opacity: 0; } }
@keyframes rg-out { 0% { transform: none; } 30% { transform: translateX(10px); } 100% { transform: translate(40px, 120px) rotate(40deg); opacity: 0; } }
@keyframes rg-short { 0%, 60% { transform: none; } 100% { transform: translateY(-50px); opacity: 0; } }
