/* Chess XR — HUD styles (the 3D scene fills the page behind it) */
:root {
  --bg: #0f1115;
  --panel: rgba(20, 22, 28, 0.78);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #ece7df;
  --muted: #9a958c;
  --accent: #e3b665;
  --accent-ink: #1b1408;
  --btn: rgba(255, 255, 255, 0.06);
  --btn-hover: rgba(255, 255, 255, 0.12);
  --danger: #e0645a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; touch-action: none; }
#panel { position: fixed; top: 16px; right: 16px; bottom: 16px; width: 300px; display: flex; flex-direction: column; gap: 12px;
  padding: 18px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 16px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0,0,0,.45); }
h1 { margin: 0; font: 600 20px/1 Georgia, "Times New Roman", serif; letter-spacing: .04em; }
h1 span { color: var(--accent); font: 700 11px/1 ui-sans-serif, system-ui; letter-spacing: .2em; margin-left: 8px; vertical-align: middle;
  padding: 4px 6px; border: 1px solid var(--accent); border-radius: 4px; }
#status { font-size: 16px; font-weight: 600; min-height: 22px; }
#status.over { color: var(--accent); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
label { min-width: 0; }
select { width: 100%; min-width: 0; appearance: none; background: var(--btn) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239a958c'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--text); border: 1px solid var(--panel-border); border-radius: 8px; padding: 8px 28px 8px 10px; font: inherit; font-size: 14px; text-transform: none; letter-spacing: 0; }
select option { background: #1b1d23; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
button { background: var(--btn); color: var(--text); border: 1px solid var(--panel-border); border-radius: 8px; padding: 9px 10px; font: inherit; font-weight: 500; cursor: pointer; transition: background .15s; }
button:hover:not(:disabled) { background: var(--btn-hover); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #f0c77c; }
#think { font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); min-height: 52px; padding: 8px 10px; border-radius: 8px; background: rgba(0,0,0,.25); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
#think b { color: var(--text); font-weight: 600; }
#moves { flex: 1; min-height: 60px; overflow-y: auto; margin: 0; padding: 0; list-style: none; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  display: grid; grid-template-columns: 34px 1fr 1fr; align-content: start; }
#moves .n { color: var(--muted); }
#moves .m { padding: 0 6px; border-radius: 4px; }
#moves .m.last { background: rgba(227, 182, 101, .22); color: #fff; }
.foot { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.foot a { color: var(--muted); }
#evalbar { position: fixed; left: 16px; top: 50%; transform: translateY(-50%); width: 12px; height: 56vh; border-radius: 6px; overflow: hidden;
  background: #26282e; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 6px 24px rgba(0,0,0,.4); }
#evalfill { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: #efe8dc; transition: height .5s cubic-bezier(.2,.8,.2,1); }
#evalbar.flipped #evalfill { bottom: auto; top: 0; }
#evaltext { position: fixed; left: 34px; top: 50%; transform: translateY(-50%); font: 600 12px ui-monospace, Menlo, monospace; color: var(--text); text-shadow: 0 1px 4px #000; }
#toast { position: fixed; left: 50%; top: 24px; transform: translate(-50%, -20px); opacity: 0; pointer-events: none; padding: 12px 20px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--panel-border); backdrop-filter: blur(12px); font-weight: 600; font-size: 16px; transition: all .35s; white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); color: var(--muted); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; transition: opacity .6s; z-index: 5; }
#loading.hide { opacity: 0; pointer-events: none; }
.xr button { display: flex; align-items: center; justify-content: center; gap: 6px; }
kbd { font: 10px ui-monospace, monospace; padding: 1px 4px; border: 1px solid var(--panel-border); border-radius: 3px; }
@media (max-width: 760px) {
  #panel { top: auto; left: 16px; right: 16px; width: auto; bottom: 16px; max-height: 42vh; padding: 12px; gap: 8px; overflow-y: auto; }
  #moves { flex: none; max-height: 90px; }
  #think { min-height: 0; -webkit-line-clamp: 2; }
  #evalbar { height: 36vh; top: 30%; }
  #evaltext { top: 30%; }
  .foot { display: none; }
  h1 { font-size: 17px; }
}
#stage canvas { cursor: default; }
@media (max-height: 760px) and (min-width: 761px) {
  #panel { gap: 8px; padding: 14px; }
  #think { min-height: 0; -webkit-line-clamp: 2; }
}
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--text); cursor: pointer; }
label.check[hidden] { display: none; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }

/* Sidebar header: title + icon buttons, collapsible panel, help popover */
.head { display: flex; align-items: center; gap: 6px; }
.head h1 { flex: 1; }
button.icon { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: 8px; color: var(--muted); }
button.icon:hover, button.icon[aria-expanded="true"]#btn-help { color: var(--text); }
#btn-collapse svg { transition: transform .2s; }
#panel.collapsed { bottom: auto; }
#panel.collapsed > :not(.head) { display: none; }
#panel.collapsed #btn-collapse svg { transform: rotate(180deg); }
#help { position: fixed; top: 16px; right: 332px; width: 300px; max-height: calc(100% - 32px); overflow-y: auto; z-index: 4;
  padding: 16px 18px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 16px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0,0,0,.45); font-size: 13px; }
#help[hidden] { display: none; }
#help h2 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
#help h2:not(:first-child) { margin-top: 14px; }
#help ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
#help dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; }
#help dt { white-space: nowrap; } #help dd { margin: 0; }
@media (max-width: 760px) {
  #help { top: 16px; left: 16px; right: 16px; width: auto; max-height: calc(58vh - 40px); }
}
button.icon[hidden] { display: none; }
#btn-fs .fs-exit, #btn-fs.on .fs-enter { display: none; }
#btn-fs.on .fs-exit { display: block; }

/* Credit / dedication: quiet, sits under everything else */
.credit { display: flex; flex-direction: column; align-items: flex-end; text-align: right; gap: 1px;
  font-size: 11px; line-height: 1.5; color: rgba(236, 231, 223, 0.38); padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.credit .gift { font: italic 12px/1.5 Georgia, "Times New Roman", serif; color: rgba(236, 231, 223, 0.55); letter-spacing: .01em; }
.credit .gift span { color: rgba(227, 182, 101, 0.55); font-style: normal; font-size: 10px; margin-left: 2px; }
.credit a { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, 0.12); transition: color .15s, border-color .15s; }
.credit a:hover { color: var(--muted); border-color: rgba(255, 255, 255, 0.3); }
#help .credit { display: block; text-align: right; margin: 16px 0 0; padding-top: 12px; }
#help .credit .gift { display: block; }
@media (max-width: 760px) { #panel .credit { padding-top: 6px; } }

/* Button icons */
button:not(.icon) { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
button .ic { flex: none; opacity: .75; }
button.primary .ic { opacity: .9; }
button:hover:not(:disabled) .ic { opacity: 1; }
.foot a { display: inline-flex; align-items: center; gap: 4px; }
.foot a .ic { opacity: .8; }
