[hidden] { display: none !important; }
:root {
  --paper: #f6f1e7;
  --card: #fffdf8;
  --ink: #23201b;
  --muted: #6f675b;
  --line: #e3dccd;
  --accent: #1f5d4f;
  --accent-ink: #ffffff;
  --warn: #a4471f;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  padding-bottom: calc(88px + var(--safe-b));
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
a { color: var(--accent); }

header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  background: rgba(246, 241, 231, 0.94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
header h1 { flex: 1; margin: 0; font-size: 21px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tabs { display: flex; gap: 4px; }
#tabs a {
  padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 15px;
}
#tabs a.on { background: var(--ink); color: var(--paper); }
.icon-btn {
  border: 0; background: none; font-size: 30px; line-height: 1; padding: 2px 10px 6px; min-width: 44px; min-height: 44px; cursor: pointer;
}

main { padding: 14px; max-width: 640px; margin: 0 auto; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 22px 4px 8px; }
h2:first-child { margin-top: 4px; }
.empty { color: var(--muted); padding: 6px 4px 10px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
  text-decoration: none; color: inherit;
}
.cover {
  width: 56px; height: 80px; flex: none; border-radius: 6px; object-fit: cover; background: var(--line);
}
.cover.big { width: 160px; height: 230px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.meta { flex: 1; min-width: 0; }
.meta .t { font-weight: 650; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta .s { color: var(--muted); font-size: 15px; margin-top: 2px; }
.meta .due { font-size: 15px; margin-top: 4px; }
.due.soon { color: var(--warn); font-weight: 600; }
.pill { display: inline-block; font-size: 13px; padding: 2px 8px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); color: var(--muted); margin-right: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-weight: 650; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 15px; }
.btn[disabled] { opacity: 0.5; }
.btn.block { width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

form.login { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 10px; }
label { display: block; font-weight: 600; margin: 10px 0 6px; }
input[type=text], input[type=password], input[type=search], input[type=tel] {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 18px;
  -webkit-appearance: none; appearance: none;
}
.err { color: var(--warn); margin: 10px 0 0; }
.hint { color: var(--muted); font-size: 14px; margin-top: 14px; }

.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input { flex: 1; }

.work-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 8px 0 4px; }
.work-head .t { font-size: 22px; font-weight: 700; line-height: 1.2; }
.work-head .s { color: var(--muted); }
.abstract { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 14px; }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.status { color: var(--muted); font-size: 15px; text-align: center; }

/* player */
.player { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 10px; text-align: center; }
.player .t { font-size: 21px; font-weight: 700; line-height: 1.2; }
.player .s { color: var(--muted); margin-top: -8px; }
.scrub { width: 100%; }
.scrub input { width: 100%; accent-color: var(--accent); height: 32px; }
.times { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: center; gap: 22px; }
.controls button { border: 0; background: none; cursor: pointer; }
.skip { font-size: 15px; font-weight: 700; width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line) !important; background: var(--card) !important; }
.play { width: 84px; height: 84px; border-radius: 50%; background: var(--accent) !important; color: #fff; font-size: 34px; }
.extras { display: flex; gap: 10px; }

#mini {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); z-index: 6;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 8px;
  background: var(--ink); color: var(--paper); border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
#mini[hidden] { display: none; }
#mini img { width: 40px; height: 56px; border-radius: 5px; object-fit: cover; background: #444; }
.mini-text { flex: 1; min-width: 0; text-align: left; border: 0; background: none; color: inherit; display: flex; flex-direction: column; padding: 0; cursor: pointer; }
#mini-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mini-time { font-size: 13px; opacity: 0.7; font-variant-numeric: tabular-nums; }
#mini .icon-btn { color: var(--paper); font-size: 24px; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b)); z-index: 7;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 12px; max-width: 90vw; text-align: center;
}
#toast[hidden] { display: none; }
.spinner { text-align: center; color: var(--muted); padding: 30px 0; }
.player .cover.big { width: 230px; height: 230px; }
