:root {
  --ink: #241B2F;
  --paper: #FFF6E9;
  --pop-pink: #FF5D8F;
  --pop-yellow: #FFC93C;
  --pop-blue: #4C6EF5;
  --card-border: 3px solid var(--ink);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Verdana, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

/* ---------- Header ---------- */

.site-header {
  text-align: center;
  padding: 28px 16px 12px;
}

.site-header h1 {
  margin: 0 0 6px;
  font-size: clamp(1.8rem, 6vw, 2.6rem);
}

.tagline {
  margin: 0;
  font-size: 1rem;
  color: #55495f;
}

/* ---------- Layout ---------- */

.layout {
  display: flex;
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  align-items: flex-start;
}

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- Cards ---------- */

.card {
  background: #fff;
  border: var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 6px 6px 0 var(--ink);
}

/* ---------- Upload box ---------- */

.upload-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  border: 3px dashed var(--ink);
  border-radius: 12px;
  background: #fffaf0;
  cursor: pointer;
  overflow: hidden;
  text-align: center;
  padding: 16px;
}

.upload-box:hover {
  background: #fff1d6;
}

#upload-hint {
  font-size: 1.1rem;
  font-weight: 600;
}

#preview-img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  display: block;
}

.rate-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  background: var(--pop-pink);
  border: var(--card-border);
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
}

.rate-btn:disabled {
  background: #cfc7d8;
  cursor: not-allowed;
  box-shadow: none;
}

.rate-btn:not(:disabled):hover {
  background: #ff3f7c;
}

.rate-btn.secondary {
  background: var(--pop-blue);
}

.rate-btn.secondary:hover {
  background: #3a5ce0;
}

.fine-print {
  font-size: 0.8rem;
  color: #7a6f85;
  text-align: center;
  margin: 12px 0 0;
}

/* ---------- Results ---------- */

.results-card h2 {
  margin-top: 0;
  text-align: center;
}

.score-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.score-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 4px solid var(--ink);
  background: var(--pop-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
}

.score-max {
  font-size: 1.1rem;
  font-weight: 600;
  margin-left: 2px;
}

.score-label {
  font-weight: 700;
  text-align: center;
  margin: 0;
}

.fact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fact-list li {
  background: #fffaf0;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 12px 14px;
}

.fact-list .fact-emoji {
  margin-right: 8px;
}

#reroll-btn {
  margin-top: 20px;
}

.smart-link-btn {
  display: block;
  margin-top: 14px;
  padding: 12px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--pop-yellow);
  border: 2px solid var(--ink);
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.1s ease;
}

.smart-link-btn:hover {
  transform: translate(-1px, -1px);
}

/* ---------- Ad slots ---------- */

.ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-top {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  margin: 0 auto;
}

.ad-incontent {
  width: 100%;
  min-height: 250px;
  max-width: 300px;
  align-self: center;
}

.ad-sidebar {
  width: 160px;
  min-height: 600px;
  flex-shrink: 0;
}

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;
  font-size: 0.8rem;
  color: #7a6f85;
  padding: 20px 16px 40px;
}

/* ---------- Responsive ---------- */

@media (max-width: 850px) {
  .ad-sidebar {
    display: none;
  }
}

@media (max-width: 500px) {
  .ad-top {
    min-height: 50px;
  }
  .card {
    padding: 18px;
  }
}