/* ================= GGGL Chess ================= */
.chess-page { max-width: var(--wrap); margin: 0 auto; padding: 16px 24px 40px; width: 100%; }
.muted { color: var(--haze); margin: 0; }
[hidden] { display: none !important; }

/* ---------- Holli ---------- */
.lobby-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.lobby-head h1 { font: 700 clamp(32px, 6vw, 48px)/1 var(--display); margin: 8px 0 8px; }
.lobby-head .sub { color: var(--haze); margin: 0; }
.my-rating {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: var(--r); background: var(--deck); border: 1px solid var(--rail);
}
.my-rating b { font: 700 26px/1 var(--display); color: var(--gold); }
.my-rating small { display: block; color: var(--haze); font-size: 12px; }

.resume { margin-bottom: 16px; display: grid; gap: 8px; }
.resume a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-radius: var(--r-sm); text-decoration: none;
  background: linear-gradient(90deg, rgba(255,194,75,.18), var(--deck)); border: 1px solid rgba(255,194,75,.5);
  font-weight: 700;
}
.resume a span:last-child { color: var(--gold); }

.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mode-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px; border-radius: var(--r);
  background: linear-gradient(180deg, var(--deck-2), var(--deck)); border: 1px solid var(--rail);
}
.mode-card header { display: flex; gap: 12px; align-items: flex-start; }
.mode-card h2 { margin: 0; font: 700 19px/1.2 var(--display); }
.mode-card header p { margin: 4px 0 0; color: var(--haze); font-size: 14px; }
.mc-icon { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--ink); border: 1px solid var(--rail); font-size: 20px; }
.mode-card .btn.primary { margin-top: auto; }

.tc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tc {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 8px; border-radius: var(--r-sm);
  background: var(--ink); border: 1px solid var(--rail); color: var(--chalk); cursor: pointer;
  font: 700 20px/1 var(--display);
  transition: border-color .12s, transform .12s;
}
.tc small { font: 700 11px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--haze); }
.tc:hover { border-color: var(--accent); }
.tc:active { transform: scale(.98); }
.tc:disabled { opacity: .45; cursor: default; }

.field-row { display: grid; gap: 6px; }
.field-row label { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--haze); }
.seg.small button { padding: 8px 6px; font-size: 13px; }
.join { display: flex; gap: 8px; }
.join input {
  flex: 1; min-width: 0; padding: 12px; border-radius: var(--r-sm);
  border: 1px solid var(--rail); background: var(--ink); color: var(--chalk);
  font: 700 15px var(--body); letter-spacing: .08em; text-transform: uppercase;
}
.join input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 500; }
.need-login { margin: 0; font-size: 14px; color: var(--haze); }
.need-login a { color: var(--gold); }

.seek { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--ink); border: 1px solid var(--rail); }
.seek small { display: block; color: var(--haze); font-size: 12px; }
.seek .btn { margin-left: auto; padding: 8px 12px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--rail); border-top-color: var(--gold); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.recent { margin-top: 24px; }
.recent h2 { font: 700 20px/1.2 var(--display); margin: 0 0 12px; }
.recent ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.recent li a {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center;
  padding: 10px 14px; border-radius: var(--r-sm); background: var(--deck); text-decoration: none; font-size: 14px;
}
.res-badge { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.res-badge.win { background: rgba(83,224,138,.18); color: var(--ok); }
.res-badge.loss { background: rgba(255,90,110,.18); color: var(--danger); }
.res-badge.draw { background: rgba(141,149,201,.2); color: var(--haze); }
.recent .dl { font: 700 13px var(--display); }
.recent .dl.up { color: var(--ok); } .recent .dl.down { color: var(--danger); }
.recent .when { color: var(--haze); font-size: 12px; }

/* ---------- Loja ---------- */
.play { display: flex; gap: 24px; justify-content: center; align-items: flex-start; }
.side { width: 340px; flex: none; }
.board-col { display: flex; flex-direction: column; gap: 8px; width: min(100%, calc(100dvh - 300px), 720px); min-width: 280px; flex: none; }
.board-wrap { position: relative; width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden; box-shadow: 0 30px 60px -30px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.06); }

.cboard { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; position: relative; }
.sq { position: relative; display: grid; place-items: center; }
.sq.light { background: #DCE3F7; }
.sq.dark { background: #7082C6; }
.sq.last.light { background: #F4E3A6; }
.sq.last.dark { background: #C9AE5E; }
.sq.sel { box-shadow: inset 0 0 0 4px rgba(108,140,255,.95); }
.sq.check { background: radial-gradient(circle, #FF5A6E 0%, rgba(255,90,110,.7) 35%, transparent 75%) !important; }
.sq.dot::after { content: ''; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(11,16,38,.32); pointer-events: none; }
.sq.cap::after { content: ''; position: absolute; inset: 4%; border-radius: 50%; border: 5px solid rgba(11,16,38,.35); pointer-events: none; }
.sq.hover { box-shadow: inset 0 0 0 4px rgba(255,255,255,.75); }
.coord { position: absolute; font: 800 11px/1 var(--body); pointer-events: none; }
.coord.rank { top: 4px; left: 4px; }
.coord.file { bottom: 3px; right: 5px; }
.sq.light .coord { color: #7082C6; } .sq.dark .coord { color: #DCE3F7; }
.pc { width: 100%; height: 100%; position: relative; z-index: 1; cursor: grab; pointer-events: none; }
.pc.lifted { opacity: .3; }
svg.ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; filter: drop-shadow(0 8px 10px rgba(0,0,0,.45)); }

.promo-shade { position: absolute; inset: 0; background: rgba(11,16,38,.55); z-index: 5; }
.promo { position: absolute; z-index: 6; display: flex; flex-direction: column; background: #F2F4FF; border-radius: 8px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.promo[style*="bottom"] { flex-direction: column-reverse; }
.promo button { border: 0; background: transparent; padding: 0; cursor: pointer; display: block; }
.promo button:hover { background: #C9D3F5; }
.promo svg { width: 100%; height: 100%; }

.pbar {
  display: flex; align-items: center; gap: 10px; min-height: 48px;
  padding: 6px 8px 6px 10px; border-radius: 12px; background: var(--deck); border: 1px solid var(--rail);
}
.pbar .avatar { width: 28px; height: 28px; }
.pbar .who { min-width: 0; flex: 1; }
.pbar .nm { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.pbar .rt { color: var(--haze); font-size: 12px; font-weight: 700; }
.pbar .taken { font-size: 15px; letter-spacing: -2px; color: var(--haze); white-space: nowrap; }
.clock {
  min-width: 96px; padding: 8px 12px; border-radius: 10px; text-align: right;
  background: var(--ink); color: var(--haze); font: 700 22px/1 var(--display); font-variant-numeric: tabular-nums;
}
.clock.on { background: var(--chalk); color: var(--ink); }
.clock.low.on { background: var(--danger); color: #fff; }
.pbar.turn { border-color: var(--gold); }

.side { display: flex; flex-direction: column; gap: 12px; }
.status { padding: 14px 16px; border-radius: var(--r-sm); background: var(--deck); border: 1px solid var(--rail); font-weight: 700; min-height: 52px; }
.status small { display: block; color: var(--haze); font-weight: 500; font-size: 13px; margin-top: 2px; }
.offer { display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--r-sm); background: rgba(255,194,75,.12); border: 1px solid rgba(255,194,75,.5); font-weight: 700; }
.offer div { display: flex; gap: 8px; }
.offer .btn { padding: 10px 14px; font-size: 14px; }
.moves {
  list-style: none; margin: 0; padding: 8px; max-height: min(46vh, 420px); min-height: 120px; overflow-y: auto;
  border-radius: var(--r-sm); background: var(--deck); border: 1px solid var(--rail);
  display: grid; grid-template-columns: 38px 1fr 1fr; align-content: start; gap: 2px 4px; font-size: 14px;
}
.moves li { display: contents; }
.moves .n { color: var(--haze); padding: 5px 0 5px 6px; font-size: 12px; }
.moves .m { padding: 5px 8px; border-radius: 6px; font-weight: 700; }
.moves .m.cur { background: var(--deck-2); color: var(--gold); }
.moves .empty { grid-column: 1 / -1; color: var(--haze); padding: 8px; font-weight: 500; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.controls .btn { flex: 1 1 auto; padding: 11px 12px; font-size: 14px; }

.invite, .result { text-align: center; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; padding: 12px; border-radius: var(--r-sm); border: 1px solid var(--rail); background: var(--ink); color: var(--chalk); font: 600 13px var(--body); }
.code { color: var(--gold); letter-spacing: .12em; font-family: var(--display); }
.result h3 { font-size: 28px; }
.delta { margin: 0; font: 700 18px var(--display); }
.delta.up { color: var(--ok); } .delta.down { color: var(--danger); }
.eyebrow { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--haze); }

@media (max-width: 1000px) {
  .mode-grid { grid-template-columns: 1fr 1fr; }
  .mode-grid .mode-card:first-child { grid-column: 1 / -1; }
  .play { flex-direction: column; align-items: center; }
  .board-col { width: min(100%, calc(100dvh - 230px), 640px); }
  .side { width: min(100%, 640px); margin: 0 auto; }
  .moves { max-height: 180px; }
}
@media (max-width: 620px) {
  .chess-page { padding: 8px 12px 32px; }
  .mode-grid { grid-template-columns: 1fr; }
  .board-col { width: 100%; min-width: 0; }
  .clock { min-width: 84px; font-size: 19px; }
  .tc { padding: 14px 6px; font-size: 18px; }
}
.report-link { text-align: center; color: var(--haze); font-size: 13px; }
.report-link:hover { color: var(--chalk); }
