/* App-specific styles on top of base.css tokens. */
:root { --accent: #7a3e1d; --accent-soft: #f6e9df; --paper: #fbf7ef; }
@media (prefers-color-scheme: dark) { :root { --accent: #e3a072; --accent-ink: #1d120b; --accent-soft: #3a2619; --paper: #221d17; } }

.brand { font-family: Georgia, "Times New Roman", serif; letter-spacing: 0; font-size: 1.15rem; }
.card.narrow-wide { max-width: 640px; }
.break { word-break: break-word; max-width: 28rem; }
.error-text { color: var(--danger); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stats .card { margin: 0; display: flex; flex-direction: column; gap: .2rem; }
.stat-n { font-size: 1.8rem; font-weight: 700; line-height: 1; }

/* Profiles in the admin account view */
.profile-list { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.profile-row { display: grid; gap: .6rem; padding: .8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
@media (min-width: 900px) { .profile-row { grid-template-columns: 1.1fr .9fr 1fr 1.3fr auto; align-items: end; } }
.profile-flags { display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: center; }
.add-box summary { list-style: none; cursor: pointer; }
.add-box summary::-webkit-details-marker { display: none; }
.add-box[open] summary { margin-bottom: .8rem; }
.add-box form { max-width: 440px; }

.vis-grid td, .vis-grid th { white-space: nowrap; }
.vis-grid input[type=checkbox] { width: 1.15rem; height: 1.15rem; }

/* Books */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; }
.book-card { margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.book-card h2 { font-size: 1rem; margin: .3rem 0 0; }
.book-card p { margin: 0; }
.link-card { color: var(--ink); }
.link-card:hover { text-decoration: none; border-color: var(--accent); }
.book-thumb {
    aspect-ratio: 1 / 1.414; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000));
    color: #fff; font: 700 2.4rem Georgia, serif; border-radius: 4px 8px 8px 4px;
    box-shadow: inset 6px 0 0 rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.15);
}
.landscape .book-thumb, .book-thumb.landscape { aspect-ratio: 1.414 / 1; }
.card.narrow .book-thumb { width: 140px; margin: 0 auto 1rem; }

/* Profile picker */
.profile-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.25rem; margin: 2rem 0; }
.profile-tile {
    display: flex; flex-direction: column; align-items: center; gap: .4rem; width: 140px; padding: 1rem .5rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font: inherit; color: var(--ink);
}
.profile-tile:hover, .profile-tile:focus-visible { border-color: var(--accent); outline: none; }
.avatar {
    width: 72px; height: 72px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent); font: 700 1.8rem Georgia, serif;
}
.avatar.big { width: 96px; height: 96px; font-size: 2.4rem; margin-bottom: .5rem; }
.tile-name { font-weight: 600; }
.pin-input { text-align: center; font-size: 1.6rem; letter-spacing: .5em; }
.pin-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.pin-form input { width: 8rem; }

/* Media bank */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.media-item { margin: 0; padding: .6rem; display: flex; flex-direction: column; gap: .5rem; }
.media-item img, .media-item video { width: 100%; height: 160px; object-fit: cover; border-radius: 4px; background: var(--bg); }
.media-item figcaption { display: flex; flex-direction: column; gap: .15rem; }
.upload-status { display: flex; flex-direction: column; gap: .35rem; }
.upload-status[hidden] { display: none; }
.upload-status progress { width: 100%; height: .6rem; accent-color: var(--accent); }
.tabs { margin-top: 1rem; }

/* Quota meter */
.quota { display: flex; flex-direction: column; gap: .2rem; min-width: 220px; }
.quota progress { width: 100%; height: .55rem; accent-color: var(--accent); }
.quota progress.full { accent-color: var(--danger); }

/* Video embeds: click-to-play placeholder */
.embed-ph {
    position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 160px;
    padding: 0; border: 0; border-radius: 4px; overflow: hidden; cursor: pointer; color: #fff;
    background: linear-gradient(135deg, #2a2723, #48413a); font: inherit;
}
.embed-ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .75; }
.embed-play {
    position: relative; width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.6); font-size: 1.4rem; padding-left: 4px;
}
.embed-note { position: absolute; left: .4rem; right: .4rem; bottom: .3rem; font-size: .7rem; line-height: 1.25; text-align: left;
    background: rgba(0,0,0,.55); padding: .2rem .35rem; border-radius: 3px; }
.embed-ph:hover .embed-play, .embed-ph:focus-visible .embed-play { background: var(--accent); }
.embed-frame { width: 100%; height: 160px; border: 0; border-radius: 4px; }
.media-item form { margin: 0; }

/* Age labels */
.age-badge { background: var(--info-soft); color: var(--ink); }
.age-badge.age-high { background: var(--danger-soft); color: var(--danger); }
.content-tags { margin-left: .3rem; }
.age-blocked { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.age-form select { width: auto; padding: .3rem .4rem; }

label .hint { font-weight: 400; }

/* Designed covers in book lists */
.book-thumb.has-cover { background: none; box-shadow: 0 2px 8px rgba(0,0,0,.25); padding: 0; overflow: hidden; display: block; color: transparent; }
.book-thumb.has-cover > .bk-page { width: 100%; height: 100%; }
.book-cover-link { display: block; }
.book-cover-link:hover .book-thumb { box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.lib-card { background: none; border: 0; padding: 0; }
.lib-card .book-thumb { transition: transform .15s; }
.lib-card:hover .book-thumb { transform: translateY(-3px); }
.read-progress { width: 100%; height: .35rem; accent-color: var(--accent); }

/* Ways of working (book settings) */
.mode-cards { display: grid; gap: .5rem; }
.mode-cards legend { margin-bottom: .4rem; }
.mode-card { display: grid; grid-template-columns: auto 1fr; gap: .1rem .6rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font-weight: 400; }
.mode-card input { grid-row: span 2; margin-top: .2rem; }
.mode-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode-card.disabled { opacity: .5; cursor: not-allowed; }
.mode-name { font-weight: 700; }
.mode-desc { font-size: .85rem; color: var(--muted); }
