/* Leonida Character Creator (3D): a game screen with an overlay menu, HUD, and a free-roam mode. */
.gx { position: relative; margin-top: 40px; outline: none; }
.gx-view { position: relative; aspect-ratio: 16 / 9; min-height: 560px; max-height: 86vh; width: 100%; overflow: hidden; background: #0b0414; border: 8px solid #0b0414; box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6); isolation: isolate; }
.gx-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: grab; transition: filter 0.9s var(--ease) 0.4s; }
.gx-view canvas:active { cursor: grabbing; }
.gx[data-mode="roam"] .gx-view canvas { touch-action: none; }
/* film look over the render: a soft vignette */
.gx-view::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(120% 90% at 55% 45%, transparent 55%, rgba(11, 4, 20, 0.55)); }

/* ---------- loading ---------- */
.gx-load { position: absolute; inset: 0; z-index: 6; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; background: radial-gradient(70% 60% at 50% 40%, #3a1452, #0b0414); transition: opacity 0.6s var(--ease), visibility 0.6s; }
.gx[data-state="ready"] .gx-load { opacity: 0; visibility: hidden; }
.gx-load-t { margin: 0; font: 400 clamp(40px, 6vw, 72px)/1 var(--neon); color: #ffe3f0; text-shadow: 0 0 10px var(--pink), 0 0 30px var(--pink); }
.gx-progress { display: block; width: min(320px, 70vw); height: 6px; background: rgba(255, 244, 230, 0.15); }
.gx-progress b { display: block; height: 100%; width: 0; background: var(--cash); transition: width 0.3s; }
.gx-load-tip { margin: 0; color: var(--muted); font-size: 15px; max-width: 40ch; }
.gx[data-state="error"] .gx-progress { display: none; }
.gx.is-busy .gx-view canvas { filter: brightness(0.6) blur(2px); transition-delay: 0s; }

/* ---------- creator HUD ---------- */
.gx-top { position: absolute; top: 16px; right: 20px; z-index: 3; display: flex; align-items: center; gap: 16px; }
.char-wanted { display: flex; gap: 4px; }
.char-wanted svg { width: 26px; height: 26px; fill: transparent; stroke: rgba(255, 244, 230, 0.9); stroke-width: 2.6; filter: drop-shadow(0 2px 0 #000); transition: fill 0.3s; }
.char-wanted svg.is-on { fill: var(--cream); }
.char-tag { font: 800 15px/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; text-shadow: 0 2px 0 #000; }
.gx-plate { position: absolute; right: 24px; bottom: 76px; z-index: 3; width: min(380px, 40%); display: grid; gap: 2px; text-align: right; pointer-events: none; }
.char-name { margin: 0; font: 900 clamp(40px, 4.6vw, 68px)/0.85 var(--display); text-transform: uppercase; text-shadow: 0 3px 0 #000, 0 0 24px rgba(0, 0, 0, 0.5); overflow-wrap: anywhere; }
.char-nick { margin: 0 4px 10px 0; font: 400 clamp(26px, 2.6vw, 38px)/1 var(--neon); color: #ffe3f0; text-shadow: 0 0 8px var(--pink), 0 0 20px var(--pink); }
.char-stats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; text-align: left; }
.char-stats span { display: block; font: 800 12px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255, 244, 230, 0.85); margin-bottom: 5px; text-shadow: 0 1px 0 #000; }
.char-stats i { display: block; height: 6px; background: rgba(255, 244, 230, 0.22); position: relative; }
.char-stats i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--v, 0%); background: var(--cash); transition: width 0.6s var(--ease); }
.char-stats li:last-child i::after { background: var(--pink); }

.gx-poses { position: absolute; right: 20px; bottom: 18px; z-index: 3; display: flex; gap: 4px; }
.gx-poses button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 2px; background: rgba(11, 4, 20, 0.72); color: var(--cream); font: 800 16px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; transition: background 0.2s, color 0.2s; }
.gx-poses button:hover { background: rgba(255, 244, 230, 0.2); }
.gx-poses button[aria-pressed="true"] { background: var(--cream); color: var(--ink); }
.gx-poses button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.gx-hint { position: absolute; z-index: 3; margin: 0; font: 700 13px/1.2 var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255, 244, 230, 0.85); text-shadow: 0 1px 0 #000; pointer-events: none; }
.gx-hint kbd { display: inline-block; margin: 0 4px 0 10px; padding: 3px 6px; border-radius: 2px; background: var(--cream); color: var(--ink); font: 800 12px/1 var(--display); text-shadow: none; }
.gx-hint kbd:first-child { margin-left: 0; }
.gx-hint-create { top: 54px; right: 20px; }

.char-wasted { position: absolute; left: 50%; top: 42%; translate: -50% -50%; margin: 0; z-index: 4; font: 900 clamp(64px, 10vw, 150px)/1 var(--display); text-transform: uppercase; color: #d51b2b; text-shadow: 0 5px 0 #000, 0 0 30px rgba(0, 0, 0, 0.6); opacity: 0; pointer-events: none; }
.gx.is-wasted .gx-view canvas { filter: grayscale(1) brightness(0.72) contrast(1.1); }
.gx.is-wasted .char-wasted { animation: wasted-in 0.6s var(--ease) 1.1s forwards; }
@keyframes wasted-in { from { opacity: 0; transform: scale(1.5); } to { opacity: 1; transform: none; } }

/* ---------- the menu, game style ---------- */
.gx-panel { position: absolute; left: 22px; top: 22px; bottom: 22px; z-index: 4; width: 370px; display: flex; flex-direction: column; background: rgba(8, 3, 16, 0.8); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45); overflow: hidden; }
.gx-head { flex: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; background: linear-gradient(100deg, var(--pink-deep), var(--pink) 60%, #ff7a5a); }
.gx-head span { font: 400 34px/1 var(--neon); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.gx-head b { font: 800 15px/1 var(--display); letter-spacing: 0.1em; color: rgba(255, 255, 255, 0.85); margin-bottom: 4px; }
.gx-panel .cc-names { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 10px 10px 4px; }
.gx-panel .field > span { font-size: 12px; margin-bottom: 0; }
.gx-panel .field { gap: 4px; }
.gx-panel .field input { min-height: 40px; font-size: 19px; padding: 0 10px; }
.cc-menu { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 1px; padding: 6px 0; scrollbar-width: thin; scrollbar-color: rgba(255, 244, 230, 0.3) transparent; }
.cc-row { display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(110px, 1.15fr) 34px; align-items: center; gap: 2px; min-height: 38px; padding: 0 4px 0 14px; transition: background 0.15s, color 0.15s; }
.cc-row:hover, .cc-row:focus-visible, .cc-row:focus-within { background: var(--cream); outline: none; }
.cc-row:hover .cc-label, .cc-row:focus-within .cc-label, .cc-row:focus-visible .cc-label,
.cc-row:hover .cc-val, .cc-row:focus-within .cc-val, .cc-row:focus-visible .cc-val,
.cc-row:hover .cc-arrow, .cc-row:focus-within .cc-arrow, .cc-row:focus-visible .cc-arrow { color: var(--ink); }
.cc-label { font: 800 15px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.cc-val { text-align: center; font: 900 18px/1 var(--display); text-transform: uppercase; color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-arrow { width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: transparent; color: var(--cream); cursor: pointer; border-radius: 2px; }
.cc-arrow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.cc-arrow:hover { background: var(--ink); color: var(--cream) !important; }
.cc-arrow:active { transform: scale(0.9); }
.cc-colors { grid-template-columns: minmax(0, 0.85fr) minmax(0, 2fr); padding-block: 5px; }
.cc-sw { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.cc-sw button { width: 22px; height: 22px; border: 2px solid rgba(0, 0, 0, 0.45); background: var(--c); cursor: pointer; outline: 2px solid transparent; outline-offset: 1px; transition: transform 0.15s var(--ease); }
.cc-sw button:hover { transform: scale(1.15); }
.cc-sw button[aria-pressed="true"] { outline-color: var(--yellow); }
.cc-row:hover .cc-sw button[aria-pressed="true"], .cc-row:focus-within .cc-sw button[aria-pressed="true"] { outline-color: var(--ink); }
.gx-desc { flex: none; margin: 0; padding: 10px 14px 12px; border-top: 1px solid rgba(255, 244, 230, 0.12); font-size: 14px; line-height: 1.4; color: var(--muted); min-height: 3.2em; }

.gx-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.gx-bar .btn { flex: 1 1 auto; }
.gx-bar .gx-play { flex: 2 1 260px; font-size: 20px; }
.gx-fine { margin-top: 12px; }

/* ---------- free roam ---------- */
.gx-roam { display: none; }
.gx[data-mode="roam"] .gx-roam { display: block; }
.gx[data-mode="roam"] :is(.gx-panel, .gx-plate, .gx-poses, .gx-hint-create, .gx-top, .char-wasted, .gx-bar) { display: none; }
.gx-radar { position: absolute; left: 22px; bottom: 22px; z-index: 3; width: 150px; height: 150px; border-radius: 50%; overflow: hidden; background: radial-gradient(circle, rgba(25, 211, 197, 0.18), rgba(11, 4, 20, 0.75) 70%); border: 3px solid rgba(255, 244, 230, 0.85); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
.gx-radar::before { content: ""; position: absolute; inset: 0; background: conic-gradient(from 0deg, rgba(141, 255, 169, 0.25), transparent 25%); animation: sweep 3s linear infinite; }
@keyframes sweep { to { transform: rotate(1turn); } }
.gx-me { position: absolute; left: 50%; top: 50%; width: 0; height: 0; translate: -50% -60%; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 14px solid var(--cream); z-index: 2; }
.gx-dot { position: absolute; left: calc(50% - 5px); top: calc(50% - 5px); width: 10px; height: 10px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.gx-coins { position: absolute; top: 18px; left: 22px; z-index: 3; margin: 0; font: 900 30px/1 var(--display); text-transform: uppercase; color: var(--cream); text-shadow: 0 3px 0 #000; }
.gx-coins b { color: var(--gold); font-size: 44px; }
.gx.is-pop .gx-coins b { display: inline-block; animation: pop 0.45s var(--ease); }
@keyframes pop { 40% { transform: scale(1.5); color: var(--cash); } }
.gx-hint-roam { left: 50%; translate: -50% 0; bottom: 20px; white-space: nowrap; }
.gx-exit { position: absolute; top: 16px; right: 18px; z-index: 3; min-height: 42px; padding: 0 16px; border: 0; border-radius: 2px; background: var(--cream); color: var(--ink); font: 800 16px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
.gx-exit:hover { background: var(--pink); color: #fff; }
.gx-stick { position: absolute; z-index: 3; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 3px solid rgba(255, 244, 230, 0.6); background: rgba(11, 4, 20, 0.35); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.gx-stick.is-on { opacity: 1; }
.gx-stick i { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: var(--cream); }
.gx-pad { display: none; position: absolute; right: 14px; bottom: 14px; z-index: 3; grid-template-columns: repeat(2, 64px); gap: 8px; }
.gx-pad button { width: 64px; height: 64px; border-radius: 50%; border: 3px solid rgba(255, 244, 230, 0.75); background: rgba(11, 4, 20, 0.55); color: var(--cream); font: 800 13px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; touch-action: none; }
.gx-pad button:active, .gx-pad button[aria-pressed="true"] { background: var(--pink); border-color: var(--pink); }
.gx.is-touch .gx-pad { display: grid; }
.gx.is-touch .gx-hint-roam { display: none; }
.gx.is-touch .gx-radar { width: 110px; height: 110px; top: 70px; bottom: auto; left: 14px; }
@media (pointer: coarse) {
  .gx-pad { display: grid; }
  .gx-hint-roam { display: none; }
  .gx-radar { width: 110px; height: 110px; top: 70px; bottom: auto; left: 14px; }
}

/* ---------- smaller screens: the screen on top, the menu below ---------- */
@media (max-width: 1020px) {
  .gx-view { aspect-ratio: 4 / 5; min-height: 0; max-height: 78vh; border-width: 6px; }
  .gx[data-mode="roam"] .gx-view { aspect-ratio: 3 / 4; }
  .gx-panel { position: static; width: auto; margin-top: 12px; backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(8, 3, 16, 0.6); }
  .cc-menu { overflow: visible; }
  .cc-row { min-height: 48px; grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1.2fr) 42px; }
  .cc-arrow { width: 42px; height: 42px; }
  .cc-sw button { width: 28px; height: 28px; }
  .gx-top { left: 14px; right: 14px; top: 12px; justify-content: space-between; }
  .gx-hint-create { display: none; }
  .gx-plate { left: 16px; right: 16px; width: auto; bottom: 66px; text-align: left; }
  .char-nick { margin-left: 4px; }
  .gx-poses { left: 10px; right: 10px; bottom: 10px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .gx-poses button { flex: 1 0 auto; padding: 0 10px; font-size: 14px; min-height: 44px; }
}
@media (max-width: 480px) {
  .gx-panel .cc-names { grid-template-columns: minmax(0, 1fr); }
  .cc-colors { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-block: 10px; }
  .cc-sw { justify-content: flex-start; }
  .char-stats { gap: 6px; }
  .char-stats span { font-size: 10px; letter-spacing: 0.04em; }
  .gx-coins { font-size: 22px; }
  .gx-coins b { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .gx-radar::before { animation: none; }
  .gx.is-wasted .char-wasted { animation-duration: 0.01s; }
}

/* ---------- mobile fixes from the audit ---------- */
@media (max-width: 1020px) {
  .cc-row.cc-colors { grid-template-columns: minmax(0, 0.85fr) minmax(0, 2fr); }
  .cc-sw { gap: 6px; }
  .cc-sw button { width: 36px; height: 36px; position: relative; }
  .cc-sw button::before { content: ""; position: absolute; inset: -4px; }
  .gx-panel .field input { min-height: 46px; font-size: 18px; }
}
@media (max-width: 480px) {
  .cc-row.cc-colors { grid-template-columns: minmax(0, 1fr); }
  .gx-poses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; overflow: visible; }
  .gx-poses button { min-height: 42px; padding: 0 4px; font-size: 13px; }
  .gx-plate { bottom: 108px; }
  .char-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; }
  .char-stats span { font-size: 11px; letter-spacing: 0.06em; }
  .char-tag { font-size: 12px; letter-spacing: 0.08em; white-space: nowrap; }
  .gx-exit { padding: 0 12px; font-size: 13px; min-height: 44px; right: 10px; top: 10px; }
  .gx-coins { left: 14px; top: 14px; }
}

/* the menu shares the 3D view's grid cell on wide screens, so it can never run over the button bar */
.gx { display: grid; grid-template-columns: minmax(0, 1fr); }
.gx-view { grid-area: 1 / 1; }
.gx-panel { grid-area: 1 / 1; position: relative; inset: auto; margin: 22px; align-self: stretch; justify-self: start; contain: size; }
.gx-bar { grid-area: 2 / 1; }
@media (max-width: 1020px) {
  .gx-panel { grid-area: 2 / 1; contain: none; margin: 12px 0 0; justify-self: stretch; }
  .gx-bar { grid-area: 3 / 1; }
}
