/* ── BASE RESET ── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Roboto Mono", "Liberation Mono", monospace;
  background: #f5f5f5;
  color: #333;
  text-align: left;
}

/* ── PORTRAIT WRAPPER ── */
.portrait {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 0;
}

/* ── HEADER ── */
header {
  text-align: left;
  background: #fff;
  border: 1px solid #ddd;
  padding: 0.5rem;
}
header h1 {
  font-size: 1.5rem;
  letter-spacing: 0.04em;
}

/* ── COMMON CONTROLS SECTION ── */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid #ddd;
  padding: 0.5rem;
}
.controls label,
.controls input,
.controls select,
.controls button {
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem;
}

/* ── PALETTE STRIP ── */
.palette {
  width: 100% !important;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  background: #fff;
  border: 1px solid #ddd;
  padding: 0.5rem;
}
.palette img {
  flex: 0 0 auto;
}

/* ── CANVAS CONTAINER ── */
.canvas-wrapper {
  position: relative;
  background: #fff;
  border: 2px solid #ccc;
  padding: 0.5rem;
  overflow: auto;
}

/* JS-GENERATED GRID */
.canvas {
  position: relative;
}
.canvas .cell {
  border: 1px solid #ddd;
}

/* REPEAT PREVIEW LAYER */
.repeat-preview {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
}

/* FLOATING ACTION MENU */
#actionMenu {
  position: absolute;
  display: flex;
  gap: 0.25rem;
  background: rgba(255,255,255,0.9);
  border: 1px solid #ccc;
  border-radius: 0.25rem;
  padding: 0.25rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 1000;
}
#actionMenu button {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
}

/* ── CELL-LEVEL TOOLBAR ── */
.grid-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: left;
  background: #fff;
  border: 1px solid #ddd;
  padding: 0.5rem;
}
.grid-controls button {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
}
.grid-controls button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── GLOBAL UNDO/REDO ── */
.global-toolbar,
.grid-controls + .grid-controls /* if you have 2 grid-controls in a row */ {
  display: flex;
  gap: 0.5rem;
  justify-content: left;
  background: #fff;
  border: 1px solid #ddd;
  padding: 0.5rem;
}
.global-toolbar button {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
}

/* ── SUBMIT FORM ── */
.submit-section {
  background: #fff;
  border: 1px solid #ddd;
  padding: 1rem;
}
.submit-section h2 {
  text-align: left;
  margin-bottom: 0.5rem;
}
.submit-section form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: left;
}
.submit-section input,
.submit-section select,
.submit-section button {
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
}

/* ── SVG HIGHLIGHT GLOW ── */
#canvas svg.highlight {
  filter: drop-shadow(0 0 3px #007ACC)
          drop-shadow(0 0 3px #007ACC);
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .controls,
  .palette,
  .canvas-wrapper,
  .grid-controls,
  .submit-section {
    padding: 0.5rem;
  }
  .controls {
    flex-direction: column;
  }
}

/* ─── Make Repeat Preview Contribute to Height + Scroll ─── */
#repeatPreview {
  /* drop the absolute positioning so it flows in the container */
  position: relative !important;

  /* override the JS inline width/height */
  width: 100%      !important;
  height: auto     !important;

  /* cap the height to be about the normal canvas size */
  max-height: 440px !important;  /* ≈ your 2×2 grid of 100px blocks + padding */
  
  /* allow scrolling when the grid is larger */
  overflow-x: auto !important;
  overflow-y: auto !important;
}

/* ── Zitozza button style ── */
button {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               "Roboto Mono", "Liberation Mono", monospace;
  background-color: #3C3C3A;
  color: #DCF86F;
  border: none;
  border-radius: 0;        /* sharp, architectural */
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  line-height: 1.2;
}

/* Hover & focus states */
button:hover {
  background-color: #2f2f2d;
}

button:focus {
  outline: 1px solid #DCF86F;
  outline-offset: 2px;
}

.logo {
  height: 28px;
  width: auto;
  display: block;
}

#actionMenu img {
  width: 25px;
  height: 25px;
  display: block;
 }