:root {
  --brand: #2f6e6a;
  --brand-dark: #204b48;
  --bg: #f4f1ea;
  --text: #1f1f1f;
  --muted: #6b6b6b;
  --card-bg: #ffffff;
  --error: #b3261e;
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}

.screen {
  height: 100%;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Login ---------- */
#screen-login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card h1 {
  margin: 0;
  font-size: 22px;
  text-align: center;
  color: var(--brand-dark);
}

.login-card .subtitle {
  margin: 0 0 8px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.login-card input {
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d8d3c7;
  background: #fbfaf7;
}

.login-card input:focus {
  outline: 2px solid var(--brand);
}

.login-card button {
  margin-top: 6px;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: white;
  font-size: 16px;
  font-weight: 600;
}

.login-card button:active { background: var(--brand-dark); }
.login-card button:disabled { opacity: 0.6; }

.password-field {
  position: relative;
  display: flex;
}
.password-field input { flex: 1; padding-right: 68px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 8px;
}

.error {
  color: var(--error);
  font-size: 13px;
  margin: 0;
}

/* ---------- Library ---------- */
.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) 20px 16px;
  background: var(--brand);
  color: white;
  position: sticky;
  top: 0;
  z-index: 5;
}

.library-header h1 { margin: 0; font-size: 20px; }

.icon-button {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 15px;
  padding: 8px 10px;
}

.status-message {
  padding: 16px 20px 0;
  color: var(--muted);
  font-size: 14px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 20px;
  padding: 20px;
}

/* ---------- Nav drawer ---------- */
.nav-list {
  display: flex;
  flex-direction: column;
}
.nav-item {
  text-align: left;
  background: none;
  border: none;
  padding: 14px 4px;
  font-size: 15px;
  color: #1f1f1f;
  border-bottom: 1px solid #eee;
}
.nav-item.active { color: var(--brand); font-weight: 600; }

/* ---------- Simple list sections (videos, resenhas, anotações) ---------- */
.simple-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.list-card {
  display: flex;
  gap: 14px;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  text-align: left;
  border: none;
  text-decoration: none;
  color: inherit;
}

.list-card img {
  width: 64px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  flex: 0 0 auto;
  background: #ddd;
}

.list-card .list-card-body { flex: 1; min-width: 0; }

.list-card .list-card-title {
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 4px;
}

.list-card .list-card-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px;
}

.list-card .list-card-text {
  font-size: 13px;
  color: #444;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card.not-owned {
  opacity: 0.55;
}
.book-card .owned-badge {
  font-size: 10px;
  color: var(--brand);
  margin-top: 6px;
  font-weight: 600;
}

.book-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  text-align: left;
  border: none;
  padding: 0;
  cursor: pointer;
}

.book-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: #ddd;
  display: block;
}

.book-card .book-info { padding: 10px 12px 12px; }

.book-card .book-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card .book-progress-bar {
  height: 4px;
  background: #e4e0d5;
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.book-card .book-progress-fill {
  height: 100%;
  background: var(--brand);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #1f1f1f;
  color: white;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 50;
}
