/* Cozy Shelf - cozy/playful styling */

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

:root {
  --bg: #FFF4E6;
  --bg-2: #FFE8D0;
  --surface: #FFFFFF;
  --text: #4A3B2E;
  --text-soft: #8B7B6B;
  --accent: #E8927C;
  --accent-deep: #D4775F;
  --accent-soft: #FFD7BA;
  --sage: #A8C5A0;
  --blue: #C9D9F0;
  --rose: #F4C2C2;
  --shadow: 0 4px 16px rgba(74, 59, 46, 0.08);
  --shadow-hover: 0 8px 28px rgba(74, 59, 46, 0.14);
  --radius: 18px;
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Quicksand", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  min-height: 100vh; min-height: 100dvh;
}
body { display: flex; flex-direction: column; }
a { color: var(--accent-deep); }

/* Hero */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(1100px 380px at 50% -120px, rgba(232,146,124,0.22), transparent 60%),
    radial-gradient(800px 280px at 10% 110%, rgba(168,197,160,0.18), transparent 60%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
  padding: calc(env(safe-area-inset-top) + 3rem) 1.25rem 3rem;
  text-align: center;
}
.hero-inner { position: relative; z-index: 2; max-width: 720px; margin: 0 auto; }
.badge {
  display: inline-block;
  background: var(--surface); color: var(--accent);
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em;
  padding: 0.35rem 0.95rem; border-radius: 999px;
  box-shadow: var(--shadow); margin-bottom: 1.1rem; text-transform: lowercase;
}
h1 {
  font-family: "Fredoka", "Quicksand", sans-serif; font-weight: 600;
  font-size: clamp(2.5rem, 10vw, 4rem);
  margin: 0 0 0.5rem; color: var(--text); letter-spacing: -0.02em; line-height: 1.05;
}
.tagline { font-size: clamp(1rem, 2.5vw, 1.15rem); color: var(--text-soft); margin: 0; font-weight: 500; }

.floating-shapes { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.shape { position: absolute; font-size: 1.6rem; opacity: 0.55; animation: float 9s ease-in-out infinite; will-change: transform; }
.shape-1 { top: 18%; left: 8%;  animation-delay: 0s; }
.shape-2 { top: 14%; right: 12%; animation-delay: 1.4s; font-size: 1.2rem; }
.shape-3 { top: 60%; left: 14%; animation-delay: 0.8s; font-size: 2rem; }
.shape-4 { top: 50%; right: 8%; animation-delay: 2.2s; font-size: 1.5rem; }
.shape-5 { top: 78%; left: 50%; animation-delay: 3.1s; font-size: 1.3rem; }
.shape-6 { top: 30%; left: 55%; animation-delay: 1.8s; font-size: 1.1rem; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-12px) rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .shape { animation: none; } }

/* Container */
.container { flex: 1 1 auto; width: 100%; max-width: 960px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.section-title {
  font-family: "Fredoka", "Quicksand", sans-serif; font-weight: 500;
  font-size: 1.3rem; color: var(--text); margin: 0 0 1rem; letter-spacing: -0.005em;
}

/* Recently added */
.recent-section { margin-bottom: 2.5rem; }
.recent-card {
  display: flex; align-items: center; gap: 1.1rem;
  background: linear-gradient(135deg, var(--surface) 0%, #FFF9F2 100%);
  border: 2px solid var(--accent-soft); border-radius: 22px;
  padding: 1.25rem 1.25rem 1.25rem 1.1rem;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.recent-card:active { transform: scale(0.99); }
@media (hover: hover) { .recent-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); } }
.recent-emoji {
  flex: 0 0 auto; width: 78px; height: 78px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; background: var(--accent-soft); line-height: 1;
}
.recent-body { flex: 1 1 auto; min-width: 0; }
.recent-tag {
  display: inline-block; background: var(--accent); color: #fff;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  padding: 0.15rem 0.55rem; border-radius: 999px; margin-bottom: 0.35rem;
}
.recent-body h3 {
  margin: 0 0 0.2rem; font-family: "Fredoka","Quicksand",sans-serif;
  font-weight: 500; font-size: 1.3rem; color: var(--text);
}
.recent-body p { margin: 0; color: var(--text-soft); font-size: 0.95rem; line-height: 1.4; }
.recent-arrow { flex: 0 0 auto; font-size: 2rem; color: var(--accent); font-weight: 300; line-height: 1; }

/* Library grid */
.library-section { margin-bottom: 2.5rem; }
.games-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 540px) { .games-grid { grid-template-columns: 1fr 1fr; gap: 1.25rem; } }
@media (min-width: 900px) { .games-grid { grid-template-columns: 1fr 1fr 1fr; } }
.game-card {
  display: flex; gap: 1rem; align-items: center;
  background: var(--surface); border-radius: var(--radius);
  padding: 1rem; text-decoration: none; color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-height: 88px; -webkit-user-select: none; user-select: none;
}
.game-card:active { transform: scale(0.98); }
@media (hover: hover) {
  .game-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
  .game-card:hover .card-emoji { transform: rotate(-6deg) scale(1.05); }
}
.game-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.card-emoji {
  flex: 0 0 auto; width: 64px; height: 64px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; background: var(--accent-soft); line-height: 1;
  transition: transform 0.2s ease;
}
.card-body { min-width: 0; }
.card-body h3 {
  margin: 0 0 0.2rem; font-family: "Fredoka","Quicksand",sans-serif;
  font-weight: 500; font-size: 1.15rem; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-body p {
  margin: 0; font-size: 0.92rem; color: var(--text-soft); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Empty state */
.empty-state { display: flex; justify-content: center; padding: 1rem 0; }
.empty-card {
  background: var(--surface); border-radius: 22px;
  padding: 2.25rem 1.5rem; text-align: center;
  max-width: 480px; box-shadow: var(--shadow);
}
.empty-emoji { font-size: 3rem; margin-bottom: 0.5rem; line-height: 1; }
.empty-card h2 { font-family: "Fredoka","Quicksand",sans-serif; margin: 0 0 0.5rem; color: var(--text); }
.empty-card p { color: var(--text-soft); line-height: 1.55; margin: 0; }
.empty-card code {
  background: var(--bg-2); color: var(--accent);
  padding: 0.1rem 0.45rem; border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em;
}

/* Players */
.players-section { margin-top: 2.5rem; }
.players-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (min-width: 540px) { .players-row { gap: 1.25rem; } }
.player-card {
  background: var(--surface); border-radius: 20px;
  padding: 1.25rem 1rem; text-align: center;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
}
.player-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.25rem; line-height: 1;
}
.player-card h3 {
  margin: 0; font-family: "Fredoka","Quicksand",sans-serif;
  font-weight: 500; font-size: 1.15rem; color: var(--text);
}
.player-stat { margin: 0; color: var(--text-soft); font-size: 0.9rem; }
.player-stat span { color: var(--accent); font-weight: 600; }
.players-note { text-align: center; color: var(--text-soft); font-size: 0.85rem; margin: 0.9rem 0 0; font-style: italic; }

/* Footer */
.footer {
  text-align: center;
  padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
  color: var(--text-soft); font-size: 0.9rem;
}
.footer p { margin: 0; }

/* ===== Notes / send-a-note form ===== */
.notes-section { margin-top: 2.5rem; }
.notes-intro {
  margin: 0 0 1.1rem; color: var(--text-soft); line-height: 1.5;
  font-size: 0.95rem;
}
.notes-form {
  background: var(--surface);
  border-radius: 22px;
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 1rem;
}
.honeypot { position: absolute; left: -9999px; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label {
  font-weight: 600; color: var(--text);
  font-size: 0.9rem;
}
.optional { color: var(--text-soft); font-weight: 400; font-size: 0.85em; }
.notes-form input[type="text"],
.notes-form select,
.notes-form textarea {
  width: 100%;
  font-family: inherit;
  font-size: 16px; /* prevents iOS Safari from zooming on focus */
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--bg-2);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  outline: none;
  transition: border-color .15s, background .15s;
  appearance: none;
  -webkit-appearance: none;
}
.notes-form textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.45;
}
.notes-form select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%238B7B6B' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.25rem;
}
.notes-form input:focus,
.notes-form select:focus,
.notes-form textarea:focus {
  border-color: var(--accent);
  background: #FFF;
}
.notes-submit {
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: "Fredoka","Quicksand",sans-serif;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.75rem 2rem;
  cursor: pointer;
  transition: background .15s, transform .15s;
  min-height: 44px;
}
.notes-submit:hover:not(:disabled) { background: var(--accent-deep); }
.notes-submit:active:not(:disabled) { transform: scale(0.98); }
.notes-submit:disabled { opacity: 0.6; cursor: default; }

.notes-success {
  background: var(--surface);
  border-radius: 22px;
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  border: 2px solid var(--accent-soft);
}
.notes-success .success-emoji { font-size: 2.5rem; line-height: 1; display: block; margin-bottom: 0.5rem; }
.notes-success h3 {
  margin: 0 0 0.4rem;
  font-family: "Fredoka","Quicksand",sans-serif;
  font-weight: 500; font-size: 1.25rem; color: var(--text);
}
.notes-success p { margin: 0; color: var(--text-soft); line-height: 1.4; }
