/* Glowgram: one canvas draws the square, the tray and every piece; the HUD, tools, race strip and menus are HTML around it */
.gg { display: flex; flex-direction: column; color: #dfe9ff; --gg-hud: 50px; font-variant-numeric: tabular-nums; }
.gg [hidden] { display: none !important; }
.gg-stage { position: relative; display: flex; flex-direction: column; width: 100%; height: min(calc(100vh - 150px), 760px); min-height: 460px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 40%, #071030 0%, #040817 55%, #02040b 100%);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
@media (max-width: 600px) { .gg-stage { height: calc(100svh - 112px); max-height: 860px; min-height: 520px; } }
@media (orientation: landscape) and (max-height: 520px) { .gg-stage { height: calc(100svh - 70px); min-height: 300px; } }
.stage.is-immersive .stage-body > .gg { min-height: 0; }
.stage.is-immersive .gg-stage { flex: 1 1 auto; height: auto; max-height: none; min-height: 0; }
.stage.is-immersive .gg-help { display: none; }

/* HUD */
.gg-hud { flex: none; height: var(--gg-hud); display: flex; align-items: center; gap: 8px; padding: 0 8px; z-index: 3; }
.gg-title { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.gg-title b { font-size: 15px; font-weight: 900; letter-spacing: 0.04em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gg-title span { font-size: 11.5px; font-weight: 700; color: #8aa3c4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gg-sp { flex: 1 1 auto; }
.gg-time { font-size: 20px; font-weight: 800; color: #fff; min-width: 3.2em; text-align: right; letter-spacing: 0.01em; text-shadow: 0 0 12px rgba(85,214,255,0.35); }
.gg-time.gg-off { color: #6f84a3; text-shadow: none; }
.gg-tool { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid #1c2b4a; background: rgba(11,19,40,0.8);
  color: #bfe0ff; cursor: pointer; touch-action: manipulation; padding: 0; transition: border-color .15s, color .15s, opacity .15s; }
.gg-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .gg-tool:hover:not(:disabled) { border-color: #55d6ff; color: #fff; } }
.gg-tool:focus-visible, .gg-btn:focus-visible { outline: 2px solid #55d6ff; outline-offset: 2px; }
.gg-tool:disabled { opacity: 0.35; cursor: default; }
#gg-pause .pl { display: none; fill: currentColor; } #gg-pause.is-paused .pl { display: inline; } #gg-pause.is-paused .pz { display: none; }
#gg-sound .off { display: none; } #gg-sound[aria-pressed="true"] { color: #6f84a3; } #gg-sound[aria-pressed="true"] .on { display: none; } #gg-sound[aria-pressed="true"] .off { display: inline; }
@media (max-width: 380px) { .gg-hud { gap: 5px; padding: 0 5px; } .gg-tool { width: 36px; height: 36px; } .gg-time { font-size: 18px; } }

/* the race strip: the other racer's square in miniature and how far along they are */
.gg-race { flex: none; display: flex; align-items: center; gap: 10px; margin: 0 8px 4px; padding: 6px 10px 6px 6px; border-radius: 14px;
  background: rgba(8,14,34,0.85); border: 1px solid #1c2b4a; }
.gg-mini { width: 46px; height: 46px; flex: none; border-radius: 8px; background: #030714; }
.gg-race-info { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
.gg-race-info b { font-size: 13.5px; color: #ff9ec8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gg-race-info span { font-size: 11.5px; color: #8aa3c4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gg-bar { display: block; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; }
.gg-bar span { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #ff4fd8, #ff9ec8); box-shadow: 0 0 10px rgba(255,79,216,0.7); transition: width .35s ease; }
.gg-race-me { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.gg-race-me b { font-size: 16px; color: #5ef2d6; }
.gg-k { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: #6f84a3; }
.gg-race.gg-hot { border-color: rgba(255,79,216,0.6); box-shadow: 0 0 18px rgba(255,79,216,0.25); }

/* the online bar (online.js) */
.gg-ol { flex: none; padding: 0 8px; }
.gg-ol .ol-bar { margin: 0 0 4px; padding: 6px 10px; gap: 4px 10px; background: rgba(11,21,48,0.85); flex-direction: row; flex-wrap: wrap; align-items: center; }
.gg-ol .ol-players { display: none; }   /* the race strip shows who you're racing */
.gg-ol .ol-msg { flex: 1 1 auto; font-size: 13px; min-height: 0; }
.gg-ol .ol-btn { padding: 5px 10px; }

/* the play area */
.gg-area { position: relative; flex: 1 1 auto; min-height: 0; }
#gg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.gg-kb #gg-canvas:focus { box-shadow: inset 0 0 0 2px rgba(85,214,255,0.55); }
.gg-cover { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; pointer-events: none; }
.gg-count { font-size: clamp(64px, 20vw, 140px); font-weight: 900; color: #fff; text-shadow: 0 0 30px rgba(85,214,255,0.9), 0 0 60px rgba(255,79,216,0.5); animation: gg-pop .9s ease-out both; }
@keyframes gg-pop { from { transform: scale(1.6); opacity: 0; } 30% { transform: scale(1); opacity: 1; } to { transform: scale(.9); opacity: .0; } }

/* the tools under the board */
.gg-bar-tools { flex: none; display: flex; justify-content: center; gap: 6px; padding: 6px 8px 8px; z-index: 3; }
.gg-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; flex: 0 1 112px; height: 44px; padding: 0 10px; border-radius: 12px;
  border: 1px solid #1c2b4a; background: rgba(11,19,40,0.85); color: #dfe9ff; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; touch-action: manipulation;
  transition: border-color .15s, color .15s, opacity .15s, box-shadow .15s; }
.gg-btn svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .gg-btn:hover:not(:disabled) { border-color: #55d6ff; color: #fff; } }
.gg-btn:disabled { opacity: 0.35; cursor: default; }
.gg-btn i { position: absolute; top: -6px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #ffd166; color: #1a1200; font-style: normal; font-size: 11px; font-weight: 900; line-height: 18px; text-align: center; box-shadow: 0 0 10px rgba(255,209,102,0.6); }
.gg-btn:disabled i { background: #3a4660; color: #c6d2ea; box-shadow: none; }
.gg-btn.gg-on { border-color: #55d6ff; box-shadow: 0 0 14px rgba(85,214,255,0.3); }
@media (max-width: 420px) { .gg-btn { flex-direction: column; gap: 1px; height: 48px; font-size: 11px; padding: 0 4px; } .gg-btn svg { width: 18px; height: 18px; } }
@media (orientation: landscape) and (max-height: 520px) { .gg-bar-tools { padding: 2px 8px 4px; } .gg-btn { height: 38px; } .gg-hud { --gg-hud: 44px; height: 44px; } }

/* menus and results */
.gg-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 5; overflow: auto;
  background: radial-gradient(ellipse at center, rgba(3,6,16,0.45), rgba(3,5,12,0.84)); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.gg-panel { position: relative; width: min(100%, 400px); margin: auto; text-align: center; padding: 20px 18px 18px; border: 1px solid #1c2b4a; border-radius: 18px;
  background: rgba(8,13,30,0.92); box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(85,214,255,0.06) inset; animation: gg-in .28s cubic-bezier(.2,.9,.25,1.1); }
.gg-panel.gg-wide { width: min(100%, 460px); }
@keyframes gg-in { from { opacity: 0; transform: scale(.94) translateY(8px); } }
.gg-x { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: #8aa3c4; font-size: 22px; line-height: 1; cursor: pointer; }
.gg-x:hover { color: #fff; border-color: #1c2b4a; } .gg-x:focus-visible { outline: 2px solid #55d6ff; }
.gg-logo { margin: 0 0 2px; font-size: clamp(30px, 9vw, 42px); font-weight: 900; letter-spacing: 0.06em; line-height: 1.05;
  background: linear-gradient(90deg, #3dffb5, #55d6ff 28%, #a66bff 55%, #ff4fd8 80%, #ffd166); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(85,214,255,0.35)); }
.gg-tag { margin: 0 0 14px; color: #8aa3c4; font-size: 13.5px; line-height: 1.45; }
.gg-h { margin: 0 0 6px; font-size: 22px; font-weight: 900; color: #fff; letter-spacing: 0.01em; }
.gg-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: 13px; background: #050a18; border: 1px solid #1c2b4a; margin: 0 0 8px; }
.gg-seg button { font: inherit; font-size: 13px; font-weight: 700; color: #8aa3c4; background: transparent; border: 0; border-radius: 10px; min-height: 40px; padding: 0 4px; cursor: pointer; touch-action: manipulation; transition: background .15s, color .15s; white-space: nowrap; }
.gg-seg button[aria-checked="true"] { background: #13234a; color: #fff; box-shadow: inset 0 0 0 1px rgba(85,214,255,0.45), 0 0 16px rgba(85,214,255,0.18); }
.gg-seg.gg-tabs button[aria-checked="true"] { background: linear-gradient(135deg, rgba(61,255,181,0.18), rgba(166,107,255,0.22)); }
@media (hover: hover) { .gg-seg button:hover { color: #fff; } }
.gg-seg button:focus-visible { outline: 2px solid #55d6ff; outline-offset: 1px; }
.gg-seg button small { display: block; font-size: 10px; font-weight: 700; color: #6f84a3; margin-top: -2px; }
.gg-l { margin: 10px 0 5px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: #6f84a3; text-align: left; }
.gg-desc { margin: 2px 0 12px; font-size: 12.5px; color: #8aa3c4; min-height: 1.4em; line-height: 1.45; }
.gg-desc b { color: #dfe9ff; }
.gg-actions { display: flex; flex-direction: column; gap: 8px; }
.gg-row { display: flex; gap: 8px; } .gg-row > * { flex: 1 1 0; }
.gg-pbtn { font: inherit; font-weight: 700; font-size: 14.5px; padding: 10px 14px; min-height: 46px; border-radius: 12px; cursor: pointer; touch-action: manipulation;
  border: 1px solid #1c2b4a; background: #0b1328; color: #dfe9ff; transition: background .15s, border-color .15s, transform .1s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
@media (hover: hover) { .gg-pbtn:hover:not(:disabled) { border-color: #55d6ff; } }
.gg-pbtn:active { transform: translateY(1px); } .gg-pbtn:disabled { opacity: .4; cursor: default; }
.gg-pbtn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.gg-go { background: linear-gradient(135deg, #3dffb5, #55d6ff 55%, #a66bff); color: #03141c; border-color: transparent; font-size: 16.5px; font-weight: 900; box-shadow: 0 6px 24px rgba(85,214,255,0.3); }
@media (hover: hover) { .gg-go:hover:not(:disabled) { border-color: transparent; filter: brightness(1.08); } }
.gg-go.gg-pink { background: linear-gradient(135deg, #ff4fd8, #ff9ec8 55%, #ffd166); color: #22041a; box-shadow: 0 6px 24px rgba(255,79,216,0.3); }
.gg-links { margin: 12px 0 0; font-size: 12.5px; color: #6f84a3; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.gg-links button { font: inherit; color: #55d6ff; background: none; border: 0; padding: 4px 2px; cursor: pointer; font-weight: 700; }
.gg-links button:hover { color: #fff; } .gg-links button:focus-visible { outline: 2px solid #55d6ff; border-radius: 4px; }
.gg-num { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 0 10px; }
.gg-num button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid #1c2b4a; background: #0b1328; color: #bfe0ff; font: inherit; font-size: 18px; font-weight: 800; cursor: pointer; }
.gg-num button:disabled { opacity: .35; cursor: default; }
.gg-num span { min-width: 9em; font-size: 14px; font-weight: 800; color: #fff; }
.gg-num span small { display: block; font-size: 11.5px; font-weight: 700; color: #8aa3c4; }
.gg-panel [data-rg-daily] { display: block; margin: 0 0 10px; font-size: 12.5px; color: #b9c9e4; }

/* results */
.gg-kicker { margin: 0 0 2px; font-size: 12.5px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: #8aa3c4; }
.gg-big { margin: 0; font-size: 54px; font-weight: 900; color: #fff; line-height: 1.05; text-shadow: 0 0 24px rgba(85,214,255,0.5); }
.gg-big.gg-lose { text-shadow: 0 0 24px rgba(255,79,216,0.5); }
.gg-badge { display: inline-block; margin: 6px 0 2px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase;
  color: #1a1200; background: linear-gradient(90deg, #ffd166, #fff1b8, #ffd166); background-size: 200% 100%; animation: gg-shine 1.6s linear infinite; box-shadow: 0 0 22px rgba(255,209,102,0.55); }
@keyframes gg-shine { to { background-position: -200% 0; } }
.gg-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 14px 0 14px; }
.gg-stats div { padding: 8px 4px; border-radius: 10px; background: #050a18; border: 1px solid #16223d; }
.gg-stats span { display: block; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: #6f84a3; font-weight: 700; }
.gg-stats b { display: block; margin-top: 2px; font-size: 17px; color: #dfe9ff; }
.gg-stats .gold b { color: #ffd166; }
.gg-table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: 13px; }
.gg-table th { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #6f84a3; font-weight: 800; padding: 4px; text-align: right; }
.gg-table th:first-child, .gg-table td:first-child { text-align: left; }
.gg-table td { padding: 6px 4px; border-top: 1px solid #16223d; text-align: right; color: #dfe9ff; }
.gg-table td b { color: #ffd166; }

/* the daily calendar */
.gg-cal { margin: 4px 0 12px; }
.gg-cal-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px; }
.gg-cal-head b { font-size: 14px; color: #fff; }
.gg-cal-head button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid #1c2b4a; background: #0b1328; color: #bfe0ff; font: inherit; font-size: 17px; font-weight: 800; cursor: pointer; }
.gg-cal-head button:disabled { opacity: .3; cursor: default; }
.gg-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.gg-cal-grid span { font-size: 10px; font-weight: 800; color: #6f84a3; padding: 2px 0; }
.gg-cal-grid button { position: relative; height: 34px; border-radius: 8px; border: 1px solid #16223d; background: #060c1e; color: #b9c9e4; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; padding: 0; }
.gg-cal-grid button:disabled { opacity: .28; cursor: default; }
.gg-cal-grid button.gg-done { color: #04150f; background: linear-gradient(135deg, #3dffb5, #55d6ff); border-color: transparent; box-shadow: 0 0 10px rgba(61,255,181,0.35); }
.gg-cal-grid button.gg-part::after { content: ''; position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #ffd166; }
.gg-cal-grid button.gg-today { box-shadow: inset 0 0 0 2px #ff4fd8; }
.gg-cal-grid button:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.gg-streak { display: flex; justify-content: center; gap: 16px; margin: 0 0 8px; font-size: 12.5px; color: #8aa3c4; }
.gg-streak b { color: #ffd166; font-size: 15px; }

/* how to play */
.gg-rules { text-align: left; font-size: 13.5px; line-height: 1.5; color: #b9c9e4; }
.gg-rules p { margin: 0 0 8px; } .gg-rules b { color: #fff; }
.gg-rules ul { margin: 0 0 10px; padding-left: 18px; } .gg-rules li { margin: 0 0 4px; }
.gg-rules kbd { background: #16213a; color: #bfe9ff; border-radius: 3px; padding: 0 5px; font-family: inherit; font-size: 12px; }

.gg-toast { position: absolute; left: 50%; bottom: 66px; transform: translateX(-50%); z-index: 6; max-width: calc(100% - 24px); padding: 8px 14px; border-radius: 999px; background: #dfe9ff; color: #04060f;
  font-size: 13px; font-weight: 700; animation: gg-in .2s ease-out; pointer-events: none; text-align: center; }
.gg-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.gg-help .hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .gg-help .hint-kb { display: none; } .gg-help .hint-touch { display: inline; } }
@media (prefers-reduced-motion: reduce) { .gg-panel, .gg-count, .gg-toast { animation: none; } .gg-badge { animation: none; } }
/* short screens (a phone on its side): a compact menu */
@media (max-height: 520px) {
  .gg-overlay { padding: 6px; }
  .gg-panel { padding: 10px 14px 12px; }
  .gg-logo { font-size: 24px; } .gg-tag { display: none; }
  .gg-seg button { min-height: 32px; } .gg-l { margin: 4px 0 3px; } .gg-desc { margin: 2px 0 6px; font-size: 12px; }
  .gg-pbtn { min-height: 38px; padding: 6px 12px; } .gg-num { margin: 0 0 6px; } .gg-num button { width: 32px; height: 32px; }
  .gg-big { font-size: 38px; } .gg-stats { margin: 8px 0; } .gg-links { margin: 6px 0 0; }
  .gg-cal-grid button { height: 26px; } .gg-cal { margin: 2px 0 6px; }
  .gg-panel.gg-wide { width: min(100%, 560px); }
}
