/* /try game builder. Loaded after landing.css and reuses its tokens and .btn styles. Two columns on
   desktop (phone left, controls right); the phone moves above the controls on narrow screens. */

.sim-main { max-width: var(--w); margin: 0 auto; padding: clamp(26px, 5vw, 56px) var(--pad) clamp(40px, 7vw, 80px); }

.sim-head { max-width: 46rem; margin-bottom: clamp(24px, 4vw, 40px); }
.sim-head h1 { font-size: clamp(1.9rem, 4.6vw, 2.9rem); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 10px; }
.sim-head .lead { font-size: 1.1rem; color: var(--text-2); margin: 0; }

.sim-grid {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}

/* ---- phone ---- */

.sim-phone-col { position: sticky; top: 24px; }

/* Phone dimensions live here, not in a style attribute: the site CSP sets style-src 'self', which blocks
   inline style attributes. Keep in step with Simulator::PHONE_W / PHONE_H. */
.sim-phone { display: flex; justify-content: center; --phone-w: 390px; --phone-h: 844px; }
.sim-phone-frame {
  position: relative;
  width: calc(var(--phone-w) + 24px);
  height: calc(var(--phone-h) + 24px);
  max-width: 100%;
  padding: 12px;
  box-sizing: border-box;
  background: linear-gradient(160deg, #2a2a33, #15151b);
  border-radius: 54px;
  box-shadow: 0 0 0 2px #3a3a45, 0 30px 70px rgba(14, 11, 30, 0.42);
  /* The phone is a fixed 390x844 so the preview matches a real device; on small screens the whole frame
     scales down rather than the iframe reflowing, which would no longer be a phone preview. */
  transform-origin: top center;
}
.sim-notch {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 104px;
  height: 26px;
  background: #0b0b0f;
  border-radius: 999px;
  z-index: 2;
  pointer-events: none;
}
.sim-stage {
  display: block;
  width: var(--phone-w);
  height: var(--phone-h);
  border: 0;
  border-radius: 42px;
  background: #14112b;
}
.sim-phone-note { text-align: center; color: var(--text-2); font-size: 0.85rem; margin: 14px 0 0; }

/* ---- panel ---- */

.sim-panel { display: grid; gap: 14px; }

.sim-sec {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: clamp(16px, 2.4vw, 24px);
}
.sim-sec h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
  margin: 0 0 14px;
}

.sim-field { margin-bottom: 12px; }
.sim-field:last-child { margin-bottom: 0; }
.sim-field label, .sim-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}
.sim-field input[type=text], .sim-field select {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--text);
  box-sizing: border-box;
  min-height: 44px;
}
.sim-field input[type=text]:focus-visible, .sim-field select:focus-visible { outline: 2px solid var(--pink); outline-offset: 1px; }
.sim-field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sim-field-row label { margin: 0; }
.sim-field-row select { width: auto; min-width: 11rem; }

/* game choice */
.sim-choices { display: grid; gap: 8px; }
.sim-choice {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  background: var(--paper);
}
.sim-choice:has(input:checked) { border-color: var(--pink); box-shadow: inset 0 0 0 1px var(--pink); background: #fff; }
.sim-choice input { accent-color: var(--pink); width: 18px; height: 18px; flex: 0 0 auto; }
.sim-choice span { display: flex; flex-direction: column; }
.sim-choice small { color: var(--text-2); font-size: 0.8rem; }

/* uploads */
.sim-uploads { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sim-upload { min-width: 0; }
.sim-drop {
  display: grid;
  place-items: center;
  height: 96px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  background: var(--paper);
  text-align: center;
  padding: 8px;
  overflow: hidden;
}
.sim-drop.is-over { border-color: var(--pink); background: #fff; }
.sim-drop img { max-width: 100%; max-height: 80px; object-fit: contain; }
.sim-drop-hint { font-size: 0.78rem; color: var(--text-2); line-height: 1.35; }
.sim-drop-hint small { opacity: 0.8; }
.sim-upload-actions { display: flex; gap: 6px; margin-top: 7px; }
.sim-file { cursor: pointer; }
.sim-note { font-size: 0.78rem; color: var(--text-2); margin: 10px 0 0; }
.sim-note.is-error { color: #c01048; font-weight: 600; }

/* colours */
.sim-colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sim-color { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.sim-color input[type=color] {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 100%;
  height: 44px;
  padding: 2px;
  background: none;
  cursor: pointer;
}
.sim-color input[type=color]::-webkit-color-swatch { border: 0; border-radius: 7px; }
.sim-color input[type=color]::-moz-color-swatch { border: 0; border-radius: 7px; }
.sim-color span { font-size: 0.75rem; color: var(--text-2); }

.sim-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; }

.sim-cta { background: var(--ink); color: var(--text-on-ink); border-color: var(--ink); }
.sim-cta p { margin: 0 0 14px; }
.sim-cta strong { color: var(--buzz); }

/* ---- responsive ---- */

@media (max-width: 1040px) {
  .sim-grid { grid-template-columns: 1fr; }
  .sim-phone-col { position: static; }
}
@media (max-width: 460px) {
  /* Scale the whole phone instead of resizing the iframe, so it stays a true 390px preview. */
  .sim-phone-frame { transform: scale(0.82); margin-bottom: -150px; }
  .sim-uploads, .sim-colors { grid-template-columns: 1fr 1fr; }
  .sim-actions .btn { width: 100%; text-align: center; }
}
