/* ── Screens ───────────────────────────────────────────────── */
.sg-screen {
  align-self: stretch;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.sg-hidden {
  display: none !important;
}

/* ── Difficulty Screen ─────────────────────────────────────── */
.sg-screen-difficulty {
  justify-content: center;
  gap: 2rem;
  padding: 0 60px 60px;
}

.sg-subtitle {
  font-size: 3rem;
  color: ivory;
  font-family: monospace;
  opacity: 0.85;
}

.sg-diff-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
}

.sg-diff-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 3rem;
  padding: 2.5rem 4rem;
  border: none;
  border-radius: 2rem;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sg-diff-btn:hover {
  transform: scale(1.025);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.45);
}

.sg-diff-btn:nth-child(1) { background: #E9C46A; }
.sg-diff-btn:nth-child(2) { background: #81B29A; }
.sg-diff-btn:nth-child(3) { background: #7B9BB8; }
.sg-diff-btn:nth-child(4) { background: #E07A5F; }
.sg-diff-btn:nth-child(5) { background: #C8704E; }

.sg-diff-emoji {
  font-size: 6rem;
  line-height: 1;
}

.sg-diff-label {
  font-family: 'Chelsea Market', monospace;
  font-size: 5rem;
  color: white;
  text-shadow: -2px 3px 8px rgba(0, 0, 0, 0.25);
  flex: 1;
  text-align: left;
}

.sg-diff-info {
  font-size: 2.5rem;
  color: rgba(255, 255, 255, 0.85);
  font-family: monospace;
}

/* ── Loading Screen ────────────────────────────────────────── */
.sg-screen-loading {
  justify-content: center;
  align-items: center;
}

.sg-spinner {
  width: 120px;
  height: 120px;
  border: 12px solid rgba(233, 196, 106, 0.2);
  border-top-color: #E9C46A;
  border-radius: 50%;
  animation: sg-spin 0.85s linear infinite;
}

@keyframes sg-spin {
  to { transform: rotate(360deg); }
}

/* ── Game Screen ───────────────────────────────────────────── */
.sg-screen-game {
  justify-content: flex-start;
  padding: 0 20px 20px;
}

.sg-topbar {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  flex-shrink: 0;
}

.sg-topbar-title {
  font-family: 'Chelsea Market', monospace;
  font-size: 3rem;
  color: #E9C46A;
  text-shadow: -2px 2px 8px rgba(0, 0, 0, 0.4);
}

.sg-moves {
  font-family: 'Chelsea Market', monospace;
  font-size: 2.8rem;
  color: ivory;
  background: rgb(8, 50, 0);
  padding: 0.6rem 2rem;
  border-radius: 1rem;
  border: 3px solid #E9C46A;
}

.sg-solution-btn {
  font-family: 'Chelsea Market', monospace;
  font-size: 2.2rem;
  color: rgb(8, 50, 0);
  background: #E9C46A;
  border: none;
  border-radius: 0.75rem;
  padding: 0.5rem 1.5rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.sg-solution-btn:hover {
  background: #f0d07a;
  transform: scale(1.04);
}

.sg-change-diff-btn {
  font-family: 'Chelsea Market', monospace;
  font-size: 2.2rem;
  color: ivory;
  background: rgb(8, 50, 0);
  border: 2px solid rgba(233, 196, 106, 0.5);
  border-radius: 0.75rem;
  padding: 0.5rem 1.5rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.sg-change-diff-btn:hover {
  background: rgb(12, 70, 0);
  border-color: #E9C46A;
  transform: scale(1.04);
}

/* ── Board ─────────────────────────────────────────────────── */
.sg-board-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.sg-board {
  position: relative;
  background: rgb(8, 50, 0);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 0 4px rgba(233, 196, 106, 0.3);
  transition: z-index 0s, box-shadow 700ms ease;
}

.sg-board.sg-win-active {
  z-index: 51;
  box-shadow: 0 0 80px rgba(233, 196, 106, 0.25), 0 0 0 4px rgba(233, 196, 106, 0.5);
}

/* ── Full-screen win darkness (cobre tudo exceto o board) ─── */
.sg-full-dark {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 700ms ease;
}

.sg-full-dark.sg-visible {
  opacity: 1;
}

/* ── Solution Overlay ──────────────────────────────────────── */
.sg-solution-overlay {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 350ms ease;
  z-index: 10;
  border-radius: 0.75rem;
}

.sg-solution-overlay.sg-visible {
  opacity: 1;
  pointer-events: auto;
}

.sg-solution-close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 3.5rem;
  line-height: 1;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: ivory;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.sg-solution-close:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

/* ── Win dark overlay (inside board, behind pieces) ────────── */
.sg-win-dark {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 700ms ease;
  z-index: 1;
}

.sg-win-dark.sg-visible {
  opacity: 1;
}

/* ── Pieces ────────────────────────────────────────────────── */
.sg-piece {
  position: absolute;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  z-index: 2;
}

.sg-piece:hover {
  box-shadow: inset 0 0 0 4px rgba(233, 196, 106, 0.85);
  z-index: 3;
}

.sg-piece.sg-moveable {
  box-shadow: inset 0 0 0 3px rgba(233, 196, 106, 0.4);
}

.sg-piece.sg-moveable:hover {
  box-shadow: inset 0 0 0 4px rgba(233, 196, 106, 0.9);
}

/* ── Overlays ──────────────────────────────────────────────── */
.sg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  backdrop-filter: blur(4px);
}

/* ── Confirm ───────────────────────────────────────────────── */
.sg-confirm-card {
  width: 680px;
  background: ivory;
  border-radius: 2rem;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.55);
  padding: 5rem 5rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  border: 8px solid #E9C46A;
}

.sg-confirm-title {
  font-family: 'Chelsea Market', monospace;
  font-size: 4rem;
  color: #5a4c29;
  text-align: center;
}

.sg-confirm-sub {
  font-size: 2.5rem;
  color: #5a4c29;
  font-family: monospace;
  text-align: center;
  opacity: 0.6;
}

.sg-confirm-buttons {
  display: flex;
  gap: 2.5rem;
  margin-top: 1rem;
}

.sg-confirm-cancel,
.sg-confirm-ok {
  font-family: 'Chelsea Market', monospace;
  font-size: 3rem;
  padding: 1.25rem 4rem;
  border: none;
  border-radius: 1.25rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.sg-confirm-cancel { background: #ccc; color: #444; }
.sg-confirm-ok {
  background: #E07A5F;
  color: white;
  text-shadow: -1px 1px 4px rgba(0, 0, 0, 0.2);
}

.sg-confirm-cancel:hover,
.sg-confirm-ok:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

/* ── Win Card ──────────────────────────────────────────────── */
.sg-win-card {
  width: 740px;
  background: ivory;
  border-radius: 2rem;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.55);
  padding: 4rem 5rem 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  border: 8px solid #E9C46A;
}

/* ── Win photo (polaroid with paper clip) ──────────────────── */
.sg-win-photo-wrap {
  position: relative;
  padding-top: 3.5rem;
  animation: sg-photo-drop 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes sg-photo-drop {
  from { transform: translateY(-24px) rotate(-4deg); opacity: 0; }
  to   { transform: translateY(0)     rotate(-1.5deg); opacity: 1; }
}

.sg-win-photo-wrap::before {
  content: '📎';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(-90deg);
  font-size: 7.5rem;
  line-height: 1;
  z-index: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}

.sg-win-photo {
  background: white;
  padding: 12px 12px 52px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
  rotate: -1.5deg;
  display: inline-block;
}

.sg-win-photo-img {
  display: block;
  width: 536px;
  height: 536px;
}

.sg-win-heading {
  margin: 0;
  font-size: 6rem;
  background-color: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  color: #5a4c29;
  text-shadow: none;
}

.sg-win-msg {
  font-size: 2.8rem;
  color: #5a4c29;
  font-family: monospace;
  text-align: center;
  opacity: 0.7;
}

.sg-win-buttons {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2rem;
  margin-top: 1rem;
  width: 100%;
}

.sg-replay-btn {
  font-family: 'Chelsea Market', monospace;
  font-size: 3.5rem;
  padding: 1.5rem 5rem;
  background: #81B29A;
  color: white;
  border: none;
  border-radius: 1.5rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-shadow: -1px 1px 5px rgba(0, 0, 0, 0.2);
}

.sg-diff-change-btn {
  font-family: 'Chelsea Market', monospace;
  font-size: 2.8rem;
  padding: 1.25rem 4rem;
  background: none;
  color: #5a4c29;
  border: 3px solid rgba(90, 76, 41, 0.35);
  border-radius: 1.25rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  text-align: center;
}

.sg-replay-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.sg-diff-change-btn:hover {
  transform: scale(1.03);
  background: rgba(90, 76, 41, 0.07);
  border-color: rgba(90, 76, 41, 0.6);
}
