/* Spot the Difference — dark, warm, friendly. */

:root {
  --bg: #16130e;
  --panel: #211c14;
  --panel-2: #2b2418;
  --line: #3a3122;
  --text: #f3ecdd;
  --muted: #b5a98e;
  --accent: #ffb02e;
  --accent-2: #ff7a59;
  --good: #39d98a;
  --bad: #ff5d5d;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

#app { height: 100dvh; display: flex; flex-direction: column; }

.screen { display: none; flex: 1; min-height: 0; }
.screen.active { display: flex; flex-direction: column; }

/* ---------- buttons ---------- */
button {
  font: inherit;
  color: var(--text);
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 12px 18px;
  cursor: pointer;
}
button:active { transform: scale(0.97); }
.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #221506;
  font-weight: 700;
  border: none;
}
.ghost { background: transparent; }
.big { font-size: 1.15rem; padding: 16px 26px; }
.slim { padding: 8px 12px; }

/* ---------- home / center screens ---------- */
.home-inner, .center-inner {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px;
  max-width: 420px;
  text-align: center;
}
.home-mark, .big-emoji { font-size: 56px; }
h1 { font-size: 1.7rem; }
.tagline { color: var(--muted); }
.howto {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 16px 36px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
}
.howto b { color: var(--text); }

/* ---------- bars & badges ---------- */
.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.bar.bottom {
  border-bottom: none;
  border-top: 1px solid var(--line);
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  justify-content: center;
}
.bar-title { flex: 1; text-align: center; font-weight: 600; }
.badge {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  white-space: nowrap;
}
.badge.miss { color: var(--bad); }

/* ---------- edit screen ---------- */
.canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 8px;
}
#edit-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  touch-action: none;
}
#clone-marker {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px dashed var(--accent);
  border-radius: 50%;
  pointer-events: none;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.tools { display: flex; gap: 8px; }
.tool {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  font-size: 1.2rem;
}
.tool span { font-size: 0.72rem; color: var(--muted); }
.tool.active { border-color: var(--accent); background: rgba(255, 176, 46, 0.12); }
.tool.active span { color: var(--accent); }
.tool-opts { display: flex; align-items: center; gap: 10px; }
.size-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}
input[type="range"] { flex: 1; accent-color: var(--accent); }

/* ---------- play screen ---------- */
#play-panels {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
}
@media (orientation: landscape) {
  #play-panels { flex-direction: row; }
}
.panel {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.panel canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  touch-action: manipulation;
}

/* ---------- results ---------- */
.stats { display: flex; gap: 12px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 86px;
}
.stat-num { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 0.8rem; }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  max-width: 86vw;
  text-align: center;
  z-index: 10;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}
