.logo { color: var(--sun); }
.waiting-text { margin: 12px 0 0; text-align: center; color: var(--muted); }

.game {
  --size: min(100vw - 16px, 100dvh - 290px, 560px);
  position: fixed;
  inset: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: var(--size);
  grid-auto-rows: min-content;
  justify-content: center;
  align-content: start;
  gap: 6px;
  padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  background: linear-gradient(160deg, #2b1d3f, var(--night) 65%);
}

.bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 40px; }
.who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.who .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #3ddc84; }
.online.off { background: #ff5a36; }

.clock {
  flex: none;
  min-width: 78px;
  padding: 5px 10px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--panel);
  border-radius: 6px;
}
.clock:empty { display: none; }
.clock.active { color: #1d0f0a; background: var(--ink); }
.clock.low { color: #fff; background: #d92f12; }

.board-wrap { position: relative; width: var(--size); height: var(--size); }
.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
  touch-action: manipulation;
}
.board.hidden-3d { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.board3d-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: pointer; touch-action: pan-y; }

.sq {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 0;
  font: inherit;
  cursor: pointer;
  background: #ecdcbc;
  color: #8a5c3b;
  -webkit-appearance: none;
  appearance: none;
}
.sq.dark { background: #a8744f; color: #f3e6cb; }
.sq.last { box-shadow: inset 0 0 0 100px rgba(255, 194, 61, .42); }
.sq.selected { box-shadow: inset 0 0 0 100px rgba(255, 194, 61, .75); }
.sq.check { box-shadow: inset 0 0 0 100px rgba(226, 40, 20, .72); }

.sq .coord {
  position: absolute;
  font-size: clamp(8px, 2.2vmin, 12px);
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}
.sq .rank { top: 3px; left: 3px; }
.sq .file { bottom: 3px; right: 3px; }

.piece { position: absolute; inset: 4%; z-index: 1; pointer-events: none; }
.piece svg { display: block; width: 100%; height: 100%; }

svg.white { fill: #fff8ea; stroke: #2a2233; }
svg.black { fill: #2b2435; stroke: #f4e7cf; }
svg.white, svg.black { stroke-width: 3; stroke-linejoin: round; }
svg.white .detail { fill: #2a2233; stroke: none; }
svg.black .detail { fill: #f4e7cf; stroke: none; }
svg .line { fill: none; stroke-width: 4; stroke-linecap: round; }

.sq.target::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 35%;
  border-radius: 50%;
  background: rgba(30, 24, 45, .42);
  pointer-events: none;
}
.sq.capture::after {
  inset: 5%;
  background: transparent;
  border: 5px solid rgba(30, 24, 45, .5);
}

.promo {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  background: rgba(10, 8, 16, .68);
}
.promo button {
  width: 22%;
  aspect-ratio: 1;
  padding: 6%;
  background: #a8744f;
  border: 2px solid var(--sun);
  border-radius: 8px;
  cursor: pointer;
}
.promo svg { display: block; width: 100%; height: 100%; pointer-events: none; }

.side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.status { margin: 0; min-height: 1.3em; font-weight: 700; color: var(--sun); text-align: center; }

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  background: var(--panel);
  border: 2px solid var(--sun);
  border-radius: 8px;
}

.moves {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  white-space: nowrap;
  min-height: 24px;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  scrollbar-width: none;
}
.moves b { color: var(--ink); font-weight: 700; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.result { padding: 10px 12px; background: var(--panel); border-left: 4px solid var(--sun); border-radius: 6px; }
.result h2 { margin: 0; color: var(--sun); font-size: 22px; font-weight: 900; font-style: italic; letter-spacing: 0; text-transform: none; }
.result p { margin: 2px 0 10px; color: var(--muted); }

@media (orientation: landscape) and (min-width: 700px) {
  .game {
    --size: min(100dvh - 16px, 62vw, 760px);
    grid-template-columns: var(--size) minmax(220px, 340px);
    grid-template-rows: min-content 1fr min-content;
    grid-template-areas: "board opp" "board side" "board me";
    gap: 6px 16px;
    align-content: center;
    padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
  }
  .board-wrap { grid-area: board; }
  .opp { grid-area: opp; }
  .me { grid-area: me; }
  .side { grid-area: side; justify-content: center; overflow-y: auto; }
}
