@font-face {
  font-family: "Campton";
  src: url("./fonts/CamptonLightwoff2") format("woff2"),
       url("./fonts/CamptonLight.woff") format("woff");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Campton";
  src: url("./fonts/CamptonBold.woff2") format("woff2"),
       url("./fonts/CamptonBold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f0f1f5;
  --panel: #f8f9fb;
  --panel-border: #d7d9df;
  --text: #1a1b1f;
  --muted: #5b6474;
  --accent: #6778de;
  --accent-hover: #7685e1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  display: grid;
  gap: 28px;
}

.two-col {
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  align-items: start;
}

.panel {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  padding: 32px;
  border-radius: 8px;
  box-shadow: none;
}

h1 {
  font-weight: 200 !important;
  font-synthesis: none;
}

.panel-title {
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 200;
  letter-spacing: 0.2px;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-content: start;
}

.thumb {
  width: 100%;
  aspect-ratio: 160 / 86;
  border-radius: 4px;
  border: 2px solid var(--panel-border);
  padding: 0;
  overflow: hidden;
  background: #ffffff;
  cursor: pointer;
  position: relative;
  transition: transform 120ms ease, border-color 120ms ease;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb.is-active {
  border-color: var(--accent);
  border-width: 3px;
  transform: translateY(-2px);
}

.preview-wrap {
  display: grid;
  gap: 16px;
}

.image-frame {
  width: 744px;
  height: 400px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--panel-border);
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  padding: calc(32px * var(--preview-scale, 1));
  font-family: "Campton", system-ui, -apple-system, sans-serif;
  font-weight: 200;
  font-size: 60px;
  line-height: normal;
  color: #242933;
  isolation: isolate;
  text-shadow:
    0 0 4px rgba(255, 255, 255, 1),
    0 0 12px rgba(255, 255, 255, 1),
    0 0 28px rgba(255, 255, 255, 0.95),
    0 0 56px rgba(255, 255, 255, 0.9),
    0 0 88px rgba(255, 255, 255, 0.8);
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  display: block;
  font-synthesis: none;
}

.overlay::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  padding: calc(32px * var(--preview-scale, 1));
  color: rgb(255, 255, 255);
  font: inherit;
  filter: blur(12px);
  z-index: -1;
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: none;
}

/* Removed rectangle mask; blur is now only from text-shaped glow. */

.overlay b,
.overlay strong {
  font-weight: 700;
}

.input-label {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.text-input,
.text-editor {
  width: 100%;
  min-height: 90px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: #ffffff;
  color: var(--text);
  padding: 14px 16px;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 18px;
  resize: vertical;
}

.text-editor {
  min-height: 120px;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.text-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 8px;
}

.tool-btn {
  border: 1px solid var(--panel-border);
  background: #ffffff;
  color: var(--text);
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.tool-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.export-btn {
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  height: 48px;
  padding: 0 22px;
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 160ms ease;
}

.export-btn:hover {
  background: var(--accent-hover);
  transform: none;
  box-shadow: none;
}

.export-btn:active {
  background: var(--accent-hover);
}

@media (max-width: 900px) {
  .two-col {
    grid-template-columns: 1fr;
  }

  .image-frame {
    width: 100%;
    height: auto;
    aspect-ratio: 744 / 400;
  }

  .thumb-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overlay {
    font-size: 45px;
  }
}

@media (max-width: 1200px) {
  .image-frame {
    width: 100%;
    height: auto;
    aspect-ratio: 744 / 400;
  }

  .thumb-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .two-col .panel:first-child {
    order: 2;
  }

  .two-col .panel:last-child {
    order: 1;
  }

  .thumb-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 16px;
  }
}

@media (min-width: 1280px) {
  .app {
    max-width: 1280px;
  }
}

@media (min-width: 1440px) {
  .app {
    max-width: 1400px;
  }

  .two-col {
    grid-template-columns: minmax(320px, 520px) minmax(0, 1fr);
  }

  .thumb-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .thumb {
    aspect-ratio: 200 / 108;
  }
}

@media (min-width: 1680px) {
  .app {
    max-width: 1600px;
  }

  .two-col {
    grid-template-columns: minmax(360px, 600px) minmax(0, 1fr);
  }

  .thumb-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .thumb {
    aspect-ratio: 240 / 130;
  }
}
