@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  --paper: #f5ead5;
  --muted: #b7a999;
  --ink: #151210;
  --panel: #221a16;
  --line: #3d3028;
  --coral: #ec8067;
  --accent: #e4775c;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 290px; background: var(--ink); scroll-behavior: smooth; }
body { margin: 0; color: var(--paper); font: 14px/1.5 var(--sans); }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--coral); outline-offset: 4px; }
a { color: var(--coral); }
img { display: block; object-fit: cover; }
h1, h2, p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app-shell { min-height: 100svh; padding-bottom: max(52px, env(safe-area-inset-bottom)); }
.masthead { background: #181411; border-bottom: 1px solid #322720; }
.masthead-inner { max-width: 1112px; padding: max(14px, env(safe-area-inset-top)) 28px 14px; margin: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { color: var(--paper); display: flex; gap: 11px; align-items: center; font: 700 26px/.88 var(--serif); text-decoration: none; }
.brand img { border-radius: 50%; border: 1px solid #b46149; }
.brand small { display: block; margin-top: 5px; color: #c3ab99; font: 500 9px/1 var(--sans); letter-spacing: .11em; text-transform: uppercase; }
.brand-space { color: #dc977b; }
.views { display: flex; align-items: center; padding: 3px; gap: 3px; background: #241c18; border: 1px solid #382b24; border-radius: 30px; }
.views button { min-height: 38px; display: flex; gap: 7px; align-items: center; padding: 0 15px; border-radius: 24px; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.views button svg { width: 17px; height: 17px; }
.views button[aria-current] { background: #52332a; color: #f7d7c2; }
main { max-width: 1112px; margin: auto; padding: 34px 28px 0; }
.player { overflow: hidden; position: relative; display: grid; grid-template-columns: minmax(220px, .82fr) minmax(360px, 1fr); gap: clamp(25px, 5vw, 70px); align-items: center; padding: 33px clamp(28px, 5vw, 62px); border: 1px solid #664135; border-radius: 29px; background: radial-gradient(ellipse at 7% 2%, #613126 0, #322019 43%, transparent 76%), linear-gradient(105deg,#3d241d,#261b17 58%,#211915); }
.player-art { width: 100%; max-width: 304px; aspect-ratio: 1; margin: auto; padding: 8px; background: #f5dcb517; border: 1px solid #f0bb8d44; border-radius: 15px; box-shadow: 0 18px 38px #08060575; }
.player-art img { width: 100%; height: 100%; border-radius: 8px; background: #3f2920; }
.player-main { min-width: 0; position: relative; }
.player-meta { min-height: 31px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.player-meta span { color: #efad91; font-size: 10px; letter-spacing: .14em; font-weight: 700; text-transform: uppercase; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; background: transparent; border: 1px solid #f8d9bf2e; border-radius: 50%; color: var(--muted); padding: 0; }
.icon-button svg { width: 19px; height: 19px; }
#player-title { font: 700 clamp(38px,5.8vw,70px)/.92 var(--serif); letter-spacing: -.045em; overflow-wrap: anywhere; }
.player-byline { min-height: 21px; color: #c9b5a2; font-size: 13px; margin-top: 9px; }
.chapter-label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12px; margin-top: 23px; }
#chapter-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#chapter-count { flex: none; color: #c4ab98; font-variant-numeric: tabular-nums; }
.scrubber { display: grid; align-items: center; margin-top: 4px; height: 28px; }
.scrubber input { --fill: 0%; -webkit-appearance: none; appearance: none; width: 100%; margin: 0; height: 5px; border-radius: 10px; cursor: pointer; background: linear-gradient(to right, var(--accent) var(--fill), #553b33 var(--fill)); }
.scrubber input::-webkit-slider-thumb { appearance: none; width: 15px; height: 15px; border-radius: 50%; background: #f59e83; box-shadow: 0 0 0 4px #f59e831c; }
.scrubber input::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; border: 0; background: #f59e83; }
.time-label { display: flex; justify-content: space-between; font: 500 11px/1.2 var(--sans); color: #c6ae9d; font-variant-numeric: tabular-nums; }
.transport { display: flex; justify-content: center; align-items: center; gap: clamp(14px,4vw,27px); margin: 13px 0 19px; }
.transport button { border-radius: 50%; display: grid; place-items: center; padding: 0; }
.transport-skip { width: 47px; height: 47px; border: 1px solid #765044; background: #5a382c60; }
.transport-skip svg { width: 26px; height: 26px; }
.transport-play { width: 68px; height: 68px; background: #ed8d72; color: #2b160f; border: 0; box-shadow: 0 8px 23px #e2745638; }
.transport-play svg { width: 36px; height: 36px; }
#pause-glyph { display: none; }
#play[data-playing] #play-glyph { display: none; }
#play[data-playing] #pause-glyph { display: block; }
.player-actions { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
.player-actions button { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; min-width: 0; padding: 5px 4px; color: #dfc6b2; border: 1px solid #4e362c; border-radius: 10px; background: #2e211b; font-size: 11px; white-space: nowrap; }
.player-actions svg { width: 17px; height: 17px; flex: none; }
.player-actions strong { font-size: 13px; font-variant-numeric: tabular-nums; color: #f4a78c; }
.player-status { color: #f3b39b; margin-top: 11px; font-size: 12px; }
.library { margin-top: 39px; }
.library-header { display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.library h2, dialog h2 { font: 700 42px/.96 var(--serif); letter-spacing: -.035em; }
.library-count { min-height: 19px; margin-top: 6px; color: var(--muted); font-size: 12px; }
.search { width: min(100%,290px); display: flex; align-items: center; gap: 8px; padding: 0 11px; height: 43px; background: #241c17; border: 1px solid #47352b; border-radius: 12px; color: #c9ae9b; }
.search svg { width: 19px; height: 19px; flex: none; }
.search input { width: 100%; min-width: 0; background: transparent; border: 0; color: var(--paper); outline: none; font-size: 13px; }
.search:focus-within { border-color: var(--coral); }
.search input::placeholder { color: #ad9786; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 18px; }
.filters button { background: #241c17; border: 1px solid #3f3028; color: #c9b4a2; font-size: 12px; padding: 7px 12px; border-radius: 30px; }
.filters button[aria-pressed="true"] { color: #ffd9c8; background: #4e2c23; border-color: #8b4d3b; }
.book-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 22px 15px; }
.book-card { display: block; width: 100%; min-width: 0; padding: 0; border: 0; background: transparent; text-align: left; }
.book-card .tile-art { display: block; position: relative; overflow: hidden; aspect-ratio: 1; border: 1px solid #50382c; border-radius: 11px; background: #31231e; }
.book-card img { width: 100%; height: 100%; transition: transform .22s ease; }
.book-card:hover img { transform: scale(1.04); }
.book-card[aria-pressed="true"] .tile-art { border-color: #e8896f; box-shadow: 0 0 0 1px #e8896f; }
.book-card strong { display: block; margin-top: 7px; font: 700 22px/1 var(--serif); overflow-wrap: anywhere; }
.book-card .tile-author, .book-card .tile-state { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; margin-top: 4px; color: #bcae9d; }
.book-card .tile-state { color: #e4967a; }
.tile-progress { position: absolute; inset: auto 7px 7px; height: 4px; border-radius: 5px; background: #231711ad; overflow: hidden; }
.tile-progress i { display: block; height: 100%; border-radius: 5px; background: #ff9d81; }
.empty { color: var(--muted); padding: 18px 0; }
dialog { width: min(100% - 26px, 492px); max-height: min(76svh, 630px); padding: 0; border: 1px solid #785342; border-radius: 21px; background: #261c17; color: var(--paper); box-shadow: 0 20px 80px #0009; }
dialog::backdrop { background: #0c0808b8; backdrop-filter: blur(4px); }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 23px 11px; position: sticky; top: 0; z-index: 1; background: #261c17; }
dialog h2 { font-size: 35px; }
.sheet-body { padding: 4px 23px 20px; display: grid; gap: 8px; }
.sheet-body p { color: #dbc2ad; }
.sheet-body .info-text { margin: 3px 0 10px; font-size: 14px; }
.sheet-row { padding: 10px 12px; border: 1px solid #4f392e; background: #32231d; text-align: left; border-radius: 10px; min-height: 43px; display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; }
.sheet-row strong { font-size: 13px; font-weight: 600; }
.sheet-row small { flex: none; color: #c4a694; }
.sheet-row[aria-pressed="true"] { background: #583226; border-color: #a15b46; }
.sheet-row.accent { background: #8e4735; color: #fff1dc; border-color: #ad5944; }
.mark-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; }
.mark-row button:last-child { padding-inline: 9px; }
@media (max-width: 850px) { .book-grid { grid-template-columns: repeat(4,minmax(0,1fr)); } }
@media (max-width: 650px) {
  .masthead-inner { padding: max(10px,env(safe-area-inset-top)) 14px 10px; }
  .brand { font-size: 23px; gap: 7px; }
  .brand img { width: 36px; height: 36px; }
  .brand small { font-size: 8px; }
  .views button { min-height: 36px; padding-inline: 9px; font-size: 11px; gap: 4px; }
  .views button svg { width: 14px; }
  main { padding: 15px 13px 0; }
  .player { grid-template-columns: 1fr; padding: 16px 16px 15px; gap: 10px; border-radius: 21px; }
  .player-art { width: min(61vw, 230px); padding: 5px; border-radius: 12px; }
  .player-art img { border-radius: 7px; }
  .player-meta { min-height: 26px; }
  .icon-button { width: 33px; height: 33px; }
  #player-title { font-size: clamp(36px,10vw,54px); }
  .player-byline { font-size: 12px; margin-top: 5px; }
  .chapter-label { margin-top: 13px; }
  .transport { margin: 8px 0 12px; }
  .transport-play { width: 58px; height: 58px; }
  .transport-play svg { width: 31px; }
  .transport-skip { width: 43px; height: 43px; }
  .player-actions { gap: 4px; }
  .player-actions button { font-size: 10px; min-height: 44px; padding-inline: 3px; gap: 3px; }
  .player-actions svg { width: 14px; }
  .library { margin-top: 26px; }
  .library-header { align-items: stretch; flex-direction: column; gap: 9px; }
  .library h2 { font-size: 37px; }
  .search { width: 100%; }
  .filters { margin-top: 10px; }
  .book-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px 9px; }
  .book-card strong { font-size: 19px; }
  .book-card .tile-author, .book-card .tile-state { font-size: 10px; }
  dialog { margin: auto auto 12px; max-height: min(82svh, 630px); }
  .sheet-header, .sheet-body { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 360px) { .book-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
