:root{
  /* Core surfaces */
  --bg: #F7F3EF;
  --surface: #FFFFFF;
  --surface2: #FBFAF8;
  --text: #161616;
  --muted: rgba(22,22,22,.74);
  --muted2: rgba(22,22,22,.62);
  --border: rgba(22,22,22,.12);
  --shadow: 0 14px 34px rgba(0,0,0,.10);
  --shadowSoft: 0 10px 22px rgba(0,0,0,.08);
  --radius: 20px;

  /* Controls */
  --btnBg: #FFFFFF;
  --btnText: #161616;
  --btnBorder: rgba(22,22,22,.16);
  --btnHover: rgba(22,22,22,.04);
  --focus: rgba(22,22,22,.24);

  /* Background shapes */
  --shape-opacity: .85;
  --shape-opacity-muted: .55;

  /* Default neutral palette (used when no mood is selected) */
  --shape-a: #ffd901; /* Bold Yellow from Wrapped */
  --shape-b: #fb0ac7; /* Bold Pink from Wrapped */
  --shape-c: #ffd901; 
  --shape-d: #fb0ac7;
}



html[data-theme="dark"]{
  --bg: #0E0F14;
  --surface: #171922;
  --surface2: #12131A;
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.72);
  --muted2: rgba(255,255,255,.54);
  --border: rgba(255,255,255,.14);
  --shadow: 0 18px 50px rgba(0,0,0,.55);
  --shadowSoft: 0 14px 36px rgba(0,0,0,.40);

  --btnBg: rgba(255,255,255,.06);
  --btnText: rgba(255,255,255,.92);
  --btnBorder: rgba(255,255,255,.16);
  --btnHover: rgba(255,255,255,.06);
  --focus: rgba(255,255,255,.22);

  /* Same colours, dimmed by opacity */
  --shape-opacity: .26;
  --shape-opacity-muted: .18;
}

/* Mood palettes — two contrasting colours per mood so blobs look magnetic */
/* shape-a/c = Colour 1  ·  shape-b/d = Colour 2 (contrasting hue) */
html[data-mood="Light"]       { --shape-a: #FFD14A; --shape-b: #36D8BC; --shape-c: #F7B330; --shape-d: #1EC9A8; }
html[data-mood="Sad"]         { --shape-a: #6888E8; --shape-b: #C870D0; --shape-c: #506CD4; --shape-d: #B458BE; }
html[data-mood="Romantic"]    { --shape-a: #F04C88; --shape-b: #FF9C48; --shape-c: #DA3070; --shape-d: #F08430; }
html[data-mood="Dark"]        { --shape-a: #7C38D8; --shape-b: #3888E0; --shape-c: #6422C4; --shape-d: #2070CC; }
html[data-mood="Adventurous"] { --shape-a: #28CC8C; --shape-b: #F0C820; --shape-c: #18B278; --shape-d: #D8B010; }
html[data-mood="Inspirational"]{ --shape-a: #FF9820; --shape-b: #FF4848; --shape-c: #E07A00; --shape-d: #E62E2E; }
html[data-mood="Fun"]         { --shape-a: #28BEFF; --shape-b: #FF4EA4; --shape-c: #10A8EE; --shape-d: #EE3090; }
html[data-mood="Tense"]       { --shape-a: #EE2838; --shape-b: #FF8020; --shape-c: #D41424; --shape-d: #EE6A00; }
/* Extended palettes */
html[data-mood="Historical"]  { --shape-a: #CC5018; --shape-b: #D4A020; --shape-c: #AA3C08; --shape-d: #BC8C10; }
html[data-mood="Political"]   { --shape-a: #1855CC; --shape-b: #F0B520; --shape-c: #0A3EAA; --shape-d: #D8A008; }
html[data-mood="Fantasy"]     { --shape-a: #8828E8; --shape-b: #18C8B0; --shape-c: #6C10D0; --shape-d: #10A898; }
html[data-mood="Mystery"]     { --shape-a: #1A3878; --shape-b: #C03820; --shape-c: #0C2660; --shape-d: #A82810; }
html[data-mood="Coming-of-Age"]{ --shape-a: #58D030; --shape-b: #28C0E8; --shape-c: #42B818; --shape-d: #10A8D0; }
html[data-mood="Motivational"] { --shape-a: #FF6500; --shape-b: #2080FF; --shape-c: #EE5000; --shape-d: #1068EE; }
html[data-mood="Funny"]       { --shape-a: #FFE020; --shape-b: #FF3F90; --shape-c: #F0CE00; --shape-d: #EE2878; }
html[data-mood="Horror"]      { --shape-a: #CC1520; --shape-b: #680090; --shape-c: #AA0010; --shape-d: #500078; }

*{ box-sizing: border-box; }
html, body{ height: 100%; }

body{
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

/* Home boot gate: avoid auth-control flicker, but keep page visible */
body.authBooting #authBtn,
body.authBooting #settingsBtn,
body.authBooting #guestNote{
  visibility: hidden;
}

/* Guest mode note */
#guestNote{
  color: var(--muted2);
  font-weight: 600;
  font-size: 13.5px;
  text-align: right;
  white-space: nowrap;
}
@media (max-width: 720px){
  #guestNote{ white-space: normal; }
}

/* Background: flat colour + abstract shapes (generated in JS) */
.bg{
  position: fixed;
  inset: 0;
  z-index: -3;
  background: var(--bg);
  overflow: hidden;
}
.shapeLayer{ position: absolute; inset: 0; z-index: 0; }
.shape{
  position: absolute;
  background: var(--shape-fill, var(--shape-a));
  opacity: var(--shape-alpha, var(--shape-opacity));
  transform: translate3d(0,0,0);
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), opacity 220ms ease;
}
html.moodTransition .shapeLayer{ opacity: .25; transition: opacity 220ms ease; }
.shapeLayer.isFading{ opacity: 0; transition: opacity 220ms ease; }

/* Layout: centre the whole app on larger screens (desktop/iPad landscape).
   On phones we go back to normal top-aligned flow. */
@media (min-width: 861px){
  body{
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
}
@media (max-width: 860px){
  body{ display: block; }
}

/* Base layout: always top-aligned */
.appShell{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Tablet vertical balance */
@media (min-width: 720px) and (max-width: 1024px){
  .container{
    padding-top: 48px;
    padding-bottom: 48px;
  }
}

@media (min-width: 720px) and (max-width: 1024px){
  .topbar{
    margin-top: 32px;
  }
}

/* Shell widths */
.topbar,
.container{
  width: min(980px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.topbar{
  margin-top: 22px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.container{
  padding: 24px 0 42px;
}

.brandWrap{
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

/* Text wrapper inside brandWrap (title + subtitle) */
.brandWrap > div:not(.logo){
  overflow: hidden;
  min-width: 0;
}

.logo{
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: hidden;
  flex-shrink: 0;
}

.logoImg{
  width: 52px;
  height: 52px;
  object-fit: contain;
  display: block;
}

.siteTitle{
  font-family: Fraunces, serif;
  margin: 0;
  font-size: 22px;
  letter-spacing: .2px;
  line-height: 1.15;
  min-width: 0;
  white-space: nowrap;
}

.siteSubtitle{
  margin: 2px 0 0;
  color: var(--muted2);
  font-size: 14px;
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
}

.topActions{
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

/* Buttons */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  border: 1px solid var(--btnBorder);
  background: var(--btnBg);
  color: var(--btnText);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadowSoft);
  transition: background 140ms ease, transform 140ms ease, border-color 140ms ease;
}

.btn:hover{ background: var(--btnHover); }
.btn:active{ transform: translateY(1px); }
.btn:focus-visible{ outline: 3px solid var(--focus); outline-offset: 2px; }

.btn.primary{
  background: #161616;
  color: #FFFFFF;
  border-color: rgba(0,0,0,.25);
}
html[data-theme="dark"] .btn.primary{
  background: rgba(255,255,255,.92);
  color: #0E0F14;
  border-color: rgba(255,255,255,.28);
}

.btn.ghost{ background: transparent; }

.btn.link{
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  padding-left: 6px;
  padding-right: 6px;
}

.btn {
  font: inherit;
  text-decoration: none;
}

/* Danger variant */
.btn.danger{ color: #e53e3e; border-color: rgba(229,62,62,.4); }
.btn.danger:hover{ background: rgba(229,62,62,.08); }
.btn.primary.danger{ background: #e53e3e; color: #fff; border-color: rgba(229,62,62,.25); }
.btn.primary.danger:disabled{ opacity: 0.38; cursor: not-allowed; transform: none; }

/* Google-branded buttons — icon + label inline */
.googleAuthBtn{ display: flex; align-items: center; justify-content: center; gap: 8px; }
.googleAuthBtn svg{ flex-shrink: 0; }

/* Delete-confirm input */
.deleteConfirmInput{
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 140ms ease;
}
.deleteConfirmInput:focus{ border-color: #e53e3e; }

.hidden{ display: none !important; }

/* Theme toggle: image-based pill */
#themeBtn{
  min-height: 40px;
  min-width: 96px;
  padding: 0;
  border-radius: 999px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 96px 40px;
}
html[data-theme="dark"] #themeBtn{
  background-image: url("/images/dark mode.png");
}
html:not([data-theme="dark"]) #themeBtn{
  background-image: url("/images/light mode.png");
}

/* Menu dropdown (used on wrapped.html and other pages with a details/summary nav) */
.topMenu{ position: relative; }
.topMenu > summary{
  list-style: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.topMenu > summary::-webkit-details-marker{ display: none; }
.topMenuPanel{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
  z-index: 200;
}
.topMenuPanel .btn{
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

/* Make the auth/settings buttons match the toggle height on larger screens */
@media (min-width: 861px){
  #authBtn, #settingsBtn{ min-height: 40px; }
}

/* Hero */
.heroTitle{
  margin: 0 0 6px;
  font-family: Fraunces, serif;
  font-size: 35px;
  line-height: 1.05;
}
.heroCopy{
  margin: 0;
  color: var(--muted);
  max-width: 100ch;
  font-size: 15.5px;
  line-height: 1.5;
}

/* Signed-in personalised greeting — same visual rhythm as guest hero */
.signedInHero {
  padding-top: 6px;
  padding-bottom: 2px;
}

/* Blog spotlight — 3-post section on homepage */
.blogSpotlight {
  margin-top: 14px;
}

.blogSpotlightInner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadowSoft);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
}

.blogSpotlightHeader {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.blogSpotlightHeading {
  font-family: Fraunces, serif;
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  letter-spacing: 0.01em;
}

/* All posts button — solid black (light) / solid white (dark) */
.btn.blogSpotlightAllBtn {
  align-self: flex-start;
  margin-top: 14px;
  font-size: 13px !important;
  background: #161616;
  color: #ffffff;
  border-color: rgba(0,0,0,.25);
}
.btn.blogSpotlightAllBtn:hover {
  background: #2e2e2e;
}
html[data-theme="dark"] .btn.blogSpotlightAllBtn {
  background: rgba(255,255,255,.92);
  color: #0E0F14;
  border-color: rgba(255,255,255,.28);
}
html[data-theme="dark"] .btn.blogSpotlightAllBtn:hover {
  background: rgba(255,255,255,.80);
}

.blogSpotlightPosts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.blogSpotlightPost {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-decoration: none;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.blogSpotlightPost:hover {
  background: var(--surface);
  border-color: var(--focus);
  box-shadow: 0 6px 20px rgba(0,0,0,.13);
  transform: translateY(-2px);
}

.blogSpotlightPostMeta {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted2);
  transition: color 140ms ease;
}
.blogSpotlightPost:hover .blogSpotlightPostMeta {
  color: var(--text);
}

.blogSpotlightPostTitle {
  font-family: Fraunces, serif;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.homeNewsletterCard {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadowSoft);
}
.homeNewsletterTitle {
  margin: 0 0 10px;
  font-family: Fraunces, serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}
.homeNewsletterForm {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.homeNewsletterForm .newsletterInput {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-size: 14px;
  flex: 1 1 0;
  min-width: 0;
  outline: none;
}
.homeNewsletterForm .newsletterInput:focus {
  border-color: var(--text);
}

.homeNewsletterForm .btn[type="submit"] {
  flex: 0 0 140px;
  min-width: 110px;
  justify-content: center;
  padding: 10px 12px;
  font-size: 12.5px;
}

.homeNewsletterCard .newsletterError {
  margin: 2px 0 0;
}
.homeNewsletterCard .newsletterConsent {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted2);
  line-height: 1.4;
}

@media (max-width: 640px) {
  .blogSpotlightPosts { grid-template-columns: 1fr; gap: 8px; }
  .blogSpotlightPosts .blogSpotlightPost:nth-child(n+6) { display: none; }
  .homeNewsletterForm { gap: 6px; }
  .homeNewsletterForm .newsletterInput { padding: 9px 12px; font-size: 13px; }
  .homeNewsletterForm .btn[type="submit"] { flex-basis: 96px; min-width: 88px; padding: 9px 10px; font-size: 12px; }
}


/* Cards */
.card{
  margin-top: 14px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.card.how{ background: var(--surface2); }

.cardTitle{
  margin: 0 0 10px;
  font-size: 16px;
  letter-spacing: .2px;
}
.howList{
  margin: 0 0 10px;
  padding-left: 18px;
  color: var(--muted);
}

.small{ font-size: 13.5px; }
.muted{ color: var(--muted); }

/* Mood picker */
.moodHeader{ display:flex; align-items:baseline; justify-content:space-between; gap: 10px; }

.moodGrid{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 860px){
  .moodGrid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.moodBtn{
  appearance: none;
  border: 1px solid var(--border);
  background: var(--btnBg);
  color: var(--btnText);
  border-radius: 14px;
  padding: 14px 12px 12px;
  font-weight: 600;
  letter-spacing: .1px;
  cursor: pointer;
  box-shadow: var(--shadowSoft);
  transition: background 140ms ease, transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.moodEmoji{
  font-size: 1.7em;
  line-height: 1;
  display: block;
  will-change: transform;
}
.moodBtn:hover{ border-color: var(--focus); box-shadow: var(--shadow); }
.moodBtn:active{ transform: translateY(1px); }
.moodBtn:focus-visible{ outline: 3px solid var(--focus); outline-offset: 2px; }
.moodBtn.isLocked{ opacity: .55; cursor: not-allowed; box-shadow:none; }

/* Mood emoji animations */
@keyframes moodSun{
  0%,100%{ transform: rotate(-10deg) scale(1); }
  50%{ transform: rotate(10deg) scale(1.15); }
}
@keyframes moodRain{
  0%,100%{ transform: translateY(0); }
  50%{ transform: translateY(5px); }
}
@keyframes moodHeart{
  0%,50%,100%{ transform: scale(1); }
  20%{ transform: scale(1.35); }
  35%{ transform: scale(1.1); }
}
@keyframes moodSkull{
  0%,100%{ transform: scale(1) rotate(0deg); }
  25%{ transform: scale(1.07) rotate(-9deg); }
  75%{ transform: scale(1.07) rotate(9deg); }
}
@keyframes moodMountain{
  0%,100%{ transform: scale(1) translateY(0); }
  50%{ transform: scale(1.12) translateY(-3px); }
}
@keyframes moodSparkle{
  0%,100%{ transform: rotate(0deg) scale(1); opacity:1; }
  25%{ transform: rotate(22deg) scale(1.25); opacity:.8; }
  75%{ transform: rotate(-18deg) scale(.9); opacity:.9; }
}
@keyframes moodBounce{
  0%,100%{ transform: translateY(0) scale(1); }
  40%{ transform: translateY(-8px) scale(1.06); }
  60%{ transform: translateY(-4px) scale(1.03); }
}
@keyframes moodTense{
  0%,72%,100%{ transform: translateX(0); }
  74%,78%,82%,86%,90%{ transform: translateX(-3px); }
  76%,80%,84%,88%{ transform: translateX(3px); }
}

.moodBtn[data-mood="Light"] .moodEmoji{ animation: moodSun 4s ease-in-out infinite; }
.moodBtn[data-mood="Sad"] .moodEmoji{ animation: moodRain 1.8s ease-in-out infinite; }
.moodBtn[data-mood="Romantic"] .moodEmoji{ animation: moodHeart 2s ease-in-out infinite; }
.moodBtn[data-mood="Dark"] .moodEmoji{ animation: moodSkull 4s ease-in-out infinite; }
.moodBtn[data-mood="Adventurous"] .moodEmoji{ animation: moodMountain 3.5s ease-in-out infinite; }
.moodBtn[data-mood="Inspirational"] .moodEmoji{ animation: moodSparkle 2.5s ease-in-out infinite; }
.moodBtn[data-mood="Fun"] .moodEmoji{ animation: moodBounce 1.2s ease-in-out infinite; }
.moodBtn[data-mood="Tense"] .moodEmoji{ animation: moodTense 2.5s ease-in-out infinite; }

@media(prefers-reduced-motion: reduce){
  .moodEmoji{ animation: none !important; }
}

/* Mood colour backgrounds */
.moodBtn[data-mood="Light"]{ background: rgba(255, 227, 168, .34); }
.moodBtn[data-mood="Sad"]{ background: rgba(90, 65, 170, .26); }
.moodBtn[data-mood="Romantic"]{ background: rgba(245, 197, 211, .34); }
.moodBtn[data-mood="Dark"]{ background: rgba(201, 214, 247, .34); }
.moodBtn[data-mood="Adventurous"]{ background: rgba(189, 238, 219, .34); }
.moodBtn[data-mood="Inspirational"]{ background: rgba(255, 217, 138, .32); }
.moodBtn[data-mood="Fun"]{ background: rgba(155, 227, 255, .30); }
.moodBtn[data-mood="Tense"]{ background: rgba(255, 180, 166, .32); }

html[data-theme="dark"] .moodBtn[data-mood="Light"]{ background: rgba(255, 227, 168, .22); }
html[data-theme="dark"] .moodBtn[data-mood="Sad"]{ background: rgba(110, 85, 200, .28); }
html[data-theme="dark"] .moodBtn[data-mood="Romantic"]{ background: rgba(245, 197, 211, .22); }
html[data-theme="dark"] .moodBtn[data-mood="Dark"]{ background: rgba(201, 214, 247, .22); }
html[data-theme="dark"] .moodBtn[data-mood="Adventurous"]{ background: rgba(189, 238, 219, .22); }
html[data-theme="dark"] .moodBtn[data-mood="Inspirational"]{ background: rgba(255, 217, 138, .22); }
html[data-theme="dark"] .moodBtn[data-mood="Fun"]{ background: rgba(155, 227, 255, .20); }
html[data-theme="dark"] .moodBtn[data-mood="Tense"]{ background: rgba(255, 180, 166, .22); }

/* Recommendation screen */
.bookHeader{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.pillRow{ display:flex; align-items:center; gap: 10px; flex-wrap: wrap; }
.pill{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-weight: 600;
  font-size: 13px;
}
.pill[data-mood="Light"]{ background: rgba(255, 227, 168, .48); }
.pill[data-mood="Sad"]{ background: rgba(135, 118, 214, .36); color: #23184b; }
.pill[data-mood="Romantic"]{ background: rgba(245, 197, 211, .46); }
.pill[data-mood="Dark"]{ background: rgba(201, 214, 247, .50); color: #1e2345; }
.pill[data-mood="Adventurous"]{ background: rgba(189, 238, 219, .46); }
.pill[data-mood="Inspirational"]{ background: rgba(255, 217, 138, .46); }
.pill[data-mood="Fun"]{ background: rgba(155, 227, 255, .44); }
.pill[data-mood="Tense"]{ background: rgba(255, 180, 166, .46); }

html[data-theme="dark"] .pill[data-mood="Light"]{ background: rgba(255, 227, 168, .24); color: #f8e8b5; }
html[data-theme="dark"] .pill[data-mood="Sad"]{ background: rgba(110, 85, 200, .34); color: #ddd1ff; }
html[data-theme="dark"] .pill[data-mood="Romantic"]{ background: rgba(245, 197, 211, .26); color: #ffd4e6; }
html[data-theme="dark"] .pill[data-mood="Dark"]{ background: rgba(201, 214, 247, .28); color: #dce6ff; }
html[data-theme="dark"] .pill[data-mood="Adventurous"]{ background: rgba(189, 238, 219, .26); color: #d6fff0; }
html[data-theme="dark"] .pill[data-mood="Inspirational"]{ background: rgba(255, 217, 138, .28); color: #ffe3ab; }
html[data-theme="dark"] .pill[data-mood="Fun"]{ background: rgba(155, 227, 255, .26); color: #cff4ff; }
html[data-theme="dark"] .pill[data-mood="Tense"]{ background: rgba(255, 180, 166, .30); color: #ffd4ca; }
.tagRow{ display:flex; gap: 8px; flex-wrap: wrap; }
.tag{
  display:inline-flex;
  align-items:center;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
}

.bookCard{
  display: grid;
  grid-template-columns: minmax(0, 180px) 1fr;
  gap: 16px;
  align-items: start;
}

.coverBox{
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.coverInner{
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  width: 100%;
  max-width: 180px;
  display: grid;
  place-items: center;
  background: var(--coverA, var(--surface2));
  border: 1px solid var(--border);
}

.coverInner::after{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28%;
  background: var(--coverB, transparent);
  opacity: .9;
}

.coverImg{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 2;
}

.coverInitials{
  font-family: Fraunces, serif;
  font-size: 34px;
  letter-spacing: .6px;
  color: var(--muted2);
  position: relative;
  z-index: 3;
}

.bookTitle{ margin: 0 0 6px; font-family: Fraunces, serif; font-size: 24px; line-height: 1.1; }
.bookAuthor{ margin: 0 0 10px; color: var(--text); font-weight: 600; }

.metaRow{ display:flex; align-items:center; gap: 10px; margin: 8px 0 10px; }
.metaLabel{ color: var(--muted2); font-size: 13px; }
.metaValue{ font-weight: 600; font-size: 13px; }

.bookBlurb{ margin: 0 0 12px; color: var(--muted); line-height: 1.55; }

.noteWrap{ border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.noteLabel{ font-size: 12.5px; color: var(--muted2); text-transform: uppercase; letter-spacing: .08em; }
.noteCopy{ margin: 6px 0 0; color: var(--muted); line-height: 1.55; }

.actions{ display:flex; gap: 12px; align-items:center; flex-wrap: wrap; }
.actionsWide{ margin-top: 12px; }

.actions .btn {
  margin: 0 !important;
}

/* Give modal buttons breathing room from the text above */
.modalCard > .actions{
  margin-top: 16px;
}

/* Footer */
.footer{
  margin-top: 16px;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted2);
  font-size: 13px;
  text-align: center;
  padding: 16px 12px 40px;
}
.footer a{ color: inherit; text-decoration: none; border-bottom: 1px solid transparent; }
.footer a:hover{ border-bottom-color: currentColor; }
.footerSep{ opacity: .7; }
.footerBrandLink{ font-weight: 600; }

@media (max-width: 480px) {
  .footer { font-size: 12px; gap: 5px 8px; }
}

.linkBtnSmall{
  appearance:none;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.linkBtnSmall:hover{ border-bottom-color: currentColor; }

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.45);
  padding: 18px;
  z-index: 50;
}
html[data-theme="dark"] .modal{ background: rgba(0,0,0,.55); }

.modalCard{
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  pointer-events: auto;
  max-height: 86vh;
  overflow-y: auto;
}

#submitBookModal .modalCard{
  max-height: 90vh;
}

/* Read history lists */
.readList{
  display:flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

/* Card becomes a 2-col grid: text left, actions right */
.readRow{
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title actions"
    "meta  actions";
  gap: 6px 12px;

  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface2);
}

.readTitle{
  grid-area: title;
  font-weight: 700;
}

.readMeta{
  grid-area: meta;
  margin: 0;
}

.dotSep{
  opacity: .65;
}

/* Action row */
.readRow .actions{
  grid-area: actions;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Buttons inside read cards */
.readRow .actions .btn{
  padding: 8px 14px;
  font-size: 14px;
}

/* Mobile: stack again */
@media (max-width: 520px){
  .readRow{
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "meta"
      "actions";
  }

  .readRow .actions{
    justify-content: flex-start;
    margin-top: 8px;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .readRow .actions .btn{
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.2;
    min-height: 32px;
    flex: 0 0 auto;
    white-space: nowrap;
  }
}


/* Nudge overlay (blocks background clicks) */
#nudgeOverlay{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: transparent;
  pointer-events: auto;
}
#nudgeOverlay.hidden{ display: none; }

#nudgeSprite{
  position: absolute;
  top: 88px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 24px));
}

#nudgeSprite .nudgeCard{
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
  color: var(--text);
  pointer-events: auto;
  cursor: pointer;
}
#nudgeSprite .nudgeFace{ font-size: 22px; line-height: 1; flex: 0 0 auto; margin-top: 1px; }
#nudgeSprite .nudgeText{ font-weight: 700; line-height: 1.2; }
#nudgeSprite .nudgeSub{ color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.2; }

/* Small page body copy blocks */
.bodyCopy{
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.bodyCopy + .bodyCopy{
  margin-top: 12px;
}

.backBtn{ text-decoration:none; display:inline-flex; align-items:center; }

/* Book submission form */
.submitForm{ display:flex; flex-direction:column; gap:8px; }
.submitRow{ display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.submitInput{
  display:block; width:100%; padding:10px 12px;
  border:1px solid var(--border); border-radius:10px;
  background:var(--surface2); color:var(--text);
  font-size:14px; font-family:inherit; box-sizing:border-box;
}
.submitInput:focus{ outline:2px solid var(--text); outline-offset:2px; }
select.submitInput{ cursor:pointer; }
.submitCoverWrap{ display:flex; flex-direction:column; gap:8px; }
.submitCoverLabel{
  display:block; padding:10px 14px; border:1px dashed var(--border);
  border-radius:10px; background:var(--surface2); color:var(--muted);
  font-size:14px; cursor:pointer; text-align:center;
  transition:border-color 0.15s, color 0.15s;
}
.submitCoverLabel:hover{ border-color:var(--text); color:var(--text); }
.submitCoverPreview{ max-width:80px; max-height:110px; border-radius:8px; object-fit:cover; align-self:flex-start; }

/* My Shelf greeting — tighter spacing between name and email */
#settingsTitle{ margin-bottom: 2px; }
#settingsCopy{ font-size: 12px; margin-top: 0; margin-bottom: 14px; }

/* pickedReadNudgeModal layout */
.modalTitle{ font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 10px; }
.modalSub{ color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0; }
.modalActions{ display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 16px; }

/* Responsive tweaks */
@media (max-width: 860px){
  .heroTitle{ font-size: 30px; }

  .topbar{ align-items: center; }

  .topActions{
    gap: 6px;
    margin-left: 6px;
  }

  #themeBtn{
    min-width: 84px;
    background-size: 84px 36px;
  }

  #authBtn,
  #settingsBtn{
    padding: 8px 12px;
    font-size: 14px;
  }
}

@media (max-width: 720px){
  .bookCard{ grid-template-columns: 1fr; }
  .coverInner{ max-width: 240px; }
}

@media (max-width: 640px){
  .logo{ width: 52px; height: 52px; }
  .logoImg{ width: 52px; height: 52px; }
  .brandWrap{ gap: 10px; }
  .siteTitle{ font-size: 18px; }
  .siteSubtitle{ font-size: 13px; }
  .topbar{ gap: 10px; }
  #authBtn, #settingsBtn{ padding: 7px 10px; font-size: 13px; }
}

@media (max-width: 560px){
  .container{ padding-top: 18px; }
}



/* Email fallback field (shown when clipboard API is unavailable) */
.emailFallback{
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
  font-size: 14px;
  box-sizing: border-box;
  cursor: text;
}

/* === FIX: Give list action buttons real fills (Already Read / Skip) === */
.actions .btn.ghost{
  background: var(--btnBg);
  border-color: var(--btnBorder);
}

.actions .btn.ghost:hover{
  background: var(--btnHover);
}

.actions .btn.link{
  background: var(--btnBg);
  border: 1px solid var(--btnBorder);
  box-shadow: var(--shadowSoft);
  padding: 10px 14px;
}

.actions .btn.link:hover{
  background: var(--btnHover);
}

/* Keep the "Skip" button from looking like a tiny text link */
.actions .btn.link{
  text-decoration: none;
}

/* Focus should not look like a selected state */
.actions .btn:focus-visible{
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Activity page additions */

.activityBig{
  font-family: Fraunces, serif;
  font-size: 42px;
  font-weight: 700;
  margin: 6px 0 10px;
}

.activityList{
  list-style: none;
  padding: 0;
  margin: 0;
}

.activityList li{
  margin: 4px 0;
}

/* Home page: top-align (centering clips content above viewport on scroll) */
@media (min-width: 720px){
  body.isHome .appShell{
    justify-content: flex-start;
  }
  body.isHome .container{
    padding-top: 40px;
  }
}

/* ── Email-first auth modal ─────────────────────────────────────────── */
.authInput{
  display:block; width:100%; padding:10px 12px;
  border:1px solid var(--border); border-radius:10px;
  background:var(--surface2); color:var(--text);
  font-size:15px; font-family:inherit; box-sizing:border-box;
}
.authInput:focus{ outline:2px solid var(--text); outline-offset:2px; }
.authInputPadR{ padding-right:40px; }

.togglePasswordBtn{
  position:absolute; right:10px; top:50%; transform:translateY(-50%);
  background:none; border:none; cursor:pointer;
  padding:4px; color:var(--muted); font-size:15px; line-height:1;
}

.authError{ color:#c0392b; font-size:13px; margin:0 0 8px; }
.authEmailDisplay{ font-size:13px; color:var(--muted); margin:0 0 12px; }

.forgotPasswordBtn{
  background:none; border:none; padding:0; font-size:13px;
  color:var(--muted); text-decoration:underline; cursor:pointer;
  margin-bottom:12px; display:block;
}

.authSwitchText{ font-size:13px; color:var(--muted); margin:12px 0 0; text-align:left; }
.authSwitchBtn{
  background:none; border:none; padding:0; font-size:13px;
  color:var(--text); text-decoration:underline; cursor:pointer;
}

.authOrDivider{
  display:flex; align-items:center; gap:10px;
  margin:14px 0; color:var(--muted); font-size:13px;
}
.authOrDivider::before,
.authOrDivider::after{
  content:""; flex:1; height:1px; background:var(--border);
}

/* ── Toast notification ──────────────────────────────────────── */
.toastNotice{
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  z-index: 99999;
  pointer-events: none;
  opacity: 1;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 4px 18px rgba(0,0,0,.18);
  transition: opacity 0.25s ease;
}

/* === Shelf modal — X close button === */
.modalCard {
  position: relative;
}

.modalCloseX {
  position: absolute;
  top: 12px;
  right: 14px;
  appearance: none;
  background: none;
  border: none;
  padding: 4px 6px;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  transition: color 120ms ease, background 120ms ease;
}
.modalCloseX:hover {
  color: var(--text);
  background: var(--btnHover);
}
.modalCloseX:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* === Shelf modal — compact buttons (fit on two rows) === */
.settingsActions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.settingsActions .btn {
  font-size: 14.5px;
  padding: 9px 10px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Danger button spans full width so it sits alone */
.settingsActions .btn.danger {
  grid-column: 1 / -1;
}

.toastHide{ opacity: 0; }
