/* Color Tube Sort — page-specific visual and animation layer. */
body.tube-page {
  background-color: #d8d6cb;
  background-image: linear-gradient(rgba(14,39,33,.045) 1px,transparent 1px),linear-gradient(90deg,rgba(14,39,33,.045) 1px,transparent 1px);
  background-size: 30px 30px;
  isolation: isolate;
}
body.tube-page::before,body.tube-page::after {
  content: '';
  position: fixed;
  z-index: -2;
  width: 54vw;
  height: 54vw;
  border-radius: 50%;
  filter: blur(40px);
  opacity: .42;
  pointer-events: none;
  animation: tube-ambient 15s ease-in-out infinite alternate;
}
body.tube-page::before { left: -16vw; top: -17vw; background: radial-gradient(circle,rgba(92,174,132,.42),transparent 67%); }
body.tube-page::after { right: -17vw; top: 12vh; background: radial-gradient(circle,rgba(111,87,217,.28),rgba(255,101,66,.12) 42%,transparent 70%); animation-delay: -7s; animation-direction: alternate-reverse; }
.tube-page .tube-intro { text-align: center; }
.tube-page .tube-intro .lede { margin: 0 auto 6px; }
.tube-page .tube-facts { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 18px 0 4px; }
.tube-page .tube-facts span { padding: 6px 11px; color: #53625d; background: rgba(255,253,248,.78); border: 1px solid #c9c8bf; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tube-page .tube-facts span:first-child { color: #08715e; border-color: #92cdbf; }
.tube-page .tube-game { position: relative; isolation: isolate; overflow: hidden; background: rgba(244,244,237,.88); border-color: rgba(23,54,47,.18); backdrop-filter: blur(12px); }
.tube-page .tube-game-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.tube-page .tube-progression { display: flex; flex-direction: column; gap: 3px; }
.tube-page .tube-progression b { font-family: 'Fredoka',sans-serif; font-size: 16px; }
.tube-page .tube-progression span { color: var(--ink-soft); font-size: 12px; }
.tube-page .tube-status { display: flex; justify-content: center; gap: 7px; margin: 0; }
.tube-page .tube-status > div { min-width: 72px; padding: 7px 12px; background: var(--navy); border-radius: 10px; text-align: center; }
.tube-page .tube-status span { display: block; color: #9bb6ad; font-size: 8px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.tube-page .tube-status strong { display: block; color: var(--lime); font-family: 'Fredoka',sans-serif; font-size: 21px; line-height: 1.1; }
.tube-page .tube-board-wrap { overflow: hidden; padding: 20px 12px; background: linear-gradient(145deg,rgba(246,247,241,.9),rgba(212,220,211,.58)); border: 1px solid rgba(23,54,47,.17); border-radius: 21px; box-shadow: inset 0 1px 0 rgba(255,255,255,.85); }
.tube-page .tube-board { position: relative; min-height: 430px; display: flex; align-content: center; align-items: center; justify-content: center; flex-wrap: wrap; gap: 30px 18px; padding: 22px 12px; background: transparent; border: 0; border-radius: 0; }
.tube-page .tube { position: relative; width: 58px; height: 180px; padding: 0; background: none; border: 0; border-radius: 18px; cursor: pointer; transform-origin: center center; transition: transform .2s cubic-bezier(.2,.8,.2,1),filter .2s; }
.tube-page .tube::before { content: ''; position: absolute; left: 7px; right: 7px; top: 5px; z-index: 12; height: 12px; background: rgba(223,240,235,.08); border: 2px solid rgba(18,48,40,.72); border-radius: 50%; box-shadow: inset 0 -3px 3px rgba(18,48,40,.14),inset 0 2px 2px rgba(255,255,255,.88),0 2px 3px rgba(14,39,33,.1); }
.tube-page .tube::after { content: ''; position: absolute; left: 12px; top: 22px; z-index: 11; width: 5px; height: 126px; background: linear-gradient(rgba(255,255,255,.82),rgba(255,255,255,.08)); border-radius: 999px; opacity: .82; pointer-events: none; }
.tube-page .tube:hover { transform: translateY(-4px); }
.tube-page .tube:focus-visible { outline: 4px solid rgba(8,127,112,.25); outline-offset: 4px; }
.tube-page .tube.selected { z-index: 4; transform: translateY(-14px); filter: drop-shadow(0 10px 10px rgba(112,87,217,.25)); }
.tube-page .tube.ready { filter: drop-shadow(0 0 7px rgba(43,164,126,.52)); }
.tube-page .tube.invalid { animation: tube-shake .35s ease; }
.tube-page .tube-glass { position: absolute; inset: 11px 7px 0; overflow: hidden; display: block; background: linear-gradient(90deg,rgba(229,244,239,.3),rgba(255,255,255,.66) 46%,rgba(207,229,222,.23)); border: 2px solid rgba(18,48,40,.68); border-top: 0; border-radius: 0 0 23px 23px; box-shadow: inset 4px 0 8px rgba(255,255,255,.52),inset -3px 0 6px rgba(56,99,87,.1),3px 6px 8px rgba(14,39,33,.12); backdrop-filter: blur(2px); }
.tube-page .tube-glass::before { display: none; }
.tube-page .tube-glass::after { content: ''; position: absolute; left: 5px; top: 12px; bottom: 17px; z-index: 7; width: 3px; background: linear-gradient(rgba(255,255,255,.75),rgba(255,255,255,.05)); border-radius: 999px; opacity: .7; pointer-events: none; }
.tube-page .tube-liquid { position: absolute; right: 0; left: 0; z-index: 2; height: 22%; overflow: visible; background: linear-gradient(90deg,color-mix(in srgb,var(--liquid),black 12%),var(--liquid) 48%,color-mix(in srgb,var(--liquid),white 16%)); border: 0; border-radius: 0; box-shadow: inset 0 -4px 7px rgba(0,0,0,.07); transition: bottom .28s cubic-bezier(.2,.8,.2,1); }
.tube-page .tube-liquid:nth-child(1) { bottom: 0; }
.tube-page .tube-liquid:nth-child(2) { bottom: 22%; }
.tube-page .tube-liquid:nth-child(3) { bottom: 44%; }
.tube-page .tube-liquid:nth-child(4) { bottom: 66%; }
.tube-page .tube-liquid.top::before { content: ''; position: absolute; left: -3%; top: -5px; width: 106%; height: 10px; background: var(--liquid); border-radius: 48%; box-shadow: inset 0 3px 0 rgba(255,255,255,.2); animation: tube-wave 1.7s ease-in-out infinite alternate; }
.tube-page .tube-liquid::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(circle at 23% 74%,rgba(255,255,255,.34) 0 2px,transparent 3px),radial-gradient(circle at 72% 42%,rgba(255,255,255,.24) 0 1.5px,transparent 2.5px),radial-gradient(circle at 54% 88%,rgba(255,255,255,.2) 0 1px,transparent 2px); animation: tube-bubbles 2.8s linear infinite; }
.tube-page .tube.pouring { position: relative; z-index: 20; transform-origin: center center; transition: transform .31s cubic-bezier(.18,.76,.2,1); transform: translate(var(--travel-x),var(--travel-y)) rotate(var(--tilt)); filter: drop-shadow(0 15px 12px rgba(14,39,33,.22)); }
.tube-page .tube.receiving { animation: tube-receive .46s ease; }
.tube-page .tube.splash { animation: tube-splash .38s ease; }
.tube-page .tube-pour-stream { position: absolute; z-index: 18; width: 8px; height: 58px; background: linear-gradient(90deg,color-mix(in srgb,var(--stream),white 26%),var(--stream)); border-radius: 999px; box-shadow: 0 2px 5px color-mix(in srgb,var(--stream),transparent 58%); transform: scaleY(0); transform-origin: top center; opacity: 0; pointer-events: none; }
.tube-page .tube-pour-stream.show { opacity: 1; animation: tube-stream .28s ease forwards; }
.tube-page .tube-drop { position: absolute; z-index: 19; width: 7px; height: 10px; background: var(--drop); border-radius: 50% 50% 55% 55%; animation: tube-drop .34s ease forwards; pointer-events: none; }
.tube-page .tube-message { min-height: 29px; margin: 15px 0 5px; color: var(--ink-soft); font-size: 14px; font-weight: 600; text-align: center; }
.tube-page .tube-message.ok { color: #08715e; }
.tube-page .tube-message.no { color: #d64061; }
.tube-page .tube-controls { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 13px; }
.tube-page .tube-controls .btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.tube-page .tube-win { position: absolute; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(16,42,35,.84); backdrop-filter: blur(8px); }
.tube-page .tube-win.show { display: flex; }
.tube-page .tube-win-card { position: relative; z-index: 2; width: min(390px,100%); max-height: calc(100% - 32px); overflow: auto; padding: 30px 24px; background: var(--surface); border: 2px solid var(--navy); border-radius: 20px; box-shadow: 8px 8px 0 var(--lime); text-align: center; animation: tube-pop .4s cubic-bezier(.2,.9,.2,1.2); }
.tube-page .tube-win-icon { display: block; font-size: 44px; line-height: 1; }
.tube-page .tube-win-card h2 { margin: 7px 0 8px; }
.tube-page .tube-win-card p { margin: 0 0 20px; color: var(--ink-soft); }
.tube-page .tube-celebration { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.tube-page .tube-celebration span { animation-duration: 1.7s; }
@keyframes tube-ambient { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(10vw,7vh,0) scale(1.15); } }
@keyframes tube-wave { to { transform: translateX(7%) scaleY(.78); } }
@keyframes tube-bubbles { to { transform: translateY(-14px); } }
@keyframes tube-stream { 15% { transform: scaleY(.12); } to { transform: scaleY(1); } }
@keyframes tube-receive { 45% { transform: translateY(7px) scale(.96); } 75% { transform: translateY(-3px) scale(1.02); } }
@keyframes tube-splash { 35% { transform: translateY(-7px) scale(1.02); } 70% { transform: translateY(2px); } }
@keyframes tube-drop { to { transform: translate(8px,28px) scale(.3); opacity: 0; } }
@keyframes tube-shake { 25% { transform: translateX(-7px); } 50% { transform: translateX(7px); } 75% { transform: translateX(-4px); } }
@keyframes tube-pop { from { transform: scale(.72); opacity: 0; } }
@media (max-width: 760px) {
  .tube-page .tube-game { padding: 16px 12px; }
  .tube-page .tube-game-top { align-items: stretch; flex-direction: column; }
  .tube-page .tube-progression { text-align: center; }
  .tube-page .tube-status { justify-content: center; }
  .tube-page .tube-board-wrap { padding: 10px 3px; }
  .tube-page .tube-board { min-height: 420px; gap: 22px 8px; padding: 15px 2px; }
  .tube-page .tube { width: 51px; height: 154px; }
  .tube-page .tube::before { left: 6px; right: 6px; }
  .tube-page .tube::after { left: 10px; height: 108px; }
  .tube-page .tube-glass { inset: 11px 6px 0; border-radius: 0 0 20px 20px; }
  .tube-page .tube-status > div { min-width: 68px; padding: 7px 9px; }
  .tube-page .tube-controls .btn { min-height: 43px; padding: 9px 13px; }
  .tube-page .tube-win { padding: 16px; }
  .tube-page .tube-win-card { width: min(340px,100%); max-height: calc(100% - 20px); padding: 25px 18px; box-shadow: 6px 6px 0 var(--lime); }
}
@media (prefers-reduced-motion: reduce) {
  body.tube-page::before,body.tube-page::after { animation: none; }
}
