:root { --accent: #e63946; }

body {
  font-family: Inter, system-ui, Segoe UI, Arial, sans-serif;
  background: #fafafa;
  max-width: 900px; /* Sätter maxbredden till 900px */
  margin: 0 auto;    /* Centrerar sidan horisontellt */
  width: 100%;       /* Gör att sidan är 100% bred på små skärmar */
  box-sizing: border-box; /* Inkluderar padding i totalbredden */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 32px;
}


h1 { color: var(--accent); margin: 0; }
p { margin: 0; color: #555;

 }

/* CARD */

.card {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
  max-width: 720px;
  width: 100%;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap; /* gör layouten mobilvänlig */
}

/* PREVIEW */

.preview-wrap {
  width: 300px;
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  position: relative;
}

.svg-box {
  width: 300px;
  height: 300px;
  border-radius: 8px;
  cursor: grab;
  position: relative;
  overflow: hidden;
  background: #eee;
}

.svg-box:active { cursor: grabbing; }

svg {
  width: 100%;
  height: 100%;
  display: block;
  position: absolute;
  inset: 0;
}

/* BILD I HJÄRTAT */

#bgImage {
  position: absolute;
  top: 50%;
  left: 50%;

  transform: translate(-50%, -50%) scale(1);
  transform-origin: center;

  /* fyller rutan bättre */
  width: 120%;
  height: auto;

  max-width: none;
  pointer-events: none;
}

/* FORM */

form {
  flex: 1;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

input, textarea, button {
  font-size: 15px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  width: 100%;
  box-sizing: border-box;
}

textarea { min-height: 100px; }

button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
}

button#reset {
  background: #eee;
  color: #111;
}

.zoom-controls {
  display: flex;
  gap: 8px;
  margin-top: 5px;
}

.hint {
  font-size: 13px;
  color: #666;
  text-align: center;
}

#bgImage {

position:absolute;
top:50%;
left:50%;

transform:translate(-50%,-50%) scale(1);
transform-origin:center;

width:120%;
height:auto;

max-width:none;
pointer-events:none;

user-select:none;
-webkit-user-drag:none;

}

/* GALLERI */

.gallery {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 900px;
}

.gallery img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .2s;
}

.gallery img:hover {
  transform: scale(1.05);
}

/* LIGHTBOX */

#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  width: 100%;       /* Tar upp hela bredden upp till maxvärdet */
  max-width: 900px;  /* Sätter maxtaket till 900px */
  margin: 0 auto;    /* Centrerar lightboxen på skärmen */
  box-sizing: border-box; /* Ser till att padding inte ökar den totala bredden */
}

#lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

#lightbox button {
  background: var(--accent);
  border: none;
  font-size: 30px;
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 8px;
  font-weight: bold;
}

/* MOBIL */

@media (max-width: 700px) {

  body {
    padding: 18px;
  }

  .card {
    flex-direction: column;
    align-items: center;
  }

  .preview-wrap {
    width: 100%;
    flex: none;
  }

  .svg-box {
    width: 100%;
    max-width: 320px;
    height: auto;
    aspect-ratio: 1/1;
  }

}