:root {
  --bg: #B8A98F;
  --accent: #2E8B85;
  --text: #1F3D3B;
  --muted: rgba(31,61,59,0.70);
  --card: #2E8B85;                 /* punchy teal cards */
  --card-text: #F2FFFE;            /* light text on teal */
  --card-muted: rgba(242,255,254,0.78);
  --card-border: rgba(242,255,254,0.18);
  --border: rgba(0,0,0,0.12);
  --shadow: 0 10px 26px rgba(0,0,0,0.12);
  --radius: 18px;
  --max: 780px;
}

* {
  box-sizing: border-box;
}

body, html {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html{
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(46,139,133,0.14), transparent 60%),
    radial-gradient(900px 620px at 15% 20%, rgba(255,255,255,0.18), transparent 62%),
    linear-gradient(180deg, #CDBFA7 0%, var(--bg) 55%, #A9967B 120%);
  background-repeat: no-repeat;
  background-attachment: scroll; /* important for mobile */
}

body{
  background: transparent; /* so the html background shows through */
}


header {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(205,191,167,0.70);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

header p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

h2 {
  width: 100%;
  max-width: var(--max);
  margin: 18px auto 10px;
  padding: 0 16px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}

h3 {
  width: 100%;
  max-width: var(--max);
  margin: 14px auto 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
}

footer {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 16px 24px;
  border-top: 1px solid var(--border);
}

footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* New */

main{
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 16px 40px;
}

.book-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 10px 0 18px;
}

.book-card {
  display: flex;
  gap: 14px;
  align-items: stretch;
  background: var(--card);
  color: var(--card-text);
  border-radius: var(--radius);
  overflow: hidden;
}

.book-cover {
  width: 150px;
  flex: 0 0 150px;
  height: auto;
  display: block;
  background: rgba(0,0,0,0.10);
}

/* Meta */
.book-meta{
  flex: 1;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.book-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.25;
}

.book-dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

.book-dl dt {
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0 0 2px 0;
  color: var(--card-muted);
}

.book-dl dd{
  margin: 0;
  font-size: 0.95rem;
}

.book-author {
  color: var(--card-text);
  text-decoration-color: rgba(242,255,254,0.55);
  text-underline-offset: 3px;
}

/* Links row */
.book-links{
  display: flex;
  gap: 10px;
  align-items: center;
}

.book-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(0,0,0,0.14);  /* subtle “pill” on teal */
}

.logo{
  width: 22px;
  height: 22px;
  display: block;
  object-fit: contain;
  filter: none; /* keep original colours */
}

/* Alternate layout: even cards swap sides */
.book-card:nth-child(even){
  flex-direction: row-reverse;
}

.logo-svg {
  width: 22px;
  height: 22px;
  display: inline-flex;
}

.admin{
  width: 100%;
  max-width: var(--max);
  margin: 22px auto 0;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.admin-row{
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}

.admin-row input{
  flex: 1;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 0 12px;
  background: rgba(255,255,255,0.55);
  color: var(--text);
  font-size: 1rem;
}

.admin-row button{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  font-size: 1.1rem;
  cursor: pointer;
}

#adminOut{
  margin: 10px 0 0;
  white-space: pre-wrap;
  color: var(--muted);
}

/* Mobile readability first: stack vertically on narrow screens */
@media (max-width: 520px){
  .book-card{
    flex-direction: column;
  }
  .book-card:nth-child(even){
    flex-direction: column;
  }
  .book-cover{
    width: 100%;
    min-width: 0;
    aspect-ratio: 16 / 9; /* “banner” style; change to 2/3 if you want */
  }
}
