:root{
  --bg:#0B0E14;
  --surface:#10141F;
  --surface-2:#151A28;
  --border:#232A3B;
  --text:#E8EAED;
  --text-muted:#8B94A7;
  --accent:#5EEAD4;
  --accent-dim:#2C6E63;
  --warn:#FBBF24;
  --error:#F87171;
  --radius:10px;
  --font-display:'Space Grotesk', sans-serif;
  --font-body:'Inter', sans-serif;
  --font-mono:'JetBrains Mono', monospace;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  min-height:100vh;
  position:relative;
  overflow-x:hidden;
}

.bg-grid{
  position:fixed;
  inset:0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size:42px 42px;
  pointer-events:none;
  z-index:0;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
}

.topbar{
  position:relative;
  z-index:1;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:22px 40px;
  border-bottom:1px solid var(--border);
}
.brand{display:flex;align-items:center;gap:10px;}
.brand-mark{
  width:30px;height:30px;border-radius:7px;
  background:linear-gradient(135deg, var(--accent), var(--accent-dim));
  color:#0B0E14;
  display:flex;align-items:center;justify-content:center;
  font-family:var(--font-display);font-weight:700;font-size:16px;
}
.brand-name{font-family:var(--font-display);font-weight:600;font-size:18px;letter-spacing:0.2px;}
.topbar-tag{
  font-family:var(--font-mono);
  font-size:12.5px;
  color:var(--text-muted);
}

.layout{
  position:relative;
  z-index:1;
  display:grid;
  grid-template-columns:420px 1fr;
  gap:28px;
  max-width:1180px;
  margin:0 auto;
  padding:40px 40px 80px;
}
@media (max-width: 940px){
  .layout{grid-template-columns:1fr; padding:28px 20px 60px;}
}

.panel{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:14px;
  padding:28px;
}

/* ---- form panel ---- */
.form-panel h1{
  font-family:var(--font-display);
  font-size:24px;
  margin:0 0 6px;
}
.sub{
  color:var(--text-muted);
  font-size:14px;
  margin:0 0 26px;
}

.field{margin-bottom:18px;}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:18px;}
.field-row .field{margin-bottom:0;}

label{
  display:block;
  font-size:13px;
  font-weight:500;
  margin-bottom:7px;
  color:var(--text);
}
label .hint{
  font-weight:400;
  color:var(--text-muted);
  font-size:12px;
}

input[type="text"],
input[type="url"]{
  width:100%;
  background:var(--surface-2);
  border:1px solid var(--border);
  border-radius:8px;
  padding:11px 12px;
  color:var(--text);
  font-family:var(--font-mono);
  font-size:13.5px;
  outline:none;
  transition:border-color 0.15s;
}
input[type="text"]:focus,
input[type="url"]:focus{
  border-color:var(--accent);
}
input::placeholder{color:#535C70;}

.color-field{
  display:flex;
  align-items:center;
  gap:8px;
  background:var(--surface-2);
  border:1px solid var(--border);
  border-radius:8px;
  padding:6px 10px;
}
input[type="color"]{
  width:28px;height:28px;
  border:none;
  border-radius:6px;
  padding:0;
  background:none;
  cursor:pointer;
}
.hex-mirror{
  border:none;
  background:none;
  color:var(--text);
  font-family:var(--font-mono);
  font-size:13px;
  width:100%;
  outline:none;
}

.file-drop{
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px dashed var(--border);
  border-radius:8px;
  background:var(--surface-2);
  padding:16px;
  font-size:13px;
  color:var(--text-muted);
  cursor:pointer;
  transition:border-color 0.15s, color 0.15s;
}
.file-drop:hover{border-color:var(--accent); color:var(--text);}
.file-drop input{display:none;}

.toggle-group{display:flex;gap:10px;}
.toggle-option{
  flex:1;
  display:flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--border);
  background:var(--surface-2);
  border-radius:8px;
  padding:10px 12px;
  cursor:pointer;
  font-size:13.5px;
}
.toggle-option small{display:block;color:var(--text-muted);font-size:11px;font-weight:400;}
.toggle-option input{accent-color:var(--accent);}
.toggle-option:has(input:checked){border-color:var(--accent);}
.toggle-disabled{opacity:0.45; cursor:not-allowed;}

.build-btn{
  width:100%;
  margin-top:6px;
  background:var(--accent);
  color:#08110F;
  border:none;
  border-radius:8px;
  padding:14px;
  font-family:var(--font-display);
  font-weight:600;
  font-size:15px;
  cursor:pointer;
  transition:transform 0.1s, box-shadow 0.15s;
}
.build-btn:hover{box-shadow:0 0 0 4px rgba(94,234,212,0.15);}
.build-btn:active{transform:scale(0.99);}
.build-btn:disabled{opacity:0.55; cursor:not-allowed;}

.form-note{
  font-size:11.5px;
  color:var(--text-muted);
  margin:14px 0 0;
  line-height:1.5;
}

/* ---- preview panel ---- */
.preview-panel{display:flex; flex-direction:column; gap:24px;}

.phone-stage{display:flex; flex-direction:column; align-items:center;}
.phone-frame{
  width:220px;
  height:444px;
  background:#05070B;
  border-radius:34px;
  padding:10px;
  border:1px solid var(--border);
  box-shadow:0 30px 60px -20px rgba(0,0,0,0.6);
  position:relative;
}
.phone-notch{
  position:absolute;
  top:10px; left:50%;
  transform:translateX(-50%);
  width:70px; height:16px;
  background:#05070B;
  border-radius:0 0 12px 12px;
  z-index:2;
}
.phone-screen{
  width:100%; height:100%;
  border-radius:24px;
  overflow:hidden;
  position:relative;
  transition:background 0.2s;
}
.phone-splash{
  position:absolute; inset:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:10px;
  transition:opacity 0.2s;
}
.phone-icon{
  width:56px;height:56px;
  border-radius:14px;
  background:var(--accent);
  color:#08110F;
  display:flex;align-items:center;justify-content:center;
  font-family:var(--font-display); font-weight:700; font-size:22px;
  background-size:cover;
  background-position:center;
}
.phone-appname{
  font-family:var(--font-display);
  font-weight:600;
  font-size:13px;
  color:var(--accent);
  max-width:160px;
  text-align:center;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.phone-spinner{
  width:18px;height:18px;
  border:2px solid rgba(255,255,255,0.15);
  border-top-color:var(--accent);
  border-radius:50%;
  animation:spin 0.8s linear infinite;
  margin-top:4px;
}
@keyframes spin{to{transform:rotate(360deg);}}
.phone-iframe{
  position:absolute; inset:0;
  width:100%; height:100%;
  border:none;
  background:#fff;
}
.phone-caption{
  font-size:11.5px;
  color:var(--text-muted);
  text-align:center;
  max-width:260px;
  margin:16px 0 0;
  line-height:1.5;
}

.console{
  background:#070A10;
  border:1px solid var(--border);
  border-radius:10px;
  overflow:hidden;
  flex:1;
  display:flex;
  flex-direction:column;
  min-height:220px;
}
.console-head{
  display:flex;
  align-items:center;
  gap:7px;
  padding:10px 14px;
  border-bottom:1px solid var(--border);
  background:var(--surface-2);
}
.console-dot{width:9px;height:9px;border-radius:50%;background:#2A3142;}
.console-dot:nth-child(1){background:#F87171;opacity:0.6;}
.console-dot:nth-child(2){background:#FBBF24;opacity:0.6;}
.console-dot:nth-child(3){background:#5EEAD4;opacity:0.6;}
.console-title{
  font-family:var(--font-mono);
  font-size:11.5px;
  color:var(--text-muted);
  margin-left:6px;
}
.console-body{
  flex:1;
  padding:14px 16px;
  font-family:var(--font-mono);
  font-size:12.5px;
  line-height:1.9;
  overflow-y:auto;
  max-height:260px;
}
.console-line{color:var(--text-muted); opacity:0; transform:translateY(2px); animation:lineIn 0.25s forwards;}
@keyframes lineIn{to{opacity:1; transform:translateY(0);}}
.console-line.console-idle{opacity:0.6; animation:none;}
.console-line .ok{color:var(--accent);}
.console-line .err{color:var(--error);}
.console-line .tag{color:#566077;}

.console-result{
  border-top:1px solid var(--border);
  padding:14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background:var(--surface-2);
}
.console-result.success{border-top-color:var(--accent-dim);}
.console-result.failure{border-top-color:#5A2E2E;}
.console-result-text{font-size:12.5px; color:var(--text-muted);}
.console-result-text strong{color:var(--text); font-family:var(--font-mono);}
.download-btn{
  background:var(--accent);
  color:#08110F;
  border:none;
  border-radius:7px;
  padding:9px 16px;
  font-family:var(--font-display);
  font-weight:600;
  font-size:13px;
  text-decoration:none;
  white-space:nowrap;
}
