:root {
  --bg: #f5f3ee;
  --card: #ffffff;
  --line: rgba(29, 29, 31, 0.08);
  --text: #1d1d1f;
  --dim: #85837b;
  --accent: #ff4f1f;
  --accent-deep: #d8380e;
  --teal: #0a7f73;
  --teal-bright: #10ac9b;
  --green: #34c759;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1000px 600px at 70% -10%, #fbfaf6 0%, var(--bg) 60%), var(--bg);
  color: var(--text);
  font-family: -apple-system, 'SF Pro Text', 'Inter', 'Segoe UI', system-ui, sans-serif;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 36px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(245, 243, 238, 0.9);
  backdrop-filter: blur(10px);
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: 0.34em; }
.brand h1 span { color: var(--dim); font-weight: 400; letter-spacing: 0.1em; font-size: 13px; margin-left: 6px; }
.now { color: var(--dim); font-size: 13px; }
.now b { color: var(--accent-deep); font-weight: 600; }

main { max-width: 1060px; margin: 0 auto; padding: 28px 36px 80px; display: flex; flex-direction: column; gap: 40px; }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; margin-bottom: 14px; flex-wrap: wrap; }
h2 { margin: 0; font-size: 13px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--dim); font-weight: 600; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
  box-shadow: 0 2px 10px rgba(29, 29, 31, 0.04);
}
.stat .v { font-size: 24px; font-weight: 700; }
.stat .v.teal { color: var(--teal); }
.stat .v.amber { color: var(--accent-deep); }
.stat .k { color: var(--dim); font-size: 11.5px; margin-top: 3px; letter-spacing: 0.06em; }

/* listening chart */
.chart-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 20px 12px; box-shadow: 0 2px 10px rgba(29, 29, 31, 0.04);
}
.chart-total { color: var(--dim); font-size: 12px; }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding-top: 6px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-col .bar { width: 100%; max-width: 34px; border-radius: 6px 6px 2px 2px; background: rgba(255, 79, 31, 0.28); }
.bar-col .bar.today { background: var(--accent); }
.bar-col span { font-size: 10px; color: var(--dim); }

/* library */
.upload { cursor: pointer; text-align: right; }
.upload span {
  display: inline-block; color: var(--accent-deep); border: 1px dashed rgba(255, 79, 31, 0.5);
  border-radius: 999px; padding: 6px 16px; font-size: 13px; font-weight: 600; transition: background 0.15s;
}
.upload:hover span, .upload.drag span { background: rgba(255, 79, 31, 0.08); }
.upload small { display: block; color: var(--dim); font-size: 11px; margin-top: 5px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.book {
  display: flex; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px;
  position: relative;
  box-shadow: 0 2px 10px rgba(29, 29, 31, 0.04);
}
.book.current { border-color: rgba(255, 79, 31, 0.45); }
.book .cover {
  width: 62px; height: 62px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 19px; color: rgba(255,255,255,0.95);
}
.book .meta { min-width: 0; }
.book .t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book .a { color: var(--dim); font-size: 11.5px; margin: 2px 0 8px; }
.book .bar-track { height: 4px; border-radius: 2px; background: rgba(29,29,31,0.08); overflow: hidden; }
.book .bar-track i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.book .p { font-size: 10.5px; color: var(--dim); margin-top: 5px; }
.book .badge { position: absolute; top: 10px; right: 12px; font-size: 9px; letter-spacing: 0.12em; color: var(--accent-deep); font-weight: 600; }
.book .badge.done { color: var(--green); }

/* quotes */
select {
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-family: inherit; font-size: 12.5px;
}
.quotes { display: flex; flex-direction: column; gap: 12px; }
.quote {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--teal-bright);
  border-radius: 14px; padding: 16px 18px; display: flex; gap: 16px; align-items: flex-start;
  box-shadow: 0 2px 10px rgba(29, 29, 31, 0.04);
}
.quote .mark { color: var(--teal-bright); font-size: 30px; font-family: Georgia, serif; line-height: 0.7; flex: none; }
.quote.note .mark { font-size: 20px; line-height: 1; }
.quote .acts button:disabled { opacity: 0.4; cursor: default; }
.quote .body { flex: 1; min-width: 0; }
.quote .text { font-size: 15px; line-height: 1.5; }
.quote .text.pending { color: var(--dim); font-style: italic; }
.quote .src { color: var(--dim); font-size: 11.5px; margin-top: 8px; }
.quote .src b { color: var(--teal); font-weight: 600; }
.quote .acts { display: flex; gap: 6px; flex: none; }
.quote .acts button {
  background: none; border: 1px solid var(--line); color: var(--dim); border-radius: 8px;
  padding: 5px 10px; font-size: 11px; cursor: pointer; font-family: inherit;
}
.quote .acts button:hover { color: var(--text); border-color: var(--dim); }
.empty { color: var(--dim); font-size: 13.5px; padding: 20px; text-align: center; border: 1px dashed var(--line); border-radius: 14px; }

/* summaries */
.summaries { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.summary {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px;
  box-shadow: 0 2px 10px rgba(29, 29, 31, 0.04);
}
.summary h3 { margin: 0 0 10px; font-size: 14.5px; }
.summary ul { margin: 0; padding-left: 18px; color: var(--dim); font-size: 13px; line-height: 1.65; }
.summary li::marker { color: var(--teal-bright); }

.toastbar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  padding: 10px 20px; border-radius: 999px; font-size: 13px; box-shadow: 0 10px 30px rgba(29,29,31,0.18);
  animation: pop 0.18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }
