/* style.css */
/* All comments are in English as requested */

/* Light theme by default */
:root {
  --bg: #f7f9fc;
  --card: #ffffff;
  --border: #e6ebf2;
  --text: #0b1320;
  --muted: #5c6777;
  --accent: #2f6bff;
  --shadow: 0 10px 24px rgba(20, 30, 55, 0.08);
  --radius: 16px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  max-width: 1000px;
  margin: 48px auto;
  padding: 0 20px;
}

.header .title {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header .subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

/* Two-column layout that collapses nicely on phones */
.grid {
  display: grid;
  gap: 20px;
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: 1fr auto;
    align-items: start;
  }
}

.left, .right { min-width: 0; }

/* Inputs block */
.label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}

textarea.input {
  resize: vertical;
  min-height: 140px;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
}

.field { display: grid; gap: 6px; }

.meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

/* Right column card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

/* Fixed-size preview area that stays square */
/* On laptops it is slightly smaller for a tighter look */
.preview-box {
  width: clamp(220px, 40vw, 320px);
  aspect-ratio: 1 / 1;
  border: 1px dashed var(--border);
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #ffffff; /* white area when empty or while rendering */
}

@media (min-width: 900px) {
  .preview-box { width: 300px; } /* slightly smaller on laptops */
}

/* Canvas fills the box; internal pixel size is set in JS for HiDPI crispness */
#preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated; /* keep crisp edges when scaled */
  border-radius: 8px;
  background: #ffffff;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .05s ease, filter .15s ease, opacity .15s ease;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.btn:active:not(:disabled) { transform: translateY(1px); }

.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 10px 0 0;
}

/* Hide the probe completely to avoid any duplicates from the library */
#probe { display: none !important; }
