:root {
  color-scheme: light dark;
  --bg: #fbfbfd;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.1);
  --fill: rgba(0, 0, 0, 0.05);
  --accent: #f0553a;
  --accent-text: #ffffff;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px -12px rgba(0,0,0,.12);
  --r: 14px;
  --r-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --line: rgba(255, 255, 255, 0.14);
    --fill: rgba(255, 255, 255, 0.08);
    --accent: #ff7a5c;
    --accent-text: #1d1d1f;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--accent-text); }

/* one screen: header on top, music and projects side by side */
.app { width: min(1040px, 100%); min-height: 100vh; min-height: 100svh; margin: 0 auto; padding: clamp(24px, 5vh, 56px) 24px; display: flex; flex-direction: column; justify-content: center; gap: clamp(20px, 4vh, 40px); }
.app > * { animation: rise .8s cubic-bezier(.2,.8,.2,1) both; }
.app > .grid { animation-delay: .1s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
h1 { font-size: clamp(3rem, min(9vw, 11vh), 5.5rem); line-height: .95; letter-spacing: -.05em; font-weight: 700; }
.sub { color: var(--muted); font-size: 1.05rem; margin-top: 1rem; letter-spacing: -.01em; }
.sub { min-height: 1.45em; white-space: nowrap; }
.caret { display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; vertical-align: -.15em; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.links { display: flex; gap: 1.4rem; font-size: .95rem; padding-bottom: .3rem; }
.links a, .links button { color: var(--muted); transition: color .2s; }
.links a:hover, .links button:hover { color: var(--accent); }

.grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 1.2rem; align-items: stretch; }
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); }

/* music */
.music { padding: 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
.np { display: grid; grid-template-columns: clamp(84px, 13vh, 112px) 1fr; gap: 1.1rem; align-items: center; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.np-art { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--fill); }
.np-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.np-info { min-width: 0; }
.np-status { display: flex; align-items: center; gap: .5rem; font-size: .75rem; font-weight: 600; color: var(--accent); margin-bottom: .25rem; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.eq i { width: 3px; height: 100%; background: var(--accent); border-radius: 1px; transform-origin: bottom; transform: scaleY(.3); }
.eq.live i { animation: eq 1s ease-in-out infinite; }
.eq.live i:nth-child(2) { animation-delay: -.3s; animation-duration: .8s; }
.eq.live i:nth-child(3) { animation-delay: -.6s; animation-duration: 1.2s; }
.eq.live i:nth-child(4) { animation-delay: -.15s; animation-duration: .9s; }
@keyframes eq { 50% { transform: scaleY(1); } }
.np-title { display: block; font-size: 1.15rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.np-title:hover { color: var(--accent); }
.np-artist { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-bar { margin-top: .7rem; height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; }
#np-fill { height: 100%; width: 0; background: var(--accent); }
.np-time { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); margin-top: .3rem; font-variant-numeric: tabular-nums; }

.tops-controls { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; margin-bottom: .5rem; }
.seg { display: inline-flex; padding: 2px; border-radius: var(--r-sm); background: var(--fill); }
.seg button { padding: .25rem .65rem; font-size: .75rem; border-radius: 6px; color: var(--muted); transition: background .2s, color .2s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.top-list { list-style: none; }
.top-list li { display: grid; grid-template-columns: 1.3rem 36px 1fr; align-items: center; gap: .75rem; padding: .3rem .3rem; border-radius: var(--r-sm); transition: background .2s; }
.top-list li:hover { background: var(--fill); }
.top-list .n { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.top-list .art { position: relative; width: 36px; height: 36px; }
.top-list img, .top-list .ph { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; background: var(--fill); display: block; }
.top-list .txt { min-width: 0; }
.top-list .t { font-weight: 500; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-list .s { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.txt:hover .t { color: var(--accent); }
.top-msg { color: var(--muted); font-size: .9rem; padding: .6rem .3rem; display: block !important; }

/* preview play button */
.play { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; background: rgba(0,0,0,.38); opacity: 0; transition: opacity .2s; display: grid; place-items: center; }
.play::before { content: ''; width: 0; height: 0; border-left: 10px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 3px; }
.np-art .play::before { border-left-width: 16px; border-top-width: 10px; border-bottom-width: 10px; margin-left: 5px; }
.play.on::before { width: 4px; height: 12px; border: 0; margin: 0; background: #fff; box-shadow: 7px 0 0 #fff; transform: translateX(-3px); }
.np-art .play.on::before { width: 6px; height: 20px; box-shadow: 11px 0 0 #fff; transform: translateX(-5px); }
.play.busy::before { opacity: .5; }
.play:disabled { cursor: not-allowed; }
.play:disabled::before { opacity: .4; }
.np-art:hover .play, .top-list li:hover .play, .play:focus-visible, .play.on, .play.cur, .play:disabled:hover { opacity: 1; }
.ring { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); transform: rotate(-90deg); opacity: 0; transition: opacity .2s; pointer-events: none; }
.np-art .ring { inset: auto; width: 60px; height: 60px; left: calc(50% - 30px); top: calc(50% - 30px); }
.ring circle { fill: none; stroke-width: 2.5; }
.ring .rt { stroke: rgba(255,255,255,.3); }
.ring .rp { stroke: #fff; stroke-dasharray: 100; stroke-dashoffset: 100; stroke-linecap: round; }
.play.cur .ring { opacity: 1; }
@media (hover: none) { .play { opacity: 1; background: rgba(0,0,0,.28); } }

/* projects */
.projects { display: flex; flex-direction: column; }
.label { font-size: .8rem; font-weight: 600; color: var(--muted); margin: 0 0 .6rem .2rem; }
.project-list { flex: 1; display: flex; flex-direction: column; gap: 1.2rem; }
.project { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 1.3rem 1.4rem; transition: transform .3s cubic-bezier(.2,.8,.2,1); }
a.project:hover { transform: translateY(-3px); }
.project .badge { font-size: .75rem; font-weight: 600; color: var(--accent); }
.project h2 { font-size: 1.5rem; letter-spacing: -.025em; line-height: 1.15; margin: .25rem 0 .4rem; }
a.project h2::after { content: ' \203A'; color: var(--muted); display: inline-block; transition: transform .25s, color .25s; }
a.project:hover h2::after { transform: translateX(4px); color: var(--accent); }
.project p { color: var(--muted); font-size: .92rem; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.tags span { font-size: .72rem; padding: .2rem .55rem; border-radius: 6px; background: var(--fill); color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 1.6rem; z-index: 20; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: .7rem 1.1rem; border-radius: var(--r-sm); background: var(--text); color: var(--bg); font-size: .9rem; transition: transform .35s, opacity .35s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .head { align-items: flex-start; flex-direction: column; gap: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .001s !important; }
}
