/* Play page layout */
html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100%;
  width: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background-color: #f4f6f9;
}

body {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Top chrome: links + status stay out of the game layer (no overlap with board / parking). */
.checkmate-chrome {
  flex-shrink: 0;
  z-index: 20;
  padding: max(0.45rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) 0.55rem max(1rem, env(safe-area-inset-left, 0px));
  background: linear-gradient(to bottom, rgba(244, 246, 249, 0.98), rgba(244, 246, 249, 0.9));
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.checkmate-chrome__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

#hub_to_home {
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
  font-size: clamp(0.85rem, 2.5vw, 0.95rem);
  color: #1565c0;
  text-decoration: none;
  font-weight: 600;
}

#hub_to_home:hover {
  text-decoration: underline;
}

#checkmate_nav_links {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  font-size: clamp(0.8rem, 2.4vw, 0.92rem);
}

#checkmate_nav_links a {
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
  color: #1565c0;
  text-decoration: none;
  font-weight: 600;
}

#checkmate_nav_links a:hover {
  text-decoration: underline;
}

#game-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1rem;
  margin-top: 0.55rem;
  max-width: 100%;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-sizing: border-box;
}

@media (min-width: 28rem) {
  #game-hud {
    align-items: center;
  }

  #checkmate-timer {
    margin-left: auto;
  }
}

.game-hud--paused #checkmate-timer {
  opacity: 0.72;
}

.game-hud--solved {
  border-left: 4px solid #22c55e;
  background: rgba(240, 253, 244, 0.95);
}

.checkmate-puzzle-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    flex: 0 0 100%;
}

#checkmate-status {
    font-size: clamp(0.9rem, 2.8vw, 1.2rem);
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
    flex: 1 1 12rem;
  min-width: 0;
}

.game-hud--solved #checkmate-status {
  color: #15803d;
}

#checkmate-timer {
  font-size: clamp(1rem, 3.2vw, 1.45rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}

#game-container {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

#board_img {
  max-width: 90vmin;
  height: auto;
  display: block;
  z-index: 1;
}

.pause-control {
  position: absolute;
  z-index: 2;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  line-height: 0;
}

.pause-control:focus-visible {
  outline: 2px solid #1565c0;
  outline-offset: 3px;
}

.pause-control img {
  display: block;
  user-select: none;
}

img {
  user-select: none;
}

.dropspot {
  position: absolute;
  z-index: 1;
  pointer-events: none;
}

@media (orientation: landscape) {
  body {
    flex-direction: row;
    align-items: stretch;
  }

  .checkmate-chrome {
    align-self: stretch;
    width: min(18rem, 40vw);
    max-width: 100%;
    box-sizing: border-box;
    padding:
      max(0.45rem, env(safe-area-inset-top, 0px))
      max(0.65rem, env(safe-area-inset-right, 0px))
      max(0.55rem, env(safe-area-inset-bottom, 0px))
      max(1rem, env(safe-area-inset-left, 0px));
    border-bottom: none;
    border-right: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 2px 0 10px rgba(15, 23, 42, 0.06);
    background: linear-gradient(
      to right,
      rgba(244, 246, 249, 0.98),
      rgba(244, 246, 249, 0.9)
    );
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
  }

  .checkmate-chrome__nav {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.5rem;
  }

  #hub_to_home {
    text-align: center;
  }

  #checkmate_nav_links {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.45rem;
  }

  #checkmate_nav_links a {
    text-align: center;
  }

  #game-hud {
    flex-direction: column;
    align-items: stretch;
    margin-top: 0.75rem;
    gap: 0.35rem;
  }

  #checkmate-status {
    flex: 0 1 auto;
  }

  #checkmate-timer {
    margin-left: 0;
  }

  #game-container {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    width: auto;
  }
}
