/* Photo Puzzle — layout and UI chrome.
 * Colors/fonts come from config.js via CSS variables set in src/main.js. */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font, system-ui, sans-serif);
  background: var(--bg, #141c2e);
  color: var(--text, #fff);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

.screen { display: none; min-height: 100dvh; flex-direction: column; align-items: center; padding: 16px; }
.screen.active { display: flex; }

/* start screen */
h1 { font-size: clamp(24px, 6vw, 36px); margin: 8px 0 4px; text-align: center; }
#subtitle { opacity: 0.75; margin-bottom: 18px; text-align: center; }

#gallery {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 8px;
  max-width: 640px;
}
.thumb {
  border: 3px solid transparent;
  border-radius: 12px;
  background: var(--panel);
  padding: 6px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.thumb canvas, .thumb img { border-radius: 8px; display: block; width: 132px; height: 99px; object-fit: cover; }
.thumb span { font-size: 13px; opacity: 0.85; }
.thumb.selected { border-color: var(--primary); }

#upload-btn {
  font: inherit; font-size: 14px;
  background: none; border: 1px dashed rgba(255,255,255,0.35);
  color: var(--text); opacity: 0.85;
  border-radius: 10px; padding: 9px 16px; cursor: pointer;
  margin-bottom: 16px;
}
#upload-input { display: none; }

#difficulties { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 20px; }
.diff {
  font: inherit; font-size: 14px; font-weight: 600;
  background: var(--panel); color: var(--text);
  border: 2px solid transparent; border-radius: 10px;
  padding: 10px 16px; cursor: pointer;
}
.diff.selected { border-color: var(--primary); }

.big-btn {
  font-family: inherit; font-size: 17px; font-weight: 800; letter-spacing: 1px;
  border: 0; border-radius: 12px; padding: 14px 34px;
  background: var(--primary); color: #10131c; cursor: pointer;
  transition: transform 0.1s;
}
.big-btn:active { transform: scale(0.96); }

/* game screen */
#hud {
  width: min(96vw, 900px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 14px;
}
#hud .hud-right { display: flex; gap: 8px; }
#hud button {
  font: inherit; font-size: 13px; font-weight: 600;
  background: var(--panel); color: var(--text);
  border: 1px solid rgba(255,255,255,0.18); border-radius: 8px;
  padding: 7px 12px; cursor: pointer;
}
#hud button.active { border-color: var(--primary); color: var(--primary); }

#board-box {
  width: min(96vw, 900px);
  height: min(72dvh, 640px);
  border-radius: 12px;
  overflow: hidden;
}

/* win overlay */
#win-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 10;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s;
}
#win-overlay.open { opacity: 1; visibility: visible; pointer-events: auto; }
.win-card {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 16px; padding: 28px 24px;
  width: min(92vw, 340px); text-align: center;
  transform: scale(0.85); transition: transform 0.25s ease;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
#win-overlay.open .win-card { transform: scale(1); }
#win-title { font-size: 24px; margin-bottom: 10px; }
#win-time { font-size: 17px; margin-bottom: 6px; }
#win-best { min-height: 20px; font-size: 14px; color: var(--primary); font-weight: 700; margin-bottom: 16px; }

#mute-btn {
  position: fixed; right: 14px; top: 14px;
  width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, 0.12);
  font-size: 20px; cursor: pointer; z-index: 5;
}

/* embed mode (?embed=1): tight chrome for iframes */
body.embed .screen { padding: 8px; }
body.embed h1, body.embed #subtitle { display: none; }
body.embed #board-box { height: min(84dvh, 640px); }
body.embed #mute-btn { right: 6px; top: 6px; width: 34px; height: 34px; font-size: 16px; }
