/* Polish layer: depth, shine and texture on top of the flat colours. Loaded last on every page. */
:root {
  --shine: linear-gradient(180deg, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0.06) 48%, rgba(0, 0, 0, 0.04) 100%);
  --glass: linear-gradient(160deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.07) 100%);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  --lift: 0 10px 24px rgba(15, 3, 50, 0.35);
  --doodles: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cg fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' opacity='0.07'%3E%3Cpath d='M44 28l7 14 15 2-11 10 3 15-14-7-14 7 3-15-11-10 15-2z'/%3E%3Ccircle cx='196' cy='58' r='13'/%3E%3Cpath d='M126 150h22M137 139v22'/%3E%3Cpath d='M26 206q14-16 28 0t28 0t28 0'/%3E%3Cpath d='M206 176l10 10M216 176l-10 10'/%3E%3Crect x='150' y='22' width='16' height='16' rx='4' transform='rotate(20 158 30)'/%3E%3C/g%3E%3Cg fill='white' opacity='0.08'%3E%3Ccircle cx='98' cy='96' r='4'/%3E%3Ccircle cx='232' cy='236' r='5'/%3E%3Ccircle cx='70' cy='150' r='3'/%3E%3C/g%3E%3C/svg%3E");
}

/* Background: soft glows plus faint doodles (stars, rings, squiggles) */
body { background-color: #3A1A8A; background-image:
    radial-gradient(ellipse at 15% 0%, rgba(111, 195, 255, 0.28), transparent 45%),
    radial-gradient(ellipse at 95% 100%, rgba(255, 122, 122, 0.24), transparent 45%),
    radial-gradient(ellipse at 80% 20%, rgba(255, 201, 60, 0.10), transparent 35%),
    linear-gradient(180deg, #4320A0 0%, #34168A 100%); }
body::before { content: ""; position: fixed; top: 0; right: 0; bottom: 0; left: 0; background-image: var(--doodles); background-size: 260px 260px; pointer-events: none; z-index: -1; }
#stage { background-color: #3A1A8A; background-image:
    radial-gradient(ellipse at 12% 0%, rgba(111, 195, 255, 0.28), transparent 42%),
    radial-gradient(ellipse at 96% 100%, rgba(255, 122, 122, 0.24), transparent 42%),
    radial-gradient(ellipse at 75% 15%, rgba(255, 201, 60, 0.10), transparent 30%),
    linear-gradient(180deg, #4320A0 0%, #33158A 100%); }
#stage::before { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background-image: var(--doodles); background-size: 360px 360px; pointer-events: none; }

/* 3D logo: each word gets its own darker "side", then a soft drop shadow */
.logo { text-shadow: 0 0.03em 0 #E0A200, 0 0.06em 0 #B98200, 0 0.09em 0 #2B1464, 0 0.16em 0.12em rgba(10, 0, 40, 0.45); }
.logo b { text-shadow: 0 0.03em 0 #E05C5C, 0 0.06em 0 #B84242, 0 0.09em 0 #2B1464, 0 0.16em 0.12em rgba(10, 0, 40, 0.45); }
a.logolink { text-decoration: none; }

/* The title (owner picked option B): a sky sunburst rectangle with a white edge and a gold frame. SORE sits on top of LOSERS;
   bouncy Titan One letters, each its own colour with a white border and a deep edge, and the crying face as the O.
   Size it with font-size on .logo (1em = letter size). */
.logo .stk, .stk { position: relative; display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 0.92; white-space: nowrap;
  padding: 0.4em 0.46em 0.34em; margin: 0.12em 0.14em 0.3em; border-radius: 0.42em; text-shadow: none; font-family: "Titan One", "Luckiest Guy", var(--head); font-weight: 400;
  background: repeating-conic-gradient(from 0deg at 50% 70%, #7EC0FF 0 10deg, #4FA2F0 10deg 20deg);
  box-shadow: inset 0 0 0 0.07em rgba(255, 255, 255, 0.95), 0 0 0 0.06em #FFC94A, 0 0 0 0.1em #B86A00, 0 0.14em 0 0.1em #8A4A00, 0 0.26em 0.36em 0.04em rgba(10, 30, 80, 0.35); }
.stk::before { content: ""; position: absolute; left: 0.08em; right: 0.08em; top: 0.08em; height: 42%; border-radius: 0.36em 0.36em 0.7em 0.7em;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)); pointer-events: none; }
.stkrow { position: relative; display: flex; align-items: center; justify-content: center; }
.stkrow > span { position: relative; display: inline-block; transform: translateY(var(--y, 0)) rotate(var(--r, 0deg));
  filter: drop-shadow(0.035em 0 0 #fff) drop-shadow(-0.035em 0 0 #fff) drop-shadow(0 0.035em 0 #fff) drop-shadow(0 -0.035em 0 #fff) drop-shadow(0 0.07em 0 #0E3E80) drop-shadow(0 0.1em 0.07em rgba(0, 0, 0, 0.25)); }
.stkrow > .y { color: #FFC21C; }
.stkrow > .k { color: #2E8FF0; }
.stkrow > .c { color: #F0559E; }
.stkrow > .m { color: #14B88A; }
.stkrow > .p { color: #8B5CF6; }
.stkrow > .o { color: #FF7A2E; }
/* The crying face is the O in LOSERS. */
.stkrow > .lface { width: 0.86em; height: 0.86em; margin: 0 0.03em; transform: translateY(0.04em) rotate(-8deg); filter: drop-shadow(0 0.05em 0 #0E3E80) drop-shadow(0 0.08em 0.05em rgba(0, 0, 0, 0.2)); }
.stkrow > .lface img { width: 100%; height: 100%; display: block; }
a.logolink:hover .stk { transform: scale(1.03); }
.stk { transition: transform 0.15s; }

/* Buttons: shine on top, soft shadow below */
.btn { background-image: var(--shine); position: relative; }
.btn:not(.ghost):not(.ghost-ink) { box-shadow: 0 5px 0 #C98F00, 0 9px 16px rgba(15, 3, 50, 0.35); }
.btn.mint { box-shadow: 0 5px 0 #11866D, 0 9px 16px rgba(15, 3, 50, 0.35) !important; }
.btn.coral { box-shadow: 0 5px 0 #C24848, 0 9px 16px rgba(15, 3, 50, 0.35) !important; }
.btn.sky { box-shadow: 0 5px 0 #3A8FC7, 0 9px 16px rgba(15, 3, 50, 0.35) !important; }
.btn:active { box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3) !important; }
.btn.ghost { background-color: rgba(255, 255, 255, 0.12); background-image: var(--glass); box-shadow: var(--glass-edge), 0 5px 0 rgba(10, 0, 40, 0.3); }

/* Cream cards: slightly lit from above, soft lift */
.card, .secret-card, .gcard, .pausebox, .modal, .board { background-image: linear-gradient(180deg, #FFFFFF 0%, #FFF8EC 55%, #FBEFDB 100%); box-shadow: 0 6px 0 rgba(20, 5, 60, 0.3), var(--lift); }
.secret-card.imp { background-image: linear-gradient(180deg, #FF9A9A 0%, #FF7A7A 100%); }

/* Glassy panels on the dark background */
.panel, .ptile:not(.empty), .res-row, .srow, .wf-word, .imp-pl, .imp-clue, .imp-bar, .dd-guess, .minimedals, .upnext + .minimedals,
.steps li, .tip, .gamecard:not(.on), .prow, .toggle, .others .pchip, .endnote, .res-summary, .lr-chip, .wf-chip:not(.got), .cs-total, .lr-current:not(.valid):not(.dupe):not(.bad) {
  background-color: rgba(255, 255, 255, 0.08); background-image: var(--glass); box-shadow: var(--glass-edge);
}
.srow.done, .imp-pl.ok { background-color: rgba(31, 199, 164, 0.22); }
.cs-total.done { background-image: var(--shine); background-color: var(--mint); }
.segpick, .hosttabs, .phbar .seg { box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3); }
.segpick button.on, .gamecard.on, .chip.on, .hosttabs button.on, .phbar .seg button.on, .modaltabs button.on { background-image: var(--shine); }
.upnext { background-image: var(--shine); box-shadow: 0 6px 0 #C98F00, var(--lift); }
.quip, .phquip { background-image: var(--shine); }
.topbar { background: linear-gradient(180deg, rgba(30, 10, 80, 0.75), rgba(43, 20, 100, 0.45)); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 20px rgba(10, 0, 40, 0.25); }
.phbar { background: linear-gradient(180deg, rgba(36, 14, 92, 0.97), rgba(43, 20, 100, 0.92)); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 14px rgba(10, 0, 40, 0.25); }

/* Avatars: a white ring and a little shadow so they sit on top of things */
.av { border-radius: 50%; filter: drop-shadow(0 3px 5px rgba(10, 0, 40, 0.35)); }
.av.xl, .av.lg { filter: drop-shadow(0 6px 12px rgba(10, 0, 40, 0.4)); }
.avpick .av, .avcloud .av { box-shadow: none; }

/* Game tiles: raised, lit from above */
.wf-wrap { background-image: linear-gradient(180deg, #FFFFFF, #FBF1DE); box-shadow: 0 6px 0 rgba(20, 5, 60, 0.3), var(--lift); }
.cs-cell:not(.x):not(.k):not(.bad) { background-image: linear-gradient(160deg, #FFFFFF 0%, #F6ECD9 100%); }
.cs-cell:not(.x) { box-shadow: 0 4px 0 #CBBDF2, inset 0 2px 0 #fff, 0 6px 10px rgba(10, 0, 40, 0.18); }
.cs-cell.k { box-shadow: 0 4px 0 #8FDCC9, inset 0 0 0 3px var(--mint), 0 6px 10px rgba(10, 0, 40, 0.18); }
.qr { box-shadow: inset 0 0 0 2px rgba(61, 28, 143, 0.12); }

/* Headings on the dark background get a touch of depth */
.tv h1:not(.logo), .intro-title, .imp-center h1, .imp-result h1, .kick-title, .bigmsg h2, .block h2, .host h3 { text-shadow: 0 3px 0 rgba(20, 5, 60, 0.55), 0 8px 18px rgba(10, 0, 40, 0.35); }
.board h1, .modal h3, .card h2, .card h3 { text-shadow: none; }

/* Medals: shiny metal */
.medal.gold { background: radial-gradient(circle at 35% 30%, #FFF3B0, #FFC93C 55%, #E0A200); }
.medal.silver { background: radial-gradient(circle at 35% 30%, #FFFFFF, #D9DEEA 55%, #A9B1C4); }
.medal.bronze { background: radial-gradient(circle at 35% 30%, #FFD2A8, #E89A5B 55%, #B86B30); }

/* The big logos float: the frame drifts up and down, each letter bobs a little out of step and the face wobbles.
   Uses the separate translate/rotate properties so it doesn't fight the letters' own tilt or the hover zoom. */
.herologo .stk, .logo.big .stk { animation: logofloat 4s ease-in-out infinite; }
.herologo .stkrow > span, .logo.big .stkrow > span { animation: letterbob 2.6s ease-in-out infinite; }
.herologo .stkrow > .lface, .logo.big .stkrow > .lface { animation: facewobble 2.2s ease-in-out infinite; }
.stkrow > span:nth-child(2) { animation-delay: -0.3s; }
.stkrow > span:nth-child(3) { animation-delay: -0.6s; }
.stkrow > span:nth-child(4) { animation-delay: -0.9s; }
.stkrow > span:nth-child(5) { animation-delay: -1.2s; }
.stkrow > span:nth-child(6) { animation-delay: -1.5s; }
.stkrow + .stkrow > span { animation-duration: 2.9s; }
@keyframes logofloat { 0%, 100% { translate: 0 0; rotate: -1.5deg; } 50% { translate: 0 -0.12em; rotate: 1.5deg; } }
@keyframes letterbob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -0.06em; } }
@keyframes facewobble { 0%, 100% { rotate: -6deg; translate: 0 0; } 50% { rotate: 7deg; translate: 0 -0.05em; } }
@media (prefers-reduced-motion: reduce) { .herologo .stk, .logo.big .stk, .stkrow > span { animation: none !important; } }
/* The logo's face (owner's painted crying face, 25 Oct) gets a thin white edge like the letters */
.stkrow > .lface img { filter: drop-shadow(0.022em 0 0 #fff) drop-shadow(-0.022em 0 0 #fff) drop-shadow(0 0.022em 0 #fff) drop-shadow(0 -0.022em 0 #fff); }

/* ---------- The crying face with RUNNING tears (owner 25 Oct): cryFace() in js/ui.js. A watery shine slides down the
   painted tears (masked to them by img/faces/*-tears.webp, made by dev/faces/cut.py) and a drop forms at the bottom of
   each tear and drips off. The same shine runs on the CSS crying icons (.ic-sad, .ic-oops). ---------- */
.cryface { position: relative; display: block; width: 100%; height: 100%; }
.cryface > img { display: block; width: 100%; height: 100%; }
.cf-run, .ic-sad::after, .ic-oops::after { position: absolute; inset: 0; pointer-events: none;
  -webkit-mask: url("../img/faces/cry-face-tears.webp") center / 100% 100% no-repeat; mask: url("../img/faces/cry-face-tears.webp") center / 100% 100% no-repeat;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0) 0 38%, rgba(220, 244, 255, 0.45) 45%, rgba(255, 255, 255, 0.72) 49%, rgba(150, 210, 255, 0.3) 54%, rgba(255, 255, 255, 0) 60% 100%) 0 100% / 100% 300% no-repeat,
    linear-gradient(180deg, rgba(255, 255, 255, 0) 0 42%, rgba(235, 250, 255, 0.35) 48%, rgba(255, 255, 255, 0) 56% 100%) 0 100% / 100% 220% no-repeat;
  animation: cfRun 1.6s linear infinite; }
.cryface.badge .cf-run, .ic-sad::after, .ic-oops::after { -webkit-mask-image: url("../img/faces/cry-tears.webp"); mask-image: url("../img/faces/cry-tears.webp"); }
.ic-sad, .ic-oops { position: relative; }
.ic-sad::after, .ic-oops::after { content: ""; }
@keyframes cfRun { from { background-position: 0 100%, 0 100%; } to { background-position: 0 0, 0 0; } }
/* Drops: a little teardrop grows at the end of each tear, hangs, then falls and fades */
.cf-drop { position: absolute; top: 89.7%; width: 8%; height: 8%; margin: -4% 0 0 -4%; pointer-events: none; opacity: 0;
  border-radius: 0 50% 50% 50%; background: radial-gradient(circle at 60% 60%, #F4FBFF 0 10%, #7CCBFF 32%, #2F8FE6 78%, #1E6FC0 100%);
  box-shadow: inset -0.02em -0.02em 0 rgba(10, 60, 140, 0.25); animation: cfDrip 2.4s ease-in infinite; }
.cf-drop.l { left: 24.4%; }
.cf-drop.r { left: 76%; animation-delay: -1.2s; }
.cryface.badge .cf-drop { top: 78.8%; width: 6%; height: 6%; margin: -3% 0 0 -3%; }
.cryface.badge .cf-drop.l { left: 32.3%; }
.cryface.badge .cf-drop.r { left: 67.8%; }
@keyframes cfDrip {
  0% { opacity: 0; transform: translateY(0) rotate(45deg) scale(0.2); }
  12% { opacity: 1; transform: translateY(10%) rotate(45deg) scale(0.6); }
  45% { opacity: 1; transform: translateY(35%) rotate(45deg) scale(1); }
  78% { opacity: 1; transform: translateY(170%) rotate(45deg) scale(0.95); }
  100% { opacity: 0; transform: translateY(240%) rotate(45deg) scale(0.75); }
}
/* The phone's little home button is too small for drops: just the shine */
.homelink .cryface { width: 36px; height: 36px; }
.homelink .cf-drop { display: none; }
@media (prefers-reduced-motion: reduce) { .cf-run, .ic-sad::after, .ic-oops::after { animation: none; background: none; } .cf-drop { display: none; } }
