:root {
  --bg-1: #f7fbff;
  --bg-2: #e7fff2;
  --ink: #1f2a44;
  --ink-soft: #4d5d7a;
  --card: #ffffff;
  --accent: #ff8a65;
  --accent-2: #00a8a8;
  --accent-3: #ffc83d;
  --border: #dce6f5;
  --shadow: 0 16px 40px rgba(22, 37, 66, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff5e9 0%, transparent 55%),
              radial-gradient(circle at 80% 10%, #ddfff2 0%, transparent 45%),
              linear-gradient(135deg, var(--bg-1), var(--bg-2));
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(1px);
  opacity: 0.22;
  pointer-events: none;
}

.bg-shape-one {
  width: 260px;
  height: 260px;
  background: #ffbf69;
  top: -65px;
  left: -35px;
  animation: drift 8s ease-in-out infinite;
}

.bg-shape-two {
  width: 340px;
  height: 340px;
  background: #36cfc9;
  right: -110px;
  bottom: -120px;
  animation: drift 9s ease-in-out infinite reverse;
}

.app-shell {
  max-width: 1140px;
  margin: 0 auto;
  padding: 36px 20px 56px;
  position: relative;
  z-index: 1;
}

.hero {
  text-align: center;
  margin-bottom: 24px;
}

.badge {
  display: inline-block;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff1d6;
  color: #aa5a00;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-family: "Baloo 2", cursive;
  font-size: clamp(2rem, 4vw, 3.4rem);
  margin: 12px 0 8px;
  line-height: 1.1;
}

.subtitle {
  margin: 0 auto;
  max-width: 700px;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.workspace {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ad-panel {
  margin-bottom: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.ad-label {
  margin: 0 0 8px;
  color: #5f6f8f;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad-slot {
  min-height: 90px;
}

.ad-slot .adsbygoogle {
  display: block;
  min-height: 90px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px;
}

label,
.output-header h2,
.preview-card h2 {
  font-family: "Baloo 2", cursive;
  margin: 0 0 12px;
  font-size: 1.35rem;
}

.mode-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.mode-row label {
  margin: 0;
  font-size: 1.05rem;
}

#modeSelect,
#aiActionSelect {
  border: 1px solid #c8d6f2;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: "Nunito", sans-serif;
  font-weight: 700;
  color: #214575;
  background: #f8fbff;
}

#modeSelect:focus,
#aiActionSelect:focus {
  outline: 3px solid rgba(0, 168, 168, 0.2);
  border-color: var(--accent-2);
}

#sourceUrlInput {
  border: 1px solid #c8d6f2;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: "Nunito", sans-serif;
  font-weight: 700;
  color: #214575;
  background: #f8fbff;
  width: min(430px, 100%);
}

#sourceUrlInput:focus {
  outline: 3px solid rgba(0, 168, 168, 0.2);
  border-color: var(--accent-2);
}

.helper-text {
  margin: 0 0 10px;
  color: #5a6b89;
  font-size: 0.9rem;
}

.helper-text code {
  background: #eef4ff;
  border: 1px solid #dce8ff;
  border-radius: 8px;
  padding: 1px 6px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.82rem;
}

textarea {
  width: 100%;
  min-height: 320px;
  border: 1px solid #c8d6f2;
  border-radius: 14px;
  padding: 14px;
  font-size: 1rem;
  font-family: "Nunito", sans-serif;
  color: var(--ink);
  resize: vertical;
  line-height: 1.5;
  background: #fcfeff;
}

textarea:focus {
  outline: 3px solid rgba(0, 168, 168, 0.2);
  border-color: var(--accent-2);
}

textarea.drag-over {
  border-color: #ff8a65;
  background: #fff8f5;
  box-shadow: inset 0 0 0 2px rgba(255, 138, 101, 0.18);
}

.upload-status {
  margin: 8px 0 0;
  min-height: 1.3em;
  color: #365887;
  font-size: 0.9rem;
  font-weight: 700;
}

.upload-status.error {
  color: #b6372b;
}

.actions,
.output-header {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.actions {
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: "Nunito", sans-serif;
  padding: 11px 14px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), #ff6f91);
  color: #fff;
  box-shadow: 0 8px 20px rgba(255, 111, 145, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-ghost {
  background: #f2f7ff;
  color: #28406b;
}

.btn-ghost:hover {
  background: #e3edfc;
}

#markdownOutput {
  margin: 0;
  min-height: 320px;
  max-height: 520px;
  overflow: auto;
  background: #0e1c36;
  color: #dbecff;
  border-radius: 14px;
  padding: 16px;
  line-height: 1.5;
  font-family: "Cascadia Code", Consolas, monospace;
  border: 1px solid #1d335d;
}

.preview-card {
  margin-top: 16px;
}

#livePreview {
  background: #ffffff;
  border: 1px dashed #bfd1ee;
  border-radius: 12px;
  padding: 14px;
  min-height: 130px;
  line-height: 1.6;
}

#livePreview h1,
#livePreview h2,
#livePreview h3,
#livePreview h4,
#livePreview h5,
#livePreview h6 {
  font-family: "Baloo 2", cursive;
  margin-top: 0.8em;
  margin-bottom: 0.3em;
}

#livePreview a {
  color: #0069c2;
  text-decoration: none;
  font-weight: 700;
}

#livePreview a:hover {
  text-decoration: underline;
}

.site-footer {
  margin-top: 18px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  color: var(--ink-soft);
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.site-footer a {
  color: #1a4e86;
  text-decoration: none;
  font-weight: 700;
}

.site-footer a:hover {
  text-decoration: underline;
}

.cookie-banner {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  background: #0f2447;
  color: #d9e9ff;
  border-radius: 14px;
  padding: 14px;
  border: 1px solid #375588;
  box-shadow: 0 10px 34px rgba(8, 20, 44, 0.38);
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.cookie-banner[hidden] {
  display: none !important;
}

.cookie-banner p {
  margin: 0;
  max-width: 780px;
}

.cookie-banner a {
  color: #b9f0ff;
  font-weight: 800;
}

.cookie-actions {
  display: flex;
  gap: 8px;
}

.legal-shell {
  max-width: 960px;
}

.legal-main {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.legal-main h1,
.legal-main h2 {
  font-family: "Baloo 2", cursive;
}

.legal-main p,
.legal-main li {
  line-height: 1.65;
  color: #334a6d;
}

.legal-back {
  display: inline-block;
  margin-bottom: 14px;
  font-weight: 800;
  color: #1a4e86;
  text-decoration: none;
}

.legal-back:hover {
  text-decoration: underline;
}

@keyframes drift {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(16px, -18px) scale(1.08);
  }
}

@media (max-width: 920px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .mode-row {
    align-items: flex-start;
    flex-direction: column;
  }

  #modeSelect,
  #aiActionSelect {
    width: 100%;
  }

  #sourceUrlInput {
    width: 100%;
  }

  textarea,
  #markdownOutput {
    min-height: 260px;
  }

  .cookie-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
}
