:root {
  --ink: #263238;
  --muted: #667176;
  --paper: #fffaf0;
  --panel: rgba(255, 255, 255, 0.9);
  --teal: #2b8c83;
  --teal-dark: #1f6863;
  --coral: #f07167;
  --gold: #f2b84b;
  --mint: #b8dfd6;
  --plum: #46344e;
  --line: rgba(38, 50, 56, 0.14);
  --shadow: 0 20px 50px rgba(34, 45, 50, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(184, 223, 214, 0.55), rgba(255, 250, 240, 0.35) 42%, rgba(240, 113, 103, 0.16)),
    #fff7ea;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hero {
  min-height: clamp(410px, 62vh, 590px);
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(280px, 0.74fr);
  align-items: center;
  gap: clamp(26px, 6vw, 82px);
  padding: clamp(24px, 5vw, 54px);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 20%, rgba(242, 184, 75, 0.24), transparent 24%),
    linear-gradient(135deg, #fffbf1 0%, #e6f5ef 58%, #fedbd0 100%);
  box-shadow: var(--shadow);
}

.hero-copy {
  align-self: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal-dark);
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: 0.88;
  letter-spacing: 0;
  color: var(--plum);
}

.intro {
  max-width: 440px;
  color: #435055;
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.55;
}

.hero-art {
  position: relative;
  min-height: 370px;
}

.moon {
  position: absolute;
  width: 82px;
  aspect-ratio: 1;
  border-radius: 50%;
  right: 12%;
  top: 20px;
  background: #ffe2a5;
  box-shadow: 0 0 0 18px rgba(255, 226, 165, 0.28);
}

.shelf {
  position: absolute;
  height: 14px;
  border-radius: 999px;
  background: #9a6a4c;
  box-shadow: 0 12px 0 rgba(154, 106, 76, 0.22);
}

.shelf::before,
.shelf::after {
  content: "";
  position: absolute;
  bottom: 14px;
  width: 18px;
  height: 72px;
  border-radius: 3px 3px 0 0;
  background: var(--coral);
  box-shadow:
    24px 10px 0 #67a59c,
    48px -5px 0 #f2b84b,
    72px 7px 0 #46344e;
}

.shelf-one {
  width: 170px;
  left: 12px;
  top: 54px;
}

.shelf-two {
  width: 132px;
  right: 5px;
  bottom: 110px;
}

.cat {
  position: absolute;
  left: 16%;
  bottom: 68px;
  width: 230px;
  height: 210px;
}

.cat-body {
  position: absolute;
  inset: 86px 20px 0 24px;
  border-radius: 46% 48% 38% 42%;
  background: #38424a;
  box-shadow: inset -28px -24px 0 rgba(0, 0, 0, 0.14);
}

.cat-face {
  position: absolute;
  left: 46px;
  top: 24px;
  width: 142px;
  height: 128px;
  border-radius: 48% 48% 44% 44%;
  background: #3f4b55;
  box-shadow: inset -14px -16px 0 rgba(0, 0, 0, 0.12);
  z-index: 2;
}

.cat-ear {
  position: absolute;
  top: 8px;
  width: 58px;
  height: 66px;
  background: #3f4b55;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  z-index: 1;
}

.cat-ear.left {
  left: 42px;
  transform: rotate(-16deg);
}

.cat-ear.right {
  right: 38px;
  transform: rotate(16deg);
}

.eye {
  position: absolute;
  top: 48px;
  width: 15px;
  height: 20px;
  border-radius: 50%;
  background: #ffe2a5;
}

.eye.left {
  left: 42px;
}

.eye.right {
  right: 42px;
}

.nose {
  position: absolute;
  left: 65px;
  top: 76px;
  width: 13px;
  height: 10px;
  border-radius: 50%;
  background: var(--coral);
}

.whiskers {
  position: absolute;
  top: 82px;
  width: 42px;
  height: 2px;
  background: rgba(255, 250, 240, 0.8);
}

.whiskers.left {
  left: -4px;
  box-shadow: 2px -11px 0 rgba(255, 250, 240, 0.68), 2px 11px 0 rgba(255, 250, 240, 0.68);
}

.whiskers.right {
  right: -4px;
  box-shadow: -2px -11px 0 rgba(255, 250, 240, 0.68), -2px 11px 0 rgba(255, 250, 240, 0.68);
}

.tail {
  position: absolute;
  right: 0;
  bottom: 20px;
  width: 88px;
  height: 126px;
  border: 24px solid #38424a;
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(24deg);
}

.open-book {
  position: absolute;
  left: 30%;
  bottom: 30px;
  width: 260px;
  height: 104px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  filter: drop-shadow(0 16px 16px rgba(44, 36, 28, 0.16));
}

.open-book span {
  background: #fffaf0;
  border: 2px solid rgba(70, 52, 78, 0.16);
}

.open-book span:first-child {
  border-radius: 28px 6px 10px 28px;
  transform: skewY(5deg);
}

.open-book span:last-child {
  border-radius: 6px 28px 28px 10px;
  transform: skewY(-5deg);
}

.tracker-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(34, 45, 50, 0.08);
}

.progress-panel,
.log-panel {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.heading-actions {
  display: flex;
  gap: 8px;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  color: var(--plum);
}

.form-stack,
.entry-form {
  display: grid;
  gap: 14px;
}

.entry-form {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

label span,
.label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(38, 50, 56, 0.2);
  border-radius: 8px;
  padding: 10px 13px;
  color: var(--ink);
  background: #fffdf8;
  outline: none;
}

input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(43, 140, 131, 0.16);
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  min-height: 48px;
  padding: 0 20px;
  color: white;
  background: var(--teal);
  box-shadow: 0 10px 18px rgba(43, 140, 131, 0.18);
}

.primary-button:hover {
  background: var(--teal-dark);
}

.ghost-button {
  min-height: 38px;
  padding: 0 14px;
  color: var(--teal-dark);
  background: rgba(43, 140, 131, 0.1);
}

.danger-button {
  min-height: 48px;
  padding: 0 16px;
  color: #9d2d2f;
  background: rgba(240, 113, 103, 0.16);
}

.danger-button:hover {
  color: #7c1f22;
  background: rgba(240, 113, 103, 0.24);
}

.icon-button {
  min-width: 48px;
  height: 38px;
  color: var(--plum);
  background: rgba(70, 52, 78, 0.1);
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.book-card {
  padding: 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(242, 184, 75, 0.22), rgba(184, 223, 214, 0.36));
}

.book-card h3 {
  margin-bottom: 6px;
  font-size: 1.55rem;
}

.book-shelf {
  margin-top: 18px;
}

.book-list {
  display: grid;
  gap: 8px;
}

.book-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  text-align: left;
  background: #fffdf8;
}

.book-row:hover,
.book-row.active {
  border-color: rgba(43, 140, 131, 0.42);
  background: rgba(184, 223, 214, 0.28);
}

.book-row-title {
  min-width: 0;
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-row-progress {
  flex: 0 0 auto;
  color: var(--teal-dark);
  font-size: 0.86rem;
  font-weight: 900;
}

.empty-shelf {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.hidden {
  display: none !important;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--teal-dark);
  font-size: 0.85rem;
  font-weight: 900;
  background: rgba(184, 223, 214, 0.65);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.stats-row > div {
  min-width: 0;
  padding: 14px;
  border-radius: 8px;
  background: #fff8ec;
  border: 1px solid rgba(242, 184, 75, 0.28);
}

.stat-value,
.stat-label {
  display: block;
}

.stat-value {
  color: var(--plum);
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 900;
  line-height: 1;
}

.stat-label {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.progress-track {
  position: relative;
  height: 42px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(70, 52, 78, 0.11);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--gold), var(--teal));
  transition: width 420ms ease;
}

.progress-cat {
  position: absolute;
  top: 50%;
  left: 0;
  width: 40px;
  height: 40px;
  transform: translate(-5%, -50%);
  transition: left 420ms ease;
}

.progress-cat::before,
.progress-cat::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: var(--plum);
}

.progress-cat::before {
  left: 12px;
  top: 17px;
  width: 17px;
  height: 14px;
  transform: rotate(-12deg);
}

.progress-cat::after {
  left: 8px;
  top: 7px;
  width: 8px;
  height: 8px;
  box-shadow:
    10px -3px 0 var(--plum),
    20px 0 0 var(--plum);
}

.chart-wrap {
  margin-top: 18px;
  width: 100%;
  min-height: 220px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 360px;
}

.reading-log {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.reading-log li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fffdf8;
  border: 1px solid var(--line);
}

.log-date {
  color: var(--muted);
  font-weight: 800;
}

.log-pages {
  display: block;
  color: var(--plum);
}

.log-delete-button {
  flex: 0 0 auto;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: #9d2d2f;
  font-weight: 900;
  background: rgba(240, 113, 103, 0.16);
}

.log-delete-button:hover {
  color: #7c1f22;
  background: rgba(240, 113, 103, 0.24);
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 22px, 680px);
    padding-top: 12px;
  }

  .hero,
  .tracker-grid,
  .entry-form,
  .form-actions {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding: 24px;
  }

  .hero-art {
    min-height: 315px;
  }

  .cat {
    left: 4%;
    transform: scale(0.86);
    transform-origin: bottom left;
  }

  .open-book {
    left: 18%;
    width: 220px;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .panel {
    padding: 17px;
  }

  h1 {
    font-size: 3.2rem;
  }

  .hero-art {
    min-height: 270px;
  }

  .shelf-two {
    display: none;
  }
}
