/* Googly Eyes — blister-card blue, plastic white, sticker yellow. */

:root {
  /* Black, white and neon lime (#CCFF00). Dark mode swaps paper and ink. */
  --accent: #ccff00;
  --paper: #ffffff;
  --ink: #000000;
  --panel: #f0f0f0;
  --panel-strong: #e2e2e2;
  --muted: #555555;
  --line: rgba(0, 0, 0, 0.45);
  --track: rgba(0, 0, 0, 0.2);
  --shadow: rgba(0, 0, 0, 0.18);
  --focus: #000000;

  --font-display: "Titan One", "Arial Black", sans-serif;
  --font-ui: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;

  --radius-lg: 28px;
  --radius-sm: 10px;
  --pad: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

/* dark mode only */
:root {
    --paper: #000000;
    --ink: #ffffff;
    --panel: #121212;
    --panel-strong: #242424;
    --muted: #b0b0b0;
    --line: rgba(255, 255, 255, 0.5);
    --track: rgba(255, 255, 255, 0.25);
    --shadow: rgba(0, 0, 0, 0.6);
    --focus: var(--accent);
  }

:root[data-theme="dark"] {
  --paper: #000000;
  --ink: #ffffff;
  --panel: #121212;
  --panel-strong: #242424;
  --muted: #b0b0b0;
  --line: rgba(255, 255, 255, 0.5);
  --track: rgba(255, 255, 255, 0.25);
  --shadow: rgba(0, 0, 0, 0.6);
  --focus: var(--accent);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-ui);
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* ---------- Header: torn-paper banner with the CRAZIE LOOKS title ---------- */

.site-header {
  position: relative;
  display: flex;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) var(--pad) 40px;
  overflow: hidden;
  background: #000;
  clip-path: polygon(0 0, 100% 0, 100.00% calc(100% - 4px), 97.92% calc(100% - 9px), 95.83% calc(100% - 6px), 93.75% calc(100% - 10px), 91.67% calc(100% - 10px), 89.58% calc(100% - 1px), 87.50% calc(100% - 0px), 85.42% calc(100% - 13px), 83.33% calc(100% - 4px), 81.25% calc(100% - 4px), 79.17% calc(100% - 16px), 77.08% calc(100% - 8px), 75.00% calc(100% - 13px), 72.92% calc(100% - 8px), 70.83% calc(100% - 10px), 68.75% calc(100% - 2px), 66.67% calc(100% - 10px), 64.58% calc(100% - 14px), 62.50% calc(100% - 8px), 60.42% calc(100% - 12px), 58.33% calc(100% - 11px), 56.25% calc(100% - 1px), 54.17% calc(100% - 12px), 52.08% calc(100% - 9px), 50.00% calc(100% - 5px), 47.92% calc(100% - 0px), 45.83% calc(100% - 14px), 43.75% calc(100% - 8px), 41.67% calc(100% - 12px), 39.58% calc(100% - 14px), 37.50% calc(100% - 11px), 35.42% calc(100% - 15px), 33.33% calc(100% - 6px), 31.25% calc(100% - 13px), 29.17% calc(100% - 7px), 27.08% calc(100% - 15px), 25.00% calc(100% - 14px), 22.92% calc(100% - 2px), 20.83% calc(100% - 2px), 18.75% calc(100% - 3px), 16.67% calc(100% - 15px), 14.58% calc(100% - 7px), 12.50% calc(100% - 10px), 10.42% calc(100% - 5px), 8.33% calc(100% - 8px), 6.25% calc(100% - 6px), 4.17% calc(100% - 6px), 2.08% calc(100% - 9px), 0.00% calc(100% - 9px));
}

.header-decor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.title {
  position: relative;
  width: min(100%, 620px);
  margin: 0;
  line-height: 0;
}

.title a {
  display: block;
}

.title-art {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.title a:focus-visible {
  outline-color: var(--accent);
}

/* Cyan halftone dots, used in panel corners like the artwork. */
.drop,
.stage {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.drop::before,
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle, var(--accent) 1.9px, transparent 2.4px) 0 0 / 11px 11px;
  -webkit-mask-image: radial-gradient(circle at 100% 100%, #000 0, transparent 38%), radial-gradient(circle at 0 0, #000 0, transparent 30%);
  mask-image: radial-gradient(circle at 100% 100%, #000 0, transparent 38%), radial-gradient(circle at 0 0, #000 0, transparent 30%);
}

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

main {
  flex: 1;
  padding: 20px var(--pad) 32px;
}

.site-footer {
  padding: 0 var(--pad) max(24px, env(safe-area-inset-bottom));
  font-size: 14px;
  color: var(--muted);
}

.site-footer p {
  margin: 0 auto;
  text-align: center;
  max-width: 70ch;
}

/* ---------- Empty state ---------- */

.empty {
  display: grid;
  place-items: center;
}

.drop {
  z-index: 0;
  width: 100%;
  max-width: 760px;
  min-height: 52vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 40px 24px;
  text-align: center;
  background: var(--panel);
  border: 3px dashed var(--ink);
  border-radius: var(--radius-lg);
  transition: border-color 0.15s, background-color 0.15s;
}

.drop.is-over {
  border-style: solid;
  border-color: var(--accent);
  background: var(--panel-strong);
}

.drop h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.05;
  max-width: 16ch;
}

.drop p {
  margin: 0;
  max-width: 38ch;
  font-size: 18px;
}

.drop .drop-note {
  font-size: 14px;
  color: var(--muted);
}

/* ---------- Editor ---------- */

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
}

.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 12px;
  background: var(--panel);
  border-radius: var(--radius-lg);
}

#canvas {
  position: relative;
  display: block;
  border-radius: 6px;
  touch-action: none;
  cursor: grab;
}

#canvas.is-dragging {
  cursor: grabbing;
}

#canvas.is-cropping {
  cursor: move;
}

.tools {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-weight: 700;
}

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

.tool-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  cursor: pointer;
}

.switch input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

@media (max-width: 860px) {
  .editor {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .tool-actions {
    position: sticky;
    bottom: 0;
    margin: 0 calc(var(--pad) * -1);
    padding: 12px var(--pad) max(12px, env(safe-area-inset-bottom));
    background: var(--paper);
    box-shadow: 0 -8px 16px var(--shadow);
  }
}

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  font: 700 16px/1.1 var(--font-ui);
  color: #000;
  text-align: center;
  text-decoration: none;
  background: #fff;
  border: 3px solid #000;
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--accent);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}

.btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--accent);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary:active:not(:disabled) {
  box-shadow: 0 1px 0 var(--ink);
}

.btn-primary {
  min-height: 56px;
  padding: 10px 28px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: 0.02em;
  color: #000;
  background: var(--accent);
  box-shadow: 0 4px 0 var(--ink);
}

.btn-quiet {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
  box-shadow: none;
}

.icon-btn {
  width: 44px;
  height: 44px;
  font-size: 20px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--panel);
}

/* ---------- Range inputs with googly-eye thumbs ---------- */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  margin: 0;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: var(--track);
  border-radius: 3px;
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: var(--track);
  border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -12px;
  border: 2px solid #000;
  border-radius: 50%;
  background:
    radial-gradient(circle at 58% 62%, #000 0 30%, transparent 31%),
    radial-gradient(circle at 35% 30%, #fff, #dcdcdc);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 2px solid #000;
  border-radius: 50%;
  background:
    radial-gradient(circle at 58% 62%, #000 0 30%, transparent 31%),
    radial-gradient(circle at 35% 30%, #fff, #dcdcdc);
  cursor: pointer;
}

input[type="range"]:disabled {
  opacity: 0.4;
}

/* ---------- Share dialog ---------- */

dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 20px 24px 24px;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 0 var(--accent);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head form {
  margin: 0;
}

dialog .segmented {
  margin-top: 12px;
}

dialog h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.1;
}

.preview {
  display: block;
  width: 100%;
  max-height: 46vh;
  margin: 16px 0;
  object-fit: contain;
  background: var(--panel);
  border-radius: 14px;
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.share-actions .btn-primary:active:not(:disabled) {
  box-shadow: 0 1px 0 var(--ink);
}

.btn-primary {
  grid-column: 1 / -1;
}

dialog .hint {
  margin-top: 12px;
  color: var(--muted);
}

.link-row {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  font-weight: 700;
}

.link-row input {
  width: 100%;
  padding: 10px 12px;
  font: 15px var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
}

#open-x {
  margin-top: 12px;
}

.status {
  min-height: 1.5em;
  margin: 12px 0 0;
  font-weight: 700;
}

.status.is-error {
  display: inline-block;
  padding: 4px 12px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 999px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  font-weight: 700;
  color: #000;
  background: var(--accent);
  border: 3px solid #000;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 860px) {
  .toast {
    bottom: 96px;
  }
}

/* ---------- Share page ---------- */

.share-view {
  display: grid;
  gap: 20px;
  max-width: 760px;
  margin: 0 auto;
}

.share-img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--panel);
  border-radius: 20px;
}

.share-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.share-view h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.1;
}

.report {
  font-size: 14px;
}

.report summary {
  cursor: pointer;
  color: var(--muted);
  text-decoration: underline;
}

.report form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.report select {
  min-height: 44px;
  padding: 8px 12px;
  font: 16px var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

.report .status {
  flex-basis: 100%;
  margin: 0;
}

/* ---------- Segmented choices (GIF / Photo, crop shape) ---------- */

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  min-width: 0;
  margin: 0;
  padding: 4px;
  border: 3px solid var(--ink);
  border-radius: 999px;
}

.segmented legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.segmented label {
  padding: 0 6px;
  font-size: 15px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented input:checked + span {
  color: #000;
}

.segmented label:has(input:checked) {
  background: var(--accent);
}

.segmented label:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.gif-options { margin-top: 14px; }
.gif-options .segmented { margin-top: 6px; }
.btn-small { min-height: 40px; margin-top: 10px; padding: 6px 14px; font-size: 14px; }
.field-label { margin: 0; font-weight: 700; }
dialog { margin: auto; }

/* ---------- Banner people & animals stickers ---------- */
.sticker {
  display: block;
  object-fit: cover;
  border: 3px solid #fff;
  border-radius: 6px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
  background: #000;
}
.sticker-wrap {
  position: relative;
  display: block;
  transform: rotate(var(--tilt, 0deg));
}
.sticker-eyes { position: absolute; inset: 3px; pointer-events: none; }
.sticker-eye {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff 0%, #fff 62%, #dcdcdc 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.sticker-pupil {
  position: absolute;
  border-radius: 50%;
  background: #0a0a0a;
  will-change: transform;
}
.site-header { flex-wrap: wrap; align-items: center; gap: 12px; }
.site-header .title { z-index: 1; }
.stickers { position: relative; z-index: 1; display: flex; pointer-events: none; }
.stickers-left, .stickers-right { flex: 1; flex-wrap: wrap; justify-content: center; align-content: center; gap: 10px; max-width: 360px; }
.stickers-left .sticker, .stickers-right .sticker { width: clamp(70px, 8vw, 118px); aspect-ratio: 4 / 5; }
.stickers-strip, .stickers-bottom { display: none; }
.gutter { display: none; }

@media (max-width: 899px) {
  .stickers-left, .stickers-right { display: none; }
  .stickers-strip { display: flex; flex-basis: 100%; justify-content: center; flex-wrap: wrap; gap: 8px; }
  .stickers-strip .sticker { width: clamp(48px, 15vw, 76px); aspect-ratio: 4 / 5; }
  .stickers-bottom { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 0 var(--pad) 20px; }
  .stickers-bottom .sticker { width: clamp(60px, 22vw, 96px); aspect-ratio: 4 / 5; }
}

@media (min-width: 1180px) {
  .gutter { display: flex; flex-direction: column; justify-content: flex-start; gap: 18px; overflow: hidden; align-items: center; position: fixed; top: min(34vw, 500px); bottom: 0; width: calc((100vw - 800px) / 2); max-width: 260px; padding: 24px 12px; z-index: 0; pointer-events: none; }
  .gutter-left { left: 0; }
  .gutter-right { right: 0; }
  .gutter .sticker { width: clamp(80px, 9vw, 140px); aspect-ratio: 4 / 5; }
  .gutter .sticker-wrap { margin: -10px 0; }
  .gutter .sticker-wrap:nth-child(odd) { transform: translateX(-14%) rotate(var(--tilt)); }
  .gutter .sticker-wrap:nth-child(even) { transform: translateX(14%) rotate(var(--tilt)); }
  main, .site-footer { position: relative; z-index: 1; }
}
.site-header { z-index: 2; }

/* ---------- Terms / face notice dialogs ---------- */
.notice-dialog { max-width: min(520px, calc(100vw - 32px)); }
.notice-dialog p, .notice-list { line-height: 1.5; }
.notice-list { margin: 0 0 16px; padding-left: 1.2em; }
.notice-list li { margin-bottom: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 16px; line-height: 1.45; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.notice-dialog a, .legal a, .footer-links a { color: var(--accent); }
.notice-dialog .btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Footer links + legal pages ---------- */
.footer-links { margin-top: 10px !important; }
.legal { position: relative; z-index: 1; max-width: 70ch; margin: 0 auto; padding: 8px var(--pad) 40px; line-height: 1.65; }
.legal h1 { font-family: "Titan One", sans-serif; font-weight: 400; font-size: clamp(28px, 6vw, 40px); margin: 0 0 4px; }
.legal h2 { font-family: "Titan One", sans-serif; font-weight: 400; font-size: 20px; margin: 28px 0 6px; }
.legal .meta { color: var(--muted); margin: 0 0 20px; }
.legal .back { display: inline-block; margin: 0 0 20px; font-weight: 700; }
