:root {
  --red: #ff2a00;
  --cream: #f4ecdd;
  --ink: #000;
}

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

html, body {
  min-height: 100%;
  background: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #f5efe8;
}

body {
  background-image: url("assets/ant-trail.svg?v=2");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: cover;
  background-attachment: fixed;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 14px;
}

header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 34px 0 22px;
}

#logo {
  width: 300px;
  max-width: 60vw;
  display: block;
}

h1 {
  font-family: Montserrat, -apple-system, sans-serif;
  font-size: 45px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--cream);
  text-align: center;
  margin-top: 10px;
}

#subtitle {
  font-family: Montserrat, -apple-system, sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--cream);
  text-align: center;
  margin-top: 2px;
}

#hint { display: none; }

#stage-wrap {
  transform-origin: top center;
}

#stage {
  position: relative;
  width: 1200px;
  height: 760px;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}
canvas.watching { cursor: default; }

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  padding: 11px 18px;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, opacity .15s ease;
}
.btn:hover { background: #ff4520; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .35; cursor: default; transform: none; }
.btn.ghost {
  background: rgba(244,236,221,.18);
  color: #fff;
}
.btn.ghost:hover { background: rgba(244,236,221,.3); }

#toolbar {
  position: absolute;
  left: 0; right: 0; bottom: 30px;
  display: flex;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}
#toolbar .btn { pointer-events: auto; }
#share-url[hidden] { display: none; }

#sharebar, #afterbar {
  position: absolute;
  left: 0; right: 0; bottom: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

#share-url {
  flex: 1;
  max-width: 460px;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  color: #eee;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px;
  padding: 11px 12px;
}

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,8,6,.4);
  backdrop-filter: blur(3px);
}
#overlay-card { text-align: center; }
#overlay-text {
  font-family: Montserrat, -apple-system, sans-serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--cream);
  margin: 0 0 10px;
  text-shadow: 0 1px 6px rgba(0,0,0,.35);
}
#overlay-card .btn {
  font-size: 15px;
  padding: 12px 30px;
  margin-top: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}

#btn-skip {
  position: absolute;
  right: 14px;
  bottom: 30px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
}

#share-copied {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,8,6,.35);
  cursor: pointer;
}
#share-copied-card {
  text-align: center;
  background: rgba(28,20,12,.94);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
  padding: 28px 36px;
  max-width: 480px;
  margin: 0 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
#share-copied-title {
  font-family: Montserrat, -apple-system, sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--cream);
  margin-bottom: 10px;
}
#share-copied-sub {
  font-size: 14px;
  line-height: 1.5;
  color: #d9cfc2;
}

#toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28,20,12,.92);
  border: 1px solid rgba(255,255,255,.15);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  pointer-events: none;
}

/* --uz is set from JS to undo the stage transform on in-scene UI,
   so buttons and text stay a usable size on narrow screens */
#stage .btn {
  font-size: calc(15px * var(--uz, 1));
  padding: calc(11px * var(--uz, 1)) calc(18px * var(--uz, 1));
  gap: calc(8px * var(--uz, 1));
  border-radius: calc(10px * var(--uz, 1));
}
#btn-copy svg { width: calc(15px * var(--uz, 1)); height: calc(15px * var(--uz, 1)); }
#toolbar, #sharebar, #afterbar { bottom: calc(30px * var(--uz, 1)); }
#sharebar, #afterbar { gap: calc(8px * var(--uz, 1)); }
#sharebar-ghosts { display: flex; gap: calc(8px * var(--uz, 1)); }
#share-url {
  font-size: calc(13px * var(--uz, 1));
  padding: calc(11px * var(--uz, 1)) calc(12px * var(--uz, 1));
}
#overlay-text { font-size: calc(30px * var(--uz, 1)); }
#overlay-card .btn {
  font-size: calc(15px * var(--uz, 1));
  padding: calc(12px * var(--uz, 1)) calc(30px * var(--uz, 1));
}
#btn-skip {
  right: calc(14px * var(--uz, 1));
  top: calc(14px * var(--uz, 1));
  bottom: auto;
  font-size: calc(13px * var(--uz, 1));
  padding: calc(8px * var(--uz, 1)) calc(14px * var(--uz, 1));
}
#share-copied-card {
  padding: calc(28px * var(--uz, 1)) calc(36px * var(--uz, 1));
  max-width: min(88%, calc(480px * var(--uz, 1)));
}
#share-copied-title { font-size: calc(28px * var(--uz, 1)); }
#share-copied-sub { font-size: calc(14px * var(--uz, 1)); }
#toast {
  top: calc(14px * var(--uz, 1));
  font-size: calc(13px * var(--uz, 1));
  padding: calc(9px * var(--uz, 1)) calc(16px * var(--uz, 1));
}

.hidden { display: none !important; }

footer {
  padding: 16px 4px 20px;
  font-size: 12px;
  color: #8a7a6d;
  text-align: center;
}
footer a { color: #d9a066; }

@media (max-width: 640px) {
  header { padding: 20px 0 14px; gap: 8px; }
  #logo { width: 220px; }
  h1 { font-size: 30px; }
  #subtitle { font-size: 14px; }
  #sharebar { gap: calc(10px * var(--uz, 1)); }
  #share-url { flex-basis: 100%; max-width: none; order: -1; }
}
