:root {
  color-scheme: dark;
  --bg: #090b10;
  --panel: #11151d;
  --panel-2: #171c26;
  --border: #252c39;
  --text: #f4f7fb;
  --muted: #98a3b3;
  --accent: #8b7cff;
  --accent-2: #6d5dfc;
  --danger: #ff6b79;
  --success: #6ee7b7;
  --shadow: 0 18px 50px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, textarea, input { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.topbar { height: 72px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; background: rgba(9,11,16,.96); position: sticky; top: 0; z-index: 50; backdrop-filter: blur(14px); }
.brand-wrap { display: flex; gap: 12px; align-items: center; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), #b477ff); font-weight: 900; box-shadow: 0 8px 26px rgba(139,124,255,.35); }
.brand { font-weight: 800; letter-spacing: -.02em; }
.tagline { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; }
.workspace { display: grid; grid-template-columns: 300px minmax(420px, 1fr) 330px; min-height: calc(100vh - 72px); }
.panel { background: var(--panel); border-color: var(--border); }
.left-panel, .right-panel { padding: 20px; overflow-y: auto; max-height: calc(100vh - 72px); position: sticky; top: 72px; }
.left-panel { border-right: 1px solid var(--border); }
.right-panel { border-left: 1px solid var(--border); }
.preview-column { min-width: 0; padding: 16px; }
.preview-toolbar { min-height: 52px; border: 1px solid var(--border); border-radius: 14px; display: flex; align-items: center; gap: 12px; padding: 8px; box-shadow: var(--shadow); }
.preview-stage { margin-top: 14px; border: 1px solid var(--border); border-radius: 16px; min-height: calc(100vh - 170px); display: grid; place-items: center; overflow: auto; padding: 18px; background: radial-gradient(circle at 30% 10%, #141925, #0e1219 60%); box-shadow: var(--shadow); }
.preview-empty { text-align: center; color: var(--muted); }
.preview-empty h3 { color: var(--text); margin-bottom: 8px; }
.empty-icon { font-size: 54px; opacity: .5; }
.device-frame { width: 100%; height: calc(100vh - 210px); min-height: 540px; background: white; border-radius: 12px; position: relative; overflow: hidden; transition: width .2s ease; box-shadow: 0 22px 70px rgba(0,0,0,.45); }
.device-frame iframe { width: 100%; height: 100%; border: 0; background: white; display: block; }
#drawCanvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }
.selection-badge { position: absolute; z-index: 25; background: #111827; color: white; border: 1px solid rgba(255,255,255,.16); padding: 6px 9px; font-size: 11px; border-radius: 8px; pointer-events: none; box-shadow: 0 7px 20px rgba(0,0,0,.35); }
.hidden { display: none !important; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: .15em; color: #8f9bad; }
h2 { margin: 5px 0 0; font-size: 20px; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.55; }
.section-title-row { display: flex; justify-content: space-between; align-items: flex-start; }
.btn { border: 1px solid transparent; border-radius: 10px; padding: 10px 13px; color: var(--text); background: var(--panel-2); font-weight: 700; font-size: 13px; transition: .15s ease; }
.btn:hover { transform: translateY(-1px); border-color: #3b4352; }
.btn.primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: 0 8px 24px rgba(109,93,252,.22); }
.btn.secondary { border-color: #3a4353; background: #1b2230; }
.btn.ghost { background: transparent; border-color: var(--border); color: #c3cad5; }
.btn.tiny { padding: 7px 9px; font-size: 11px; }
.btn.full { width: 100%; margin-top: 10px; }
.upload-card { border: 1px dashed #3b4556; border-radius: 12px; padding: 18px; display: grid; place-items: center; gap: 4px; color: var(--muted); margin-top: 14px; background: #0e1219; cursor: pointer; }
.upload-card:hover { border-color: var(--accent); }
.upload-card input { display: none; }
.upload-card strong { color: var(--text); font-size: 13px; }
.upload-icon { font-size: 22px; color: var(--accent); }
.or-line { display: flex; align-items: center; gap: 10px; color: #697386; font-size: 11px; margin: 14px 0; }
.or-line::before,.or-line::after { content:""; height:1px; background:var(--border); flex:1; }
.field-label { display: block; color: #cbd2dd; font-size: 12px; font-weight: 700; margin: 10px 0 7px; }
.code-input, .feedback-input, .prompt-output { width: 100%; background: #0b0f16; color: #dce5f2; border: 1px solid var(--border); border-radius: 10px; resize: vertical; outline: none; }
.code-input { min-height: 220px; padding: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; line-height: 1.5; }
.feedback-input { min-height: 110px; padding: 11px; font-size: 13px; }
.code-input:focus,.feedback-input:focus,.prompt-output:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,124,255,.1); }
.instructions { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 20px; }
.step { display: flex; gap: 9px; align-items: flex-start; margin-top: 10px; }
.step span { min-width: 22px; height: 22px; border-radius: 999px; background: #202736; color: #bfc8d6; display:grid; place-items:center; font-size:11px; font-weight:800; }
.step p { margin: 2px 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.mode-group,.viewport-group { display:flex; gap:5px; }
.mode-btn,.viewport-btn { border: 0; background: transparent; color: #9ba6b5; padding: 8px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.mode-btn.active,.viewport-btn.active { background: #252d3c; color: white; }
.divider { width:1px; height:24px; background:var(--border); }
.toolbar-spacer { flex:1; }
.count-pill { background:#252d3c; color:#dbe2ec; min-width: 26px; height: 26px; border-radius:999px; display:grid; place-items:center; font-size:12px; font-weight:800; }
.capture-card { margin-top: 16px; background: #161c27; border: 1px solid #30394a; padding: 13px; border-radius: 12px; }
.capture-heading-row { display:flex; justify-content:space-between; align-items:center; }
.icon-btn { width:30px; height:30px; border-radius:8px; border:1px solid var(--border); color:#c5ceda; background:#111722; font-size:18px; display:grid; place-items:center; }
.target-summary { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color:#9ea9b8; font-size:11px; line-height:1.55; border-left:2px solid var(--accent); padding-left:9px; margin:10px 0 12px; overflow-wrap:anywhere; }
.issues-list { display:grid; gap:10px; margin-top:16px; }
.issue-card { border:1px solid var(--border); background:#0f141d; border-radius:12px; padding:12px; }
.issue-top { display:flex; gap:9px; justify-content:space-between; }
.issue-number { width:24px; height:24px; border-radius:7px; background:#242c3b; color:#cbd5e3; display:grid; place-items:center; font-size:11px; font-weight:800; flex:none; }
.issue-main { min-width:0; flex:1; }
.issue-title { font-size:12px; font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.issue-meta { margin-top:3px; color:#7f8b9c; font-size:10px; font-family:ui-monospace,monospace; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.issue-text { color:#c4ccd7; font-size:12px; line-height:1.5; margin:10px 0; }
.issue-actions { display:flex; gap:6px; }
.issue-actions button { border:1px solid var(--border); background:#151b26; color:#9ca8b8; border-radius:7px; padding:5px 8px; font-size:10px; }
.issue-actions button.danger:hover { color:var(--danger); border-color:rgba(255,107,121,.4); }
.issues-empty { text-align:center; color:var(--muted); padding:48px 10px 0; }
.issues-empty strong { display:block; color:#dce2eb; font-size:13px; }
.issues-empty p { font-size:11px; line-height:1.5; }
.empty-mini { font-size:32px; opacity:.5; margin-bottom:9px; }
.prompt-dialog { width:min(900px, 92vw); max-height:88vh; background:#111722; color:var(--text); border:1px solid #30394a; border-radius:16px; padding:20px; box-shadow:0 30px 90px rgba(0,0,0,.55); }
.prompt-dialog::backdrop { background:rgba(0,0,0,.72); backdrop-filter:blur(4px); }
.dialog-header { display:flex; align-items:flex-start; justify-content:space-between; }
.prompt-output { min-height: 480px; padding:14px; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:12px; line-height:1.55; }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:12px; }
@media (max-width: 1120px) {
  .workspace { grid-template-columns: 260px minmax(380px,1fr); }
  .right-panel { position: fixed; right: 0; top:72px; bottom:0; width:330px; z-index:40; box-shadow:-20px 0 50px rgba(0,0,0,.35); }
  .preview-column { margin-right:330px; }
}
@media (max-width: 880px) {
  .workspace { display:block; }
  .left-panel { position:relative; top:auto; max-height:none; border-right:0; border-bottom:1px solid var(--border); }
  .right-panel { position:relative; top:auto; width:auto; max-height:none; border-left:0; border-top:1px solid var(--border); }
  .preview-column { margin-right:0; }
  .topbar { height:auto; min-height:72px; gap:10px; align-items:flex-start; padding:12px; }
  .topbar-actions { flex-wrap:wrap; justify-content:flex-end; }
}
