:root {
  --bg: #0e0f12; --surface: #17191e; --surface2: #20232a; --border: #2a2e37;
  --text: #eceef2; --muted: #8b919e; --accent: #ff5a36; --accent-text: #fff; --done: #3ecf8e;
  --font: 'Inter', system-ui, sans-serif;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background-color: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; }
body { min-height: 100vh; display: flex; flex-direction: column;
  /* faint blueprint grid + paper grain */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 160px 160px, 64px 64px, 64px 64px;
  background-attachment: fixed;
}
select option { color: #111; background: #fff; }
a { color: inherit; }
button, select, input, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 20px; padding: 0 28px; min-height: 72px; backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 90%, #000); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -0.03em; text-decoration: none; white-space: nowrap; }
.brand img { height: 46px; width: auto; display: block; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.title-wrap { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.title-wrap h1 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 10px; align-items: center; }
select { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; cursor: pointer; }

.btn { background: var(--accent); color: var(--accent-text); border: 0; border-radius: 14px; padding: 10px 22px; font-weight: 700; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.icon { background: none; border: 0; padding: 6px; border-radius: 6px; cursor: pointer; display: inline-flex; color: var(--text); }
.icon:hover { background: var(--surface2); }
.icon svg { width: 22px; height: 22px; fill: currentColor; }

/* layout */
.review { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 0; flex: 1; }
.player-col { padding: 28px; min-width: 0; }
.comments-col { border-left: 1px solid var(--border); background: var(--surface); backdrop-filter: blur(12px); display: flex; flex-direction: column; height: calc(100vh - 72px); position: sticky; top: 72px; }

/* player */
.player { position: relative; background: #000; border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 12px 40px rgba(0,0,0,.08); overflow: hidden; aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; }
.player video { width: 100%; height: 100%; object-fit: contain; display: block; cursor: pointer; }
.big-play { position: absolute; width: 76px; height: 76px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 88%, transparent); display: grid; place-items: center; pointer-events: none; transition: opacity .2s; }
.big-play svg { width: 36px; fill: var(--accent-text); margin-left: 4px; }
.player.playing .big-play { opacity: 0; }
.video-error { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); background: #000; }
.player:fullscreen { border-radius: 0; aspect-ratio: auto; }
/* vertical / square videos: box follows the video's shape and fits the screen height */
.player.tall { aspect-ratio: var(--ar); width: min(100%, calc((100vh - 230px) * var(--ar))); margin: 0 auto; }
.player.tall:fullscreen { width: 100%; aspect-ratio: auto; }

.controls { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.icon .i-pause, .playing-ctl .i-play { display: none; }
.playing-ctl .i-pause { display: block; }
.icon .i-mute, .muted-ctl .i-vol { display: none; }
.muted-ctl .i-mute { display: block; }
.tc { font-variant-numeric: tabular-nums; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px; white-space: nowrap; padding: 0 8px; }
#speedSelect { padding: 4px 6px; font-size: 13px; }

.scrub { position: relative; flex: 1; height: 28px; cursor: pointer; margin: 0 8px; touch-action: none; }
.scrub-track { position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 2px; background: var(--surface2); overflow: hidden; }
.scrub-buffer { position: absolute; inset: 0 auto 0 0; background: var(--border); width: 0; }
.scrub-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); width: 0; }
.scrub:hover .scrub-track { height: 6px; top: 11px; }
.scrub-markers { position: absolute; inset: 0; pointer-events: none; }
.marker { position: absolute; top: 2px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); pointer-events: auto; cursor: pointer; }
.marker.done { background: var(--done); }
.marker.active { transform: scale(1.35); }
.scrub-hover { position: absolute; bottom: 30px; transform: translateX(-50%); background: var(--surface2); border: 1px solid var(--border); padding: 4px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; pointer-events: none; font-family: ui-monospace, Menlo, monospace; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.hint { font-size: 12px; margin: 10px 0 0; }

/* comments */
.comments-head { padding: 16px 18px 10px; border-bottom: 1px solid var(--border); }
.comments-head h2 { margin: 0 0 10px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.count { background: var(--surface2); border-radius: 20px; padding: 1px 8px; font-size: 12px; color: var(--muted); }
.filters { display: flex; gap: 6px; }
.filters button { background: none; border: 1px solid var(--border); border-radius: 20px; padding: 3px 12px; font-size: 12px; cursor: pointer; color: var(--muted); }
.filters button.on { background: var(--surface2); color: var(--text); }

.comment-list { flex: 1; overflow-y: auto; padding: 6px 0; }
.empty { padding: 30px 22px; color: var(--muted); text-align: center; line-height: 1.5; font-size: 14px; }
.comment { padding: 12px 18px; border-left: 3px solid transparent; cursor: pointer; }
.comment:hover { background: var(--surface2); }
.comment.active { border-left-color: var(--accent); background: var(--surface2); }
.comment { border-radius: 0; }
.comment.is-done > .c-text { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.c-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.c-author { font-weight: 600; }
.c-time { margin-left: auto; font-size: 12px; color: var(--muted); }
.c-tc { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; margin: 6px 0 0; display: inline-block; }
.c-text { margin: 6px 0 0; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; font-size: 14px; }
.c-actions { display: flex; gap: 12px; margin-top: 6px; }
.c-actions button { background: none; border: 0; padding: 0; color: var(--muted); font-size: 12px; cursor: pointer; }
.c-actions button:hover { color: var(--text); }
.c-done-badge { color: var(--done); font-size: 12px; font-weight: 600; }
.replies { margin: 8px 0 0 32px; border-left: 2px solid var(--border); padding-left: 12px; }
.replies .comment { padding: 6px 0; cursor: default; }
.replies .comment:hover { background: none; }

.composer { border-top: 1px solid var(--border); padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.composer input.author, .composer textarea { background: var(--surface2); border: 1px solid transparent; border-radius: 12px; padding: 9px 11px; width: 100%; resize: none; }
.composer input.author:focus, .composer textarea:focus { outline: none; border-color: var(--accent); }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tc-chip { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.tc-chip b { font-family: ui-monospace, Menlo, monospace; color: var(--text); font-weight: 600; }
.tc-chip input { accent-color: var(--accent); }
.replying { font-size: 12px; color: var(--muted); }
.replying button { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 12px; }

/* portfolio */
.portfolio { padding: 72px 28px 40px; border-top: 1px solid var(--border); }
.portfolio h2 { font-size: clamp(36px, 6vw, 76px); font-weight: 800; letter-spacing: -0.045em; line-height: 1.05; margin: 0 0 28px; }
.portfolio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.04); overflow: hidden; cursor: pointer; text-align: left; padding: 0; transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0,0,0,.10); }
.card .thumb { aspect-ratio: 16 / 9; background: var(--surface2) center / cover no-repeat; position: relative; }
.card .thumb::after { content: ''; position: absolute; inset: 0; }
.card .meta { padding: 14px 16px 16px; }
.card .meta b { display: block; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.card .meta span { font-size: 12px; color: var(--muted); }

.footer { padding: 28px; color: var(--muted); font-size: 13px; display: flex; gap: 18px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.footer a { color: var(--muted); }

/* modal */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.8); }
.modal-box { position: relative; width: min(1100px, 94vw); }
.modal-frame { aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.modal-frame iframe, .modal-frame video { width: 100%; height: 100%; border: 0; display: block; }
.modal-close { position: absolute; top: -42px; right: 0; color: #fff; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; z-index: 30; font-size: 14px; }

/* mobile */
@media (max-width: 900px) {
  .topbar { padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
  .title-wrap { order: 3; flex-basis: 100%; }
  .top-actions { margin-left: auto; }
  .review { grid-template-columns: 1fr; }
  .player-col { padding: 12px 16px; }
  .comments-col { border-left: 0; border-top: 1px solid var(--border); height: auto; position: static; }
  .comment-list { max-height: 55vh; }
  .player.tall { width: min(100%, calc((100svh - 200px) * var(--ar))); }
  .hint, #speedSelect, #prevFrame, #nextFrame { display: none; }
  .controls { flex-wrap: wrap; }
  .controls .tc { margin-right: auto; }
  .scrub { order: -1; flex-basis: 100%; margin: 0 0 4px; }
  .portfolio, .footer { padding-left: 16px; padding-right: 16px; }
}

.portfolio h2 em { font-style: normal; color: var(--accent); }
.card { backdrop-filter: blur(8px); }
::placeholder { color: var(--muted); opacity: .8; }

/* shared folder page */
.folder-view { flex: 1; padding: 40px 28px 60px; }
.folder-view h2 { font-size: clamp(36px, 6vw, 72px); font-weight: 800; letter-spacing: -0.045em; line-height: 1.05; margin: 0 0 24px; }
.folder-subs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.folder-subs:empty { display: none; }
.folder-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px; text-decoration: none; font-weight: 600; }
.folder-chip svg { width: 18px; height: 18px; fill: var(--accent); }
.folder-chip:hover { border-color: var(--text); }
a.card { display: block; text-decoration: none; color: inherit; }
.card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card .thumb.tall { background: rgba(0, 0, 0, .35); }
.card .thumb.tall img { object-fit: contain; }
.card .thumb .dur { position: absolute; right: 8px; bottom: 8px; z-index: 1; background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 7px; }
.back-link { font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.back-link:hover { color: var(--text); }
@media (max-width: 900px) { .folder-view { padding: 20px 16px 40px; } }

/* doodle smiley after "More work by me" */
.doodle-smiley { display: inline-block; width: .9em; height: .9em; vertical-align: -0.08em; color: var(--accent); transform: rotate(-8deg); transform-origin: 50% 60%; animation: smiley-wiggle 3.2s ease-in-out infinite; }
@keyframes smiley-wiggle { 0%, 70%, 100% { transform: rotate(-8deg); } 78% { transform: rotate(8deg) scale(1.06); } 86% { transform: rotate(-12deg); } 94% { transform: rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .doodle-smiley { animation: none; } }
