:root {
  color-scheme: light;
  --active-font-stack: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --panel-bg: rgba(255, 255, 255, 0.92);
  --panel-shadow: 0 18px 40px rgba(15, 23, 42, 0.11);
  --accent: #7f5dff;
  --accent-strong: #3f8efc;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--active-font-stack);
  background: linear-gradient(135deg, #f7f9fc, #e6ecff);
  color: #111;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem clamp(1rem, 4vw, 3rem);
}

.site-nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
}

.site-nav__brand img {
  width: 40px;
  height: 40px;
  object-fit: cover;
}

.site-nav__toggle {
  border: none;
  background: transparent;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  padding: 0.35rem;
  cursor: pointer;
}

.site-nav__toggle-line {
  width: 22px;
  height: 2px;
  background: #111;
}

.site-nav__links {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
}

.site-nav__links.is-open {
  display: flex;
}

.site-nav__links a {
  text-decoration: none;
  color: #111;
  font-weight: 600;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 4vw, 3rem) 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.app__header {
  text-align: center;
}

.app__header h1 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.8rem, 5vw, 2.75rem);
}

.app__content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.controls,
.preview {
  background-color: var(--panel-bg);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(12px);
}

.control {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.control:last-child {
  margin-bottom: 0;
}

.control label {
  font-weight: 600;
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.control--split {
  flex-direction: column;
  gap: 1rem;
}

textarea,
select,
input[type="search"],
input[type="range"],
input[type="color"],
input[type="file"],
button {
  font: inherit;
}

textarea,
select,
input[type="search"] {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid #cdd4e0;
  padding: 0.85rem 1rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;
  background-color: #fff;
  color: #111;
}

textarea::placeholder,
input::placeholder {
  color: #8b91a3;
}

textarea:focus,
select:focus,
input[type="search"]:focus,
input[type="color"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(127, 93, 255, 0.25);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

input[type="color"] {
  border: 1px solid #cdd4e0;
  border-radius: 0.75rem;
  padding: 0;
  height: 48px;
  background-color: #fff;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

input[type="file"] {
  border: 1px dashed #cdd4e0;
  border-radius: 0.75rem;
  padding: 0.65rem;
  background-color: rgba(255, 255, 255, 0.8);
}

.font-categories {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}

.font-category__btn {
  border: 1px solid rgba(127, 93, 255, 0.3);
  background: transparent;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.font-category__btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(127, 93, 255, 0.35);
}

.recommended {
  border: 1px solid rgba(127, 93, 255, 0.2);
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.recommended__header {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: #555;
  gap: 0.15rem;
}

.recommended__header span:first-child {
  font-weight: 600;
  font-size: 0.95rem;
  color: #111;
}

.recommended__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.recommended__chip {
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 0.85rem;
  background: rgba(63, 142, 252, 0.1);
  color: #2b3a67;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.recommended__chip:hover {
  background: rgba(63, 142, 252, 0.18);
}

.font-select-wrapper {
  position: relative;
}

.font-results-message {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #c05621;
}

#export-btn {
  border: none;
  border-radius: 999px;
  padding: 0.95rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  width: 100%;
}

#export-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(63, 142, 252, 0.3);
}

#export-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.status {
  min-height: 40px;
  font-size: 0.9rem;
  color: #555;
  display: flex;
  align-items: center;
}

.preview h2 {
  margin: 0 0 1rem;
}

.preview__stage {
  /* min-height: 220px; */
  border-radius: 1rem;
  padding: 1rem;
  background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
    linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
}

#preview-canvas {
  display: block;
  height: auto;
}

.site-footer {
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  padding: 1.25rem clamp(1rem, 4vw, 3rem);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.95rem;
}

.site-footer__links {
  display: flex;
  gap: 1rem;
}

.site-footer__links a {
  color: #3f8efc;
  text-decoration: none;
}

@media (min-width: 640px) {
  .site-nav__links {
    display: flex;
    flex-direction: row;
    gap: 1rem;
  }

  .site-nav__toggle {
    display: none;
  }
}

@media (min-width: 720px) {
  .control--split {
    flex-direction: row;
    gap: 1rem;
  }

  .control--split > div {
    flex: 1;
  }

  #export-btn {
    width: auto;
    align-self: flex-start;
  }
}

@media (min-width: 960px) {
  .app__content {
    flex-direction: row;
  }

  .controls,
  .preview {
    flex: 1;
  }

  .preview {
    align-self: stretch;
  }

  .site-footer {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}
