/* Zygos (Ζυγός): its home (a small tower on a rock, the length, the race switch) and its table — the level, the pieces
   still to come, the clock and the stars on top; the world (a canvas: static/js/games/zygos.js draws it) with the
   buttons to turn and drop over it; the race and the log beside it (t21.css' side panel). Phones: upright, the world
   as wide as the screen. */

/* ---------- home ---------- */
.logo-zy { display: inline-block; width: 36px; height: 36px; flex: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,.45)); }
.logo-zy svg { width: 100%; height: 100%; display: block; }
.zy-art { position: relative; height: 170px; margin: -6px 0 4px; display: grid; place-items: center; }
.zy-art svg { width: 230px; height: 172px; overflow: visible; }
.zy-art .zya-t { transform-origin: 100px 106px; animation: zyWobble 5s ease-in-out infinite; }
.zy-art .zya-crack { opacity: 0; animation: zyCrackIn 5s ease-in-out infinite; }
@keyframes zyWobble { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-1.4deg); } 55% { transform: rotate(1.1deg); } 75% { transform: rotate(-.4deg); } }
@keyframes zyCrackIn { 0%, 40% { opacity: 0; } 55%, 85% { opacity: .9; } 100% { opacity: 0; } }
.zy-len { display: flex; flex-wrap: wrap; gap: 6px; }
.zy-len button { flex: 1 0 auto; min-width: 64px; font-weight: 900; font-variant-numeric: tabular-nums; }
.zy-len button.on { background: linear-gradient(180deg, #ffd978, #e5a92e); color: #2a1800; border-color: transparent; box-shadow: 0 3px 0 #8a6412; }
#zyFirstRow.hidden { display: none; }

/* ---------- the table ---------- */
.zy-layout .t21-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.zy-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-auto-flow: column; grid-auto-columns: auto; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)), rgba(10,12,28,.75); border: 1px solid rgba(255,255,255,.08); }
.zy-lv { display: block; line-height: 1; min-width: 74px; }
.zy-lv .label { display: block; font-size: 10px; letter-spacing: 1.2px; margin-bottom: 3px; white-space: nowrap; }
.zy-lv b { font-size: 26px; font-weight: 900; color: #ffe2a8; font-variant-numeric: tabular-nums; }
.zy-lv small { font-size: 13px; font-weight: 800; color: var(--muted); margin-left: 2px; }
.zy-queue { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; justify-content: center; }
.zq-n { display: flex; flex-direction: column; align-items: center; line-height: 1; margin-right: 4px; }
.zq-n b { font-size: 18px; font-weight: 900; }
.zq-n small { font-size: 9.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.zq-c { width: 64px; height: 43px; border-radius: 9px; background: rgba(0,0,0,.28); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); opacity: .7; }
.zq-c.now { opacity: 1; background: rgba(255,207,77,.1); box-shadow: inset 0 0 0 1.5px rgba(255,207,77,.6), 0 0 14px -4px rgba(255,207,77,.6); }
.zy-clock { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.zy-clock b { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; color: #dfe4ff; }
/* full screen: the same button as every game's table */
.zy-fs { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border-radius: 11px; cursor: pointer;
  color: #f1eef8; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.14); }
.zy-fs:hover { border-color: rgba(255,216,102,.6); }
.zy-fs svg.i { width: 17px; height: 17px; }
.zy-fs.hidden { display: none; }
.zy-stars { display: inline-flex; gap: 2px; font-style: normal; }
.zy-stars i { font-style: normal; font-size: 15px; color: rgba(255,255,255,.18); transition: color .4s, text-shadow .4s; }
.zy-stars i.on { color: #ffd866; text-shadow: 0 0 8px rgba(255,216,102,.6); }

/* testing (the admin's switch): the Levels button, the badge of a practice game, the level picker */
.zy-pick { display: block; margin-top: 5px; padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(255,216,102,.5); background: rgba(255,216,102,.08);
  color: #ffe7a3; font: 800 10.5px/1.2 'Inter', system-ui, sans-serif; letter-spacing: .4px; cursor: pointer; }
.zy-pick:hover { background: rgba(255,216,102,.16); }
.zy-pick.hidden, .zy-prac.hidden { display: none; }
.zy-prac { font-size: 10px; font-weight: 800; color: #ffb3bd; letter-spacing: .3px; white-space: nowrap; }
.zm-pickbox { width: min(460px, 100%); }
.zm-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin: 4px 0 16px; }
.zm-lv { height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,.14); color: #fff; cursor: pointer; font: 800 14px/1 'Inter', system-ui, sans-serif;
  font-variant-numeric: tabular-nums; transition: transform .1s, border-color .2s, box-shadow .2s; }
.zm-lv.wd { background: linear-gradient(160deg, rgba(185,129,80,.45), rgba(110,66,33,.45)); }
.zm-lv.st { background: linear-gradient(160deg, rgba(160,155,147,.4), rgba(90,86,80,.45)); }
.zm-lv:hover { border-color: rgba(255,255,255,.5); transform: translateY(-1px); }
.zm-lv.cur { border-color: #ffd866; box-shadow: 0 0 0 2px rgba(255,216,102,.35), 0 0 16px -4px rgba(255,216,102,.7); }

/* the world: as big as the screen allows */
.zy-stage { position: relative; height: calc(100dvh - var(--top, 64px) - 196px); min-height: 380px; border-radius: 16px; overflow: hidden;
  background: #0b0906; box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 24px 50px -24px rgba(0,0,0,.95); }
.zy-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.zy-stage.shake { animation: zyShake .3s ease-in-out; }
@keyframes zyShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
/* after the last piece: the seconds everything must stand */
.zy-hold { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); width: 84px; height: 84px; display: grid; place-items: center;
  pointer-events: none; color: #fff; --k: 0; }
.zy-hold.hidden { display: none; }
.zy-hold svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.zy-hold circle { fill: rgba(8,10,20,.55); stroke: rgba(255,255,255,.14); stroke-width: 3.5; }
.zy-hold .zh-k { fill: none; stroke: #7fe25a; stroke-linecap: round; stroke-dasharray: 106.8; stroke-dashoffset: calc(106.8 * (1 - var(--k))); filter: drop-shadow(0 0 4px #7fe25a); }
.zy-hold b { position: relative; font-size: 28px; font-weight: 900; line-height: 1; margin-top: -8px; }
.zy-hold small { position: absolute; bottom: -20px; font-size: 11px; font-weight: 800; white-space: nowrap; text-shadow: 0 1px 4px #000; }
.zy-banner { z-index: 6; top: 18%; }
/* the buttons over the world: turn, a quarter turn, drop, start again */
.zy-ctrl { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 8px; padding: 6px;
  border-radius: 999px; background: rgba(8,10,20,.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.1);
  transition: opacity .25s; }
.zy-ctrl.off { opacity: .3; pointer-events: none; }
/* a building cannot be turned: the turn buttons rest */
.zy-ctrl.noturn [data-zyrot], .zy-ctrl.noturn [data-action="zy-turn90"] { opacity: .3; pointer-events: none; }
.zc-b { width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #fff; display: grid; place-items: center;
  cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.zc-b:active { background: rgba(255,255,255,.18); transform: scale(.94); }
.zc-b svg.i { width: 20px; height: 20px; }
.zc-re { margin-left: 4px; opacity: .8; }
.zc-drop { height: 42px; padding: 0 18px; border: 0; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font: 900 13px/1 'Inter', system-ui, sans-serif; letter-spacing: .8px; text-transform: uppercase; color: #2a1800;
  background: linear-gradient(180deg, #ffe38a, #e5a92e); box-shadow: 0 3px 0 #8a6412, 0 8px 18px -8px rgba(0,0,0,.8); }
.zc-drop:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a6412; }
.zc-drop svg.i { width: 18px; height: 18px; stroke-width: 2.6; }
@media (pointer: fine) { .zc-drop { display: none; } }         /* a mouse drops with its click */

/* the messages over the world: fell, passed (the stars), the gift, finished, how it is played */
.zy-msg { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: 18px; background: rgba(6,8,18,.5);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.zy-msg.hidden { display: none; }
.zm-box { width: min(360px, 100%); padding: 22px 18px 18px; border-radius: 20px; text-align: center; color: #fff;
  background: linear-gradient(170deg, rgba(34,30,70,.97), rgba(13,12,34,.97)); border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.95); animation: zyBox .45s cubic-bezier(.3,1.3,.5,1); }
.zm-box.good { background: radial-gradient(120% 90% at 50% 0%, rgba(127,226,90,.22), transparent 70%), linear-gradient(170deg, rgba(28,44,40,.97), rgba(10,18,20,.97)); }
.zm-box.bad { background: radial-gradient(120% 90% at 50% 0%, rgba(255,90,90,.2), transparent 70%), linear-gradient(170deg, rgba(48,24,34,.97), rgba(20,10,16,.97)); }
.zm-box.gold, .zm-box.gift { background: radial-gradient(120% 90% at 50% 0%, rgba(255,207,77,.28), transparent 70%), linear-gradient(170deg, rgba(48,38,20,.97), rgba(20,14,8,.97)); }
@keyframes zyBox { from { transform: scale(.88) translateY(14px); opacity: 0; } }
.zm-box h3 { margin: 6px 0 6px; font-size: 21px; font-weight: 900; }
.zm-box p { margin: 0 0 14px; font-size: 13.5px; line-height: 1.45; color: rgba(223,228,255,.8); }
/* the button: discreet — a thin pill with a light border, a soft glow on hover (gold on a passed level) */
.zm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 150px; height: 40px; padding: 0 22px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.06); color: #f4f1ea; cursor: pointer;
  font: 700 13px/1 'Inter', system-ui, sans-serif; letter-spacing: .6px; transition: background .2s, border-color .2s, box-shadow .2s, transform .1s; }
.zm-btn:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.5); box-shadow: 0 0 18px -6px rgba(255,255,255,.5); }
.zm-btn:active { transform: translateY(1px); }
.zm-box.good .zm-btn, .zm-box.gift .zm-btn, .zm-box.gold .zm-btn { border-color: rgba(255,216,102,.55); color: #ffe7a3; }
.zm-box.good .zm-btn:hover, .zm-box.gift .zm-btn:hover { background: rgba(255,216,102,.1); box-shadow: 0 0 18px -6px rgba(255,216,102,.7); }
.zm-box.bad .zm-btn { border-color: rgba(255,160,160,.45); color: #ffd9d9; }
.zm-ico { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,90,90,.18); color: #ff8b95; }
.zm-ico svg.i { width: 26px; height: 26px; }
.zm-stars { display: flex; justify-content: center; gap: 8px; margin-bottom: 2px; }
.zm-stars i { font-style: normal; font-size: 42px; line-height: 1; color: rgba(255,255,255,.15); }
.zm-stars i.on { color: #ffd866; text-shadow: 0 0 18px rgba(255,216,102,.7); animation: zyStar .55s cubic-bezier(.3,1.6,.5,1) backwards; animation-delay: var(--d); }
@keyframes zyStar { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
.zm-gift svg { width: 84px; height: 84px; animation: zyChip 1.4s cubic-bezier(.3,1.3,.5,1); filter: drop-shadow(0 8px 18px rgba(255,190,60,.55)); }
@keyframes zyChip { 0% { transform: translateY(-60px) rotateY(0) scale(.4); opacity: 0; } 60% { transform: translateY(6px) rotateY(540deg) scale(1.1); opacity: 1; } 100% { transform: none; } }
.zm-amount { font-size: 34px !important; font-weight: 900; color: #ffd866 !important; margin: 0 0 6px !important; text-shadow: 0 0 20px rgba(255,216,102,.5); }
.zm-crown { font-size: 44px; line-height: 1; display: block; }
.zm-how { text-align: left; margin: 4px 0 14px; padding-left: 20px; font-size: 13px; line-height: 1.5; color: rgba(223,228,255,.85); }
.zm-how li { margin-bottom: 6px; }
.zm-tips .zm-how { list-style: none; padding-left: 0; }
.zm-tips .zm-how li { padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.05); }
.zm-tips .zm-how b { display: block; color: #ffd98a; font-size: 13px; }

/* the dock under the world: what to do now */
.zy-dock { grid-template-columns: minmax(0, 1fr); margin-top: 0; padding: 10px 14px; }
.zy-dock .turnlbl { margin: 0; align-items: center; }

/* the race: each player's level, stars, place */
.zy-race { display: grid; gap: 8px; }
.zr { display: flex; align-items: center; gap: 9px; min-width: 0; }
.zr.gone { opacity: .4; }
.zr-av { position: relative; flex: none; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-size: 13px;
  font-weight: 900; color: #fff; background: linear-gradient(160deg, #6c5ce7, #3a2f9e); }
.zr.me .zr-av { box-shadow: 0 0 0 2px #ffd866; }
.zr-av .ava-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.zr-m { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.zr-n { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.zr-n b { font-size: 12.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zr-n em { flex: none; font-style: normal; font-size: 11px; font-weight: 800; color: var(--muted); }
.zr.fin .zr-n em { color: #ffd866; }
.zr-bar { display: block; height: 6px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.zr-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #7fe25a, #2de0c4); transition: width .6s cubic-bezier(.3,.8,.3,1); }
.zr.me .zr-bar i { background: linear-gradient(90deg, #ffd866, #ff9f43); }
.zr-st { flex: none; font-size: 11.5px; font-weight: 800; color: #ffd866; }

/* phones, held upright: the world as wide as the screen */
@media (max-width: 620px) {
  .page#table:has(.zy-layout) { padding: 8px 6px 20px; }
  .zy-top { gap: 8px; padding: 6px 8px; border-radius: 13px; }
  .zy-lv { min-width: 54px; }
  .zy-lv b { font-size: 22px; }
  .zq-c { width: 48px; height: 32px; }
  .zq-c:nth-of-type(n + 4) { display: none; }
  .zy-stage { height: calc(100dvh - var(--top, 64px) - 210px); min-height: 360px; border-radius: 12px; }
  .zy-ctrl { bottom: 10px; gap: 6px; padding: 5px; }
  .zc-b { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .zy-art .zya-t, .zy-art .zya-crack, .zm-stars i.on, .zm-gift svg, .zy-stage.shake { animation: none; }
}
