/* Theme variables */
/* Light default */
:root {
  --bg: #f3f6fc;
  --fg: #101828;
  --muted: #5f6c85;
  --card: rgba(255, 255, 255, 0.95);
  --accent: #3a7bff;
  --accent2: #8c5bff;
  --border: rgba(16, 30, 54, 0.12);
  --shadow: 0 22px 48px rgba(16, 34, 70, 0.18);
  --shadow-soft: 0 12px 28px rgba(16, 34, 70, 0.12);
  --surface-glow: rgba(255, 255, 255, 0.65);
  --radius-large: 22px;
  --radius-medium: 14px;
  --header-bg: color-mix(in srgb, #ffffff 82%, var(--bg) 18%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #060b12;
    --fg: #e6f0ff;
    --muted: #90a0c2;
    --card: rgba(16, 23, 32, 0.92);
    --accent: #5f8cff;
    --accent2: #8f75ff;
    --border: rgba(230, 244, 255, 0.12);
    --shadow: 0 22px 48px rgba(3, 8, 18, 0.78);
    --shadow-soft: 0 12px 28px rgba(3, 8, 18, 0.55);
    --surface-glow: rgba(12, 18, 28, 0.85);
    --header-bg: color-mix(in srgb, rgba(12, 18, 28, 0.95) 90%, var(--bg) 10%);
  }
}

html[data-theme="light"] {
  --bg: #f3f6fc;
  --fg: #101828;
  --muted: #5f6c85;
  --card: rgba(255, 255, 255, 0.95);
  --accent: #3a7bff;
  --accent2: #8c5bff;
  --border: rgba(16, 30, 54, 0.12);
  --shadow: 0 22px 48px rgba(16, 34, 70, 0.18);
  --shadow-soft: 0 12px 28px rgba(16, 34, 70, 0.12);
  --surface-glow: rgba(255, 255, 255, 0.65);
  --header-bg: color-mix(in srgb, #ffffff 82%, var(--bg) 18%);
}

html[data-theme="dark"] {
  --bg: #060b12;
  --fg: #e6f0ff;
  --muted: #90a0c2;
  --card: rgba(16, 23, 32, 0.92);
  --accent: #5f8cff;
  --accent2: #8f75ff;
  --border: rgba(230, 244, 255, 0.12);
  --shadow: 0 22px 48px rgba(3, 8, 18, 0.78);
  --shadow-soft: 0 12px 28px rgba(3, 8, 18, 0.55);
  --surface-glow: rgba(12, 18, 28, 0.85);
  --header-bg: color-mix(in srgb, rgba(12, 18, 28, 0.95) 90%, var(--bg) 10%);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, Apple Color Emoji, Segoe UI Emoji;
  background:
    radial-gradient(1200px circle at 12% 5%, color-mix(in srgb, var(--accent) 10%, transparent) 0%, transparent 70%),
    radial-gradient(980px circle at 88% 0%, color-mix(in srgb, var(--accent2) 12%, transparent) 0%, transparent 66%),
    var(--bg);
  color: var(--fg);
  line-height: 1.6;
  transition: background 0.45s ease, color 0.2s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent2);
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.scroll-region {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.scroll-region.scrolling {
  scrollbar-color: color-mix(in srgb, var(--accent) 55%, transparent) transparent;
}

.scroll-region::-webkit-scrollbar {
  width: 10px;
}

.scroll-region::-webkit-scrollbar-track {
  background: transparent;
}

.scroll-region::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}

.scroll-region.scrolling::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--card) 60%, transparent);
}

.scroll-region.scrolling::-webkit-scrollbar-thumb {
  background: linear-gradient(120deg, var(--accent), var(--accent2));
}

main.container {
  display: grid;
  gap: 32px;
  padding: 40px 24px 72px;
  width: 100%;
  min-height: 0;
  flex: 1 0 auto;
}

main.container > * {
  min-width: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  background: var(--header-bg);
  backdrop-filter: blur(22px);
  box-shadow: 0 18px 40px rgba(15, 28, 54, 0.12);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--fg);
  font-weight: 700;
  text-decoration: none;
  padding: 6px 0;
}

.brand-logo {
  width: 36px;
  height: 36px;
  display: block;
}

.brand-text {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-name {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.brand-app {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.brand-app::before {
  content: '·';
  font-size: 18px;
  line-height: 1;
  color: color-mix(in srgb, var(--muted) 75%, transparent);
}

.icon-toggle {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-medium);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--card) 85%, var(--surface-glow) 15%);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
}

.icon-toggle:hover,
.icon-toggle:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
  border-color: color-mix(in srgb, var(--border) 95%, transparent);
  outline: none;
}

[data-hover] {
  position: relative;
}

@media (hover: hover) and (pointer: fine) {
  [data-hover]::after {
    content: attr(data-hover);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%) translateY(6px);
    background: var(--fg);
    color: var(--bg);
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: var(--shadow-soft);
    z-index: 20;
  }

  [data-hover]:hover::after,
  [data-hover]:focus-visible::after {
    opacity: 0.94;
    transform: translateX(-50%) translateY(0);
  }
}

.btn,
button {
  font: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-medium);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.btn.primary:hover,
.btn.primary:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  outline: none;
}

.btn.ghost {
  background: color-mix(in srgb, var(--card) 80%, transparent);
  border-color: color-mix(in srgb, var(--border) 80%, transparent);
  color: var(--fg);
}

.btn.ghost:hover,
.btn.ghost:focus-visible {
  background: color-mix(in srgb, var(--card) 90%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  outline: none;
  box-shadow: var(--shadow-soft);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.surface-card {
  background: color-mix(in srgb, var(--card) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  border-radius: var(--radius-large);
  padding: 28px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.surface-card:not(.inset):hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.surface-card.inset {
  background: color-mix(in srgb, var(--card) 88%, var(--surface-glow) 12%);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--border) 40%, transparent), 0 10px 24px rgba(15, 30, 54, 0.12);
  padding: 20px;
}

.home-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 0 8px;
}

.home-hero h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 40px);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tool-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  grid-auto-rows: 240px;
  justify-items: center;
}

.tool-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  color: var(--fg);
  text-decoration: none;
  width: 100%;
  max-width: 320px;
  min-height: 100%;
}

.tool-card .card-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.tool-card .card-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.tool-card .card-title {
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 6px;
}

.tool-card .card-desc {
  font-size: 14px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.45;
}

.tool-card.coming-soon {
  opacity: 0.92;
}

.info-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.info-card {
  display: grid;
  gap: 14px;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.checklist li {
  position: relative;
  padding-left: 26px;
  color: var(--fg);
}

.checklist li::before {
  content: '\\2713';
  position: absolute;
  left: 0;
  top: 2px;
  font-size: 14px;
  color: var(--accent);
}

.inline-link {
  font-weight: 600;
}

.form-card {
  display: grid;
  gap: 24px;
}

.section-heading h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 5vw, 34px);
}

.section-heading .muted {
  margin: 0;
}

.form-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.helper-text {
  font-size: 13px;
  color: var(--muted);
}

.card-title {
  font-weight: 600;
  font-size: 18px;
  margin: 0 0 6px;
}

.card-desc {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

textarea,
input[type="text"],
input[type="number"],
input[type="file"],
input[type="email"],
select {
  width: 100%;
  font: inherit;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--card) 90%, transparent);
  color: var(--fg);
  padding: 12px 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
  min-height: 260px;
  resize: vertical;
  line-height: 1.5;
  box-shadow: inset 0 2px 6px rgba(15, 28, 54, 0.08);
}

textarea:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

label.file-input {
  position: relative;
  overflow: hidden;
  border: 1px dashed color-mix(in srgb, var(--border) 90%, transparent);
  border-radius: var(--radius-medium);
  padding: 12px 18px;
  cursor: pointer;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

label.file-input span {
  pointer-events: none;
}

label.file-input input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.paste-content {
  background: color-mix(in srgb, var(--card) 88%, transparent);
  border-radius: var(--radius-medium);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  padding: 20px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--border) 40%, transparent);
}

pre {
  margin: 0;
  font-family: inherit;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: color-mix(in srgb, var(--card) 80%, transparent);
  border-radius: 8px;
  padding: 2px 6px;
}

.linkbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.link-prefix {
  color: var(--muted);
}

.slug {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: color-mix(in srgb, var(--card) 88%, transparent);
}

.slug-form {
  display: inline-flex;
  align-items: center;
}

.slug-form[hidden] {
  display: none !important;
}

.slug-form input {
  width: 120px;
  border-radius: 999px;
  padding: 6px 10px;
}

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-medium);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--card) 88%, var(--surface-glow) 12%);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: var(--shadow-soft);
  outline: none;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 16px;
  align-items: stretch;
}

#editor {
  min-height: 420px;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
}

.side-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upload-card {
  display: grid;
  gap: 18px;
}

.upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.usage-pill {
  margin-left: auto;
  font-size: 13px;
}

.inline-form {
  display: inline-flex;
  margin-left: 10px;
}

.inline-form .icon-btn {
  width: 40px;
  height: 40px;
  font-size: 16px;
}

.file-list ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 10px;
}

.file-list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.error-text {
  color: #b00020;
  font-size: 13px;
  margin: 0;
}

.preview-wrap {
  background: color-mix(in srgb, var(--card) 90%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  border-radius: var(--radius-large);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.preview {
  max-width: 100%;
  display: block;
  border-radius: var(--radius-medium);
}

.feature-highlight {
  display: grid;
  gap: 14px;
  margin-top: 32px;
}

.site-footer {
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: 0 -10px 28px rgba(15, 28, 54, 0.08);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 28px 0;
  color: var(--muted);
}

.footer-links a {
  color: inherit;
  font-weight: 500;
  margin-right: 12px;
}

.footer-links a:last-child {
  margin-right: 0;
}

.footer-links .sep {
  margin: 0 8px;
}

.ad-slot {
  min-height: 40px;
  max-height: 60px;
  overflow: hidden;
  margin: 6px 0;
  border: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: var(--radius-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  padding: 8px;
}

.ad-slot.ad-active {
  border: 0;
  padding: 0;
  min-height: unset;
  max-height: unset;
  overflow: visible;
}

.ad-center {
  justify-content: center;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

p {
  color: var(--fg);
  opacity: 0.92;
  margin-top: 0;
}

.muted {
  color: var(--muted);
}

@media (min-width: 768px) {
  .ad-slot {
    min-height: 60px;
    max-height: 90px;
  }
}

@media (min-width: 1024px) {
  .ad-slot {
    min-height: 80px;
    max-height: 120px;
  }
}

@media (max-width: 900px) {
  .header-row {
    padding: 16px 0;
  }

  .home-hero {
    padding: 24px 0 4px;
  }
}

@media (max-width: 720px) {
  main.container {
    padding: 32px 0 56px;
  }
}

@media (max-width: 540px) {
  .surface-card {
    padding: 24px;
  }

  .surface-card.inset {
    padding: 18px;
  }

  .icon-btn,
  .icon-toggle {
    width: 42px;
    height: 42px;
  }

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

  .side-actions {
    flex-direction: row;
  }
}
