:root {
  --ink: #151916;
  --muted: #6f756f;
  --paper: #f3f0e8;
  --panel: #fbfaf6;
  --line: #d8d6cd;
  --accent: #ed5b2f;
  --lime: #d9ff68;
  --code: #171c19;
  --code-muted: #7f8982;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Manrope, sans-serif; }
body:not(.authenticated) > .topbar,
body:not(.authenticated) > main { display: none; }
button, textarea { font: inherit; }
button { color: inherit; }

.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 3vw; border-bottom: 1px solid var(--line); background: rgba(243,240,232,.94); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 700; letter-spacing: -.4px; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; color: white; background: var(--ink); font-family: "DM Mono"; font-size: 13px; transform: rotate(-3deg); }
.brand-mark span { color: var(--lime); }
nav { display: flex; height: 100%; gap: 36px; }
nav a { display: flex; align-items: center; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; border-bottom: 2px solid transparent; }
nav a.active { color: var(--ink); border-color: var(--accent); }
.header-actions { display: flex; gap: 10px; }
.icon-btn, .profile { width: 36px; height: 36px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.profile { border-radius: 50%; background: var(--lime); border: 0; font-size: 11px; font-weight: 700; }

.auth-screen { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-screen[hidden] { display: none; }
.auth-copy { padding: 7vw; display: flex; flex-direction: column; justify-content: center; background: var(--ink); color: var(--paper); position: relative; overflow: hidden; }
.auth-copy::after { content: "R/"; position: absolute; right: -20px; bottom: -75px; font: 500 280px "DM Mono"; color: transparent; -webkit-text-stroke: 1px #ffffff20; }
.auth-copy .brand { position: absolute; top: 40px; left: 7vw; }
.auth-copy .brand-mark { background: var(--paper); color: var(--ink); }
.auth-copy .eyebrow { margin-bottom: 20px; }
.auth-copy h1 { margin: 0; font-size: clamp(45px, 6vw, 78px); line-height: 1; letter-spacing: -4px; }
.auth-copy h1 em { color: var(--lime); font-family: Georgia, serif; font-weight: 400; }
.auth-copy p { color: #aab0ab; max-width: 390px; line-height: 1.7; }
.auth-card { display: grid; place-items: center; align-content: center; padding: 30px; }
.auth-card > p { color: var(--muted); font-size: 12px; }
#userButton { width: 36px; height: 36px; display: grid; place-items: center; }

.hero { padding: 76px 7vw 64px; position: relative; overflow: hidden; }
.hero::after { content: "REVIEW"; position: absolute; right: -18px; top: 17px; font-size: clamp(90px, 15vw, 220px); font-weight: 700; letter-spacing: -12px; color: transparent; -webkit-text-stroke: 1px #ddd9cf; z-index: -1; }
.eyebrow, .label { font-family: "DM Mono"; font-size: 10px; letter-spacing: 1.4px; font-weight: 500; }
.eyebrow { display: flex; align-items: center; gap: 9px; color: var(--accent); }
.eyebrow > span { width: 20px; height: 2px; background: var(--accent); }
.hero h1 { font-size: clamp(40px, 5vw, 74px); line-height: 1.03; letter-spacing: -4px; margin: 18px 0; max-width: 850px; }
.hero h1 em { font-family: Georgia, serif; font-weight: 400; color: var(--accent); }
.hero > p { color: var(--muted); font-size: 17px; max-width: 560px; line-height: 1.7; }
.hero-stats { display: flex; gap: 48px; position: absolute; right: 7vw; bottom: 68px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-family: "DM Mono"; font-size: 23px; }
.hero-stats span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }

.workspace { margin: 0 3vw 80px; min-height: 710px; border: 1px solid #2c322e; background: var(--code); display: grid; grid-template-columns: 280px minmax(420px, 1fr) 330px; box-shadow: 0 22px 60px rgba(27,31,28,.16); }
.brief-panel, .comments-panel { background: var(--panel); display: flex; flex-direction: column; min-width: 0; }
.brief-panel { border-right: 1px solid #313733; }
.panel-top, .comments-head { height: 55px; padding: 0 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.label { color: var(--muted); }
.more-btn { border: 0; background: none; cursor: pointer; }
.challenge-selector { border-bottom: 1px solid var(--line); max-height: 238px; overflow-y: auto; }
.challenge { width: 100%; border: 0; border-left: 3px solid transparent; background: transparent; text-align: left; display: flex; gap: 11px; padding: 13px 14px; cursor: pointer; }
.challenge:hover { background: #f1efe8; }
.challenge.active { background: #ece9df; border-left-color: var(--accent); }
.challenge > span { font-family: "DM Mono"; color: var(--muted); font-size: 11px; padding-top: 2px; }
.challenge div { display: flex; flex-direction: column; min-width: 0; }
.challenge b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.challenge small, .author small { font-size: 10px; color: var(--muted); margin-top: 2px; }
.brief { padding: 24px 20px; }
.brief h2 { font-size: 21px; letter-spacing: -.7px; line-height: 1.2; margin: 10px 0 16px; }
.brief > p { font-size: 12px; line-height: 1.65; color: #4f554f; margin: 20px 0; }
.author { display: flex; align-items: center; gap: 10px; }
.avatar { width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; background: #b9d6ff; font-size: 9px; font-weight: 700; }
.author div { display: flex; flex-direction: column; font-size: 11px; }
.requirements { padding-top: 16px; border-top: 1px solid var(--line); }
.requirements ul { padding: 0; list-style: none; }
.requirements li { font-size: 11px; line-height: 1.4; padding: 6px 0 6px 20px; position: relative; }
.requirements li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.review-progress { margin-top: auto; padding: 18px 20px; background: #e9e5da; border-top: 1px solid var(--line); }
.progress-head { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; }
.progress-track { height: 4px; margin: 10px 0; background: #d0ccc1; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.review-progress p { margin: 0; font-size: 9px; color: var(--muted); line-height: 1.5; }

.code-panel { color: #d9dfda; min-width: 0; overflow: hidden; }
.code-toolbar { height: 55px; border-bottom: 1px solid #313733; display: flex; align-items: center; justify-content: space-between; }
.file-tab { align-self: stretch; display: flex; align-items: center; gap: 9px; padding: 0 16px; font-family: "DM Mono"; font-size: 11px; background: #202622; border-top: 2px solid var(--lime); }
.file-tab b { color: var(--code-muted); margin-left: 14px; }
.file-icon { color: #f6d85c; font-size: 9px; }
.diff-stats { display: flex; gap: 12px; align-items: center; font-family: "DM Mono"; font-size: 10px; }
.diff-stats span:first-child { color: #6bd696; }
.diff-stats span:nth-child(2) { color: #ff7d6f; }
.diff-stats button { margin-left: 5px; height: 54px; padding: 0 18px; color: #cdd4ce; background: #202622; border: 0; border-left: 1px solid #313733; font-family: "DM Mono"; cursor: pointer; }
.file-path { height: 39px; padding: 0 19px; display: flex; align-items: center; gap: 7px; color: var(--code-muted); background: #1b211d; font-family: "DM Mono"; font-size: 10px; border-bottom: 1px solid #2a302c; }
.file-path b { color: #c7cec8; }
.code-wrap { overflow: auto; height: 615px; padding: 12px 0 50px; }
.code-line { min-height: 25px; display: grid; grid-template-columns: 44px 18px 1fr; padding-right: 22px; font-family: "DM Mono"; font-size: 11px; line-height: 25px; white-space: pre; cursor: pointer; border-left: 2px solid transparent; }
.code-line:hover { background: #242b26; border-left-color: var(--lime); }
.code-line.selected { background: rgba(217,255,104,.1); border-left-color: var(--lime); }
.line-no { text-align: right; color: #59615b; user-select: none; }
.add-icon { opacity: 0; width: 15px; height: 15px; margin: 5px 0 0 7px; border-radius: 50%; line-height: 14px; text-align: center; background: var(--lime); color: #172018; font-size: 12px; }
.code-line:hover .add-icon { opacity: 1; }
.kw { color: #e58dce; }.fn { color: #86bfff; }.str { color: #dfc681; }.cm { color: #707972; }.num { color: #b69bea; }.obj { color: #7fd5c4; }

.comments-panel { border-left: 1px solid #313733; }
.comments-head button { background: none; border: 0; color: var(--accent); font-size: 10px; font-weight: 700; cursor: pointer; }
.count { display: inline-grid; place-items: center; margin-left: 7px; min-width: 18px; height: 18px; border-radius: 10px; background: #e1ded5; font-size: 9px; }
.empty-comments { text-align: center; padding: 55px 35px; }
.empty-icon { font-size: 30px; color: #a5aaa5; }
.empty-comments h3 { font-size: 13px; margin: 12px 0 6px; }
.empty-comments p { font-size: 10px; line-height: 1.5; color: var(--muted); }
#commentsList { padding: 12px; overflow-y: auto; max-height: 350px; }
.comment-card { border: 1px solid var(--line); background: white; margin-bottom: 10px; }
.comment-line { padding: 7px 10px; background: #eeece5; color: var(--muted); font-family: "DM Mono"; font-size: 9px; display: flex; justify-content: space-between; }
.comment-card textarea { width: 100%; min-height: 72px; border: 0; padding: 10px; resize: vertical; outline: none; font-size: 11px; line-height: 1.5; }
.comment-footer { display: flex; justify-content: flex-end; gap: 6px; padding: 7px; border-top: 1px solid #eee; }
.comment-footer button { border: 0; background: transparent; font-size: 9px; cursor: pointer; color: var(--muted); }
.comment-footer .save-comment { background: var(--ink); color: white; padding: 6px 9px; }
.review-actions { margin-top: auto; border-top: 1px solid var(--line); padding: 15px; }
.review-actions label { display: block; font-size: 10px; font-weight: 700; margin-bottom: 7px; }
.review-actions label span { float: right; color: var(--muted); font-weight: 400; }
.review-actions > textarea { width: 100%; min-height: 58px; resize: none; border: 1px solid var(--line); background: transparent; padding: 9px; font-size: 10px; outline-color: var(--accent); }
.decision-row { display: grid; grid-template-columns: repeat(3, 1fr); margin: 9px 0; }
.decision { border: 1px solid var(--line); border-right: 0; background: transparent; padding: 8px 2px; font-size: 8px; cursor: pointer; }
.decision:last-child { border-right: 1px solid var(--line); }
.decision.active { background: #e8e4d9; font-weight: 700; }
.submit-review, .next-review { width: 100%; border: 0; background: var(--accent); color: white; padding: 12px; font-size: 11px; font-weight: 700; cursor: pointer; }
.submit-review span { float: right; opacity: .7; }

.how { padding: 50px 7vw 100px; display: grid; grid-template-columns: 1fr 2fr; gap: 80px; }
.how h2 { font-size: 42px; letter-spacing: -2px; margin: 14px 0; }
.steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.steps article { padding-top: 16px; border-top: 2px solid var(--ink); }
.steps article > span { font-family: "DM Mono"; color: var(--accent); font-size: 11px; }
.steps h3 { font-size: 15px; margin: 24px 0 8px; }
.steps p { color: var(--muted); font-size: 11px; line-height: 1.6; }

.modal-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(12,16,13,.75); display: grid; place-items: center; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.feedback-modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--panel); padding: 35px; position: relative; box-shadow: 0 25px 70px #0007; }
.modal-close { position: absolute; right: 18px; top: 14px; border: 0; background: none; font-size: 22px; cursor: pointer; }
.score-ring { width: 110px; height: 110px; border: 8px solid var(--lime); border-radius: 50%; display: flex; align-items: baseline; justify-content: center; padding-top: 27px; margin: 18px 0; }
.score-ring strong { font: 500 34px "DM Mono"; }.score-ring span { font-size: 10px; color: var(--muted); }
.feedback-modal h2 { margin: 0; font-size: 27px; }.feedback-modal > p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.feedback-list { margin: 20px 0; }
.feedback-item { display: flex; gap: 10px; border-top: 1px solid var(--line); padding: 12px 0; font-size: 11px; line-height: 1.5; }
.feedback-item b { color: var(--accent); }
.next-review { margin-top: 5px; }

body.light-off { --paper:#111512; --panel:#1d221f; --ink:#edf0ec; --muted:#9aa29c; --line:#343a36; }
body.light-off .topbar { background: rgba(17,21,18,.93); }
body.light-off .challenge:hover, body.light-off .challenge.active, body.light-off .review-progress, body.light-off .decision.active { background:#282e2a; }
body.light-off .comment-card { background:#222824; }
body.light-off .comment-line { background:#2a302c; }
body.light-off textarea { color:white; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 245px 1fr; }
  .comments-panel { grid-column: 1 / -1; min-height: 400px; }
  .hero-stats { display:none; }
}
@media (max-width: 720px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-copy { min-height: 38vh; padding: 80px 7vw 40px; }
  .auth-copy h1 { font-size: 45px; letter-spacing: -2px; }
  .auth-card { min-height: 62vh; }
  nav { display:none; }
  .hero { padding: 48px 6vw; }
  .hero h1 { letter-spacing:-2px; }
  .workspace { margin:0; grid-template-columns: 1fr; }
  .brief-panel { border-right:0; }
  .code-panel { min-height:650px; }
  .comments-panel { grid-column:auto; }
  .how { grid-template-columns:1fr; gap:20px; }
  .steps { grid-template-columns:1fr; }
}
