:root{
  --bg:#f1efe6;
  --card-shadow: rgba(0,0,0,0.18);
  --accent:#c76b2a;
  --text:#222;
  --muted:#5a5a5a;
  --back-bg:#fff;
  --card-size:300px;
  --gap:20px;
  /* handwriting forward-looking stack + serif fallback */
  font-family: "Segoe Script", "Bradley Hand", "Comic Sans MS", "Segoe UI", "Helvetica Neue", Arial, serif;
  --elite-letter-spacing: 0.4px;
}

/* base */
*{box-sizing:border-box}

html,body,#app{
  height:100%;
  margin:0;
  /* page background: photo with soft gradient overlays for warmth and legibility */
  background-image:
    url("istockphoto-964907870-612x612.jpg"),
    radial-gradient(circle at 10% 10%, rgba(255,255,255,0.6), transparent 10%),
    linear-gradient(180deg,#f7f5ee,#efece0 70%);
  /* tile the uploaded photo to cover the page by repeating it; keep overlays non-repeating */
  background-repeat: repeat, no-repeat, no-repeat;
  background-position: left top, 10% 10%, 0 0;
  /* let the tiled photo use its natural size so it repeats seamlessly; keep overlay sizes */
  background-size: auto, 40% auto, cover;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  -webkit-touch-callout: none;
}

.board{
  display:grid;
  /* force two cards per row for desktop/tablet, collapse to one on narrow screens */
  grid-template-columns: repeat(2, minmax(calc(var(--card-size) - 20px), 1fr));
  gap:var(--gap);
  padding:28px;
  width:100%;
  max-width:1200px;
  margin:28px auto;
  align-content:start;
}

/* Post-it card */
.postit{
  perspective:1200px;
  width:100%;
  height:var(--card-size);
  max-height:420px;
  min-height:220px;
  position:relative;
  cursor:pointer;
  transform-style: preserve-3d;
  transition: transform 260ms ease;
}

/* slightly irregular sizes for authenticity */
.postit .card-inner{
  position:relative;
  width:100%;
  height:100%;
  transition: transform 620ms cubic-bezier(.2,.9,.3,1), box-shadow 200ms ease;
  transform-style: preserve-3d;
  border-radius:12px;
  will-change: transform;
  /* subtle paper texture + warm yellow default; actual color per-card set inline */
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.01) 0px, rgba(0,0,0,0.01) 1px, transparent 1px, transparent 6px),
    linear-gradient(180deg, rgba(255,255,255,0.25), rgba(255,255,255,0.06)),
    var(--card-bg, linear-gradient(180deg,#fff79a,#ffeaa3));
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 18px 36px rgba(17,17,17,0.18);
  overflow:visible;
}

/* flip */
.postit.flipped .card-inner{
  transform: rotateY(180deg);
}

/* subtle hover/tilt for 3D effect */
.postit:hover{
  transform: translateY(-8px) rotateX(3deg) rotateY(-2deg);
}

/* face styles */
.card-face{
  position:absolute;
  inset:0;
  backface-visibility: hidden;
  border-radius:8px;
  padding:18px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  box-shadow: inset 0 -6px 12px rgba(0,0,0,0.03);
  overflow:hidden;
  transform: translateZ(40px);
}

/* front (post-it look) */
.card-front{
  /* paper edges via inner shadow and slightly off-white highlight */
  transform: rotateY(0deg);
  padding-top:34px; /* space for tape */
  position:relative;
  background: none;
}

/* sticky tape at top */
.card-front::before{
  content:"";
  position:absolute;
  left:50%;
  transform:translateX(-50%) rotate(-2deg);
  top:8px;
  width:56%;
  height:28px;
  border-radius:4px;
  background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(245,245,220,0.6));
  box-shadow: 0 2px 6px rgba(0,0,0,0.12), inset 0 -6px 10px rgba(0,0,0,0.03);
  opacity:0.95;
  z-index:6;
  mix-blend-mode: multiply;
  pointer-events:none;
}

/* curled bottom-right corner */
.card-front::after{
  content:"";
  position:absolute;
  right:10px;
  bottom:10px;
  width:48px;
  height:28px;
  background: linear-gradient(135deg, rgba(255,255,255,0.6), rgba(0,0,0,0.02));
  transform: rotate(12deg) skewX(-6deg);
  border-radius:4px;
  opacity:0.6;
  box-shadow: 0 6px 12px rgba(0,0,0,0.06);
  z-index:3;
}

/* back (clean white) */
.card-back{
  background: linear-gradient(180deg,#fff,#fbfbfb);
  transform: rotateY(180deg);
  border:1px solid rgba(0,0,0,0.06);
  gap:10px;
  padding:18px;
  box-shadow: 0 12px 24px rgba(0,0,0,0.06);
}

/* front content container so we can apply inner paper look */
.card-front .content{
  position:relative;
  z-index:5;
  height:100%;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

/* front: paper edge subtle border */
.card-front .paper-inner{
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.02));
  border-radius:8px;
  height:100%;
  padding:10px 14px 12px 14px;
  box-shadow: inset 0 -12px 28px rgba(0,0,0,0.02);
}

/* front content */
.quote{
  font-size:24px;
  color:var(--text);
  line-height:1.26;
  font-weight:700;
  margin-bottom:12px;
  word-break:break-word;
  letter-spacing: var(--elite-letter-spacing);
  /* handwriting-ish tilt */
  transform: rotate(-0.7deg);
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
  font-family: inherit;
}

/* reduce weight on smaller screens */
.quote.short{
  font-size:28px;
}

/* author */
.author{
  font-size:12px;
  color:var(--muted);
  text-align:right;
  font-style:italic;
  letter-spacing:0.4px;
  opacity:0.9;
}

/* back content */
.versions{
  display:flex;
  flex-direction:column;
  gap:8px;
  width:100%;
  align-items:flex-start;
  justify-content:center;
  height:100%;
}

.version{
  background: linear-gradient(180deg,#ffffff,#fbfbfb);
  border-radius:8px;
  padding:10px 12px;
  width:100%;
  border:1px solid rgba(0,0,0,0.04);
  box-shadow: 0 6px 12px rgba(0,0,0,0.04);
}

.version .label{
  font-size:11px;
  color:var(--muted);
  margin-bottom:6px;
}

.version .text{
  font-size:13px;
  color:var(--text);
  line-height:1.3;
  font-family: inherit;
}

/* control row on back */
.controls{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  align-items:center;
  margin-top:6px;
}

.btn{
  font-size:13px;
  padding:8px 10px;
  border-radius:8px;
  background:var(--accent);
  color:white;
  border:none;
  cursor:pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.btn:active{ transform: translateY(1px); box-shadow: 0 4px 10px rgba(0,0,0,0.12); }

.btn.secondary{
  background:#efefef;
  color:#222;
  border:1px solid rgba(0,0,0,0.04);
}

.small{
  font-size:12px;
  padding:6px 8px;
}

/* accessible focus */
.postit:focus{
  outline: none;
  box-shadow: 0 0 0 3px rgba(80,150,240,0.12);
}

/* tuned shadows per rotation so cards sit 'on' board */
.postit{ transition: transform 260ms cubic-bezier(.2,.9,.3,1); }

/* responsive tweaks */
@media (max-width:520px){
  :root{ --card-size:240px; --gap:12px; }
  .board{ padding:12px; margin:12px auto; }
  .card-inner{ box-shadow: 0 10px 22px rgba(0,0,0,0.12); }
  .quote{ font-size:20px; }
}

/* instruction header (steel letters) */
.instruction{
  display:block;
  width:100%;
  text-align:center;
  font-weight:800;
  font-size:20px;
  letter-spacing:1.6px;
  text-transform:uppercase;
  padding:14px 18px;
  margin:8px auto 6px;
  -webkit-font-smoothing:antialiased;
  color: #000; /* solid black letters */
  background: none;
  text-shadow:
    0 1px 0 rgba(255,255,255,0.35),
    0 3px 6px rgba(0,0,0,0.12);
  max-width:1100px;
  margin-left:auto;
  margin-right:auto;
  border-radius:8px;
  -webkit-user-select:none;
  user-select:none;
  pointer-events:none;
}

/* slightly larger on wider screens for emphasis */
@media (min-width:720px){
  .instruction{ font-size:26px; padding:18px 20px; }
}

/* make room so board doesn't overlap header */
.board{
  margin-top:6px; /* keep compact but ensure separation */
  padding-top:6px;
}

/* responsive override: one card per row on narrow screens */
@media (max-width:520px){
  .board{
    grid-template-columns: 1fr;
  }
}